From b910584019e79d13aa9dba39aa7bbb02ef129ae1 Mon Sep 17 00:00:00 2001 From: WUSIJIAN <13825895+wsj0228@user.noreply.gitee.com> Date: Tue, 23 Dec 2025 16:55:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=86=E7=B1=BB=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E7=AE=A1=E7=90=86,=E7=A7=BB=E9=99=A4description?= =?UTF-8?q?=E5=AD=97=E6=AE=B5,=E7=BB=9F=E4=B8=80=E4=BD=BF=E7=94=A8name?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=AD=98=E5=82=A8=E5=B1=9E=E6=80=A7=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E5=92=8C=E5=AD=97=E5=85=B8=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assets/asset/component/editAsset.vue | 9 ++++---- src/views/assets/asset/index.vue | 2 +- .../category/component/editCategory.vue | 22 ++++++++----------- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/src/views/assets/asset/component/editAsset.vue b/src/views/assets/asset/component/editAsset.vue index 6aafb49..db2c16d 100644 --- a/src/views/assets/asset/component/editAsset.vue +++ b/src/views/assets/asset/component/editAsset.vue @@ -355,7 +355,6 @@ interface CategoryAttr { name: string; type: string; options?: { label: string; value: string }[]; - description?: string; } interface RuleForm { @@ -411,12 +410,12 @@ const isTimeSlotLimitReached = computed(() => ruleForm.serviceAssetConfig.schedu // 获取属性的key const getAttrKey = (attr: CategoryAttr): string => { - return attr.name || attr.description || `attr_${categoryAttrs.value.indexOf(attr)}`; + return attr.name || `attr_${categoryAttrs.value.indexOf(attr)}`; }; // 获取属性的显示名称 const getAttrLabel = (attr: CategoryAttr): string => { - return attr.description || attr.name || '属性'; + return attr.name || '属性'; }; // 图片相关 @@ -692,7 +691,7 @@ const onCategoryChange = (categoryId: string) => { if (data?.attrs && Array.isArray(data.attrs)) { categoryAttrs.value = data.attrs; // 初始化属性值,确保 boolean 类型默认为 false - data.attrs.forEach((attr: CategoryAttr) => { + categoryAttrs.value.forEach((attr: CategoryAttr) => { const key = getAttrKey(attr); if (attr.type === 'boolean') { ruleForm.metadata[key] = false; @@ -789,7 +788,7 @@ const openDialog = (row?: any, edit?: boolean) => { if (catData?.attrs && Array.isArray(catData.attrs)) { categoryAttrs.value = catData.attrs; // 初始化属性值,确保 boolean 类型默认为 false - catData.attrs.forEach((attr: CategoryAttr) => { + categoryAttrs.value.forEach((attr: CategoryAttr) => { const key = getAttrKey(attr); if (attr.type === 'boolean' && ruleForm.metadata[key] === undefined) { ruleForm.metadata[key] = false; diff --git a/src/views/assets/asset/index.vue b/src/views/assets/asset/index.vue index bb0b360..22e2aaa 100644 --- a/src/views/assets/asset/index.vue +++ b/src/views/assets/asset/index.vue @@ -64,7 +64,7 @@ diff --git a/src/views/assets/category/component/editCategory.vue b/src/views/assets/category/component/editCategory.vue index 0f9ae7a..cd89112 100644 --- a/src/views/assets/category/component/editCategory.vue +++ b/src/views/assets/category/component/editCategory.vue @@ -37,7 +37,7 @@ placeholder="请输入属性名称" clearable /> - {{ attr.description || '请选择字典' }} + {{ attr.name || '请选择字典' }}
@@ -51,7 +51,7 @@
{ ruleForm.attrs.push({ name: '', type: 'text', - description: '', options: [], }); }; @@ -271,10 +268,10 @@ const onAttrTypeChange = (attr: CustomAttr) => { if (dictTypeOptions.value.length === 0) { fetchDictTypeOptions(); } - attr.description = ''; + attr.name = ''; attr.options = []; } else { - attr.description = ''; + attr.name = ''; attr.options = []; } }; @@ -364,7 +361,7 @@ const formatDictOptions = (attr: CustomAttr) => { value: opt.value ?? opt.key ?? '', })); } - const dictValues = getDictValuesByType(attr.description || ''); + const dictValues = getDictValuesByType(attr.name || ''); return options.map((optValue: string) => { const dictItem = dictValues.find((d: any) => d.key === optValue); return { @@ -383,7 +380,6 @@ const onSubmit = () => { const processedAttrs = ruleForm.attrs.map((attr) => { const base = { type: attr.type, - description: attr.description || '', required: attr.required ?? false, multiple: attr.type === 'multi_select', sort: attr.sort ?? 0, @@ -392,7 +388,7 @@ const onSubmit = () => { if (isDictType(attr.type)) { return { ...base, - name: '', + name: attr.name || '', options: formatDictOptions(attr), }; }