From 0617ca9d09f6928b2be2f72174df2ac7ccbd85d7 Mon Sep 17 00:00:00 2001
From: chenwenchang <479999519@qq.com>
Date: Mon, 21 Oct 2024 10:41:13 +0800
Subject: [PATCH] =?UTF-8?q?feat(frontend):=20=E5=AF=86=E7=A0=81=E8=A7=84?=
 =?UTF-8?q?=E5=88=99=E6=A0=A1=E9=AA=8C=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?=
 =?UTF-8?q?=20#7031=20#=20Reviewed,=20transaction=20id:=2021392?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 dbm-ui/frontend/src/locales/zh-cn.json          |  3 +--
 .../policy/components/Content.vue               | 17 +++++------------
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/dbm-ui/frontend/src/locales/zh-cn.json b/dbm-ui/frontend/src/locales/zh-cn.json
index 8e5e91abbb..94e154753b 100644
--- a/dbm-ui/frontend/src/locales/zh-cn.json
+++ b/dbm-ui/frontend/src/locales/zh-cn.json
@@ -3487,7 +3487,6 @@
     "【MongoDB】实例视图": "【MongoDB】实例视图",
     "【MongoDB】副本集集群管理": "【MongoDB】副本集集群管理",
     "【MongoDB】分片集群管理": "【MongoDB】分片集群管理",
-    "任意 N 种, N 必须 >= 1 。且 <= 密码组成的种类": "任意 N 种, N 必须 >= 1 。且 <= 密码组成的种类",
-    "密码组成至少要选 1 种": "密码组成至少要选 1 种",
+    "请至少选择一种类型": "请至少选择一种类型",
     "这行勿动!新增翻译请在上一行添加!": ""
 }
diff --git a/dbm-ui/frontend/src/views/password-manage/policy/components/Content.vue b/dbm-ui/frontend/src/views/password-manage/policy/components/Content.vue
index 804c4692e3..03bb990bd7 100644
--- a/dbm-ui/frontend/src/views/password-manage/policy/components/Content.vue
+++ b/dbm-ui/frontend/src/views/password-manage/policy/components/Content.vue
@@ -88,7 +88,7 @@
             v-model="formData.number_of_types"
             class="password-policy-number ml-6 mr-6"
             :max="typeMaxCount"
-            :min="0"
+            :min="1"
             type="number" />
           {{ t('种类型') }}
         </BkFormItem>
@@ -175,17 +175,10 @@
     include_rule: [
       {
         trigger: 'change',
-        message: t('密码组成至少要选 1 种'),
+        message: t('请至少选择一种类型'),
         validator: () => Object.values(formData.include_rule).some((checked) => checked),
       },
     ],
-    number_of_types: [
-      {
-        trigger: 'change',
-        message: t('任意 N 种, N 必须 >= 1 。且 <= 密码组成的种类'),
-        validator: () => formData.number_of_types >= 1 && formData.number_of_types <= typeMaxCount.value,
-      },
-    ],
   };
 
   const defaultConfig = reactive(initData());
@@ -245,9 +238,9 @@
     },
   );
 
-  const handleChangeIncludeRule = async () => {
-    await formRef.value.validate();
-    formData.number_of_types = Math.min(formData.number_of_types, typeMaxCount.value);
+  const handleChangeIncludeRule = () => {
+    formData.number_of_types = typeMaxCount.value;
+    formRef.value.validate();
   };
 
   const handleInputChange = (value: string) => {