优化设备物模型属性

This commit is contained in:
ChenYi 2026-01-04 15:40:14 +08:00
parent 1aabdbcc86
commit 292277b635
9 changed files with 169 additions and 101 deletions

View File

@ -993,15 +993,15 @@ export const CTWingPrivateProductInfoDtoSchema = {
description: '设备数量', description: '设备数量',
format: 'int32' format: 'int32'
}, },
deviceThingModelFileId: { thingModelFileId: {
type: 'string', type: 'string',
description: '设备物模型文件Id', description: '物模型文件Id',
format: 'uuid', format: 'uuid',
nullable: true nullable: true
}, },
deviceThingModelFileName: { thingModelFileName: {
type: 'string', type: 'string',
description: '设备物模型文件名称', description: '物模型文件名称',
nullable: true nullable: true
}, },
isEnabled: { isEnabled: {
@ -1049,15 +1049,15 @@ export const CTWingPrivateProductInfoInsertInputSchema = {
description: '必填,产品描述', description: '必填,产品描述',
nullable: true nullable: true
}, },
deviceThingModelFileId: { thingModelFileId: {
type: 'string', type: 'string',
description: '设备物模型文件Id', description: '物模型文件Id',
format: 'uuid', format: 'uuid',
nullable: true nullable: true
}, },
deviceThingModelFileName: { thingModelFileName: {
type: 'string', type: 'string',
description: '设备物模型文件名称', description: '物模型文件名称',
nullable: true nullable: true
}, },
tupDeviceModel: { tupDeviceModel: {
@ -1138,15 +1138,15 @@ export const CTWingPrivateProductInfoModifyInputSchema = {
description: '必填,产品描述', description: '必填,产品描述',
nullable: true nullable: true
}, },
deviceThingModelFileId: { thingModelFileId: {
type: 'string', type: 'string',
description: '设备物模型文件Id', description: '物模型文件Id',
format: 'uuid', format: 'uuid',
nullable: true nullable: true
}, },
deviceThingModelFileName: { thingModelFileName: {
type: 'string', type: 'string',
description: '设备物模型文件名称', description: '物模型文件名称',
nullable: true nullable: true
}, },
tupDeviceModel: { tupDeviceModel: {
@ -1302,15 +1302,23 @@ export const CopyAnotherProductInputSchema = {
} as const; } as const;
export const CopyIoTPlatformThingModelToDeviceInputSchema = { export const CopyIoTPlatformThingModelToDeviceInputSchema = {
required: ['deviceThingModelId', 'filedTypes', 'ioTPlatform', 'ioTPlatformProductId'],
type: 'object', type: 'object',
properties: { properties: {
ioTPlatform: { ioTPlatform: {
'$ref': '#/components/schemas/IoTPlatformTypeEnum' '$ref': '#/components/schemas/IoTPlatformTypeEnum'
}, },
filedTypes: {
type: 'array',
items: {
type: 'string'
},
description: '物联网平台中对应产品物模型属性或者事件类型 JiShe.ServicePro.Core.DataDictionaryTypeConst'
},
ioTPlatformProductId: { ioTPlatformProductId: {
minLength: 1,
type: 'string', type: 'string',
description: '物联网平台中对应的产品Id', description: '物联网平台中对应的产品Id'
nullable: true
}, },
deviceThingModelId: { deviceThingModelId: {
type: 'string', type: 'string',
@ -3715,11 +3723,11 @@ export const DeviceUpgradeSourceTypeEnumSchema = {
} as const; } as const;
export const DeviceUpgradeStatusTypeEnumSchema = { export const DeviceUpgradeStatusTypeEnumSchema = {
enum: [1, 2, 3, 4], enum: [1, 2, 3, 4, 5],
type: 'integer', type: 'integer',
description: '设备升级状态枚举', description: '设备升级状态枚举',
format: 'int32', format: 'int32',
'说明:': '未升级=1,升级中=2,升级成功=3,升级失败=4' '说明:': '未升级=1,升级中=2,固件下载中=3,升级成功=4,升级失败=5'
} as const; } as const;
export const DisabledTwoFactorInputSchema = { export const DisabledTwoFactorInputSchema = {
@ -5792,6 +5800,11 @@ export const IoTPlatformProductPropertyInfoInputSchema = {
ioTPlatformType: { ioTPlatformType: {
'$ref': '#/components/schemas/IoTPlatformTypeEnum' '$ref': '#/components/schemas/IoTPlatformTypeEnum'
}, },
filedType: {
type: 'string',
description: '物联网平台中对应产品物模型属性或者事件类型 JiShe.ServicePro.Core.DataDictionaryTypeConst',
nullable: true
},
ioTPlatformProductId: { ioTPlatformProductId: {
minLength: 1, minLength: 1,
type: 'string', type: 'string',
@ -7003,15 +7016,15 @@ export const OneNETProductInfoDtoSchema = {
description: '产品访问密钥', description: '产品访问密钥',
nullable: true nullable: true
}, },
deviceThingModelFileId: { thingModelFileId: {
type: 'string', type: 'string',
description: '设备物模型文件Id', description: '物模型文件Id',
format: 'uuid', format: 'uuid',
nullable: true nullable: true
}, },
deviceThingModelFileName: { thingModelFileName: {
type: 'string', type: 'string',
description: '设备物模型文件名称', description: '物模型文件名称',
nullable: true nullable: true
}, },
isEnabled: { isEnabled: {
@ -7253,15 +7266,15 @@ export const OneNetProductInfoInsertInputSchema = {
description: 'TLS通讯服务地址', description: 'TLS通讯服务地址',
nullable: true nullable: true
}, },
deviceThingModelFileId: { thingModelFileId: {
type: 'string', type: 'string',
description: '设备物模型文件Id', description: '物模型文件Id',
format: 'uuid', format: 'uuid',
nullable: true nullable: true
}, },
deviceThingModelFileName: { thingModelFileName: {
type: 'string', type: 'string',
description: '设备物模型文件名称', description: '物模型文件名称',
nullable: true nullable: true
} }
}, },
@ -7352,15 +7365,15 @@ export const OneNetProductInfoModifyInputSchema = {
description: 'TLS通讯服务地址', description: 'TLS通讯服务地址',
nullable: true nullable: true
}, },
deviceThingModelFileId: { thingModelFileId: {
type: 'string', type: 'string',
description: '设备物模型文件Id', description: '物模型文件Id',
format: 'uuid', format: 'uuid',
nullable: true nullable: true
}, },
deviceThingModelFileName: { thingModelFileName: {
type: 'string', type: 'string',
description: '设备物模型文件名称', description: '物模型文件名称',
nullable: true nullable: true
} }
}, },

View File

@ -284,15 +284,19 @@ export type CopyAnotherProductInput = {
* *
*/ */
export type CopyIoTPlatformThingModelToDeviceInput = { export type CopyIoTPlatformThingModelToDeviceInput = {
ioTPlatform?: IoTPlatformTypeEnum; ioTPlatform: IoTPlatformTypeEnum;
/**
* JiShe.ServicePro.Core.DataDictionaryTypeConst
*/
filedTypes: Array<(string)>;
/** /**
* Id * Id
*/ */
ioTPlatformProductId?: (string) | null; ioTPlatformProductId: string;
/** /**
* Id * Id
*/ */
deviceThingModelId?: string; deviceThingModelId: string;
}; };
/** /**
@ -819,13 +823,13 @@ export type CTWingPrivateProductInfoDto = {
*/ */
deviceCount?: number; deviceCount?: number;
/** /**
* Id * Id
*/ */
deviceThingModelFileId?: (string) | null; thingModelFileId?: (string) | null;
/** /**
* *
*/ */
deviceThingModelFileName?: (string) | null; thingModelFileName?: (string) | null;
/** /**
* *
*/ */
@ -854,13 +858,13 @@ export type CTWingPrivateProductInfoInsertInput = {
*/ */
productDesc?: (string) | null; productDesc?: (string) | null;
/** /**
* Id * Id
*/ */
deviceThingModelFileId?: (string) | null; thingModelFileId?: (string) | null;
/** /**
* *
*/ */
deviceThingModelFileName?: (string) | null; thingModelFileName?: (string) | null;
/** /**
* *
*/ */
@ -922,13 +926,13 @@ export type CTWingPrivateProductInfoModifyInput = {
*/ */
productDesc?: (string) | null; productDesc?: (string) | null;
/** /**
* Id * Id
*/ */
deviceThingModelFileId?: (string) | null; thingModelFileId?: (string) | null;
/** /**
* *
*/ */
deviceThingModelFileName?: (string) | null; thingModelFileName?: (string) | null;
/** /**
* *
*/ */
@ -2169,7 +2173,7 @@ export type DeviceUpgradeSourceTypeEnum = 1 | 2;
/** /**
* *
*/ */
export type DeviceUpgradeStatusTypeEnum = 1 | 2 | 3 | 4; export type DeviceUpgradeStatusTypeEnum = 1 | 2 | 3 | 4 | 5;
export type DisabledTwoFactorInput = { export type DisabledTwoFactorInput = {
/** /**
@ -2954,6 +2958,10 @@ export type IoTPlatformProductInfoOutput = {
*/ */
export type IoTPlatformProductPropertyInfoInput = { export type IoTPlatformProductPropertyInfoInput = {
ioTPlatformType: IoTPlatformTypeEnum; ioTPlatformType: IoTPlatformTypeEnum;
/**
* JiShe.ServicePro.Core.DataDictionaryTypeConst
*/
filedType?: (string) | null;
/** /**
* Id * Id
*/ */
@ -3756,13 +3764,13 @@ export type OneNETProductInfoDto = {
*/ */
productAccesskey?: (string) | null; productAccesskey?: (string) | null;
/** /**
* Id * Id
*/ */
deviceThingModelFileId?: (string) | null; thingModelFileId?: (string) | null;
/** /**
* *
*/ */
deviceThingModelFileName?: (string) | null; thingModelFileName?: (string) | null;
/** /**
* *
*/ */
@ -3858,13 +3866,13 @@ export type OneNetProductInfoInsertInput = {
*/ */
communicationAddressTLS?: (string) | null; communicationAddressTLS?: (string) | null;
/** /**
* Id * Id
*/ */
deviceThingModelFileId?: (string) | null; thingModelFileId?: (string) | null;
/** /**
* *
*/ */
deviceThingModelFileName?: (string) | null; thingModelFileName?: (string) | null;
}; };
export type OneNetProductInfoListInput = { export type OneNetProductInfoListInput = {
@ -3934,13 +3942,13 @@ export type OneNetProductInfoModifyInput = {
*/ */
communicationAddressTLS?: (string) | null; communicationAddressTLS?: (string) | null;
/** /**
* Id * Id
*/ */
deviceThingModelFileId?: (string) | null; thingModelFileId?: (string) | null;
/** /**
* *
*/ */
deviceThingModelFileName?: (string) | null; thingModelFileName?: (string) | null;
}; };
/** /**

View File

@ -300,7 +300,7 @@
"IsEncrypted": "IsEncrypted", "IsEncrypted": "IsEncrypted",
"CommunicationAddress": "Communication Address", "CommunicationAddress": "Communication Address",
"CommunicationAddressTLS": "TLS Communication Address", "CommunicationAddressTLS": "TLS Communication Address",
"DeviceThingModelFileName": "DeviceThingModelFileName", "ThingModelFileName": "ThingModelFileName",
"IoTPlatformProductUpdateTime": "ProductUpdateTime", "IoTPlatformProductUpdateTime": "ProductUpdateTime",
"IoTPlatformProductCreateTime": "ProductCreateTime", "IoTPlatformProductCreateTime": "ProductCreateTime",
"CreationTime": "CreationTime", "CreationTime": "CreationTime",
@ -320,7 +320,7 @@
"IsEncrypted": "IsEncrypted", "IsEncrypted": "IsEncrypted",
"CommunicationAddress": "Communication Address", "CommunicationAddress": "Communication Address",
"CommunicationAddressTLS": "TLS Communication Address", "CommunicationAddressTLS": "TLS Communication Address",
"DeviceThingModelFileName": "DeviceThingModelFileName", "ThingModelFileName": "ThingModelFileName",
"IoTPlatformProductUpdateTime": "ProductUpdateTime", "IoTPlatformProductUpdateTime": "ProductUpdateTime",
"IoTPlatformProductCreateTime": "ProductCreateTime", "IoTPlatformProductCreateTime": "ProductCreateTime",
"CreationTime": "CreationTime", "CreationTime": "CreationTime",

View File

@ -295,7 +295,7 @@
"IsEncrypted": "是否加密", "IsEncrypted": "是否加密",
"CommunicationAddress": "通讯地址", "CommunicationAddress": "通讯地址",
"CommunicationAddressTLS": "TLS通讯地址", "CommunicationAddressTLS": "TLS通讯地址",
"DeviceThingModelFileName": "物模型文件", "ThingModelFileName": "物模型文件",
"IoTPlatformProductUpdateTime": "平台更新时间", "IoTPlatformProductUpdateTime": "平台更新时间",
"IoTPlatformProductCreateTime": "平台创建时间", "IoTPlatformProductCreateTime": "平台创建时间",
"CreationTime": "创建时间", "CreationTime": "创建时间",
@ -315,7 +315,7 @@
"IsEncrypted": "是否加密", "IsEncrypted": "是否加密",
"CommunicationAddress": "通讯地址", "CommunicationAddress": "通讯地址",
"CommunicationAddressTLS": "TLS通讯地址", "CommunicationAddressTLS": "TLS通讯地址",
"DeviceThingModelFileName": "物模型文件", "ThingModelFileName": "物模型文件",
"IoTPlatformProductUpdateTime": "平台更新时间", "IoTPlatformProductUpdateTime": "平台更新时间",
"IoTPlatformProductCreateTime": "平台创建时间", "IoTPlatformProductCreateTime": "平台创建时间",
"CreationTime": "创建时间", "CreationTime": "创建时间",

View File

@ -48,10 +48,10 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
minWidth: '150', minWidth: '150',
}, },
{ {
field: 'deviceThingModelFileName', field: 'thingModelFileName',
title: $t('abp.CTWingManagement.DeviceThingModelFileName'), title: $t('abp.CTWingManagement.ThingModelFileName'),
minWidth: '150', minWidth: '150',
slots: { default: 'deviceThingModelFileName' }, slots: { default: 'thingModelFileName' },
}, },
{ {
field: 'creationTime', field: 'creationTime',
@ -124,7 +124,7 @@ export const addProductFormSchema: any = computed(() => [
{ {
component: 'ApiSelect', component: 'ApiSelect',
fieldName: 'ctWingAccountId', fieldName: 'ctWingAccountId',
label: $t('abp.CTWingManagement.BelongingAccountName'), label: $t('abp.CTWingManagement.AccountName'),
componentProps: { componentProps: {
api: postCtWingAccountListAsync, api: postCtWingAccountListAsync,
params: { params: {
@ -158,10 +158,10 @@ export const addProductFormSchema: any = computed(() => [
// 如果都不是,返回空数组 // 如果都不是,返回空数组
return []; return [];
}, },
placeholder: `${$t('common.pleaseSelect')}${$t('abp.CTWingManagement.BelongingAccountName')}`, placeholder: `${$t('common.pleaseSelect')}${$t('abp.CTWingManagement.AccountName')}`,
}, },
rules: z.string().min(1, { rules: z.string().min(1, {
message: `${$t('common.pleaseSelect')}${$t('abp.CTWingManagement.BelongingAccountName')}`, message: `${$t('common.pleaseSelect')}${$t('abp.CTWingManagement.AccountName')}`,
}), }),
}, },
{ {
@ -175,9 +175,9 @@ export const addProductFormSchema: any = computed(() => [
{ {
component: 'Input', component: 'Input',
fieldName: 'productAccesskey', fieldName: 'productAccesskey',
label: $t('abp.CTWingManagement.ProductAccesskey'), label: $t('abp.CTWingManagement.MasterKey'),
rules: z.string().min(1, { rules: z.string().min(1, {
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.CTWingManagement.ProductAccesskey')}`, message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.CTWingManagement.MasterKey')}`,
}), }),
}, },
{ {
@ -198,8 +198,8 @@ export const addProductFormSchema: any = computed(() => [
}, },
{ {
component: 'Input', component: 'Input',
fieldName: 'deviceThingModelFileName', fieldName: 'thingModelFileName',
label: $t('abp.CTWingManagement.DeviceThingModelFileName'), label: $t('abp.CTWingManagement.ThingModelFileName'),
componentProps: { componentProps: {
placeholder: '请选择文件', placeholder: '请选择文件',
readonly: true, readonly: true,
@ -253,12 +253,12 @@ export const addProductFormSchema: any = computed(() => [
), ),
}, },
rules: z.string().min(1, { rules: z.string().min(1, {
message: `${$t('common.pleaseSelect')}${$t('abp.CTWingManagement.DeviceThingModelFileName')}`, message: `${$t('common.pleaseSelect')}${$t('abp.CTWingManagement.ThingModelFileName')}`,
}), }),
}, },
{ {
component: 'Input', component: 'Input',
fieldName: 'deviceThingModelFileId', fieldName: 'thingModelFileId',
label: '', label: '',
componentProps: { componentProps: {
type: 'hidden', type: 'hidden',
@ -270,7 +270,7 @@ export const editProductFormSchemaEdit: any = computed(() => [
{ {
component: 'ApiSelect', component: 'ApiSelect',
fieldName: 'ctWingAccountId', fieldName: 'ctWingAccountId',
label: $t('abp.CTWingManagement.BelongingAccountName'), label: $t('abp.CTWingManagement.AccountName'),
componentProps: { componentProps: {
api: postCtWingAccountListAsync, api: postCtWingAccountListAsync,
params: { params: {
@ -305,10 +305,10 @@ export const editProductFormSchemaEdit: any = computed(() => [
// 如果都不是,返回空数组 // 如果都不是,返回空数组
return []; return [];
}, },
placeholder: `${$t('common.pleaseSelect')}${$t('abp.CTWingManagement.BelongingAccountName')}`, placeholder: `${$t('common.pleaseSelect')}${$t('abp.CTWingManagement.AccountName')}`,
}, },
rules: z.string().min(1, { rules: z.string().min(1, {
message: `${$t('common.pleaseSelect')}${$t('abp.CTWingManagement.BelongingAccountName')}`, message: `${$t('common.pleaseSelect')}${$t('abp.CTWingManagement.AccountName')}`,
}), }),
}, },
{ {
@ -326,13 +326,13 @@ export const editProductFormSchemaEdit: any = computed(() => [
{ {
component: 'Input', component: 'Input',
fieldName: 'productAccesskey', fieldName: 'productAccesskey',
label: $t('abp.CTWingManagement.ProductAccesskey'), label: $t('abp.CTWingManagement.MasterKey'),
disabled: true, disabled: true,
componentProps: { componentProps: {
readonly: true, // 编辑时只读 readonly: true, // 编辑时只读
}, },
rules: z.string().min(1, { rules: z.string().min(1, {
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.CTWingManagement.ProductAccesskey')}`, message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.CTWingManagement.MasterKey')}`,
}), }),
}, },
{ {
@ -353,8 +353,8 @@ export const editProductFormSchemaEdit: any = computed(() => [
}, },
{ {
component: 'Input', component: 'Input',
fieldName: 'deviceThingModelFileName', fieldName: 'thingModelFileName',
label: $t('abp.CTWingManagement.DeviceThingModelFileName'), label: $t('abp.CTWingManagement.ThingModelFileName'),
componentProps: { componentProps: {
placeholder: '请选择文件', placeholder: '请选择文件',
readonly: true, readonly: true,
@ -408,12 +408,12 @@ export const editProductFormSchemaEdit: any = computed(() => [
), ),
}, },
rules: z.string().min(1, { rules: z.string().min(1, {
message: `${$t('common.pleaseSelect')}${$t('abp.CTWingManagement.DeviceThingModelFileName')}`, message: `${$t('common.pleaseSelect')}${$t('abp.CTWingManagement.ThingModelFileName')}`,
}), }),
}, },
{ {
component: 'Input', component: 'Input',
fieldName: 'deviceThingModelFileId', fieldName: 'thingModelFileId',
label: '', label: '',
componentProps: { componentProps: {
type: 'hidden', type: 'hidden',

View File

@ -159,7 +159,7 @@ async function submit() {
const formValues = await formApi.getValues(); const formValues = await formApi.getValues();
// //
if (!formValues.deviceThingModelFileName) { if (!formValues.thingModelFileName) {
Message.error('请选择设备模型文件'); Message.error('请选择设备模型文件');
return; return;
} }
@ -174,7 +174,7 @@ async function submit() {
if (fileInfo && fileInfo.id) { if (fileInfo && fileInfo.id) {
formValues.deviceThingModelFileId = fileInfo.id; formValues.deviceThingModelFileId = fileInfo.id;
// //
formValues.deviceThingModelFileName = formValues.thingModelFileName =
fileInfo.fileName || selectedFile.name; fileInfo.fileName || selectedFile.name;
} else { } else {
Message.error('文件上传成功但未获取到文件ID'); Message.error('文件上传成功但未获取到文件ID');
@ -276,7 +276,7 @@ async function onDownloadFile(record: any) {
link.href = url; link.href = url;
link.setAttribute( link.setAttribute(
'download', 'download',
record.deviceThingModelFileName || 'device-model-file', record.thingModelFileName || 'device-model-file',
); );
document.body.append(link); document.body.append(link);
link.click(); link.click();
@ -383,12 +383,12 @@ async function onThingModelUpdate(record: any) {
" /> " />
</template> </template>
<template #deviceThingModelFileName="{ row }"> <template #thingModelFileName="{ row }">
<a v-if="row.deviceThingModelFileName && row.deviceThingModelFileId" @click="onDownloadFile(row)" <a v-if="row.thingModelFileName && row.deviceThingModelFileId" @click="onDownloadFile(row)"
style="color: #1890ff; text-decoration: underline; cursor: pointer"> style="color: #1890ff; text-decoration: underline; cursor: pointer">
{{ row.deviceThingModelFileName }} {{ row.thingModelFileName }}
</a> </a>
<span v-else>{{ row.deviceThingModelFileName || '-' }}</span> <span v-else>{{ row.thingModelFileName || '-' }}</span>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">

View File

@ -50,10 +50,10 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
minWidth: '150', minWidth: '150',
}, },
{ {
field: 'deviceThingModelFileName', field: 'thingModelFileName',
title: $t('abp.OneNETManagement.DeviceThingModelFileName'), title: $t('abp.OneNETManagement.ThingModelFileName'),
minWidth: '150', minWidth: '150',
slots: { default: 'deviceThingModelFileName' }, slots: { default: 'thingModelFileName' },
}, },
{ {
field: 'productCreateTime', field: 'productCreateTime',
@ -190,8 +190,8 @@ export const addProductFormSchema: any = computed(() => [
}, },
{ {
component: 'Input', component: 'Input',
fieldName: 'deviceThingModelFileName', fieldName: 'thingModelFileName',
label: $t('abp.OneNETManagement.DeviceThingModelFileName'), label: $t('abp.OneNETManagement.ThingModelFileName'),
componentProps: { componentProps: {
placeholder: '请选择文件', placeholder: '请选择文件',
readonly: true, readonly: true,
@ -245,12 +245,12 @@ export const addProductFormSchema: any = computed(() => [
), ),
}, },
rules: z.string().min(1, { rules: z.string().min(1, {
message: `${$t('common.pleaseSelect')}${$t('abp.OneNETManagement.DeviceThingModelFileName')}`, message: `${$t('common.pleaseSelect')}${$t('abp.OneNETManagement.ThingModelFileName')}`,
}), }),
}, },
{ {
component: 'Input', component: 'Input',
fieldName: 'deviceThingModelFileId', fieldName: 'thingModelFileId',
label: '', label: '',
componentProps: { componentProps: {
type: 'hidden', type: 'hidden',
@ -345,8 +345,8 @@ export const editProductFormSchemaEdit: any = computed(() => [
}, },
{ {
component: 'Input', component: 'Input',
fieldName: 'deviceThingModelFileName', fieldName: 'thingModelFileName',
label: $t('abp.OneNETManagement.DeviceThingModelFileName'), label: $t('abp.OneNETManagement.ThingModelFileName'),
componentProps: { componentProps: {
placeholder: '请选择文件', placeholder: '请选择文件',
readonly: true, readonly: true,
@ -400,12 +400,12 @@ export const editProductFormSchemaEdit: any = computed(() => [
), ),
}, },
rules: z.string().min(1, { rules: z.string().min(1, {
message: `${$t('common.pleaseSelect')}${$t('abp.OneNETManagement.DeviceThingModelFileName')}`, message: `${$t('common.pleaseSelect')}${$t('abp.OneNETManagement.ThingModelFileName')}`,
}), }),
}, },
{ {
component: 'Input', component: 'Input',
fieldName: 'deviceThingModelFileId', fieldName: 'thingModelFileId',
label: '', label: '',
componentProps: { componentProps: {
type: 'hidden', type: 'hidden',

View File

@ -688,6 +688,37 @@ const [CopyPropertyForm, copyPropertyFormApi] = useVbenForm({
}; };
}, },
}, },
{
component: 'ApiSelect',
fieldName: 'filedTypes',
label: '平台物模型类型',
rules: z.preprocess(
(v) => (v == null ? [] : v),
z.array(z.string()).min(1, '请至少选择一个物模型类型'),
),
componentProps: {
api: getCommonGetSelectList,
params: {
query: {
typeName: 'DataDictionaryTypeConst',
},
},
labelField: 'value',
valueField: 'key',
optionsPropName: 'options',
immediate: true,
allowClear: true,
mode: 'multiple',
placeholder: '请选择要复制的物模型类型(可多选)',
maxTagCount: 'responsive',
afterFetch: (res: any) => {
if (Array.isArray(res)) return res;
if (res && Array.isArray(res.items)) return res.items;
if (res && Array.isArray(res.data)) return res.data;
return [];
},
},
},
], ],
showCollapseButton: false, showCollapseButton: false,
showDefaultActions: false, showDefaultActions: false,
@ -919,6 +950,11 @@ async function submitCopyProperty() {
return; return;
} }
if (!formValues.filedTypes || formValues.filedTypes.length === 0) {
Message.warning('请至少选择一个物模型类型');
return;
}
try { try {
const resp = const resp =
await postDeviceThingModelManagementCopyIoTplatformThingModelToDeviceAsync( await postDeviceThingModelManagementCopyIoTplatformThingModelToDeviceAsync(
@ -929,6 +965,7 @@ async function submitCopyProperty() {
| 2, | 2,
ioTPlatformProductId: String(formValues.ioTPlatformProductId), ioTPlatformProductId: String(formValues.ioTPlatformProductId),
deviceThingModelId: deviceThingModelId.value, deviceThingModelId: deviceThingModelId.value,
filedTypes: formValues.filedTypes || [],
}, },
}, },
); );

View File

@ -307,11 +307,12 @@ export const getAddThingModelFormSchema = (
z.string().min(1, $t('common.required')), z.string().min(1, $t('common.required')),
), ),
dependencies: { dependencies: {
triggerFields: ['_ioTPlatform', '_ioTPlatformProductId'], triggerFields: ['_ioTPlatform', '_ioTPlatformProductId', 'filedType'],
componentProps: (formValues: any) => { componentProps: (formValues: any) => {
// 优先从表单值获取(这是最可靠的方式,因为值是在打开弹窗时设置的) // 优先从表单值获取(这是最可靠的方式,因为值是在打开弹窗时设置的)
let platform = formValues?._ioTPlatform; let platform = formValues?._ioTPlatform;
let productId = formValues?._ioTPlatformProductId; let productId = formValues?._ioTPlatformProductId;
let filedType = formValues?.filedType;
// 如果表单值中没有,尝试从其他字段获取 // 如果表单值中没有,尝试从其他字段获取
if (!platform && formValues?.ioTPlatform) { if (!platform && formValues?.ioTPlatform) {
@ -350,12 +351,14 @@ export const getAddThingModelFormSchema = (
console.log('平台物模型编码下拉框配置:', { console.log('平台物模型编码下拉框配置:', {
platform, platform,
productId, productId,
filedType,
hasApi: !!(platform && productId), hasApi: !!(platform && productId),
fromForm: { fromForm: {
_ioTPlatform: formValues?._ioTPlatform, _ioTPlatform: formValues?._ioTPlatform,
_ioTPlatformProductId: formValues?._ioTPlatformProductId, _ioTPlatformProductId: formValues?._ioTPlatformProductId,
ioTPlatform: formValues?.ioTPlatform, ioTPlatform: formValues?.ioTPlatform,
ioTPlatformProductId: formValues?.ioTPlatformProductId, ioTPlatformProductId: formValues?.ioTPlatformProductId,
filedType: formValues?.filedType,
}, },
}); });
@ -373,6 +376,7 @@ export const getAddThingModelFormSchema = (
? Number.parseInt(platform) ? Number.parseInt(platform)
: platform, : platform,
ioTPlatformProductId: String(productId), ioTPlatformProductId: String(productId),
...(filedType ? { filedType: String(filedType) } : {}),
}, },
} }
: {}, : {},
@ -381,6 +385,7 @@ export const getAddThingModelFormSchema = (
optionsPropName: 'options', optionsPropName: 'options',
immediate: !!(platform && productId), // 当有平台和产品ID时立即加载 immediate: !!(platform && productId), // 当有平台和产品ID时立即加载
allowClear: true, allowClear: true,
showSearch: true,
placeholder: placeholder:
$t('common.pleaseSelect') + $t('common.pleaseSelect') +
$t('abp.thingModelInfos.IoTPlatformRawFieldName'), $t('abp.thingModelInfos.IoTPlatformRawFieldName'),
@ -614,11 +619,12 @@ export const getEditThingModelFormSchema = (
z.string().min(1, $t('common.required')), z.string().min(1, $t('common.required')),
), ),
dependencies: { dependencies: {
triggerFields: ['_ioTPlatform', '_ioTPlatformProductId'], triggerFields: ['_ioTPlatform', '_ioTPlatformProductId', 'filedType'],
componentProps: (formValues: any) => { componentProps: (formValues: any) => {
// 优先从表单值获取(这是最可靠的方式,因为值是在打开弹窗时设置的) // 优先从表单值获取(这是最可靠的方式,因为值是在打开弹窗时设置的)
let platform = formValues?._ioTPlatform; let platform = formValues?._ioTPlatform;
let productId = formValues?._ioTPlatformProductId; let productId = formValues?._ioTPlatformProductId;
let filedType = formValues?.filedType;
// 如果表单值中没有,尝试从其他字段获取 // 如果表单值中没有,尝试从其他字段获取
if (!platform && formValues?.ioTPlatform) { if (!platform && formValues?.ioTPlatform) {
@ -657,12 +663,14 @@ export const getEditThingModelFormSchema = (
console.log('平台物模型编码下拉框配置:', { console.log('平台物模型编码下拉框配置:', {
platform, platform,
productId, productId,
filedType,
hasApi: !!(platform && productId), hasApi: !!(platform && productId),
fromForm: { fromForm: {
_ioTPlatform: formValues?._ioTPlatform, _ioTPlatform: formValues?._ioTPlatform,
_ioTPlatformProductId: formValues?._ioTPlatformProductId, _ioTPlatformProductId: formValues?._ioTPlatformProductId,
ioTPlatform: formValues?.ioTPlatform, ioTPlatform: formValues?.ioTPlatform,
ioTPlatformProductId: formValues?.ioTPlatformProductId, ioTPlatformProductId: formValues?.ioTPlatformProductId,
filedType: formValues?.filedType,
}, },
}); });
@ -680,6 +688,7 @@ export const getEditThingModelFormSchema = (
? Number.parseInt(platform) ? Number.parseInt(platform)
: platform, : platform,
ioTPlatformProductId: String(productId), ioTPlatformProductId: String(productId),
...(filedType ? { filedType: String(filedType) } : {}),
}, },
} }
: {}, : {},
@ -688,6 +697,7 @@ export const getEditThingModelFormSchema = (
optionsPropName: 'options', optionsPropName: 'options',
immediate: !!(platform && productId), // 当有平台和产品ID时立即加载 immediate: !!(platform && productId), // 当有平台和产品ID时立即加载
allowClear: true, allowClear: true,
showSearch: true,
placeholder: placeholder:
$t('common.pleaseSelect') + $t('common.pleaseSelect') +
$t('abp.thingModelInfos.IoTPlatformRawFieldName'), $t('abp.thingModelInfos.IoTPlatformRawFieldName'),