From 97e527fc0b33427fda419543add07bc11dde5315 Mon Sep 17 00:00:00 2001 From: hyt <958868763@qq.com> Date: Tue, 7 May 2024 15:05:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9D=83=E9=99=90=E5=85=A8=E9=80=89=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../compoments/baseMenuTree.vue | 1 + .../roleJurisdiction/rightDialog.vue | 47 +++++++++++++++++++ .../userJurisdiction/rightDialog.vue | 47 +++++++++++++++++++ 3 files changed, 95 insertions(+) diff --git a/src/views/intergrationTask/compoments/baseMenuTree.vue b/src/views/intergrationTask/compoments/baseMenuTree.vue index fd3e629..db5ea1e 100644 --- a/src/views/intergrationTask/compoments/baseMenuTree.vue +++ b/src/views/intergrationTask/compoments/baseMenuTree.vue @@ -230,6 +230,7 @@ export default { }, }, methods: { + //选中第一个 clickFirst() { document.querySelectorAll(".is-focusable")[0].click(); }, diff --git a/src/views/systemSettings/jurisdictionManage/roleJurisdiction/rightDialog.vue b/src/views/systemSettings/jurisdictionManage/roleJurisdiction/rightDialog.vue index 39ab06f..17322a1 100644 --- a/src/views/systemSettings/jurisdictionManage/roleJurisdiction/rightDialog.vue +++ b/src/views/systemSettings/jurisdictionManage/roleJurisdiction/rightDialog.vue @@ -180,7 +180,54 @@ export default { }) }, handleSelectionChange(val, row) { + // row.check = !row.check + this.multipleSelection = val; + let data = this.treeToArray([row]); + this.childNode = !row.check; row.check = !row.check + if (data.length > 1) { + data.forEach((el, index) => { + el.check = this.childNode + this.$refs.multipleTable.toggleRowSelection(el, this.childNode); + }); + let ids = data[0].id; + let arr = this.treeFindPath( + this.menuDatas, + (data) => data.id == ids, + "id" + ); + arr = arr.splice(0, arr.length - 1); + let dataList = []; + let allList = this.treeToArray(this.menuDatas); + allList.forEach((el, index) => { + if (arr.includes(el.id)) { + dataList.push(el); + } + }); + dataList.forEach((el, index) => { + el.check = true + this.$refs.multipleTable.toggleRowSelection(el, true); + }); + } else { + let ids = data[0].id; + let arr = this.treeFindPath( + this.menuDatas, + (data) => data.id == ids, + "id" + ); + arr = arr.splice(0, arr.length - 1); + let dataList = []; + let allList = this.treeToArray(this.menuDatas); + allList.forEach((el, index) => { + if (arr.includes(el.id)) { + dataList.push(el); + } + }); + dataList.forEach((el, index) => { + el.check=true + this.$refs.multipleTable.toggleRowSelection(el, true); + }); + } }, // 默认选中 exhibitList(menu, list, id) { diff --git a/src/views/systemSettings/jurisdictionManage/userJurisdiction/rightDialog.vue b/src/views/systemSettings/jurisdictionManage/userJurisdiction/rightDialog.vue index 3f7cc13..87ac3a6 100644 --- a/src/views/systemSettings/jurisdictionManage/userJurisdiction/rightDialog.vue +++ b/src/views/systemSettings/jurisdictionManage/userJurisdiction/rightDialog.vue @@ -180,7 +180,54 @@ export default { }) }, handleSelectionChange(val, row) { + // row.check = !row.check + this.multipleSelection = val; + let data = this.treeToArray([row]); + this.childNode = !row.check; row.check = !row.check + if (data.length > 1) { + data.forEach((el, index) => { + el.check = this.childNode + this.$refs.multipleTable.toggleRowSelection(el, this.childNode); + }); + let ids = data[0].id; + let arr = this.treeFindPath( + this.menuDatas, + (data) => data.id == ids, + "id" + ); + arr = arr.splice(0, arr.length - 1); + let dataList = []; + let allList = this.treeToArray(this.menuDatas); + allList.forEach((el, index) => { + if (arr.includes(el.id)) { + dataList.push(el); + } + }); + dataList.forEach((el, index) => { + el.check = true + this.$refs.multipleTable.toggleRowSelection(el, true); + }); + } else { + let ids = data[0].id; + let arr = this.treeFindPath( + this.menuDatas, + (data) => data.id == ids, + "id" + ); + arr = arr.splice(0, arr.length - 1); + let dataList = []; + let allList = this.treeToArray(this.menuDatas); + allList.forEach((el, index) => { + if (arr.includes(el.id)) { + dataList.push(el); + } + }); + dataList.forEach((el, index) => { + el.check=true + this.$refs.multipleTable.toggleRowSelection(el, true); + }); + } }, // 默认选中 exhibitList(menu, list, id) {