From 82fff5df02f44d1f36c3b9052870bac2b24bd47b Mon Sep 17 00:00:00 2001 From: zouyu <2723363702@qq.com> Date: 星期六, 26 八月 2023 17:54:00 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.110.209:9001/r/lims-before --- src/views/standardLibrary/index.vue | 54 +++++++++++------------------------------------------- 1 files changed, 11 insertions(+), 43 deletions(-) diff --git a/src/views/standardLibrary/index.vue b/src/views/standardLibrary/index.vue index 747c0e7..5c69021 100644 --- a/src/views/standardLibrary/index.vue +++ b/src/views/standardLibrary/index.vue @@ -54,13 +54,14 @@ <el-table :data="tableData" style="width: 100%; margin-bottom: 20px" - row-key="name" + row-key="id" border height="calc(100vh - 250px)" default-expand-all ref="multipleTable" @select="selectTr" @select-all="selectAll" + @selection-change="handleSelectionChange" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" > <el-table-column type="selection" label="搴忓彿"> </el-table-column> @@ -402,7 +403,6 @@ this.$message.error("娣诲姞澶辫触"); } - console.log(res); this.$message.success("娣诲姞鎴愬姛"); this.addTreeForm = { addTypeArr: [], @@ -457,20 +457,6 @@ this.isAllSelect = !this.isAllSelect; let data = this.tableData; this.toggleSelect(data, this.isAllSelect, "all"); - // 鑷畾涔� - if (this.isAllSelect) { - val.forEach((i) => { - if (i.id !== undefined) { - this.deleteList.push(i.id); - } else { - i.children.forEach((c) => { - this.deleteList.push(c.id); - }); - } - }); - } else { - this.deleteList.splice(0, this.deleteList.length); - } }, //閫夋嫨鏌愯 selectTr(selection, row) { @@ -479,33 +465,6 @@ this.isAllSelect = row.isChecked; this.toggleSelect(row, row.isChecked, "tr"); }); - - if (row.isChecked === true) { - if (row.children !== undefined) { - row.children.forEach((i) => { - this.deleteList.push(i.id); - }); - } else { - this.deleteList.push(row.id); - } - } else if (row.isChecked === false) { - if (row.children !== undefined) { - row.children.forEach((i) => { - this.deleteList.findIndex((c, index) => { - if (c === i.id) { - this.deleteList.splice(index, 1); - return; - } - }); - }); - } - this.deleteList.findIndex((c, index) => { - if (c === row.id) { - this.deleteList.splice(index, 1); - return; - } - }); - } }, //閫掑綊瀛愮骇 toggleSelect(data, flag, type) { @@ -539,6 +498,15 @@ } }); }, + handleSelectionChange(val) { + this.deleteList = [] + val.forEach((v) => { + if(v.id !== undefined){ + this.deleteList.push(v.id) + } + }) + console.log(`output->this.deleteList`,this.deleteList) + }, // 琛ㄦ牸鏍戝叏閮ㄩ�変腑閰嶇疆 缁撴潫 deleteListClick() { deleteListApi(this.deleteList).then((res) => { -- Gitblit v1.9.3