| | |
| | | <div class="right"> |
| | | <el-table :data="tableData" style="width: 100%;overflow-y: auto;min-height: 100%" |
| | | max-height="100%" row-key="name" border |
| | | @select-all="selectAll" |
| | | @select="selectTr" |
| | | ref="multipleTable" |
| | | @selection-change="handleSelectionChange" |
| | |
| | | this.selectAllright() |
| | | }, |
| | | methods:{ |
| | | // 表格树全部选中配置 |
| | | // 全选/取消选操作 |
| | | selectAll(val) { |
| | | this.isAllSelect = !this.isAllSelect; |
| | | let data = this.tableData; |
| | | this.toggleSelect(data, this.isAllSelect, "all"); |
| | | }, |
| | | handleSelectionChange(val) { |
| | | this.selects = val; |
| | | this.deleteList = []; |
| | | val.forEach((v) => { |
| | | if (v.id !== undefined) { |
| | | this.deleteList.push(v.id); |
| | | } |
| | | }); |
| | | }, |
| | | // 全选/取消选操作 |
| | | selectAll(val) { |
| | | this.isAllSelect = !this.isAllSelect; |
| | | let data = this.tableData; |
| | | this.toggleSelect(data, this.isAllSelect, "all"); |
| | | }, |
| | | //选择某行 |
| | | selectTr(selection, row) { |
| | | console.log(selection,row); |
| | | this.$set(row, "isChecked", !row.isChecked); |
| | | this.$nextTick(() => { |
| | | this.isAllSelect = row.isChecked; |
| | | this.toggleSelect(row, row.isChecked, "tr"); |
| | | }); |
| | | }, |
| | | toggleSelection(row, flag) { |
| | | this.$set(row, "isChecked", flag); |
| | | this.$nextTick(() => { |
| | | if (flag) { |
| | | this.$refs.multipleTable.toggleRowSelection(row, flag); |
| | | } else { |
| | | this.$refs.multipleTable.clearSelection(); |
| | | } |
| | | }); |
| | | }, |
| | | //递归子级 |
| | | toggleSelect(data, flag, type) { |
| | | // console.log('222'); |
| | | if (type === "all") { |
| | | console.log('222'); |
| | | if (data.length > 0) { |
| | | data.forEach((item) => { |
| | | this.toggleSelection(item, flag); |
| | |
| | | } |
| | | } |
| | | }, |
| | | handleClose(){ |
| | | |
| | | }, |
| | | //--------------------------------------------------------------------------------------------------------------------------------------- |
| | | handleClose(){}, |
| | | selectDataList() { |
| | | this.list.forEach(a => { |
| | | a.code = '[1]' |
| | |
| | | }) |
| | | }, |
| | | dels() { |
| | | this.selects.forEach(a => { |
| | | for (var b = 0; b < this.tableData.length; b++) { |
| | | if (this.tableData[b].id == a.id) { |
| | | this.tableData.splice(b, 1) |
| | | b-- |
| | | } |
| | | } |
| | | }) |
| | | let cc = this.selects.map(el => { |
| | | return el.id |
| | | }) |
| | | cc.splice(0,1) |
| | | this.delete = cc.join(',') |
| | | |
| | | let ee = [] |
| | | console.log(this.selects); |
| | | this.selects.forEach(el =>{ |
| | | if(el.children){ |
| | | el.children.forEach(ele =>{ |
| | | ee.push(ele.id) |
| | | }) |
| | | } |
| | | }) |
| | | // cc.splice(0,1) |
| | | this.delete = ee.join(',') |
| | | console.log(this.delete); |
| | | this.delAllTechskill() |
| | | this.$message.success('删除完成') |
| | |
| | | }, |
| | | modify() { |
| | | this.modifyevent = true |
| | | }, |
| | | |
| | | handleSelectionChange(val) { |
| | | this.selects = val; |
| | | this.deleteList = []; |
| | | val.forEach((v) => { |
| | | if (v.id !== undefined) { |
| | | this.deleteList.push(v.id); |
| | | } |
| | | }); |
| | | }, |
| | | //编辑 |
| | | |
| | |
| | | style="width: 100%;margin-bottom: 20px;height: 600px;overflow: auto;" |
| | | row-key="rowId" |
| | | border |
| | | @select-all="selectAll" |
| | | @select="selectTr" |
| | | @selection-change="handleSelectionChange" |
| | | default-expand-all |
| | |
| | | }, |
| | | |
| | | dels() { |
| | | this.selects.forEach(a => { |
| | | for (var b = 0; b < this.tableData.length; b++) { |
| | | if (this.tableData[b].id == a.id) { |
| | | this.tableData.splice(b, 1) |
| | | b-- |
| | | } |
| | | } |
| | | }) |
| | | let cc = this.selects.map(el => { |
| | | return el.id |
| | | }) |
| | | // cc.forEach((el,idx) =>{ |
| | | // delete idx[0] |
| | | // }) |
| | | cc.splice(0,1) |
| | | console.log(cc); |
| | | this.delete = cc.join(',') |
| | | let ee = [] |
| | | console.log(this.selects); |
| | | this.selects.forEach(el =>{ |
| | | if(el.children){ |
| | | el.children.forEach(ele =>{ |
| | | ee.push(ele.id) |
| | | }) |
| | | } |
| | | }) |
| | | console.log(ee); |
| | | this.delete = ee.join(',') |
| | | console.log(this.delete); |
| | | this.delAllQue() |
| | | this.$message.success('删除完成') |
| | |
| | | // }, |
| | | handleSelectionChange(val) { |
| | | this.selects = val |
| | | // console.log(this.selects); |
| | | this.deleteList = []; |
| | | val.forEach((v) => { |
| | | if (v.id !== undefined) { |
| | |
| | | } |
| | | }); |
| | | }, |
| | | // 表格树全部选中配置 |
| | | // 全选/取消选操作 |
| | | selectAll(val) { |
| | | this.isAllSelect = !this.isAllSelect; |
| | | let data = this.tableData; |
| | | // 全选/取消选操作 |
| | | selectAll(val) { |
| | | // console.log(val); |
| | | this.isAllSelect = !this.isAllSelect; |
| | | let data = this.tableData; |
| | | this.$nextTick(() =>{ |
| | | this.toggleSelect(data, this.isAllSelect, "all"); |
| | | }, |
| | | }) |
| | | }, |
| | | //选择某行 |
| | | selectTr(selection, row) { |
| | | console.log(selection,row); |
| | |
| | | }); |
| | | |
| | | }, |
| | | toggleSelection(row, flag) { |
| | | this.$set(row, "isChecked", flag); |
| | | this.$nextTick(() => { |
| | | if (flag) { |
| | | this.$refs.multipleTable.toggleRowSelection(row, flag); |
| | | } else { |
| | | this.$refs.multipleTable.clearSelection(); |
| | | } |
| | | }); |
| | | }, |
| | | //递归子级 |
| | | toggleSelect(data, flag, type) { |
| | | if (type === "all") { |
| | | console.log('222'); |
| | | if (data.length > 0) { |
| | | data.forEach((item) => { |
| | | this.toggleSelection(item, flag); |
| | |
| | | } |
| | | } |
| | | }, |
| | | |
| | | } |
| | | } |
| | | </script> |