diff --git a/src/views/assets/category/component/editCategory.vue b/src/views/assets/category/component/editCategory.vue index 2dc877e..e1c5acb 100644 --- a/src/views/assets/category/component/editCategory.vue +++ b/src/views/assets/category/component/editCategory.vue @@ -68,6 +68,7 @@ :key="idx" :label="item.name || ''" :value="item.name || ''" + :disabled="isDictOptionDisabled(item.name || '', attr)" /> @@ -249,6 +250,13 @@ const onDictKeyChange = (attr: CustomAttr) => { attr.options = []; }; +// 判断字典选项是否应被禁用 +const isDictOptionDisabled = (dictName: string, currentAttr: CustomAttr) => { + if (!dictName) return false; + // 检查该字典名称是否已被其他属性使用 + return ruleForm.attrs.some((attr) => attr !== currentAttr && isDictType(attr.type) && attr.name === dictName); +}; + // 添加自定义属性 const addAttr = () => { ruleForm.attrs.push({