diff --git a/apps/web-antd/src/api-client/schemas.gen.ts b/apps/web-antd/src/api-client/schemas.gen.ts index 47cc6fa..01d7969 100644 --- a/apps/web-antd/src/api-client/schemas.gen.ts +++ b/apps/web-antd/src/api-client/schemas.gen.ts @@ -3693,6 +3693,11 @@ export const DeviceUpgradeRecordDtoSchema = { description: '扩展属性,用于存储自定义字段,JSON格式', nullable: true }, + deviceDataId: { + type: 'string', + description: '设备数据Id', + format: 'uuid' + }, deviceName: { type: 'string', description: '设备名称', @@ -5958,6 +5963,9 @@ export const IoTPlatformThingModelCreateInputSchema = { type: 'string', description: '物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode', nullable: true + }, + identifierType: { + '$ref': '#/components/schemas/ThingModelIdentifierTypeEnum' } }, additionalProperties: false @@ -6101,6 +6109,9 @@ export const IoTPlatformThingModelInfoDtoSchema = { type: 'string', description: '物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode', nullable: true + }, + identifierType: { + '$ref': '#/components/schemas/ThingModelIdentifierTypeEnum' } }, additionalProperties: false, @@ -6178,6 +6189,14 @@ export const IoTPlatformThingModelPageInputSchema = { type: 'boolean', description: '是否可操作标识符', nullable: true + }, + accessMode: { + type: 'string', + description: '物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode', + nullable: true + }, + identifierType: { + '$ref': '#/components/schemas/ThingModelIdentifierTypeEnum' } }, additionalProperties: false @@ -6246,6 +6265,9 @@ export const IoTPlatformThingModelUpdateInputSchema = { description: '物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode', nullable: true }, + identifierType: { + '$ref': '#/components/schemas/ThingModelIdentifierTypeEnum' + }, id: { type: 'string', format: 'uuid' @@ -10860,6 +10882,14 @@ export const TenantDtoPagedResultDtoSchema = { additionalProperties: false } as const; +export const ThingModelIdentifierTypeEnumSchema = { + enum: [1, 2], + type: 'integer', + description: '设备物模型标识符类型枚举', + format: 'int32', + '说明:': '数据标识符=1,属性标识符=2' +} as const; + export const TimeZoneSchema = { type: 'object', properties: { diff --git a/apps/web-antd/src/api-client/types.gen.ts b/apps/web-antd/src/api-client/types.gen.ts index 41954ba..c02a34a 100644 --- a/apps/web-antd/src/api-client/types.gen.ts +++ b/apps/web-antd/src/api-client/types.gen.ts @@ -2151,6 +2151,10 @@ export type DeviceUpgradeRecordDto = { extraProperties?: { [key: string]: unknown; } | null; + /** + * 设备数据Id + */ + deviceDataId?: string; /** * 设备名称 */ @@ -3067,6 +3071,7 @@ export type IoTPlatformThingModelCreateInput = { * 物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode */ accessMode?: (string) | null; + identifierType?: ThingModelIdentifierTypeEnum; }; /** @@ -3160,6 +3165,7 @@ export type IoTPlatformThingModelInfoDto = { * 物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode */ accessMode?: (string) | null; + identifierType?: ThingModelIdentifierTypeEnum; }; export type IoTPlatformThingModelInfoDtoPagedResultDto = { @@ -3208,6 +3214,11 @@ export type IoTPlatformThingModelPageInput = { * 是否可操作标识符 */ isOperableIdentifier?: (boolean) | null; + /** + * 物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode + */ + accessMode?: (string) | null; + identifierType?: ThingModelIdentifierTypeEnum; }; export type IoTPlatformThingModelUpdateInput = { @@ -3260,6 +3271,7 @@ export type IoTPlatformThingModelUpdateInput = { * 物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode */ accessMode?: (string) | null; + identifierType?: ThingModelIdentifierTypeEnum; id?: string; }; @@ -5949,6 +5961,11 @@ export type TenantDtoPagedResultDto = { totalCount?: number; }; +/** + * 设备物模型标识符类型枚举 + */ +export type ThingModelIdentifierTypeEnum = 1 | 2; + export type TimeZone = { iana?: IanaTimeZone; windows?: WindowsTimeZone; diff --git a/apps/web-antd/src/locales/langs/en-US/abp.json b/apps/web-antd/src/locales/langs/en-US/abp.json index eb442fe..fcb56a5 100644 --- a/apps/web-antd/src/locales/langs/en-US/abp.json +++ b/apps/web-antd/src/locales/langs/en-US/abp.json @@ -228,10 +228,12 @@ "StandardFieldDisplayName": "StandardFieldDisplayName", "IsValueNeedConvert": "IsValueNeedConvert", "AccessMode": "AccessMode", + "IdentifierType": "IdentifierType", "IsOperableIdentifier": "IsOperableIdentifier", "StandardFieldValueType": "StandardFieldValueType", "copyStandardThingModel": "CopyStandardThingModel", - "copyAnotherThingModelModal": "CopyAnotherThingModelModal" + "copyAnotherThingModelModal": "CopyAnotherThingModelModal", + "ioTPlatformProduct": "IoTPlatformProduct" }, "IoTDBBase": { "IoTDataType": "IoTDataType", diff --git a/apps/web-antd/src/locales/langs/zh-CN/abp.json b/apps/web-antd/src/locales/langs/zh-CN/abp.json index 3f3f715..f68bddc 100644 --- a/apps/web-antd/src/locales/langs/zh-CN/abp.json +++ b/apps/web-antd/src/locales/langs/zh-CN/abp.json @@ -219,12 +219,14 @@ "IoTPlatformRawFieldName": "平台物模型编码", "StandardFieldName": "标准物模型编码", "StandardFieldDisplayName": "标准物模型名称", - "IsValueNeedConvert": "是否需要值类型转换", + "IsValueNeedConvert": "是否值类型转换", "AccessMode": "访问模式", - "IsOperableIdentifier": "是否可操作物模型标识符", + "IdentifierType": "标识符类型", + "IsOperableIdentifier": "是否可操作标识符", "StandardFieldValueType": "标准物模型值类型", "copyStandardThingModel": "复制标准模型", - "copyAnotherThingModelModal": "复制已有模型" + "copyAnotherThingModelModal": "复制已有模型", + "ioTPlatformProduct": "所属产品" }, "IoTDBBase": { "IoTDataType": "数据类型", diff --git a/apps/web-antd/src/views/thingmodelinfo/ioTPlatformThingModelInfo/index.vue b/apps/web-antd/src/views/thingmodelinfo/ioTPlatformThingModelInfo/index.vue index 6581c24..0057fd5 100644 --- a/apps/web-antd/src/views/thingmodelinfo/ioTPlatformThingModelInfo/index.vue +++ b/apps/web-antd/src/views/thingmodelinfo/ioTPlatformThingModelInfo/index.vue @@ -12,6 +12,7 @@ import { message as Message, Tag } from 'ant-design-vue'; import { useVbenForm } from '#/adapter/form'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { + getCommonGetSelectList, postIoTplatformThingModelInfoCopyAnotherThingModelAsync, postIoTplatformThingModelInfoCopyStandardThingModel, postIoTplatformThingModelInfoCreateAsync, @@ -42,6 +43,41 @@ const productId = ref((route.query.productId as string) || ''); const productName = ref((route.query.productName as string) || ''); const ioTPlatform = ref((route.query.ioTPlatform as string) || '2'); +// 标识符类型选项映射 +const identifierTypeMap = ref>({}); + +// 获取标识符类型选项 +const loadIdentifierTypeOptions = async () => { + try { + const res = await getCommonGetSelectList({ + query: { + typeName: 'ThingModelIdentifierTypeEnum', + }, + }); + const items = Array.isArray(res.data) + ? res.data + : Array.isArray(res.data?.items) + ? res.data.items + : Array.isArray(res.data?.data) + ? res.data.data + : []; + const map: Record = {}; + items.forEach((item: any) => { + if (item.key !== undefined && item.value) { + map[item.key] = item.value; + } + }); + identifierTypeMap.value = map; + } catch (error) { + console.error('获取标识符类型选项失败:', error); + // 使用默认映射 + identifierTypeMap.value = { + 1: '数据标识符', + 2: '属性标识符', + }; + } +}; + const formOptions: VbenFormProps = { schema: querySchema.value, initialValues: { @@ -148,6 +184,21 @@ const gridOptions: VxeGridProps = { queryParams.ioTPlatformProductId = String(currentProductId); } + // 添加访问模式参数 + if (finalFormValues?.accessMode) { + queryParams.accessMode = finalFormValues.accessMode; + } + + // 添加标识符类型参数 + if ( + finalFormValues?.identifierType !== undefined && + finalFormValues?.identifierType !== null + ) { + queryParams.identifierType = Number.parseInt( + String(finalFormValues.identifierType), + ) as 1 | 2; + } + const { data } = await postIoTplatformThingModelInfoPageAsync({ body: queryParams, }); @@ -237,6 +288,12 @@ const [ThingModelModal, thingModelModalApi] = useVbenModal({ ...(isEdit ? editRow.value : {}), _ioTPlatform: platformValue, _ioTPlatformProductId: productIdValue, + // 确保 identifierType 转换为字符串格式,以便与下拉框的 key 匹配 + ...(isEdit && + editRow.value.identifierType !== undefined && + editRow.value.identifierType !== null && { + identifierType: String(editRow.value.identifierType), + }), }); // 手动触发平台物模型编码字段的重新加载 @@ -423,6 +480,9 @@ watch( // 页面初始化时加载数据 onMounted(async () => { + // 加载标识符类型选项 + await loadIdentifierTypeOptions(); + // 从路由参数初始化 if (route.query.productId) { productId.value = route.query.productId as string; @@ -483,9 +543,7 @@ async function submit() { ? await gridApi.formApi.getValues() : {}; finalProductId = - searchFormValues.ioTPlatformProductId || - productId.value || - undefined; + searchFormValues.ioTPlatformProductId || productId.value || undefined; if (finalProductId) { finalProductId = String(finalProductId); } @@ -521,6 +579,13 @@ async function submit() { // 自动添加平台和产品信息 ioTPlatform: finalPlatform, ioTPlatformProductId: finalProductId, + // 转换标识符类型为数字类型(如果存在) + ...(formValues.identifierType !== undefined && + formValues.identifierType !== null && { + identifierType: Number.parseInt( + String(formValues.identifierType), + ) as 1 | 2, + }), // 编辑时需要添加ID ...(isEdit && { id: editRow.value.id }), }; @@ -562,6 +627,11 @@ async function onEdit(record: any) { ...record, _ioTPlatform: platformValue, _ioTPlatformProductId: productIdValue, + // 确保 identifierType 转换为字符串格式,以便与下拉框的 key 匹配 + ...(record.identifierType !== undefined && + record.identifierType !== null && { + identifierType: String(record.identifierType), + }), }); // 手动触发平台物模型编码字段的重新加载 @@ -793,6 +863,35 @@ async function onDel(record: any) { " /> + + + +