Browse Source

修复:角色管理-编辑角色修改除应用和编码之外的值,保存时报错:校验编码唯一

ZL 2 weeks ago
parent
commit
1e102bb701
1 changed files with 3 additions and 7 deletions
  1. 3 7
      jeecgboot-vue3/src/views/system/role/role.data.ts

+ 3 - 7
jeecgboot-vue3/src/views/system/role/role.data.ts

@@ -168,8 +168,6 @@ export const formSchema: FormSchema[] = [
       return !values.appId;
     },
     dynamicRules: ({ values, model }) => {
-      console.log('values:', values);
-
       return [
         {
           required: true,
@@ -179,12 +177,10 @@ export const formSchema: FormSchema[] = [
             }
 
             if (values) {
-              // console.log('values:', values.appId);
-              // if (!values.appId) {
-              //   return Promise.reject('请先选择应用');
-              // }
+              
               return new Promise((resolve, reject) => {
-                isRoleExist({ id: model.id, roleCode: value, appId: model.appId })
+                const appId = Array.isArray(model.appId) ? model.appId[0] : model.appId;
+                isRoleExist({ id: model.id, roleCode: value, appId:appId })
                   .then((res) => {
                     res.success ? resolve() : reject(res.message || '校验失败');
                   })