Przeglądaj źródła

修改权限项

zhaoke 2 lat temu
rodzic
commit
107e984ce1

+ 2 - 2
src/utils/axiosReq.ts

@@ -52,7 +52,7 @@ service.interceptors.response.use(
     // if the custom code is not 20000, it is judged as an error.
     if (res.code != '0') {
       ElMessage({
-        message: res.message || 'Error',
+        message: '执行失败',
         type: 'error',
         duration: 5 * 1000,
       })
@@ -75,7 +75,7 @@ service.interceptors.response.use(
           router.push(`/login`)
         })
       }
-      return Promise.reject((res.message || res.returnData?.message || 'Error'))
+      return Promise.reject(res.message || res.returnData?.message || 'Error')
     } else {
       return res
     }

+ 3 - 0
src/views/userManagement/permission/index.vue

@@ -164,6 +164,9 @@ const optionsApp: any = ref([]);
 const ruleFormRef = ref<FormInstance>();
 const rules = reactive<FormRules>({
   auth_name: [{ required: true, message: "请输入权限名称", trigger: "blur" }],
+  auth_ident: [
+    { required: true, message: "请输入权限标识符", trigger: "blur" },
+  ],
 });
 const defaultProps = {
   children: "children",

+ 9 - 6
src/views/userManagement/role/auth.vue

@@ -273,14 +273,18 @@ const checksBoxTs = async (datas, arr, type) => {
   const [msg1, msg2] = [<any>[], <any>[]];
   if (res && res.length) {
     for (let i = 0; i < res.length; i++) {
-      delete res[i].children;
+      //delete res[i].children;
+      const cap = _.cloneDeep(res[i]);
+      if (cap.children) {
+        delete cap.children;
+      }
       let obj = <any>{
-        auth_id: res[i].auth_id || res[i].AuthId,
+        auth_id: cap.auth_id || cap.AuthId,
         role_id: role_id,
       };
-      let authObj = res[i].AuthList
-        ? Object.assign(_.cloneDeep(obj), res[i].AuthList)
-        : Object.assign(_.cloneDeep(obj), res[i]);
+      let authObj = cap.AuthList
+        ? Object.assign(_.cloneDeep(obj), cap.AuthList)
+        : Object.assign(_.cloneDeep(obj), cap);
       if (type == "add") {
         obj.event = 1;
         authObj.event = 1;
@@ -334,7 +338,6 @@ const checksBoxTs = async (datas, arr, type) => {
       });
     }
   } else {
-    // this.$message.error('未选中数据')
   }
 };