From 2874160e450a97dd487c9dd3a4993e4930ec4584 Mon Sep 17 00:00:00 2001 From: ChenYi <296215406@outlook.com> Date: Thu, 23 Oct 2025 14:31:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=95=B0=E6=8D=AE=E5=AD=97?= =?UTF-8?q?=E5=85=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/api-client/schemas.gen.ts | 5 ++ apps/web-antd/src/api-client/types.gen.ts | 4 ++ .../devicemanagement/thingmodelinfo/schema.ts | 2 +- .../DataDictionaryDetailModal.vue | 50 +++++++++++++++---- 4 files changed, 50 insertions(+), 11 deletions(-) diff --git a/apps/web-antd/src/api-client/schemas.gen.ts b/apps/web-antd/src/api-client/schemas.gen.ts index 9830caa..95c9b30 100644 --- a/apps/web-antd/src/api-client/schemas.gen.ts +++ b/apps/web-antd/src/api-client/schemas.gen.ts @@ -8890,6 +8890,11 @@ export const UpdateDetailInputSchema = { order: { type: 'integer', format: 'int32' + }, + extendedAttribute: { + type: 'string', + description: '扩展属性', + nullable: true } }, additionalProperties: false diff --git a/apps/web-antd/src/api-client/types.gen.ts b/apps/web-antd/src/api-client/types.gen.ts index c25be2e..ad33023 100644 --- a/apps/web-antd/src/api-client/types.gen.ts +++ b/apps/web-antd/src/api-client/types.gen.ts @@ -4574,6 +4574,10 @@ export type UpdateDetailInput = { displayText?: (string) | null; description?: (string) | null; order?: number; + /** + * 扩展属性 + */ + extendedAttribute?: (string) | null; }; export type UpdateFeatureDto = { diff --git a/apps/web-antd/src/views/devicemanagement/thingmodelinfo/schema.ts b/apps/web-antd/src/views/devicemanagement/thingmodelinfo/schema.ts index ddf51d1..64bbf48 100644 --- a/apps/web-antd/src/views/devicemanagement/thingmodelinfo/schema.ts +++ b/apps/web-antd/src/views/devicemanagement/thingmodelinfo/schema.ts @@ -354,7 +354,7 @@ export const editThingModelFormSchema = computed(() => [ return items.map((item: any) => ({ ...item, // 使用secondValue的小写版本作为value,保持label为原始value - value: item.secondValue?.toLowerCase() || item.value?.toLowerCase(), + value: item.secondValue || item.value?.toLowerCase(), label: item.value, // 显示文本 })); }, diff --git a/apps/web-antd/src/views/system/abpdatadictionary/DataDictionaryDetailModal.vue b/apps/web-antd/src/views/system/abpdatadictionary/DataDictionaryDetailModal.vue index d05d8a1..a37189e 100644 --- a/apps/web-antd/src/views/system/abpdatadictionary/DataDictionaryDetailModal.vue +++ b/apps/web-antd/src/views/system/abpdatadictionary/DataDictionaryDetailModal.vue @@ -5,6 +5,7 @@ import { useVbenModal } from '@vben/common-ui'; import { useVbenForm } from '#/adapter/form'; import { + getCommonGetSelectList, postDataDictionaryCreateDetail, postDataDictionaryUpdateDetail, } from '#/api-client/index'; @@ -69,9 +70,38 @@ const [Form, formApi] = useVbenForm({ rules: 'required', }, { - component: 'Input', + component: 'ApiSelect', componentProps: { - placeholder: $t('common.pleaseInput'), + api: getCommonGetSelectList, + params: { + query: { + typeName: 'StandardThingModelDataTypeEnum', + }, + }, + labelField: 'value', + valueField: 'secondValue', + optionsPropName: 'options', + immediate: true, + allowClear: true, + placeholder: + $t('common.pleaseSelect') + + $t('abp.dataDictionary.extendedAttribute'), + afterFetch: (res: any) => { + // 确保返回的是数组格式 + if (Array.isArray(res)) { + return res; + } + // 如果是包装在 items 中的,提取出来 + if (res && Array.isArray(res.items)) { + return res.items; + } + // 如果是包装在 data 中的,提取出来 + if (res && Array.isArray(res.data)) { + return res.data; + } + // 如果都不是,返回空数组 + return []; + }, }, fieldName: 'extendedAttribute', label: $t('abp.dataDictionary.extendedAttribute'), @@ -110,15 +140,15 @@ const [Modal, modalApi] = useVbenModal({ const values = await formApi.getValues(); await (data.value.isEdit ? postDataDictionaryUpdateDetail({ - body: { - ...values, - id: data.value.row.id, - dataDictionaryId: data.value.id, - }, - }) + body: { + ...values, + id: data.value.row.id, + dataDictionaryId: data.value.id, + }, + }) : postDataDictionaryCreateDetail({ - body: { ...values, id: data.value.id }, - })); + body: { ...values, id: data.value.id }, + })); emit('reload'); modalApi.close(); } finally {