提交 05a9d699 authored 作者: quanlili's avatar quanlili

修改标签

上级 49908f42
......@@ -189,7 +189,8 @@
<div class="name">{{ item.value }}</div>
</template>
</el-autocomplete>
<el-table :data="gridData" @filter-method="filterChange" :row-key="getRowKeys" @select="selectItem" @selection-change="handleSelectionChange" ref="multipleTable">
<!-- @select="selectItem" -->
<el-table :data="gridData" @filter-method="filterChange" :row-key="getRowKeys" @selection-change="handleSelectionChange" ref="multipleTable">
<el-table-column
type="selection"
:reserve-selection="true"
......@@ -225,7 +226,6 @@ import pagination from '@/components/pagination/pagination'
import {
resourceCommitAPI,
resourceDiyTypeAPI,
resourceLabelListAPI,
editItemAPI,
saveEditAPI,
getMetaDataPlanListAPI,
......@@ -348,6 +348,7 @@ export default {
// ]
},
resourceLabelList: [], //资源标签列表
resourceLabelCopy:[],//存储的标签中间数组
resourceDiyType: '',
resourceLabel: [],//便签的数组
options: [
......@@ -385,7 +386,6 @@ export default {
},
mounted() {
this.getresourceDiyTypeList();
this.resourceLabelListAPI();
this.getLookContent();
this.getNowTime();
this.getSearchPageLable ();
......@@ -554,46 +554,6 @@ export default {
changeType(e) {//解决el-input type为textarea时候无法输入的问题
this.$forceUpdate()
},
resourceLabelListAPI() { //获取资源标签列表数据
resourceLabelListAPI()
.then(res => {
console.log(res, "III")
if (res.data.code === 0) {
this.resourceLabelList = res.data.data;
}
})
},
// commitResource: debounce(function() {// 提交资源防抖处理
// console.log(11)
// this.formData.fieldJson = JSON.stringify(this.formData.fieldJsonArr)
// const formOne = new Promise((resolve,reject) => {
// this.$refs['formOne'].validate(valid=>{
// if(valid) resolve()
// })
// });
// const formTwo = new Promise((resolve,reject) => {
// this.$refs['formTwo'].validate(valid => {
// if(valid) resolve()
// })
// });
// const formThree = new Promise((resolve,reject) => {
// this.$refs['formThree'].validate(valid => {
// if(valid) resolve()
// })
// });
// Promise.all([formOne, formTwo, formThree]).then(() => {
// resourceCommitAPI(this.formData)
// .then(res => {
// console.log(res, '%%%%%%%%%%%%%^')
// if (res.data.code === 0) {
// this.$message.success('提交成功');
// this.$router.back(-1);
// } else {
// this.$message.error('提交失败');
// }
// })
// })
// }),
commitResource: _.throttle(function() {// 提交资源节流处理
console.log(11)
this.formData.fieldJson = JSON.stringify(this.formData.fieldJsonArr)
......@@ -827,6 +787,7 @@ export default {
},
showLableDia () {
this.searchPageLableForm.pageNum = 1;
console.log(this.multipleSelection,"点击选择选择资源标签")
this.getSearchPageLable();
let _this = this;
this.dialogTableVisible = true;
......@@ -844,20 +805,20 @@ export default {
}
})
}
this.setDelData();
//this.setDelData();
},
handleSelectionChange (val) {
// multipleSelection
console.log(val, 'valvalvalval')
val.map(item => {
this.$set(item, 'labelId', item.id)
})
this.multipleSelection = val;
console.log(this.multipleSelection, '呵呵呵呵呵呵呵呵')
if (this.$route.query.flag === 'look') {
console.log(this.resourceLabel, "&*&*&*")
//val.length = 0;
this.multipleSelection = this.resourceLabel;
// this.multipleSelection = [...this.multipleSelection, ...val];//需要去重
// //数组对象去重
......@@ -906,7 +867,7 @@ export default {
if (item.id === row.id && ids.includes(row.id) === false) {//如果二者相等说明点击的row是一开始没有被选中的需要返显到resourceLabel
//this.resourceLabel.unshift(row)
} else { //剩下最后一个再点的时候selection是个空数组,没有元素,没有对应的item.id,所以下边的代码不跑
console.log(this.resourceLabel, "88888888888")//没有666说明二者不相等,不相等就删除resourceLabel中的对应项
//没有666说明二者不相等,不相等就删除resourceLabel中的对应项
// this.resourceLabel.map((item2, index) => {
// if (!item2.labelId) {
// this.$set(item2, 'labelId', item2.id)
......@@ -939,9 +900,9 @@ export default {
// this.resourceLabel.push(item.name)
// }
// })
console.log(this.resourceLabel, '888999')
console.log(this.multipleSelection,"点击确定按钮的时候")
let rr = [...new Set(this.clickedLableIds)];
console.log(rr, '888888OOO')
rr.map( ( item, index ) => {
this.resourceLabel.map(( item2, index ) => {
if ( item === item2.labelId ) {
......@@ -949,8 +910,9 @@ export default {
}
})
} )
console.log(this.multipleSelection,this.multipleSelection.length,"hahahhahahaahahahah")
if ( this.multipleSelection.length != 0 ) {
console.log(this.multipleSelection, "789OOO")
this.resourceLabel = this.multipleSelection;
let optIdArr = [];
this.resourceLabel.map((item, index) => {
......@@ -960,7 +922,7 @@ export default {
optIdArr.push(obj)
})
this.formData.label = optIdArr;
console.log(optIdArr, '312312312')
this.dialogTableVisible = false;
} else {
this.$message.warning('请选择资源标签')
......@@ -977,6 +939,9 @@ export default {
let _this = this;
this.searchPageLableForm.pageNum = val
this.getSearchPageLable();
this.setDelData()
console.log(_this.resourceLabel,'_this.resourceLabel_this.resourceLabel6666666');
setTimeout(() => {
if (_this.$route.query.flag === 'look') {
_this.resourceLabel.map(itemX => {
......@@ -995,13 +960,21 @@ export default {
}, 100)
},
closeLableDia() {
console.log(this.resourceLabel,'88888')
this.$refs.multipleTable.clearSelection();
this.delArr = [];
console.log(this.resourceLabel,'closeLableDia')
//this.$refs.multipleTable.clearSelection();
//this.delArr = [];
},
deleteLableItem (item, key) {
//this.delArr.push(item);
let Id=item.id
this.resourceLabel.splice(key, 1);//删除便签
this.gridData.forEach((item2, index) => {
if (Id == item2.id) {
this.$nextTick(function () {
this.$refs.multipleTable.toggleRowSelection(this.gridData[index], false);
})
}
})
let optIdArr = [];
this.resourceLabel.map((item, index) => {
var obj = {
......@@ -1010,15 +983,14 @@ export default {
optIdArr.push(obj)
})
this.formData.label = optIdArr;
console.log(optIdArr, '312312312')
},
setDelData(){
console.log(this.resourceLabel, '55555566')
console.log(this.gridData, '5555556688')
let Vue=this;
this.resourceLabel.forEach((list,index)=>{
let ID=list.id;
let INDEX=index;
//this.$refs.multipleTable.clearSelection();
this.gridData.forEach((item2, index) => {
if (ID == item2.id) {
Vue.$nextTick(function () {
......@@ -1028,12 +1000,6 @@ export default {
}
})
})
// this.multipleSelection.forEach((item1, index) => {
// console.log(item1 + index, '1233')
// if (item.id == item1.id) {
// }
// })
let optIdArr = [];
this.resourceLabel.map((item, index) => {
var obj = {
......@@ -1042,11 +1008,11 @@ export default {
optIdArr.push(obj)
})
this.formData.label = optIdArr;
console.log(optIdArr, '312312312')
},
querySearch (queryString, cb) {
var restaurants = this.gridData;
console.log(restaurants, '1231rr')
var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
cb(results);
},
......@@ -1056,7 +1022,6 @@ export default {
};
},
handleSelect (item) {
console.log(item);
this.searchPageLableForm.search = item.value;
},
searchLable () {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论