Преглед изворни кода

4.0.42 修复身份源管理

liuyanpeng пре 2 година
родитељ
комит
31eda97327
4 измењених фајлова са 66 додато и 88 уклоњено
  1. 1 1
      package.json
  2. 31 55
      src/identity/AccountAssociation.vue
  3. 33 32
      src/identity/BasicConfiguration.vue
  4. 1 0
      src/identity/CreateIdentity.vue

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
 {
   "name": "client-base-v4",
   "name": "client-base-v4",
   "description": "Leanwo Prodog Client",
   "description": "Leanwo Prodog Client",
-  "version": "4.0.41",
+  "version": "4.0.42",
   "author": "yangzhijie1488 <yangzhijie1488@163.com>",
   "author": "yangzhijie1488 <yangzhijie1488@163.com>",
   "scripts": {
   "scripts": {
     "dev": "cross-env webpack serve --config ./webpack.dev.js",
     "dev": "cross-env webpack serve --config ./webpack.dev.js",

+ 31 - 55
src/identity/AccountAssociation.vue

@@ -1,6 +1,7 @@
 <template>
 <template>
   <div class="proDog-setting">
   <div class="proDog-setting">
     <a-form
     <a-form
+      ref="formRef"
       name="basic"
       name="basic"
       :label-col="{ style: { width: '186px' } }"
       :label-col="{ style: { width: '186px' } }"
       :wrapper-col="{ span: 8 }"
       :wrapper-col="{ span: 8 }"
@@ -104,26 +105,7 @@
     </a-form>
     </a-form>
     <div style="margin: 22px 0 -22px 0">
     <div style="margin: 22px 0 -22px 0">
       <a-button @click="prev"> 上一步 </a-button>
       <a-button @click="prev"> 上一步 </a-button>
-      <a-button
-        type="primary"
-        :disabled="
-          !identitySetting.spEntityID ||
-            !identitySetting.uid ||
-            !identitySetting.userName ||
-            !identitySetting.userNo ||
-            !identitySetting.clientId ||
-            !identitySetting.roleTemplateNo ||
-            !identitySetting.spEntityID ||
-            !identitySetting.spAssertionConsumeService ||
-            !identitySetting.spAssertionConsumeSuccessRedirectService ||
-            service ||
-            redirect
-            ? true
-            : false
-        "
-        style="margin-left: 8px"
-        @click="createIdentity"
-      >
+      <a-button type="primary" style="margin-left: 8px" @click="createIdentity">
         完成
         完成
       </a-button>
       </a-button>
     </div>
     </div>
@@ -150,9 +132,7 @@ const props = defineProps({
     default: () => ({}),
     default: () => ({}),
   },
   },
 });
 });
-
-const service = ref(false);
-const redirect = ref(false);
+const formRef = ref();
 const prevDatas = ref({});
 const prevDatas = ref({});
 const identitySetting = ref({});
 const identitySetting = ref({});
 
 
