提交 13a3585a authored 作者: 王腾飞's avatar 王腾飞

2019.12.30

上级 2951d299
......@@ -170,11 +170,9 @@ export default {
.then(res => {
if (res.data.code === 0) {
this.$message.success('添加标签成功');
this.addLableForm = {
id: null,
name: null,
description: null
}
this.addLableForm.id = null;
this.addLableForm.name = null;
this.addLableForm.description = null;
this.getLableList();
this.dialogFormVisible = false
} else {
......@@ -208,11 +206,9 @@ export default {
if (res.data.code === 0) {
this.$message.success('更新资源标签成功')
this.dialogFormVisible = false;
this.addLableForm = {
id: null,
name: null,
description: null
}
this.addLableForm.id = null;
this.addLableForm.name = null;
this.addLableForm.description = null;
this.getLableList();
} else {
this.$message.error('更新资源标签失败')
......@@ -276,6 +272,7 @@ export default {
},
closeDia() {
this.$refs.addLableForm.resetFields();
this.addLableForm.id = null;
this.addLableForm.name = null;
this.addLableForm.description = null;
}
......
......@@ -102,7 +102,7 @@
<!-- <el-input v-model="resourceLabel" multiple placeholder="指定资源所属专题与内容特征,相关标签需提前在“资源标签”功能中设置。" @focus="showLableDia"></el-input> -->
<div style="display:flex;">
<div class="entityDataCon">
<span v-for="(item, key) in resourceLabel" :key="key" class="entitySpan" @click="deleteLableItem(key)">{{ item.name }}<i class="el-icon-error" style="padding-left:5px;"></i></span>
<span v-for="(item, key) in resourceLabel" :key="key" class="entitySpan" @click="deleteLableItem(item, key)">{{ item.name }}<i class="el-icon-error" style="padding-left:5px;"></i></span>
</div>
<i class="el-icon-star-off" @click="showLableDia" style="width:140px; text-align:center; line-height:36px; color:#fff; background:#409EFF; border-top-right-radius:4px; border-bottom-right-radius:4px; cursor:pointer;">请选择资源标签</i>
</div>
......@@ -182,16 +182,17 @@
popper-class="my-autocomplete"
v-model="searchPageLableForm.search"
:fetch-suggestions="querySearch"
placeholder="请输入内容"
placeholder="请输入检索内容"
@select="handleSelect">
<i slot="append" class="el-icon-search" @click="searchLable">检索标签</i>
<!-- <i slot="append" class="el-icon-search" @click="searchLable">检索标签</i> -->
<template slot-scope="{ item }">
<div class="name">{{ item.value }}</div>
</template>
</el-autocomplete>
<el-table :data="gridData" @selection-change="handleSelectionChange">
<el-table :data="gridData" :row-key="getRowKeys" @selection-change="handleSelectionChange" ref="multipleTable">
<el-table-column
type="selection"
:reserve-selection="true"
width="55">
</el-table-column>
<el-table-column property="name" label="标签名称"></el-table-column>
......@@ -237,6 +238,7 @@ export default {
},
data() {
return {
selectItemArr: [],
restaurants: [],
totalCount: 0,
gridData: [],
......@@ -612,7 +614,7 @@ export default {
}
})
})
}, 1000),
}, 3000),
formSixBtn() {
if (this.$route.query.resourceType) {
this.isShowSavaBtn = true;
......@@ -785,17 +787,17 @@ export default {
},
handleSelectionChange (val) {
// multipleSelection
let arr = [...this.multipleSelection, ...val];
console.log(arr,123)
//数组对象去重
let obj = {};
let peon = arr.reduce((cur,next) => {
obj[next.id] ? "" : obj[next.id] = true && cur.push(next);
return cur;
},[]) //设置cur默认类型为数组,并且初始值为空的数组
this.multipleSelection = peon;
this.multipleSelection = val;
// let arr = [...this.multipleSelection, ...val];
// console.log(arr,123)
// //数组对象去重
// let obj = {};
// let peon = arr.reduce((cur,next) => {
// obj[next.id] ? "" : obj[next.id] = true && cur.push(next);
// return cur;
// },[]) //设置cur默认类型为数组,并且初始值为空的数组
// this.multipleSelection = peon;
let optIdArr = [];
console.log(this.multipleSelection, 'ttyy')
this.multipleSelection.map((item, index) => {
var obj = {
labelId: item.id
......@@ -803,7 +805,7 @@ export default {
optIdArr.push(obj)
})
this.formData.label = optIdArr;
this.resourceLabel = peon
this.resourceLabel = val
},
sureLable () {
// this.multipleSelection.map((item, index) => {
......@@ -811,7 +813,7 @@ export default {
// this.resourceLabel.push(item.name)
// }
// })
this.dialogTableVisible = false
this.dialogTableVisible = false;
},
cancleSureLable () {
this.dialogTableVisible = false
......@@ -819,18 +821,32 @@ export default {
closeLableDia() {
//this.resourceLabel = [];
},
deleteLableItem (key) {
this.resourceLabel.splice(key, 1)
console.log(this.resourceLabel, 'rrtt')
deleteLableItem (item, key) {
// this.resourceLabel.splice(key, 1)
this.multipleSelection.forEach((item1, index) => {
console.log(item1 + index, '1233')
if (item.id == item1.id) {
this.resourceLabel.splice(key, 1)
this.gridData.forEach((item2, index) => {
console.log(this.gridData, '123ttt')
if (item1.id == item2.id) {
this.$refs.multipleTable.toggleRowSelection(this.gridData[index], false);
}
})
}
})
let optIdArr = [];
this.resourceLabel.map((item, index) => {
var obj = {
labelId: item.labelId
labelId: item.id
}
optIdArr.push(obj)
})
this.formData.label = optIdArr;
console.log(this.formData.label, '222')
console.log(this.formData.label, '222');
},
querySearch (queryString, cb) {
var restaurants = this.gridData;
......@@ -858,6 +874,9 @@ export default {
this.searchPageLableForm.pageNum = val;
this.getSearchPageLable ()
},
getRowKeys(row) {
return row.id
},
},
beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论