From fbbcf60c35a300c9411c04078fa946a96d9e2a96 Mon Sep 17 00:00:00 2001 From: leiqiaochu Date: Wed, 27 Sep 2023 11:25:49 +0800 Subject: [PATCH 1/2] fix: bug#18724 --- src/views/system/Dictionary/components/Right/Save/index.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/views/system/Dictionary/components/Right/Save/index.vue b/src/views/system/Dictionary/components/Right/Save/index.vue index 6053c118..a435c258 100644 --- a/src/views/system/Dictionary/components/Right/Save/index.vue +++ b/src/views/system/Dictionary/components/Right/Save/index.vue @@ -47,7 +47,7 @@ const form: any = ref({ text: '', ordinal: 0 }) - +const lastValue = ref() const loading = ref(false) const formRef = ref() /* @@ -66,7 +66,7 @@ const validateInput = async (_rule: Rule, value: string) => { * 校验value唯一 */ const validateValue = async (_rule: Rule, value: string) => { - if (value && props.type === 'add') { + if (value && lastValue.value !== value) { const res:any = await verifyValue({ terms: [ { @@ -133,6 +133,7 @@ onMounted(() => { form.value.ordinal = props.sort } else { form.value = props.data + lastValue.value = props.data.value } }) From 490f34b21525ede561e1959b413765101f1313c0 Mon Sep 17 00:00:00 2001 From: leiqiaochu Date: Wed, 27 Sep 2023 13:42:24 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E5=85=B3=E7=B3=BB=E6=94=B9?= =?UTF-8?q?=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Relationship/components/EditDialog.vue | 17 +++++++++++++++++ src/views/system/Relationship/index.vue | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/views/system/Relationship/components/EditDialog.vue b/src/views/system/Relationship/components/EditDialog.vue index 7ad2232f..67004110 100644 --- a/src/views/system/Relationship/components/EditDialog.vue +++ b/src/views/system/Relationship/components/EditDialog.vue @@ -76,25 +76,30 @@ :rules="[ { required: true, message: '请输入名称' }, { max: 64, message: '最多可输入64个字符' }, + { required: true , validator:validateName, trigger: 'blur',} ]" > + 正向关系示例:用户张三是001号视频设备的管理员 + + 反向关系示例:001号视频设备是用户张三的管辖设备 { + if(!value){ + return Promise.resolve() + } + return form.data.reverseName === form.data.name ? Promise.reject('不能使用相同的关系名称') : Promise.resolve() +} const targetList = computed(() => form.data.objectType === 'device' ? [{ id: 'user', name: '用户' }] : [], ); @@ -224,3 +235,9 @@ type formType = { id?: string; }; + diff --git a/src/views/system/Relationship/index.vue b/src/views/system/Relationship/index.vue index 480535dd..99b7fbce 100644 --- a/src/views/system/Relationship/index.vue +++ b/src/views/system/Relationship/index.vue @@ -90,7 +90,7 @@ const columns = [ }, }, { - title: '正向关系名称', + title: '反向关系名称', dataIndex: 'reverseName', key: 'reverseName', ellipsis: true,