zhangjie 2 سال پیش
والد
کامیت
5e29085fc0

+ 1 - 1
src/modules/admin/components/ModifySchoolSet.vue

@@ -20,7 +20,7 @@
       </el-button>
     </div>
 
-    <div class="part-box part-box-pad">
+    <div v-if="modalIsShow" class="part-box part-box-pad">
       <component :is="compName" :school="school"></component>
     </div>
 

+ 10 - 13
src/modules/admin/components/school/SchoolSetMenu.vue

@@ -4,9 +4,15 @@
       v-if="menus && menus.length"
       ref="PrivilegeSet"
       :menus="menus"
+      :show-permission="false"
     ></privilege-set>
 
-    <el-button type="primary" :loading="loading" @click="confirm"
+    <el-button
+      v-if="menus && menus.length"
+      class="mt-1"
+      type="primary"
+      :loading="loading"
+      @click="confirm"
       >保存</el-button
     >
   </div>
@@ -35,7 +41,6 @@ export default {
     return {
       menus: [],
       privilegeIds: [],
-      dataPermissionInfo: [],
       loading: false
     };
   },
@@ -47,10 +52,7 @@ export default {
       await this.getPrivileges();
       await this.getSchoolMenuInfo();
       this.$nextTick(() => {
-        this.$refs.PrivilegeSet.buildTableData(
-          this.privilegeIds,
-          this.dataPermissionInfo
-        );
+        this.$refs.PrivilegeSet.buildTableData(this.privilegeIds, []);
       });
     },
     async getPrivileges() {
@@ -68,19 +70,14 @@ export default {
     async getSchoolMenuInfo() {
       const data = await schoolSetMenuInfo(this.school.id);
       this.privilegeIds = data.privilegeIdList || [];
-      this.dataPermissionInfo = data.dataPermissionInfo || [];
     },
     async confirm() {
       if (this.loading) return;
       this.loading = true;
-      const {
-        privilegeIds,
-        dataPermissionInfo
-      } = this.$refs.PrivilegeSet.getSelectedPrivileges();
+      const { privilegeIds } = this.$refs.PrivilegeSet.getSelectedPrivileges();
       const res = await schoolSetMenuUpdate({
         schoolId: this.school.id,
-        privilegeIds,
-        dataPermissionInfo
+        privilegeIds
       }).catch(() => {});
       this.loading = false;
       if (!res) return;

+ 40 - 18
src/modules/base/components/PrivilegeSet.vue

@@ -71,6 +71,16 @@ export default {
       default() {
         return [];
       }
+    },
+    showPermission: {
+      type: Boolean,
+      default: true
+    },
+    disabledPermissionUrls: {
+      type: Array,
+      default() {
+        return ["TaskApplyManage", "TaskReviewManage"];
+      }
     }
   },
   data() {
@@ -110,20 +120,16 @@ export default {
       for (let index = 0; index < this.maxDeep; index++) {
         headers.push(`${codes[index]}级页面`);
       }
-      headers = [
-        ...headers,
-        "页面",
-        "数据权限",
-        "查询条件",
-        "功能按钮",
-        "列表展示",
-        "操作列"
-      ];
+      headers = [...headers, "页面"];
+      if (this.showPermission) headers.push("数据权限");
+      headers = [...headers, "查询条件", "功能按钮", "列表展示", "操作列"];
+
       return headers;
     },
     buildTableData(privilegeIds = [], dataPermissionInfo = []) {
       let tableData = [];
-      let tableColumnCount = this.maxDeep + 6;
+      const privColumnCount = this.showPermission ? 6 : 5;
+      let tableColumnCount = this.maxDeep + privColumnCount;
       const pageSetTypes = ["conditions", "buttons", "lists", "links"];
 
       let datePermissionMap = {};
@@ -133,18 +139,24 @@ export default {
       const buildData = (navs, deep) => {
         ++deep;
         navs.forEach(nav => {
+          const isDisabledPermissionUrl = this.disabledPermissionUrls.includes(
+            nav.url
+          );
           let columns = new Array(tableColumnCount);
           columns[deep - 1] = { type: "page", name: nav.name };
           columns[this.maxDeep] = {
             type: "page-checkbox"
           };
-          columns[this.maxDeep + 1] = {
-            type: "page-data-permission"
-          };
+          if (this.showPermission && !isDisabledPermissionUrl) {
+            columns[this.maxDeep + 1] = {
+              type: "page-data-permission"
+            };
+          }
 
           const isPage = pageSetTypes.some(
             type => nav[type] && nav[type].length
           );
+          const offsetPageSetInd = this.showPermission ? 2 : 1;
           if (isPage) {
             pageSetTypes.forEach((type, index) => {
               const datas = !nav[type]
@@ -154,17 +166,22 @@ export default {
                     data.enable = privilegeIds.includes(elem.id);
                     return data;
                   });
-              columns[this.maxDeep + index + 2] = { type, datas };
+              columns[this.maxDeep + index + offsetPageSetInd] = {
+                type,
+                datas
+              };
             });
           }
 
           tableData.push({
             id: nav.id,
             name: nav.name,
+            url: nav.url,
             enable: privilegeIds.includes(nav.id),
-            dataPermissionType: isPage
-              ? datePermissionMap[nav.id] || "SELF"
-              : null,
+            dataPermissionType:
+              isPage && this.showPermission && !isDisabledPermissionUrl
+                ? datePermissionMap[nav.id] || "SELF"
+                : null,
             type: nav.type,
             parentId: nav.parentId,
             isPage,
@@ -181,7 +198,12 @@ export default {
     },
     resetdataPermissionType(val) {
       this.tableData.forEach(item => {
-        if (item.isPage) item.dataPermissionType = val;
+        if (
+          item.isPage &&
+          this.showPermission &&
+          !this.disabledPermissionUrls.includes(item.url)
+        )
+          item.dataPermissionType = val;
       });
     },
     getSelectedPrivileges() {