|
@@ -38,17 +38,18 @@
|
|
|
</el-form>
|
|
|
<div class="key_data" v-for="(item,index) in keyDatas.data" :key="index" v-if="keyDatas.data[0]">
|
|
|
<h2>{{item.s_item}}
|
|
|
- <img src="@/assets/images/bianji.png" @click="editKey(item.s_item)">
|
|
|
- <img src="@/assets/images/del.png" @click="delKey(item.s_item)">
|
|
|
+ <img src="@/assets/images/bianji.png" @click="editKey(item.s_item,'i_edit',index)">
|
|
|
+ <img src="@/assets/images/del.png" @click="delKey(item.s_item,index)">
|
|
|
</h2>
|
|
|
<div class="word_card">
|
|
|
<div class="lis_card" v-for="(ite,indx) in item.a_key" :key="indx">
|
|
|
<p>关键词:{{String(ite.key)?String(ite.key):'--'}}</p>
|
|
|
<p>附加词:{{String(ite.appendkey)?String(ite.appendkey.join(",").replace(/,/g, "、")):'--'}}</p>
|
|
|
<p>排除词:{{String(ite.notkey) ? String(ite.notkey.join(",").replace(/,/g, "、")) : '--'}}</p>
|
|
|
- <img src="@/assets/images/del.png" @click="keyDel">
|
|
|
- <div class="top_edit" @click="toop(item.s_item,String(ite.key),String(ite.appendkey),String(ite.notkey))">编辑<i class="tri-down"></i></div>
|
|
|
+ <img src="@/assets/images/del.png" @click="keyDel(index,indx)">
|
|
|
+ <div class="top_edit" @click="toop(item.s_item,String(ite.key),String(ite.appendkey),String(ite.notkey),index,'edit')">编辑<i class="tri-down"></i></div>
|
|
|
</div>
|
|
|
+ <div class="lis_card add_card" @click="addCell(item.s_item,'add',index)"><i class="el-icon-plus"></i></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -96,16 +97,16 @@
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
<!-- 删除关键词分类提醒框 -->
|
|
|
- <v-warn ref="keysed" :keyNames="keyNames"></v-warn>
|
|
|
+ <v-warns ref="keysed" :exportData="exportData" :arrExport="arrExport" :keyNames="keyNames" :keyIndex="keyIndex"></v-warns>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { updateKeys, scribeKey } from '@/api/api';
|
|
|
-import vWarn from './warnBox.vue';
|
|
|
+import vWarns from './warnBox.vue';
|
|
|
export default {
|
|
|
components: {
|
|
|
- vWarn
|
|
|
+ vWarns
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -130,7 +131,12 @@ export default {
|
|
|
tips: false,
|
|
|
keyNames: '',
|
|
|
keys: '',
|
|
|
- keysEdit: []
|
|
|
+ keysEdit: [],
|
|
|
+ toopIndex: 0,
|
|
|
+ wordType: '',
|
|
|
+ exportData: {},
|
|
|
+ arrExport: {},
|
|
|
+ keyIndex: 0
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -143,27 +149,33 @@ export default {
|
|
|
this.keyDatas = res.data;
|
|
|
})
|
|
|
},
|
|
|
- editKey(name) {
|
|
|
+ editKey(name,tip,inx) {
|
|
|
this.editVisible = true;
|
|
|
this.tips = false;
|
|
|
this.editsForm.keyClassify = name;
|
|
|
+ this.wordType = tip;
|
|
|
+ this.toopIndex = inx;
|
|
|
},
|
|
|
- toop(ite1,ite2,ite3,ite4) {
|
|
|
+ toop(ite1,ite2,ite3,ite4,index,name) {
|
|
|
this.editVisible = true;
|
|
|
this.tips = true;
|
|
|
this.editsForm.keyClassify = ite1;
|
|
|
this.editsForm.botWord = ite2;
|
|
|
this.editsForm.lWord = ite3.split(',');
|
|
|
this.editsForm.rWord = ite4.split(',');
|
|
|
+ this.toopIndex = index;
|
|
|
+ this.wordType = name;
|
|
|
},
|
|
|
- delKey(name) {
|
|
|
+ delKey(name,index) {
|
|
|
this.$refs.keysed.visibles = true;
|
|
|
this.$refs.keysed.care = 1;
|
|
|
this.$refs.keysed.keyShow = true;
|
|
|
this.keyNames = name;
|
|
|
+ this.keyIndex = index;
|
|
|
},
|
|
|
- keyDel() {
|
|
|
- alert('111')
|
|
|
+ keyDel(index,indx) {
|
|
|
+ this.keyDatas.data[index].a_key.splice(indx,1);
|
|
|
+ this.updated({a_items:this.keyDatas.data});
|
|
|
},
|
|
|
wAdd() {
|
|
|
this.bookForm.additions.push({
|
|
@@ -183,6 +195,18 @@ export default {
|
|
|
exclude() {
|
|
|
this.editsForm.rWord.push("");
|
|
|
},
|
|
|
+ addCell(ite1,name,index) {
|
|
|
+ this.editVisible = true;
|
|
|
+ this.tips = true;
|
|
|
+ this.editsForm.keyClassify = ite1;
|
|
|
+ this.wordType = name;
|
|
|
+ this.toopIndex = index;
|
|
|
+ // this.editsForm = {
|
|
|
+ // botWord: '',
|
|
|
+ // lWord: [],
|
|
|
+ // rWord: []
|
|
|
+ // };
|
|
|
+ },
|
|
|
updated(obj) {
|
|
|
updateKeys(obj).then(res => {
|
|
|
if (res.data.status == 1) {
|
|
@@ -232,40 +256,54 @@ export default {
|
|
|
]
|
|
|
}
|
|
|
]
|
|
|
- this.keyDatas.data.forEach(v => {
|
|
|
- arr1.push(v);
|
|
|
- if (this.bookForm.keyType == v.s_item) {
|
|
|
- this.$message({
|
|
|
- message: '所填关键词分类名已存在',
|
|
|
- type: 'warning'
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- })
|
|
|
+ if (this.keyDatas.data) {
|
|
|
+ this.keyDatas.data.forEach(v => {
|
|
|
+ arr1.push(v);
|
|
|
+ if (this.bookForm.keyType == v.s_item) {
|
|
|
+ this.$message({
|
|
|
+ message: '所填关键词分类名已存在',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
this.updated({a_items:arr1})
|
|
|
},
|
|
|
saveEdit() {
|
|
|
this.editVisible = false;
|
|
|
- this.keyDatas.data.push({
|
|
|
- s_item: this.editsForm.keyClassify,
|
|
|
- a_key:[
|
|
|
- {
|
|
|
- key: this.editsForm.botWord,
|
|
|
- appendkey: this.editsForm.lWord,
|
|
|
- notkey: this.editsForm.rWord
|
|
|
- }
|
|
|
- ]
|
|
|
- })
|
|
|
- console.log(this.keyDatas.data)
|
|
|
- let obj = {
|
|
|
- delete_item: '',
|
|
|
- update_item: {
|
|
|
- before: '',
|
|
|
- after: ''
|
|
|
- },
|
|
|
- a_items:[this.keyDatas.data]
|
|
|
+ let a_key = [];
|
|
|
+ if(this.wordType == 'add') {
|
|
|
+ this.keyDatas.data[this.toopIndex].a_key.push({
|
|
|
+ key: this.editsForm.botWord,
|
|
|
+ appendkey: this.editsForm.lWord,
|
|
|
+ notkey: this.editsForm.rWord
|
|
|
+ })
|
|
|
+ this.editsForm = {
|
|
|
+ botWord: '',
|
|
|
+ lWord: [],
|
|
|
+ rWord: []
|
|
|
+ };
|
|
|
+ } else if(this.wordType == 'edit') {
|
|
|
+ this.keyDatas.data.splice(this.toopIndex,1,{
|
|
|
+ s_item: this.editsForm.keyClassify,
|
|
|
+ a_key:[
|
|
|
+ {
|
|
|
+ key: this.editsForm.botWord,
|
|
|
+ appendkey: this.editsForm.lWord,
|
|
|
+ notkey: this.editsForm.rWord
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ })
|
|
|
+ this.editsForm = {
|
|
|
+ botWord: '',
|
|
|
+ lWord: [],
|
|
|
+ rWord: []
|
|
|
+ };
|
|
|
+ } else if(this.wordType == 'i_edit') {
|
|
|
+ this.keyDatas.data[this.toopIndex].s_item = this.editsForm.keyClassify;
|
|
|
}
|
|
|
- // this.updated(obj)
|
|
|
+ this.updated({a_items:this.keyDatas.data})
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -399,6 +437,23 @@ export default {
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
}
|
|
|
+ .add_card {
|
|
|
+ width: 164px;
|
|
|
+ height: 82px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ cursor: pointer;
|
|
|
+ padding: 0;
|
|
|
+ i {
|
|
|
+ font-size: 24px;
|
|
|
+ color: #C4C4C4;
|
|
|
+ }
|
|
|
+ &:hover {
|
|
|
+ color: #2CB7CA;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|