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) {