|
|
@@ -59,6 +59,7 @@
|
|
|
|
|
|
<el-table-column prop="operation" label="操作" fixed="right" width="200" align="center" header-align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
+ <span class="link" @click="editTemplate(row)">编辑</span>
|
|
|
<span class="link danger" @click="deleteTemplate(row)">删除</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -67,7 +68,7 @@
|
|
|
<PaginationPage ref="pagination" :total="total" @getList="queryTemplateList" />
|
|
|
</div>
|
|
|
<el-dialog
|
|
|
- title="添加拼音校正"
|
|
|
+ :title="data.id ? '编辑拼音校正' : '添加拼音校正'"
|
|
|
:visible="visible"
|
|
|
width="660px"
|
|
|
:close-on-click-modal="false"
|
|
|
@@ -131,7 +132,12 @@ import MenuPage from '../common/menu.vue';
|
|
|
import PaginationPage from '@/components/PaginationPage.vue';
|
|
|
|
|
|
import { PageQueryPinyinCorrectionListPersonal } from '@/api/list.js';
|
|
|
-import { toolAddPinyinCorrection, toolDeletePinyinCorrection, toolGetCXList } from '@/api/pinyinCorrection';
|
|
|
+import {
|
|
|
+ toolAddPinyinCorrection,
|
|
|
+ toolDeletePinyinCorrection,
|
|
|
+ toolGetCXList,
|
|
|
+ toolUpdatePinyinCorrection,
|
|
|
+} from '@/api/pinyinCorrection';
|
|
|
|
|
|
export default {
|
|
|
name: 'PersonalWorkbenchPinyinCorrectionList',
|
|
|
@@ -248,29 +254,55 @@ export default {
|
|
|
// 确定创建拼音校正
|
|
|
addTemplate() {
|
|
|
this.loading = true;
|
|
|
- toolAddPinyinCorrection(this.data)
|
|
|
- .then((res) => {
|
|
|
- this.loading = false;
|
|
|
- this.visible = false;
|
|
|
- if (res.status === 1) {
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '创建成功!',
|
|
|
- });
|
|
|
- this.data = {
|
|
|
- storage_type: 0,
|
|
|
- word: '',
|
|
|
- pos: '',
|
|
|
- pinyin: '',
|
|
|
- pinyin_lt: '',
|
|
|
- };
|
|
|
+ if (this.data.id) {
|
|
|
+ toolUpdatePinyinCorrection(this.data)
|
|
|
+ .then((res) => {
|
|
|
+ this.loading = false;
|
|
|
+ this.visible = false;
|
|
|
+ if (res.status === 1) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '修改成功!',
|
|
|
+ });
|
|
|
+ this.data = {
|
|
|
+ storage_type: 0,
|
|
|
+ word: '',
|
|
|
+ pos: '',
|
|
|
+ pinyin: '',
|
|
|
+ pinyin_lt: '',
|
|
|
+ };
|
|
|
|
|
|
- this.queryList();
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
+ this.queryList();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ toolAddPinyinCorrection(this.data)
|
|
|
+ .then((res) => {
|
|
|
+ this.loading = false;
|
|
|
+ this.visible = false;
|
|
|
+ if (res.status === 1) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '创建成功!',
|
|
|
+ });
|
|
|
+ this.data = {
|
|
|
+ storage_type: 0,
|
|
|
+ word: '',
|
|
|
+ pos: '',
|
|
|
+ pinyin: '',
|
|
|
+ pinyin_lt: '',
|
|
|
+ };
|
|
|
+
|
|
|
+ this.queryList();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
// 删除词汇
|
|
|
@@ -293,6 +325,18 @@ export default {
|
|
|
})
|
|
|
.catch(() => {});
|
|
|
},
|
|
|
+ // 编辑词汇
|
|
|
+ editTemplate(row) {
|
|
|
+ this.data = {
|
|
|
+ id: row.id,
|
|
|
+ storage_type: 0,
|
|
|
+ word: row.word,
|
|
|
+ pos: row.pos,
|
|
|
+ pinyin: row.pinyin,
|
|
|
+ pinyin_lt: row.pinyin_lt,
|
|
|
+ };
|
|
|
+ this.visible = true;
|
|
|
+ },
|
|
|
CopyToClipboard(element) {
|
|
|
var doc = document,
|
|
|
text = doc.getElementById(element),
|