@@ -163,33 +143,35 @@ onMounted(() => {
 
 
 // 新建或更新认证源
 // 新建或更新认证源
 const createIdentity = () => {
 const createIdentity = () => {
-  const jsonStr = JSON.stringify(identitySetting.value);
-  const formData = new FormData();
-  formData.append('attribute', jsonStr);
-  formData.append('id', prevDatas.value.id);
-  formData.append('name', prevDatas.value.name);
-  formData.append('no', prevDatas.value.no);
-  formData.append('logo', prevDatas.value.file);
-  formData.append('active', prevDatas.value.active);
-  formData.append('authType', prevDatas.value.authType);
-  formData.append('description', prevDatas.value.description);
-  saveUpdateAuth(formData).then(
-    success => {
-      if (success.errorCode === 0) {
-        if (!prevDatas.value.id) {
-          message.success('新建认证源成功!');
+  formRef.value.validate().then(success => {
+    const jsonStr = JSON.stringify(identitySetting.value);
+    const formData = new FormData();
+    formData.append('attribute', jsonStr);
+    formData.append('id', prevDatas.value.id);
+    formData.append('name', prevDatas.value.name);
+    formData.append('no', prevDatas.value.no);
+    formData.append('logo', prevDatas.value.file);
+    formData.append('active', prevDatas.value.active);
+    formData.append('authType', prevDatas.value.authType);
+    formData.append('description', prevDatas.value.description);
+    saveUpdateAuth(formData).then(
+      success => {
+        if (success.errorCode === 0) {
+          if (!prevDatas.value.id) {
+            message.success('新建认证源成功!');
+          } else {
+            message.success('更新认证源成功!');
+          }
+          router.push('/desktop/identityManager');
         } else {
         } else {
-          message.success('更新认证源成功!');
+          message.error(success.errorMessage);
         }
         }
-        router.push('/desktop/identityManager');
-      } else {
-        message.error(success.errorMessage);
-      }
-    },
-    error => {
-      Common.processException(error);
-    },
-  );
+      },
+      error => {
+        Common.processException(error);
+      },
+    );
+  });
 };
 };
 
 
 const prev = () => {
 const prev = () => {
@@ -207,10 +189,7 @@ let validateService = async (_rule, value) => {
   }
   }
   let no = prevDatas.value.no;
   let no = prevDatas.value.no;
   if (!value.endsWith('/api/saml/sso/' + no)) {
   if (!value.endsWith('/api/saml/sso/' + no)) {
-    service.value = true;
-    return Promise.reject('断言解析地址必须以/api/saml/sso/' + no + '结束');
-  } else {
-    service.value = false;
+    return Promise.reject('断言解析地址必须以/api/saml/sso/' + no + '结束,' + no + '为认证源标识');
   }
   }
 };
 };
 // 验证断言解析成功跳转地址结束字符是否正确
 // 验证断言解析成功跳转地址结束字符是否正确
@@ -219,12 +198,9 @@ let redirectService = async (_rule, value) => {
     return Promise.reject('请输入 Prodog 断言解析成功跳转地址');
     return Promise.reject('请输入 Prodog 断言解析成功跳转地址');
   }
   }
   if (!value.endsWith('index.html#/samlLogin')) {
   if (!value.endsWith('index.html#/samlLogin')) {
-    redirect.value = true;
     return Promise.reject(
     return Promise.reject(
       '断言解析成功跳转地址必须以index.html#/samlLogin结束',
       '断言解析成功跳转地址必须以index.html#/samlLogin结束',
     );
     );
-  } else {
-    redirect.value = false;
   }
   }
 };
 };
 const rules = {
 const rules = {

+ 33 - 32
src/identity/BasicConfiguration.vue

@@ -1,39 +1,26 @@
 <template>
 <template>
   <a-form
   <a-form
+    ref="formRef"
     name="basic"
     name="basic"
     :label-col="{ style: { width: '120px' } }"
     :label-col="{ style: { width: '120px' } }"
     :wrapper-col="{ span: 8 }"
     :wrapper-col="{ span: 8 }"
     :model="identitySetting"
     :model="identitySetting"
     autocomplete="off"
     autocomplete="off"
+    :rules="rulesForStep"
   >
   >
-    <a-form-item
-      has-feedback
-      label="身份提供商 id"
-      name="entityID"
-      :rules="[{ required: true, message: '请输入身份提供商 id!' }]"
-    >
+    <a-form-item has-feedback label="身份提供商 id" name="entityID">
       <a-input
       <a-input
         v-model:value="identitySetting.entityID"
         v-model:value="identitySetting.entityID"
         placeholder="必填,请输入身份提供商 id"
         placeholder="必填,请输入身份提供商 id"
       />
       />
     </a-form-item>
     </a-form-item>
-    <a-form-item
-      has-feedback
-      label="SSO 地址"
-      name="ssoUrl"
-      :rules="[{ required: true, message: '请输入 SSO 地址' }]"
-    >
+    <a-form-item has-feedback label="SSO 地址" name="ssoUrl">
       <a-input
       <a-input
         v-model:value="identitySetting.ssoUrl"
         v-model:value="identitySetting.ssoUrl"
         placeholder="必填,请输入 SSO 地址"
         placeholder="必填,请输入 SSO 地址"
       />
       />
     </a-form-item>
     </a-form-item>
-    <a-form-item
-      has-feedback
-      label="证书"
-      name="certificate"
-      :rules="[{ required: true, message: '请输入证书' }]"
-    >
+    <a-form-item has-feedback label="证书" name="certificate">
       <a-textarea
       <a-textarea
         v-model:value="identitySetting.certificate"
         v-model:value="identitySetting.certificate"
         :rows="4"
         :rows="4"
@@ -50,18 +37,7 @@
   </a-form>
   </a-form>
   <div style="margin: 22px 0 -22px 0">
   <div style="margin: 22px 0 -22px 0">
     <a-button @click="prev"> 上一步 </a-button>
     <a-button @click="prev"> 上一步 </a-button>
-    <a-button
-      type="primary"
-      style="margin-left: 8px"
-      :disabled="
-        !identitySetting.entityID ||
-          !identitySetting.ssoUrl ||
-          !identitySetting.certificate
-          ? true
-          : false
-      "
-      @click="next"
-    >
+    <a-button type="primary" style="margin-left: 8px" @click="next">
       下一步
       下一步
     </a-button>
     </a-button>
   </div>
   </div>
@@ -78,9 +54,32 @@ const props = defineProps({
   },
   },
 });
 });
 
 
+const formRef = ref();
 // 表单数据
 // 表单数据
 const identitySetting = ref({});
 const identitySetting = ref({});
-
+const rulesForStep = {
+  entityID: [
+    {
+      required: true,
+      message: '请输入身份提供商 id!',
+      trigger: 'change',
+    },
+  ],
+  ssoUrl: [
+    {
+      required: true,
+      message: '请输入 SSO 地址!',
+      trigger: 'change',
+    },
+  ],
+  certificate: [
+    {
+      required: true,
+      message: '请输入证书!',
+      trigger: 'change',
+    },
+  ],
+};
 onMounted(() => {
 onMounted(() => {
   identitySetting.value = props.formData;
   identitySetting.value = props.formData;
 });
 });
@@ -102,7 +101,9 @@ const next = () => {
     current: 3,
     current: 3,
     formData: identitySetting.value,
     formData: identitySetting.value,
   };
   };
-  emit('getDatas', datas);
+  formRef.value.validate().then(success => {
+    emit('getDatas', datas);
+  });
 };
 };
 </script>
 </script>
 
 

+ 1 - 0
src/identity/CreateIdentity.vue

@@ -283,6 +283,7 @@ const imgToBase64 = () => {
   image.onload = function () {
   image.onload = function () {
     let base64 = imageToBase64(image); //图片转base64
     let base64 = imageToBase64(image); //图片转base64
     identityInfo.file = base64toFile(base64, logoName.value); //base64转File
     identityInfo.file = base64toFile(base64, logoName.value); //base64转File
+    identityInfo.logo.push(identityInfo.file);
   };
   };
 };
 };