From 7e33695561c2da43fcc752894e9bd46a7059cb3f Mon Sep 17 00:00:00 2001 From: Fixiaobai <fixiaobai@163.com> Date: 星期四, 14 九月 2023 15:38:25 +0800 Subject: [PATCH] modified: src/components/view/standard.vue --- src/components/view/Technicalindex.vue | 153 ++++++++++++++++++++++++++++++++++----------------- 1 files changed, 102 insertions(+), 51 deletions(-) diff --git a/src/components/view/Technicalindex.vue b/src/components/view/Technicalindex.vue index 03d8f56..9d33124 100644 --- a/src/components/view/Technicalindex.vue +++ b/src/components/view/Technicalindex.vue @@ -94,7 +94,10 @@ <!-- 涓讳綋鍙� --> <div class="right"> <el-table :data="tableData" style="width: 100%;overflow-y: auto;min-height: 100%" - max-height="100%" row-key="name" border @selection-change="handleSelectionChange" + max-height="100%" row-key="name" border + @select="selectTr" + ref="multipleTable" + @selection-change="handleSelectionChange" default-expand-all :tree-props="{children: 'children', hasChildren: 'hasChildren'}"> <el-table-column type="selection" width="55"> </el-table-column> @@ -281,51 +284,92 @@ export default { data() { return { - search: { - type: 0, - technology: null, - }, - // handleClose:[], - checkTreeNode: { - id: '', - }, - higherlevel: [], - value: {}, - options: [], - process: [], - filterNode: [], - list: [], - form: { - father: '', - work: '', - name: '', - unit: '', - project: '', - }, - children: [], - modifyevent: false, - dialogVisible: false, - tableData: [], - typeselect: 0, - upData: {}, - upDia: false, - craftapi: [], - edit: { - techFather: '', - techName: '', - father: '', - name: '', - unit: '', - id: '' - } - } - }, - mounted() { + search:{ + type:0, + technology:null, + }, + // handleClose:[], + checkTreeNode :{ + id:'', + }, + higherlevel:[], + value:{}, + options:[], + process:[], + filterNode:[], + list: [], + form:{ + father:'', + work:'', + name:'', + unit:'', + project:'', + }, + children:[], + modifyevent:false, + dialogVisible:false, + tableData: [], + typeselect:0, + upData:{}, + upDia:false, + craftapi:[], + edit:{ + techFather:'', + techName:'', + father:'', + name:'', + unit:'', + id:'', + + }, + isAllSelect:false, + } + + }, + mounted() { this.selectAllleft() this.selectAllright() }, - methods: { - handleClose() { + 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(){ }, selectDataList() { @@ -372,7 +416,8 @@ "Content-Type": "application/json" } }).then(res => { - this.selectAllright() + /* this.selectAllright() */ + this.$parent.removeAllTab() }) }, submitUpData() { //纭畾 @@ -385,8 +430,9 @@ this.$axios.post(this.$api.url.delTechBy, { id: this.upData.id }).then(res => { - this.selectAllright() + /* this.selectAllright() */ this.$message.success('鍒犻櫎瀹屾垚') + this.$parent.removeAllTab() }) }, deleteRow(index, rows) { @@ -400,7 +446,8 @@ this.$axios.post(this.$api.url.delAllTechskill, { ids: this.delete }).then(res => { - this.selectAllright() + /* this.selectAllright() */ + this.$parent.removeAllTab() }) }, dels() { @@ -415,6 +462,7 @@ let cc = this.selects.map(el => { return el.id }) + cc.splice(0,1) this.delete = cc.join(',') console.log(this.delete); this.delAllTechskill() @@ -555,12 +603,15 @@ modify() { this.modifyevent = true }, - // deleteRow(index, rows) { - // console.log(); - // rows.splice(index, 1); - // }, + handleSelectionChange(val) { this.selects = val; + this.deleteList = []; + val.forEach((v) => { + if (v.id !== undefined) { + this.deleteList.push(v.id); + } + }); }, //缂栬緫 @@ -693,4 +744,4 @@ height: 30px; border-radius: 2px; } -</style> \ No newline at end of file +</style> -- Gitblit v1.9.3