提交 1353103f authored 作者: quanlili's avatar quanlili

修改复选框

上级 ea51578c
...@@ -190,7 +190,9 @@ ...@@ -190,7 +190,9 @@
</template> </template>
</el-autocomplete> </el-autocomplete>
<!-- @select="selectItem" --> <!-- @select="selectItem" -->
<el-table :data="gridData" @filter-method="filterChange" :row-key="getRowKeys" @selection-change="handleSelectionChange" ref="multipleTable"> <el-table :data="gridData" @filter-method="filterChange" :row-key="getRowKeys" @selection-change="handleSelectionChange"
@select="selectHandler"
ref="multipleTable">
<el-table-column <el-table-column
type="selection" type="selection"
:reserve-selection="true" :reserve-selection="true"
...@@ -627,27 +629,6 @@ export default { ...@@ -627,27 +629,6 @@ export default {
_this.$set(item, 'value', item.labelId); _this.$set(item, 'value', item.labelId);
_this.resourceLabel.push(item) _this.resourceLabel.push(item)
}) })
// console.log(this.gridData, '123OP')
// _this.$nextTick(function() {
// res.data.data.label.map((item, index) => {
// _this.$set(item, 'value', item.labelId);
// _this.resourceLabel.push(item)
// })
// console.log(_this.resourceLabel, 'KLlll')
// _this.resourceLabel.map(itemX => {
// console.log(itemX, "123")
// _this.gridData.map((itemY, index) => {
// console.log(itemY, 'HJHJHj')
// if (itemX.labelId == itemY.id) {
// _this.$nextTick(function () {
// // DOM 更新了
// console.log(_this.$refs.multipleTable, '123456789')
// _this.$refs.multipleTable.toggleRowSelection(_this.gridData[index], true);
// })
// }
// })
// })
// })
res.data.data.diyType.map((item, index) => { res.data.data.diyType.map((item, index) => {
this.$set(item, 'value', item.dtId); this.$set(item, 'value', item.dtId);
this.$set(item, 'label', item.typeName); this.$set(item, 'label', item.typeName);
...@@ -786,9 +767,10 @@ export default { ...@@ -786,9 +767,10 @@ export default {
}) })
}, },
showLableDia () { showLableDia () {
this.searchPageLableForm.pageNum = 1; //this.searchPageLableForm.pageNum = 1;
console.log(this.multipleSelection,"点击选择选择资源标签") console.log(this.multipleSelection,"点击选择选择资源标签")
this.getSearchPageLable(); //this.getSearchPageLable();
this.setDelData();
let _this = this; let _this = this;
this.dialogTableVisible = true; this.dialogTableVisible = true;
if (this.$route.query.flag === 'look') { if (this.$route.query.flag === 'look') {
...@@ -807,9 +789,7 @@ export default { ...@@ -807,9 +789,7 @@ export default {
} }
//this.setDelData(); //this.setDelData();
}, },
handleSelectionChange (val) { selectHandler(val,row){
// multipleSelection
val.map(item => { val.map(item => {
this.$set(item, 'labelId', item.id) this.$set(item, 'labelId', item.id)
}) })
...@@ -817,44 +797,21 @@ export default { ...@@ -817,44 +797,21 @@ export default {
console.log(this.multipleSelection, '呵呵呵呵呵呵呵呵') console.log(this.multipleSelection, '呵呵呵呵呵呵呵呵')
if (this.$route.query.flag === 'look') { if (this.$route.query.flag === 'look') {
console.log(this.resourceLabel, "&*&*&*") console.log(this.resourceLabel, "&*&*&*")
//val.length = 0; }
//this.multipleSelection = this.resourceLabel; //console.log(selection, row,'selectHandlerselectHandler')
// this.multipleSelection = [...this.multipleSelection, ...val];//需要去重
// //数组对象去重
// let obj = {};
// let peon = this.multipleSelection.reduce((cur,next) => {
// obj[next.labelId] ? "" : obj[next.labelId] = true && cur.push(next);
// return cur;
// },[]) //设置cur默认类型为数组,并且初始值为空的数组
// this.multipleSelection = peon;
// console.log(val, '123123ttttttttttt')
}
// 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 = [];
// this.multipleSelection.map((item, index) => {
// var obj = {
// labelId: item.id
// }
// optIdArr.push(obj)
// })
// this.formData.label = optIdArr;
}, },
handleSelectionChange (val) {
// multipleSelection
// selectAll(selection) { // val.map(item => {
// if (selection.length != 0) { // this.$set(item, 'labelId', item.id)
// this.multipleSelection = [...this.multipleSelection, ...selection]; // })
// this.multipleSelection = val;
// console.log(this.multipleSelection, '呵呵呵呵呵呵呵呵')
// if (this.$route.query.flag === 'look') {
// console.log(this.resourceLabel, "&*&*&*")
// } // }
// }, },
selectItem(selection, row) { selectItem(selection, row) {
let ids = []; let ids = [];
this.resourceLabel.map(item => { this.resourceLabel.map(item => {
...@@ -939,7 +896,7 @@ export default { ...@@ -939,7 +896,7 @@ export default {
let _this = this; let _this = this;
this.searchPageLableForm.pageNum = val this.searchPageLableForm.pageNum = val
this.getSearchPageLable(); this.getSearchPageLable();
this.setDelData() //this.setDelData()
console.log(_this.resourceLabel,'_this.resourceLabel_this.resourceLabel6666666'); console.log(_this.resourceLabel,'_this.resourceLabel_this.resourceLabel6666666');
setTimeout(() => { setTimeout(() => {
...@@ -986,10 +943,10 @@ export default { ...@@ -986,10 +943,10 @@ export default {
}, },
setDelData(){ setDelData(){
let Vue=this; let Vue=this;
//this.$refs.multipleTable.clearSelection();
this.resourceLabel.forEach((list,index)=>{ this.resourceLabel.forEach((list,index)=>{
let ID=list.id; let ID=list.id;
let INDEX=index; let INDEX=index;
//this.$refs.multipleTable.clearSelection();
this.gridData.forEach((item2, index) => { this.gridData.forEach((item2, index) => {
if (ID == item2.id) { if (ID == item2.id) {
Vue.$nextTick(function () { Vue.$nextTick(function () {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论