gangyj il y a 2 ans
Parent
commit
7852e40afa
1 fichiers modifiés avec 38 ajouts et 3 suppressions
  1. 38 3
      src/views/authority/role.vue

+ 38 - 3
src/views/authority/role.vue

@@ -293,11 +293,30 @@
       submit() {
         const menuList = this.$refs.treeMenu.getCheckedKeys();
         const menuClientList = this.$refs.treeClientMenu.getCheckedKeys();
+        const menuListHanlf = this.$refs.treeMenu.getHalfCheckedKeys();
+        const menuClientListHanlf = this.$refs.treeMenu.getHalfCheckedKeys();
         const dataScopeList = this.$refs.treeDataScope.getCheckedKeys();
         const apiScopeList = this.$refs.treeApiScope.getCheckedKeys();
         const tableOwnersList = this.$refs.tableOwners.getCheckedKeys();
 
-        grant(this.idsArray, menuList, menuClientList, dataScopeList, apiScopeList, tableOwnersList).then(() => {
+        let menuAll = [];
+        let menuClientAll = [];
+        menuList.forEach((id)=>{
+          menuAll.push(id+'&&all')
+        })
+        menuListHanlf.forEach((id)=>{
+          menuAll.push(id+'&&hanlf')
+        })
+
+        menuClientList.forEach((id)=>{
+          menuClientAll.push(id+'&&all')
+        })
+        menuClientListHanlf.forEach((id)=>{
+          menuClientAll.push(id+'&&hanlf')
+        })
+
+
+        grant(this.idsArray, menuAll, menuClientAll, dataScopeList, apiScopeList, tableOwnersList).then(() => {
           this.box = false;
           this.$message({
             type: "success",
@@ -395,8 +414,24 @@
             this.dataScopeGrantList = res.data.data.dataScope;
             this.apiScopeGrantList = res.data.data.apiScope;
             getRole(this.ids).then(res => {
-              this.menuTreeObj = res.data.data.menu;
-              this.menuClientObj = res.data.data.usermenu;
+              let menuTreeObj = [];
+              res.data.data.menu.forEach((item)=>{
+                let arr = item.split("&&");
+                if(arr[1] == 'all'){
+                  menuTreeObj.push(arr[0])
+                }
+              });
+              this.menuTreeObj = menuTreeObj;
+
+              let menuClientObj = [];
+              res.data.data.usermenu.forEach((item)=>{
+                let arr = item.split("&&");
+                if(arr[1] == 'all'){
+                  menuClientObj.push(arr[0])
+                }
+              });
+              this.menuClientObj = menuClientObj;
+
               this.tableOwnerObj = res.data.data.tableOwners;
               this.dataScopeTreeObj = res.data.data.dataScope;
               this.apiScopeTreeObj = res.data.data.apiScope;