| | |
| | | placeholder="请输入搜索内容" |
| | | size="small" |
| | | clearable @input="query" ></el-input> |
| | | <el-tree :data="list" ref="tree" :props="{children: 'children',label: 'father'}" node-key="name" default-expand-all |
| | | <el-tree :data="list" ref="tree" :props="{children: 'children',label: 'father'}" style="height: 500px;overflow-y: auto;" node-key="name" default-expand-all |
| | | @node-click="handleNodeClick" highlight-current |
| | | > |
| | | <div class="custom-tree-node" slot-scope="{ node, data }"> |
| | |
| | | <div class="right"> |
| | | <el-table |
| | | :data="tableData" |
| | | style="width: 100%;margin-bottom: 20px;" |
| | | style="width: 100%;margin-bottom: 20px; height: 580px;overflow: auto;" |
| | | row-key="name" |
| | | border |
| | | @select="selectTr" |
| | | @selection-change="handleSelectionChange" |
| | | default-expand-all |
| | | ref="multipleTable" |
| | | :tree-props="{children: 'children', hasChildren: 'hasChildren'}"> |
| | | <el-table-column |
| | | type="selection" |
| | |
| | | unit:'', |
| | | id:'', |
| | | |
| | | } |
| | | }, |
| | | isAllSelect:false, |
| | | } |
| | | |
| | | }, |
| | |
| | | |
| | | }, |
| | | methods:{ |
| | | // 表格树全部选中配置 |
| | | // 全选/取消选操作 |
| | | 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"); |
| | | }); |
| | | }, |
| | | //递归子级 |
| | | toggleSelect(data, flag, type) { |
| | | if (type === "all") { |
| | | console.log('222'); |
| | | if (data.length > 0) { |
| | | data.forEach((item) => { |
| | | this.toggleSelection(item, flag); |
| | | if (item.children && item.children.length > 0) { |
| | | this.toggleSelect(item.children, flag, type); |
| | | } |
| | | }); |
| | | } |
| | | } else { |
| | | if (data.children && data.children.length > 0) { |
| | | data.children.forEach((item) => { |
| | | item.isChecked = !item.isChecked; |
| | | this.$refs.multipleTable.toggleRowSelection(item, flag); |
| | | this.toggleSelect(item, flag, type); |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | handleClose(){ |
| | | |
| | | }, |
| | |
| | | // rows.splice(index, 1); |
| | | // }, |
| | | handleSelectionChange(val) { |
| | | console.log(val); |
| | | this.selects = val; |
| | | }, |
| | | //编辑 |