完善设备物模型绑定和平台端物模型管理

This commit is contained in:
ChenYi 2026-01-22 14:23:01 +08:00
parent 569f75e96d
commit dce95f9e7b
10 changed files with 642 additions and 155 deletions

View File

@ -446,7 +446,15 @@ export const BatchCreateDeviceAggregationInputSchema = {
items: { items: {
type: 'string' type: 'string'
}, },
description: '表通信地址集合' description: '设备地址不能为空'
},
deviceInfos: {
type: 'array',
items: {
'$ref': '#/components/schemas/OpenApiDeviceInfoInput'
},
description: '设备信息',
nullable: true
}, },
ioTPlatform: { ioTPlatform: {
'$ref': '#/components/schemas/IoTPlatformTypeEnum' '$ref': '#/components/schemas/IoTPlatformTypeEnum'
@ -456,8 +464,11 @@ export const BatchCreateDeviceAggregationInputSchema = {
type: 'string', type: 'string',
description: '集中器在物联网平台中对应的产品Id' description: '集中器在物联网平台中对应的产品Id'
}, },
deviceSourceTypeEnum: { deviceSourceType: {
'$ref': '#/components/schemas/DeviceSourceTypeEnum' '$ref': '#/components/schemas/DeviceSourceTypeEnum'
},
deviceType: {
'$ref': '#/components/schemas/DeviceTypeEnum'
} }
}, },
additionalProperties: false, additionalProperties: false,
@ -1442,6 +1453,9 @@ export const CreateDeviceAggregationInputSchema = {
type: 'string', type: 'string',
description: '表通信地址' description: '表通信地址'
}, },
deviceInfos: {
'$ref': '#/components/schemas/OpenApiDeviceInfoInput'
},
ioTPlatform: { ioTPlatform: {
'$ref': '#/components/schemas/IoTPlatformTypeEnum' '$ref': '#/components/schemas/IoTPlatformTypeEnum'
}, },
@ -1450,8 +1464,11 @@ export const CreateDeviceAggregationInputSchema = {
type: 'string', type: 'string',
description: '设备在物联网平台中对应的产品Id' description: '设备在物联网平台中对应的产品Id'
}, },
deviceSourceTypeEnum: { deviceSourceType: {
'$ref': '#/components/schemas/DeviceSourceTypeEnum' '$ref': '#/components/schemas/DeviceSourceTypeEnum'
},
deviceType: {
'$ref': '#/components/schemas/DeviceTypeEnum'
} }
}, },
additionalProperties: false, additionalProperties: false,
@ -2422,10 +2439,10 @@ export const DeviceManagementInfoDtoSchema = {
format: 'date-time', format: 'date-time',
nullable: true nullable: true
}, },
securityKey: { subDeviceCapacity: {
type: 'string', type: 'integer',
description: '设备接入鉴权key', description: '子设备容量',
nullable: true format: 'int32'
} }
}, },
additionalProperties: false additionalProperties: false
@ -2519,7 +2536,7 @@ export const DeviceTableModelDataInfoPageInputSchema = {
ioTDataType: { ioTDataType: {
type: 'string', type: 'string',
description: `数据类型,用于构建存储路径 description: `数据类型,用于构建存储路径
JiShe.ServicePro.Consts.IoTDBDataTypeConst`, JiShe.ServicePro.Core.IoTDBDataTypeConst`,
nullable: true nullable: true
}, },
deviceType: { deviceType: {
@ -3521,7 +3538,7 @@ export const DeviceTreeModelDataInfoInputSchema = {
ioTDataType: { ioTDataType: {
type: 'string', type: 'string',
description: `数据类型,用于构建存储路径 description: `数据类型,用于构建存储路径
JiShe.ServicePro.Consts.IoTDBDataTypeConst`, JiShe.ServicePro.Core.IoTDBDataTypeConst`,
nullable: true nullable: true
}, },
deviceType: { deviceType: {
@ -3547,6 +3564,16 @@ export const DeviceTreeModelDataInfoInputSchema = {
isNeedPaging: { isNeedPaging: {
type: 'boolean', type: 'boolean',
description: '是否需要分页, 默认为true' description: '是否需要分页, 默认为true'
},
subDeviceAddress: {
type: 'string',
description: '子设备地址',
nullable: true
},
deviceEvent: {
type: 'string',
description: '设备事件类型名称',
nullable: true
} }
}, },
additionalProperties: false, additionalProperties: false,
@ -3761,11 +3788,11 @@ export const DeviceUpgradeRecordDtoPagedResultDtoSchema = {
} as const; } as const;
export const DeviceUpgradeResultTypeEnumSchema = { export const DeviceUpgradeResultTypeEnumSchema = {
enum: [0, 1001, 1002, 1003, 1004, 1005, 2001, 2002, 2003, 2004, 2005, 2006, 3001, 3002, 3003, 4001, 5001, 6001, 6002, 6003, 6004, 6005, 6006, 6007, 6008, 9999], enum: [0, 1, 1001, 2001, 2002, 2003, 2004, 2005, 3001, 3002, 4001, 5001, 6001, 6002, 6003],
type: 'integer', type: 'integer',
description: '设备升级结果枚举', description: '设备升级结果枚举',
format: 'int32', format: 'int32',
'说明:': 'Success=0,InvalidUrl=1001,UrlFileNameMismatch=1002,InvalidFileLength=1003,NvmWriteFailed=1004,ModuleUrlFetchFailed=1005,DownloadTimeout=2001,ParseHttpDlFileFailed=2002,DownloadIncomplete=2003,DownloadSizeMismatch=2004,ModuleReadTimeout=2005,FilePointerException=2006,ExternalFlashWriteFailed=3001,ExternalFlashReadCrcMismatch=3002,ExternalFlashWriteCrcMismatch=3003,SecurityVerificationFailed=4001,Crc32Mismatch=5001,DiffDecompressFailed=6001,DiffPatchFailed=6002,DiffDictionaryExceeded=6003,DiffCompressionTypeUnsupported=6004,RestoredFirmwareSizeExceeded=6005,TargetAddressInBootArea=6006,IapPowerAbnormal=6007,IapSerialPowerAbnormal=6008,UnknownError=9999' '说明:': 'Default=0,Success=1,InvalidUrlOrModuleUrlFetchFailed=1001,DownloadTimeout=2001,ParseHttpDlFileFailedOrDownloadIncomplete=2002,DownloadSizeMismatch=2003,ModuleReadTimeout=2004,FilePointerException=2005,ExternalFlashWriteFailed=3001,ExternalFlashCrc16Mismatch=3002,SignatureVerificationFailed=4001,Crc32Mismatch=5001,DiffDecompressOrPatchFailed=6001,RestoredFirmwareSizeExceededOrTargetAddressInBootArea=6002,IapPowerAbnormal=6003'
} as const; } as const;
export const DeviceUpgradeSourceTypeEnumSchema = { export const DeviceUpgradeSourceTypeEnumSchema = {
@ -5922,6 +5949,15 @@ export const IoTPlatformThingModelCreateInputSchema = {
type: 'string', type: 'string',
description: '物联网平台中对应产品物模型标识符扩展,用于扩展结构体类型', description: '物联网平台中对应产品物模型标识符扩展,用于扩展结构体类型',
nullable: true nullable: true
},
isOperableIdentifier: {
type: 'boolean',
description: '是否可操作物模型标识符'
},
accessMode: {
type: 'string',
description: '物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode',
nullable: true
} }
}, },
additionalProperties: false additionalProperties: false
@ -6056,6 +6092,15 @@ export const IoTPlatformThingModelInfoDtoSchema = {
type: 'string', type: 'string',
description: '物模型属性或者事件类型名称', description: '物模型属性或者事件类型名称',
nullable: true nullable: true
},
isOperableIdentifier: {
type: 'boolean',
description: '是否可操作物模型标识符'
},
accessMode: {
type: 'string',
description: '物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode',
nullable: true
} }
}, },
additionalProperties: false, additionalProperties: false,
@ -6128,6 +6173,11 @@ export const IoTPlatformThingModelPageInputSchema = {
type: 'string', type: 'string',
description: '物联网平台中对应产品物模型属性或者事件类型 JiShe.ServicePro.Core.DataDictionaryTypeConst', description: '物联网平台中对应产品物模型属性或者事件类型 JiShe.ServicePro.Core.DataDictionaryTypeConst',
nullable: true nullable: true
},
isOperableIdentifier: {
type: 'boolean',
description: '是否可操作标识符',
nullable: true
} }
}, },
additionalProperties: false additionalProperties: false
@ -6187,6 +6237,15 @@ export const IoTPlatformThingModelUpdateInputSchema = {
description: '物联网平台中对应产品物模型标识符扩展,用于扩展结构体类型', description: '物联网平台中对应产品物模型标识符扩展,用于扩展结构体类型',
nullable: true nullable: true
}, },
isOperableIdentifier: {
type: 'boolean',
description: '是否可操作物模型标识符'
},
accessMode: {
type: 'string',
description: '物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode',
nullable: true
},
id: { id: {
type: 'string', type: 'string',
format: 'uuid' format: 'uuid'
@ -6441,7 +6500,7 @@ export const MeterReadingPacketInfoPageInputSchema = {
ioTDataType: { ioTDataType: {
type: 'string', type: 'string',
description: `数据类型,用于构建存储路径 description: `数据类型,用于构建存储路径
JiShe.ServicePro.Consts.IoTDBDataTypeConst`, JiShe.ServicePro.Core.IoTDBDataTypeConst`,
nullable: true nullable: true
}, },
deviceType: { deviceType: {
@ -6489,7 +6548,7 @@ export const MeterReadingPacketInfoPageOutputSchema = {
ioTDataType: { ioTDataType: {
type: 'string', type: 'string',
description: `数据类型,用于构建存储路径 description: `数据类型,用于构建存储路径
JiShe.ServicePro.Consts.IoTDBDataTypeConst`, JiShe.ServicePro.Core.IoTDBDataTypeConst`,
nullable: true nullable: true
}, },
deviceType: { deviceType: {
@ -7435,6 +7494,51 @@ export const OneNetProductInfoModifyInputSchema = {
description: '修改OneNET产品' description: '修改OneNET产品'
} as const; } as const;
export const OpenApiDeviceInfoInputSchema = {
type: 'object',
properties: {
deviceAddress: {
type: 'string',
description: '网关设备或直连设备地址,此数据自研设备在生产的时候就已经入库',
nullable: true
},
businessSystemDeviceDataId: {
type: 'integer',
description: '业务系统设备数据Id一般指集中器Id',
format: 'int64',
nullable: true
},
subDeviceName: {
type: 'string',
description: '子设备名称',
nullable: true
},
subDeviceAddress: {
type: 'string',
description: '子设备地址',
nullable: true
},
subDeviceIndex: {
type: 'integer',
description: '子设备索引,抑或是主设备下唯一标识符',
format: 'int32'
},
subDeviceBrandCode: {
type: 'string',
description: '子设备品牌编码',
nullable: true
},
businessSystemSubDeviceDataId: {
type: 'integer',
description: '业务系统子设备数据Id',
format: 'int64',
nullable: true
}
},
additionalProperties: false,
description: '开放接口单个设备入参信息'
} as const;
export const OpenApiRequestSchema = { export const OpenApiRequestSchema = {
type: 'object', type: 'object',
properties: { properties: {
@ -9773,6 +9877,9 @@ export const PropertyApiDescriptionModelSchema = {
regex: { regex: {
type: 'string', type: 'string',
nullable: true nullable: true
},
isNullable: {
type: 'boolean'
} }
}, },
additionalProperties: false additionalProperties: false
@ -9812,7 +9919,7 @@ export const QueryCTWingAepReceiveMessageInputSchema = {
ioTDataType: { ioTDataType: {
type: 'string', type: 'string',
description: `数据类型,用于构建存储路径 description: `数据类型,用于构建存储路径
JiShe.ServicePro.Consts.IoTDBDataTypeConst`, JiShe.ServicePro.Core.IoTDBDataTypeConst`,
nullable: true nullable: true
}, },
deviceType: { deviceType: {
@ -9860,7 +9967,7 @@ export const QueryCTWingAepReceiveMessageOutputSchema = {
ioTDataType: { ioTDataType: {
type: 'string', type: 'string',
description: `数据类型,用于构建存储路径 description: `数据类型,用于构建存储路径
JiShe.ServicePro.Consts.IoTDBDataTypeConst`, JiShe.ServicePro.Core.IoTDBDataTypeConst`,
nullable: true nullable: true
}, },
deviceType: { deviceType: {
@ -10029,7 +10136,7 @@ export const QueryOneNETReceiveMessageInputSchema = {
ioTDataType: { ioTDataType: {
type: 'string', type: 'string',
description: `数据类型,用于构建存储路径 description: `数据类型,用于构建存储路径
JiShe.ServicePro.Consts.IoTDBDataTypeConst`, JiShe.ServicePro.Core.IoTDBDataTypeConst`,
nullable: true nullable: true
}, },
deviceType: { deviceType: {
@ -10077,7 +10184,7 @@ export const QueryOneNETReceiveMessageOutputSchema = {
ioTDataType: { ioTDataType: {
type: 'string', type: 'string',
description: `数据类型,用于构建存储路径 description: `数据类型,用于构建存储路径
JiShe.ServicePro.Consts.IoTDBDataTypeConst`, JiShe.ServicePro.Core.IoTDBDataTypeConst`,
nullable: true nullable: true
}, },
deviceType: { deviceType: {

File diff suppressed because one or more lines are too long

View File

@ -161,15 +161,20 @@ export type AuthTypeEnum = 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9;
*/ */
export type BatchCreateDeviceAggregationInput = { export type BatchCreateDeviceAggregationInput = {
/** /**
* *
*/ */
addressList: Array<(string)>; addressList: Array<(string)>;
/**
*
*/
deviceInfos?: Array<OpenApiDeviceInfoInput> | null;
ioTPlatform: IoTPlatformTypeEnum; ioTPlatform: IoTPlatformTypeEnum;
/** /**
* Id * Id
*/ */
ioTPlatformProductId: string; ioTPlatformProductId: string;
deviceSourceTypeEnum?: DeviceSourceTypeEnum; deviceSourceType?: DeviceSourceTypeEnum;
deviceType?: DeviceTypeEnum;
}; };
/** /**
@ -355,12 +360,14 @@ export type CreateDeviceAggregationInput = {
* *
*/ */
deviceAddress: string; deviceAddress: string;
deviceInfos?: OpenApiDeviceInfoInput;
ioTPlatform: IoTPlatformTypeEnum; ioTPlatform: IoTPlatformTypeEnum;
/** /**
* Id * Id
*/ */
ioTPlatformProductId: string; ioTPlatformProductId: string;
deviceSourceTypeEnum?: DeviceSourceTypeEnum; deviceSourceType?: DeviceSourceTypeEnum;
deviceType?: DeviceTypeEnum;
}; };
/** /**
@ -1352,9 +1359,9 @@ export type DeviceManagementInfoDto = {
*/ */
upgradeDate?: (string) | null; upgradeDate?: (string) | null;
/** /**
* key *
*/ */
securityKey?: (string) | null; subDeviceCapacity?: number;
}; };
export type DeviceManagementInfoDtoPagedResultDto = { export type DeviceManagementInfoDtoPagedResultDto = {
@ -1412,7 +1419,7 @@ export type DeviceTableModelDataInfoPageInput = {
isPage?: boolean; isPage?: boolean;
/** /**
* *
* JiShe.ServicePro.Consts.IoTDBDataTypeConst * JiShe.ServicePro.Core.IoTDBDataTypeConst
*/ */
ioTDataType?: (string) | null; ioTDataType?: (string) | null;
deviceType?: DeviceTypeEnum; deviceType?: DeviceTypeEnum;
@ -2054,7 +2061,7 @@ export type DeviceTreeModelDataInfoInput = {
isPage?: boolean; isPage?: boolean;
/** /**
* *
* JiShe.ServicePro.Consts.IoTDBDataTypeConst * JiShe.ServicePro.Core.IoTDBDataTypeConst
*/ */
ioTDataType?: (string) | null; ioTDataType?: (string) | null;
deviceType?: DeviceTypeEnum; deviceType?: DeviceTypeEnum;
@ -2074,6 +2081,14 @@ export type DeviceTreeModelDataInfoInput = {
* true * true
*/ */
isNeedPaging?: boolean; isNeedPaging?: boolean;
/**
*
*/
subDeviceAddress?: (string) | null;
/**
*
*/
deviceEvent?: (string) | null;
}; };
/** /**
@ -2197,7 +2212,7 @@ export type DeviceUpgradeRecordDtoPagedResultDto = {
/** /**
* *
*/ */
export type DeviceUpgradeResultTypeEnum = 0 | 1001 | 1002 | 1003 | 1004 | 1005 | 2001 | 2002 | 2003 | 2004 | 2005 | 2006 | 3001 | 3002 | 3003 | 4001 | 5001 | 6001 | 6002 | 6003 | 6004 | 6005 | 6006 | 6007 | 6008 | 9999; export type DeviceUpgradeResultTypeEnum = 0 | 1 | 1001 | 2001 | 2002 | 2003 | 2004 | 2005 | 3001 | 3002 | 4001 | 5001 | 6001 | 6002 | 6003;
/** /**
* *
@ -3044,6 +3059,14 @@ export type IoTPlatformThingModelCreateInput = {
* *
*/ */
ioTPlatformRawFieldExtension?: (string) | null; ioTPlatformRawFieldExtension?: (string) | null;
/**
*
*/
isOperableIdentifier?: boolean;
/**
* 访 JiShe.ServicePro.Core.DevicePropertyAccessMode
*/
accessMode?: (string) | null;
}; };
/** /**
@ -3129,6 +3152,14 @@ export type IoTPlatformThingModelInfoDto = {
* *
*/ */
filedTypeName?: (string) | null; filedTypeName?: (string) | null;
/**
*
*/
isOperableIdentifier?: boolean;
/**
* 访 JiShe.ServicePro.Core.DevicePropertyAccessMode
*/
accessMode?: (string) | null;
}; };
export type IoTPlatformThingModelInfoDtoPagedResultDto = { export type IoTPlatformThingModelInfoDtoPagedResultDto = {
@ -3173,6 +3204,10 @@ export type IoTPlatformThingModelPageInput = {
* JiShe.ServicePro.Core.DataDictionaryTypeConst * JiShe.ServicePro.Core.DataDictionaryTypeConst
*/ */
filedType?: (string) | null; filedType?: (string) | null;
/**
*
*/
isOperableIdentifier?: (boolean) | null;
}; };
export type IoTPlatformThingModelUpdateInput = { export type IoTPlatformThingModelUpdateInput = {
@ -3217,6 +3252,14 @@ export type IoTPlatformThingModelUpdateInput = {
* *
*/ */
ioTPlatformRawFieldExtension?: (string) | null; ioTPlatformRawFieldExtension?: (string) | null;
/**
*
*/
isOperableIdentifier?: boolean;
/**
* 访 JiShe.ServicePro.Core.DevicePropertyAccessMode
*/
accessMode?: (string) | null;
id?: string; id?: string;
}; };
@ -3378,7 +3421,7 @@ export type MeterReadingPacketInfoPageInput = {
isPage?: boolean; isPage?: boolean;
/** /**
* *
* JiShe.ServicePro.Consts.IoTDBDataTypeConst * JiShe.ServicePro.Core.IoTDBDataTypeConst
*/ */
ioTDataType?: (string) | null; ioTDataType?: (string) | null;
deviceType?: DeviceTypeEnum; deviceType?: DeviceTypeEnum;
@ -3414,7 +3457,7 @@ export type MeterReadingPacketInfoPageOutput = {
dataBaseName?: (string) | null; dataBaseName?: (string) | null;
/** /**
* *
* JiShe.ServicePro.Consts.IoTDBDataTypeConst * JiShe.ServicePro.Core.IoTDBDataTypeConst
*/ */
ioTDataType?: (string) | null; ioTDataType?: (string) | null;
/** /**
@ -3985,6 +4028,40 @@ export type OneNetProductInfoModifyInput = {
thingModelFileName?: (string) | null; thingModelFileName?: (string) | null;
}; };
/**
*
*/
export type OpenApiDeviceInfoInput = {
/**
*
*/
deviceAddress?: (string) | null;
/**
* IdId
*/
businessSystemDeviceDataId?: (number) | null;
/**
*
*/
subDeviceName?: (string) | null;
/**
*
*/
subDeviceAddress?: (string) | null;
/**
*
*/
subDeviceIndex?: number;
/**
*
*/
subDeviceBrandCode?: (string) | null;
/**
* Id
*/
businessSystemSubDeviceDataId?: (number) | null;
};
/** /**
* *
*/ */
@ -5310,6 +5387,7 @@ export type PropertyApiDescriptionModel = {
minimum?: (string) | null; minimum?: (string) | null;
maximum?: (string) | null; maximum?: (string) | null;
regex?: (string) | null; regex?: (string) | null;
isNullable?: boolean;
}; };
/** /**
@ -5341,7 +5419,7 @@ export type QueryCTWingAepReceiveMessageInput = {
isPage?: boolean; isPage?: boolean;
/** /**
* *
* JiShe.ServicePro.Consts.IoTDBDataTypeConst * JiShe.ServicePro.Core.IoTDBDataTypeConst
*/ */
ioTDataType?: (string) | null; ioTDataType?: (string) | null;
deviceType?: DeviceTypeEnum; deviceType?: DeviceTypeEnum;
@ -5377,7 +5455,7 @@ export type QueryCTWingAepReceiveMessageOutput = {
dataBaseName?: (string) | null; dataBaseName?: (string) | null;
/** /**
* *
* JiShe.ServicePro.Consts.IoTDBDataTypeConst * JiShe.ServicePro.Core.IoTDBDataTypeConst
*/ */
ioTDataType?: (string) | null; ioTDataType?: (string) | null;
/** /**
@ -5501,7 +5579,7 @@ export type QueryOneNETReceiveMessageInput = {
isPage?: boolean; isPage?: boolean;
/** /**
* *
* JiShe.ServicePro.Consts.IoTDBDataTypeConst * JiShe.ServicePro.Core.IoTDBDataTypeConst
*/ */
ioTDataType?: (string) | null; ioTDataType?: (string) | null;
deviceType?: DeviceTypeEnum; deviceType?: DeviceTypeEnum;
@ -5537,7 +5615,7 @@ export type QueryOneNETReceiveMessageOutput = {
dataBaseName?: (string) | null; dataBaseName?: (string) | null;
/** /**
* *
* JiShe.ServicePro.Consts.IoTDBDataTypeConst * JiShe.ServicePro.Core.IoTDBDataTypeConst
*/ */
ioTDataType?: (string) | null; ioTDataType?: (string) | null;
/** /**
@ -6612,6 +6690,16 @@ export type GetAggregationDeviceDownloadFirmwareResponse = (RemoteStreamContent)
export type GetAggregationDeviceDownloadFirmwareError = unknown; export type GetAggregationDeviceDownloadFirmwareError = unknown;
export type PostAggregationDeviceBindingDeviceThingModelData = {
query?: {
input?: BindingDeviceThingModelInput;
};
};
export type PostAggregationDeviceBindingDeviceThingModelResponse = (boolean);
export type PostAggregationDeviceBindingDeviceThingModelError = unknown;
export type PostFirmwareInfoCreateAsyncData = { export type PostFirmwareInfoCreateAsyncData = {
query?: { query?: {
input?: CreateDeviceFirmwareInfoInput; input?: CreateDeviceFirmwareInfoInput;
@ -6706,16 +6794,6 @@ export type PostDeviceInfoCacheDeviceDataToRedisResponse = (boolean);
export type PostDeviceInfoCacheDeviceDataToRedisError = unknown; export type PostDeviceInfoCacheDeviceDataToRedisError = unknown;
export type PostDeviceInfoBindingDeviceThingModelData = {
query?: {
input?: BindingDeviceThingModelInput;
};
};
export type PostDeviceInfoBindingDeviceThingModelResponse = (boolean);
export type PostDeviceInfoBindingDeviceThingModelError = unknown;
export type PostDeviceThingModelManagementCreateAsyncData = { export type PostDeviceThingModelManagementCreateAsyncData = {
query?: { query?: {
input?: DeviceThingModelCreateInput; input?: DeviceThingModelCreateInput;
@ -7204,6 +7282,16 @@ export type PostIoTplatformThingModelInfoStandardThingModelPageAsyncResponse = (
export type PostIoTplatformThingModelInfoStandardThingModelPageAsyncError = unknown; export type PostIoTplatformThingModelInfoStandardThingModelPageAsyncError = unknown;
export type PostIoTplatformThingModelInfoUpdateOperableIdentifierData = {
query?: {
input?: IdInput;
};
};
export type PostIoTplatformThingModelInfoUpdateOperableIdentifierResponse = (boolean);
export type PostIoTplatformThingModelInfoUpdateOperableIdentifierError = unknown;
export type PostLanguagesAllResponse = (Array<PageLanguageOutput>); export type PostLanguagesAllResponse = (Array<PageLanguageOutput>);
export type PostLanguagesAllError = (RemoteServiceErrorResponse); export type PostLanguagesAllError = (RemoteServiceErrorResponse);

View File

@ -226,6 +226,8 @@
"StandardFieldName": "StandardFieldName", "StandardFieldName": "StandardFieldName",
"StandardFieldDisplayName": "StandardFieldDisplayName", "StandardFieldDisplayName": "StandardFieldDisplayName",
"IsValueNeedConvert": "IsValueNeedConvert", "IsValueNeedConvert": "IsValueNeedConvert",
"AccessMode": "AccessMode",
"IsOperableIdentifier": "IsOperableIdentifier",
"StandardFieldValueType": "StandardFieldValueType", "StandardFieldValueType": "StandardFieldValueType",
"copyStandardThingModel": "CopyStandardThingModel", "copyStandardThingModel": "CopyStandardThingModel",
"copyAnotherThingModelModal": "CopyAnotherThingModelModal" "copyAnotherThingModelModal": "CopyAnotherThingModelModal"

View File

@ -219,6 +219,8 @@
"StandardFieldName": "标准物模型编码", "StandardFieldName": "标准物模型编码",
"StandardFieldDisplayName": "标准物模型名称", "StandardFieldDisplayName": "标准物模型名称",
"IsValueNeedConvert": "是否需要值类型转换", "IsValueNeedConvert": "是否需要值类型转换",
"AccessMode": "访问模式",
"IsOperableIdentifier": "是否可操作物模型标识符",
"StandardFieldValueType": "标准物模型值类型", "StandardFieldValueType": "标准物模型值类型",
"copyStandardThingModel": "复制标准模型", "copyStandardThingModel": "复制标准模型",
"copyAnotherThingModelModal": "复制已有模型" "copyAnotherThingModelModal": "复制已有模型"

View File

@ -22,6 +22,7 @@ import { useVbenForm } from '#/adapter/form';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
postAggregationDeviceBatchCreateAsync, postAggregationDeviceBatchCreateAsync,
postAggregationDeviceBindingDeviceThingModel,
postAggregationDeviceCreateAsync, postAggregationDeviceCreateAsync,
postAggregationDeviceDeleteAsync, postAggregationDeviceDeleteAsync,
postAggregationDeviceDeviceBatchUpgradeForApiAsync, postAggregationDeviceDeviceBatchUpgradeForApiAsync,
@ -29,7 +30,6 @@ import {
postAggregationDeviceDeviceUpgradeForApiAsync, postAggregationDeviceDeviceUpgradeForApiAsync,
postAggregationDeviceGetDevicePropertyValueForApiAsync, postAggregationDeviceGetDevicePropertyValueForApiAsync,
postAggregationDeviceRepushDeviceInfoToIoTplatform, postAggregationDeviceRepushDeviceInfoToIoTplatform,
postDeviceInfoBindingDeviceThingModel,
postDeviceInfoCacheDeviceDataToRedis, postDeviceInfoCacheDeviceDataToRedis,
postDeviceInfoPage, postDeviceInfoPage,
postIoTplatformThingModelInfoPageAsync, postIoTplatformThingModelInfoPageAsync,
@ -345,6 +345,10 @@ const commandTableColumns = computed(() => [
key: 'commandValue', key: 'commandValue',
width: 200, width: 200,
customRender: ({ record }: any) => { customRender: ({ record }: any) => {
// r
if (record.accessMode === 'r') {
return h('span', { style: { color: '#999' } }, '只读属性,无法设置指令');
}
return h(Input, { return h(Input, {
value: record.commandValue, value: record.commandValue,
placeholder: '请输入指令内容', placeholder: '请输入指令内容',
@ -388,15 +392,11 @@ const commandTableColumns = computed(() => [
width: 200, width: 200,
fixed: 'right' as const, fixed: 'right' as const,
customRender: ({ record }: any) => { customRender: ({ record }: any) => {
return h( const buttons = [];
'div',
{ // rww
style: { if (record.accessMode === 'rw' || record.accessMode === 'w') {
display: 'flex', buttons.push(
gap: '8px',
},
},
[
h( h(
Button, Button,
{ {
@ -407,6 +407,12 @@ const commandTableColumns = computed(() => [
}, },
{ default: () => '发送指令' }, { default: () => '发送指令' },
), ),
);
}
// rrww
if (record.accessMode === 'r' || record.accessMode === 'rw') {
buttons.push(
h( h(
Button, Button,
{ {
@ -416,7 +422,18 @@ const commandTableColumns = computed(() => [
}, },
{ default: () => '抄读数据' }, { default: () => '抄读数据' },
), ),
], );
}
return h(
'div',
{
style: {
display: 'flex',
gap: '8px',
},
},
buttons,
); );
}, },
}, },
@ -434,6 +451,7 @@ interface ThingModelProperty {
result: string; // result: string; //
loading?: boolean; // loading?: boolean; //
selected?: boolean; // selected?: boolean; //
accessMode?: string; // 访rw-r-
} }
const thingModelProperties = ref<ThingModelProperty[]>([]); const thingModelProperties = ref<ThingModelProperty[]>([]);
@ -467,6 +485,7 @@ const fetchThingModelProperties = async (row: Record<string, any>) => {
pageIndex: 1, pageIndex: 1,
pageSize: 1000, // pageSize: 1000, //
IsPage: false, // IsPage: false, //
IsOperableIdentifier: true, //
ioTPlatform: ioTPlatform:
typeof row.ioTPlatform === 'string' typeof row.ioTPlatform === 'string'
? Number.parseInt(row.ioTPlatform) ? Number.parseInt(row.ioTPlatform)
@ -487,6 +506,7 @@ const fetchThingModelProperties = async (row: Record<string, any>) => {
result: '', result: '',
loading: false, loading: false,
selected: false, selected: false,
accessMode: item.accessMode || '', // 访
})); }));
} catch (error) { } catch (error) {
console.error('获取平台物模型属性失败:', error); console.error('获取平台物模型属性失败:', error);
@ -508,17 +528,19 @@ const [UserModal, userModalApi] = useVbenModal({
// //
const submitBatchCommand = async () => { const submitBatchCommand = async () => {
// // accessMode === 'r'
// rww
const selectedProperties = thingModelProperties.value.filter( const selectedProperties = thingModelProperties.value.filter(
(prop) => (prop) =>
prop.selected && prop.selected &&
prop.ioTPlatformRawFieldName && prop.ioTPlatformRawFieldName &&
(prop.accessMode === 'rw' || prop.accessMode === 'w') && //
prop.commandValue && prop.commandValue &&
prop.commandValue.trim() !== '', prop.commandValue.trim() !== '',
); );
if (selectedProperties.length === 0) { if (selectedProperties.length === 0) {
Message.warning('请至少选择一个已填写指令内容的属性'); Message.warning('请至少选择一个已填写指令内容的可写属性(只读属性无法发送指令)');
return; return;
} }
@ -569,7 +591,8 @@ const submitBatchCommand = async () => {
const [CommandModal, commandModalApi] = useVbenModal({ const [CommandModal, commandModalApi] = useVbenModal({
draggable: true, draggable: true,
onConfirm: submitBatchCommand, showCancelButton: false,
showOkButton: false,
onBeforeClose: () => { onBeforeClose: () => {
commandRow.value = {}; commandRow.value = {};
thingModelProperties.value = []; thingModelProperties.value = [];
@ -585,6 +608,9 @@ const [CommandModal, commandModalApi] = useVbenModal({
}, },
}); });
//
const commandModalState = commandModalApi.useStore();
// //
const [BindModal, bindModalApi] = useVbenModal({ const [BindModal, bindModalApi] = useVbenModal({
draggable: true, draggable: true,
@ -1398,9 +1424,7 @@ const openBindModal = async (
const allSameModel = const allSameModel =
allNeedConfig && allNeedConfig &&
!!firstModelId && !!firstModelId &&
selectedRows.every( selectedRows.every((row) => row.deviceThingModelDataId === firstModelId);
(row) => row.deviceThingModelDataId === firstModelId,
);
isNeedConfigDevicMdoel = allNeedConfig; isNeedConfigDevicMdoel = allNeedConfig;
deviceThingModelDataId = allSameModel ? String(firstModelId) : undefined; deviceThingModelDataId = allSameModel ? String(firstModelId) : undefined;
@ -1422,6 +1446,14 @@ const openBindModal = async (
// //
const sendCommand = async (property: ThingModelProperty) => { const sendCommand = async (property: ThingModelProperty) => {
//
if (property.accessMode === 'r') {
Message.warning('该属性为只读模式,无法发送指令');
return;
}
// wrw
if (!property.commandValue || property.commandValue.trim() === '') { if (!property.commandValue || property.commandValue.trim() === '') {
Message.warning('请输入指令内容'); Message.warning('请输入指令内容');
return; return;
@ -1468,6 +1500,12 @@ const sendCommand = async (property: ThingModelProperty) => {
// //
const readData = async (property: ThingModelProperty) => { const readData = async (property: ThingModelProperty) => {
//
if (property.accessMode === 'w') {
Message.warning('该属性为只写模式,无法抄读数据');
return;
}
if (!property.ioTPlatformRawFieldName) { if (!property.ioTPlatformRawFieldName) {
Message.warning('该属性缺少平台字段名,无法抄读数据'); Message.warning('该属性缺少平台字段名,无法抄读数据');
return; return;
@ -1515,6 +1553,85 @@ const readData = async (property: ThingModelProperty) => {
} }
}; };
//
const submitBatchRead = async () => {
// w
const selectedProperties = thingModelProperties.value.filter(
(prop) =>
prop.selected &&
prop.ioTPlatformRawFieldName &&
prop.accessMode !== 'w', //
);
if (selectedProperties.length === 0) {
Message.warning('请至少选择一个可读属性进行抄读(只写属性无法抄读)');
return;
}
if (!commandRow.value.id) {
Message.warning('设备ID不存在无法抄读数据');
return;
}
//
const propertyList = selectedProperties.map(
(prop) => prop.ioTPlatformRawFieldName,
);
try {
commandModalApi.setState({ loading: true, confirmLoading: false });
//
selectedProperties.forEach((prop) => {
prop.loading = true;
});
//
const result = await postAggregationDeviceGetDevicePropertyValueForApiAsync(
{
body: {
id: String(commandRow.value.id),
propertyList,
},
},
);
if (result.data !== undefined && result.data !== null) {
//
selectedProperties.forEach((prop) => {
const propertyValue = (result.data as any)[
prop.ioTPlatformRawFieldName
];
if (propertyValue !== undefined && propertyValue !== null) {
prop.result =
typeof propertyValue === 'string'
? propertyValue
: JSON.stringify(propertyValue);
} else {
prop.result = '未获取到数据';
}
prop.loading = false;
});
Message.success(`成功抄读 ${selectedProperties.length} 个属性`);
} else {
selectedProperties.forEach((prop) => {
prop.result = '抄读数据失败';
prop.loading = false;
});
Message.error('抄读数据失败');
}
} catch (error) {
console.error('批量抄读失败:', error);
selectedProperties.forEach((prop) => {
prop.result = `抄读数据失败: ${(error as Error).message}`;
prop.loading = false;
});
Message.error('批量抄读失败');
} finally {
commandModalApi.setState({ loading: false, confirmLoading: false });
}
};
// //
async function submitBindDeviceThingModel() { async function submitBindDeviceThingModel() {
const formValues = await bindFormApi.getValues(); const formValues = await bindFormApi.getValues();
@ -1545,7 +1662,7 @@ async function submitBindDeviceThingModel() {
try { try {
bindModalApi.setState({ loading: true, confirmLoading: true }); bindModalApi.setState({ loading: true, confirmLoading: true });
const result = await postDeviceInfoBindingDeviceThingModel({ const result = await postAggregationDeviceBindingDeviceThingModel({
body: { body: {
devieDataIdList: deviceIds, devieDataIdList: deviceIds,
isNeedConfigDevicMdoel: isNeedConfig, isNeedConfigDevicMdoel: isNeedConfig,
@ -2065,6 +2182,19 @@ const toolbarActions = computed(() => [
<Table :columns="commandTableColumns" :data-source="filteredThingModelProperties" :pagination="false" <Table :columns="commandTableColumns" :data-source="filteredThingModelProperties" :pagination="false"
:scroll="{ x: 1000, y: 500 }" row-key="id" size="small" /> :scroll="{ x: 1000, y: 500 }" row-key="id" size="small" />
</div> </div>
<template #footer>
<div class="flex w-full items-center justify-end gap-2">
<Button @click="commandModalApi.close()">
{{ $t('common.cancel') }}
</Button>
<Button type="default" :loading="commandModalState?.loading" @click="submitBatchRead">
批量抄读
</Button>
<Button type="primary" :loading="commandModalState?.loading" @click="submitBatchCommand">
批量发送指令
</Button>
</div>
</template>
</CommandModal> </CommandModal>
<UpgradeModal title="设备升级" class="w-[600px]"> <UpgradeModal title="设备升级" class="w-[600px]">
<UpgradeForm /> <UpgradeForm />
@ -2075,11 +2205,7 @@ const toolbarActions = computed(() => [
已选择 {{ bindRows.length }} 个设备 已选择 {{ bindRows.length }} 个设备
</div> </div>
<div class="max-h-32 overflow-y-auto text-xs text-blue-600"> <div class="max-h-32 overflow-y-auto text-xs text-blue-600">
<div <div v-for="(row, index) in bindRows" :key="row.id || index" class="mb-1">
v-for="(row, index) in bindRows"
:key="row.id || index"
class="mb-1"
>
<div> <div>
{{ index + 1 }}. {{ index + 1 }}.
{{ row.deviceName || row.deviceAddress || row.id }} {{ row.deviceName || row.deviceAddress || row.id }}

View File

@ -50,7 +50,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
}, },
{ {
field: 'propertyArray', field: 'propertyArray',
title: '属性标识符集合', title: '平台端属性标识符集合',
minWidth: 200, minWidth: 200,
showOverflow: 'tooltip', showOverflow: 'tooltip',
formatter: ({ cellValue }: { cellValue: any }) => { formatter: ({ cellValue }: { cellValue: any }) => {
@ -89,13 +89,15 @@ const [Grid, gridApi] = useVbenVxeGrid({
if (!deviceThingModelId.value) { if (!deviceThingModelId.value) {
return { items: [], totalCount: 0 }; return { items: [], totalCount: 0 };
} }
const { data } = await postDeviceThingModelManagementCommandPageAsync({ const { data } = await postDeviceThingModelManagementCommandPageAsync(
{
body: { body: {
pageIndex: page.currentPage, pageIndex: page.currentPage,
pageSize: page.pageSize, pageSize: page.pageSize,
deviceThingModelId: deviceThingModelId.value, deviceThingModelId: deviceThingModelId.value,
}, },
}); },
);
return data || { items: [], totalCount: 0 }; return data || { items: [], totalCount: 0 };
}, },
}, },
@ -121,7 +123,8 @@ const [CommandFormModal, commandFormModalApi] = useVbenModal({
// //
nextTick(async () => { nextTick(async () => {
try { try {
const { data } = await postDeviceThingModelManagementCommandFindByIdAsync({ const { data } =
await postDeviceThingModelManagementCommandFindByIdAsync({
body: { id: editRow.value.id }, body: { id: editRow.value.id },
}); });
if (data) { if (data) {
@ -169,13 +172,13 @@ async function loadPropertyOptions() {
pageIndex: 1, pageIndex: 1,
pageSize: 1000, pageSize: 1000,
deviceThingModelId: deviceThingModelId.value, deviceThingModelId: deviceThingModelId.value,
isPage:false isPage: false,
}, },
}); });
const items = data?.items || []; const items = data?.items || [];
propertyOptions.value = items.map((item: any) => ({ propertyOptions.value = items.map((item: any) => ({
label: `${item.standardFieldDisplayName || item.standardFieldName} (${item.standardFieldName})`, label: `${item.standardFieldDisplayName || item.standardFieldName} (${item.standardFieldName})`,
value: item.ioTPlatformRawFieldName value: item.ioTPlatformRawFieldName,
})); }));
} catch (error) { } catch (error) {
console.error('加载属性列表失败:', error); console.error('加载属性列表失败:', error);
@ -197,29 +200,35 @@ const [CommandForm, commandFormApi] = useVbenForm({
component: 'Input', component: 'Input',
fieldName: 'commandName', fieldName: 'commandName',
label: '指令名称', label: '指令名称',
rules: z rules: z.preprocess(
.preprocess((v) => (v == null ? '' : v), z.string().min(1, $t('common.required'))), (v) => (v == null ? '' : v),
z.string().min(1, $t('common.required')),
),
componentProps: { componentProps: {
placeholder: $t('common.pleaseInput') + '指令名称', placeholder: `${$t('common.pleaseInput')}指令名称`,
}, },
}, },
{ {
component: 'Textarea', component: 'Textarea',
fieldName: 'issueCommand', fieldName: 'issueCommand',
label: '下发指令', label: '下发指令',
rules: z rules: z.preprocess(
.preprocess((v) => (v == null ? '' : v), z.string().min(1, $t('common.required'))), (v) => (v == null ? '' : v),
z.string().min(1, $t('common.required')),
),
componentProps: { componentProps: {
rows: 4, rows: 4,
placeholder: $t('common.pleaseInput') + '下发指令(完整的单个下发指令)', placeholder: `${$t('common.pleaseInput')}下发指令(完整的单个下发指令)`,
}, },
}, },
{ {
component: 'Select', component: 'Select',
fieldName: 'propertyArray', fieldName: 'propertyArray',
label: '属性标识符集合', label: '属性标识符集合',
rules: z rules: z.preprocess(
.preprocess((v) => (v == null ? [] : v), z.array(z.string()).min(1, '请至少选择一个属性标识符')), (v) => (v == null ? [] : v),
z.array(z.string()).min(1, '请至少选择一个属性标识符'),
),
// 使 options propertyOptions // 使 options propertyOptions
componentProps: () => ({ componentProps: () => ({
mode: 'multiple', mode: 'multiple',
@ -264,9 +273,9 @@ async function submitCommand() {
// propertyArray // propertyArray
propertyArray: Array.isArray(formValues.propertyArray) propertyArray: Array.isArray(formValues.propertyArray)
? formValues.propertyArray ? formValues.propertyArray
: formValues.propertyArray : (formValues.propertyArray
? [formValues.propertyArray] ? [formValues.propertyArray]
: [], : []),
...(isEdit && { id: editRow.value.id }), ...(isEdit && { id: editRow.value.id }),
}; };
@ -286,15 +295,11 @@ async function submitCommand() {
await gridApi.reload(); await gridApi.reload();
} }
} else { } else {
Message.error( Message.error(isEdit ? $t('common.editFail') : $t('common.addFail'));
isEdit ? $t('common.editFail') : $t('common.addFail'),
);
} }
} catch (error) { } catch (error) {
console.error('提交指令失败:', error); console.error('提交指令失败:', error);
Message.error( Message.error(isEdit ? $t('common.editFail') : $t('common.addFail'));
isEdit ? $t('common.editFail') : $t('common.addFail'),
);
} }
} }
@ -340,8 +345,7 @@ const [Modal, modalApi] = useVbenModal({
<Modal :title="`指令管理 - ${deviceModelName || ''}`" class="w-[900px]"> <Modal :title="`指令管理 - ${deviceModelName || ''}`" class="w-[900px]">
<Grid> <Grid>
<template #toolbar-actions> <template #toolbar-actions>
<TableAction <TableAction :actions="[
:actions="[
{ {
label: $t('common.add'), label: $t('common.add'),
type: 'primary', type: 'primary',
@ -349,13 +353,11 @@ const [Modal, modalApi] = useVbenModal({
onClick: openAddCommandModal, onClick: openAddCommandModal,
auth: ['AbpIdentity.Users.Create'], auth: ['AbpIdentity.Users.Create'],
}, },
]" ]" />
/>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<TableAction <TableAction :actions="[
:actions="[
{ {
label: $t('common.edit'), label: $t('common.edit'),
type: 'link', type: 'link',
@ -374,16 +376,12 @@ const [Modal, modalApi] = useVbenModal({
confirm: onDeleteCommand.bind(null, row), confirm: onDeleteCommand.bind(null, row),
}, },
}, },
]" ]" />
/>
</template> </template>
</Grid> </Grid>
<!-- 指令新增/编辑弹窗 --> <!-- 指令新增/编辑弹窗 -->
<CommandFormModal <CommandFormModal :title="editRow.id ? $t('common.edit') : $t('common.add')" class="w-[800px]">
:title="editRow.id ? $t('common.edit') : $t('common.add')"
class="w-[800px]"
>
<CommandForm /> <CommandForm />
</CommandFormModal> </CommandFormModal>
</Modal> </Modal>

View File

@ -237,6 +237,7 @@ const [TestScriptModal, testScriptModalApi] = useVbenModal({
footer: true, footer: true,
showCancelButton: true, showCancelButton: true,
showConfirmButton: true, showConfirmButton: true,
confirmText: '函数测试',
onConfirm: submitTestScript, onConfirm: submitTestScript,
onBeforeClose: () => { onBeforeClose: () => {
return true; return true;
@ -347,6 +348,11 @@ async function submit() {
} }
async function onEdit(record: any) { async function onEdit(record: any) {
//
if (record.functionAnalysisFlag === true) {
Message.warning('已启用函数解析的数据不允许编辑');
return;
}
editRow.value = record; editRow.value = record;
thingModelModalApi.open(); thingModelModalApi.open();
} }
@ -625,6 +631,7 @@ onMounted(async () => {
type: 'link', type: 'link',
size: 'small', size: 'small',
auth: ['AbpIdentity.Users.Update'], auth: ['AbpIdentity.Users.Update'],
disabled: row.functionAnalysisFlag === true,
onClick: onEdit.bind(null, row), onClick: onEdit.bind(null, row),
}, },
{ {
@ -694,18 +701,24 @@ onMounted(async () => {
</ThingModelModal> </ThingModelModal>
<!-- 函数脚本测试弹窗 --> <!-- 函数脚本测试弹窗 -->
<TestScriptModal title="函数脚本测试" class="w-[900px]"> <TestScriptModal title="函数脚本测试(函数代码中的函数名要与函数名称表单值一致)" class="w-[900px]">
<div v-if="testDeviceModelName" class="mb-2 flex items-center justify-between text-base font-semibold"> <div v-if="testDeviceModelName" class="mb-2 text-base font-semibold">
<span>设备端物模型{{ testDeviceModelName }}</span> 设备端物模型{{ testDeviceModelName }}
<Button v-if="testDeviceThingModelId" type="primary" @click="updateFunctionScript">
更新函数
</Button>
</div> </div>
<TestScriptForm /> <TestScriptForm />
<div v-if="testResult" class="mt-4"> <div v-if="testResult" class="mt-4">
<div class="mb-2 font-semibold">测试结果</div> <div class="mb-2 font-semibold">测试结果</div>
<pre class="max-h-96 overflow-auto rounded border bg-gray-50 p-4 text-sm">{{ testResult }}</pre> <pre class="max-h-96 overflow-auto rounded border bg-gray-50 p-4 text-sm">{{ testResult }}</pre>
</div> </div>
<template #center-footer>
<Button
v-if="testDeviceThingModelId"
type="primary"
@click="updateFunctionScript"
>
更新函数
</Button>
</template>
</TestScriptModal> </TestScriptModal>
</Page> </Page>
</template> </template>

View File

@ -464,12 +464,6 @@ onMounted(async () => {
// //
async function submit() { async function submit() {
// ID
if (!productId.value) {
Message.error('产品ID不存在无法保存物模型信息');
return;
}
const isEdit = !!editRow.value.id; const isEdit = !!editRow.value.id;
const formApi = isEdit ? editFormApi : addFormApi; const formApi = isEdit ? editFormApi : addFormApi;
const api = isEdit const api = isEdit
@ -478,12 +472,55 @@ async function submit() {
const { valid } = await formApi.validate(); const { valid } = await formApi.validate();
if (!valid) return; if (!valid) return;
// ID使
let finalProductId: string | undefined;
if (isEdit && editRow.value.ioTPlatformProductId) {
// 使ID
finalProductId = String(editRow.value.ioTPlatformProductId);
} else {
// ID
const searchFormValues = gridApi?.formApi
? await gridApi.formApi.getValues()
: {};
finalProductId =
searchFormValues.ioTPlatformProductId ||
productId.value ||
undefined;
if (finalProductId) {
finalProductId = String(finalProductId);
}
}
// ID
if (!finalProductId) {
Message.error('产品ID不存在无法保存物模型信息');
return;
}
// 使
let finalPlatform: 1 | 2;
if (isEdit && editRow.value.ioTPlatform) {
// 使
finalPlatform =
typeof editRow.value.ioTPlatform === 'string'
? (Number.parseInt(editRow.value.ioTPlatform) as 1 | 2)
: editRow.value.ioTPlatform;
} else {
//
const searchFormValues = gridApi?.formApi
? await gridApi.formApi.getValues()
: {};
const platformValue =
searchFormValues.ioTPlatform || ioTPlatform.value || '2';
finalPlatform = Number.parseInt(String(platformValue)) as 1 | 2;
}
const formValues = await formApi.getValues(); const formValues = await formApi.getValues();
const fetchParams: any = { const fetchParams: any = {
...formValues, ...formValues,
// //
ioTPlatform: Number.parseInt(ioTPlatform.value) as 1 | 2, ioTPlatform: finalPlatform,
ioTPlatformProductId: productId.value, ioTPlatformProductId: finalProductId,
// ID // ID
...(isEdit && { id: editRow.value.id }), ...(isEdit && { id: editRow.value.id }),
}; };

View File

@ -152,6 +152,7 @@ export const tableSchema = computed(() => [
DateTime: '日期时间', DateTime: '日期时间',
Object: 'JSON对象', Object: 'JSON对象',
Array: '数组', Array: '数组',
Struct: '结构体',
}; };
return typeMap[cellValue] || cellValue; return typeMap[cellValue] || cellValue;
}, },
@ -162,6 +163,26 @@ export const tableSchema = computed(() => [
minWidth: 120, minWidth: 120,
slots: { default: 'isValueNeedConvert' }, slots: { default: 'isValueNeedConvert' },
}, },
{
field: 'accessMode',
title: $t('abp.thingModelInfos.AccessMode'),
minWidth: 120,
formatter: ({ cellValue }: { cellValue: any }) => {
return cellValue === 'rw'
? '读写模式'
: cellValue === 'r'
? '只读模式'
: '只写模式';
},
},
{
field: 'isOperableIdentifier',
title: $t('abp.thingModelInfos.IsOperableIdentifier'),
minWidth: 150,
formatter: ({ cellValue }: { cellValue: any }) => {
return cellValue === true ? '是' : '否';
},
},
{ {
field: 'creationTime', field: 'creationTime',
title: $t('common.creationTime'), title: $t('common.creationTime'),
@ -318,7 +339,7 @@ export const getAddThingModelFormSchema = (
// 优先从表单值获取(这是最可靠的方式,因为值是在打开弹窗时设置的) // 优先从表单值获取(这是最可靠的方式,因为值是在打开弹窗时设置的)
let platform = formValues?._ioTPlatform; let platform = formValues?._ioTPlatform;
let productId = formValues?._ioTPlatformProductId; let productId = formValues?._ioTPlatformProductId;
let filedType = formValues?.filedType; const filedType = formValues?.filedType;
// 如果表单值中没有,尝试从其他字段获取 // 如果表单值中没有,尝试从其他字段获取
if (!platform && formValues?.ioTPlatform) { if (!platform && formValues?.ioTPlatform) {
@ -448,6 +469,48 @@ export const getAddThingModelFormSchema = (
style: { width: 'auto' }, style: { width: 'auto' },
}, },
}, },
{
component: 'ApiSelect',
fieldName: 'accessMode',
label: $t('abp.thingModelInfos.AccessMode'),
componentProps: {
api: getCommonGetSelectList,
params: {
query: {
typeName: 'DevicePropertyAccessMode',
},
},
labelField: 'value',
valueField: 'key',
optionsPropName: 'options',
immediate: true,
allowClear: true,
placeholder:
$t('common.pleaseSelect') + $t('abp.thingModelInfos.AccessMode'),
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 [];
},
},
},
{
component: 'Switch',
fieldName: 'isOperableIdentifier',
label: $t('abp.thingModelInfos.IsOperableIdentifier'),
defaultValue: false,
componentProps: {
style: { width: 'auto' },
},
},
{ {
component: 'ApiSelect', component: 'ApiSelect',
fieldName: 'ioTPlatformRawFieldDataType', fieldName: 'ioTPlatformRawFieldDataType',
@ -639,7 +702,7 @@ export const getEditThingModelFormSchema = (
// 优先从表单值获取(这是最可靠的方式,因为值是在打开弹窗时设置的) // 优先从表单值获取(这是最可靠的方式,因为值是在打开弹窗时设置的)
let platform = formValues?._ioTPlatform; let platform = formValues?._ioTPlatform;
let productId = formValues?._ioTPlatformProductId; let productId = formValues?._ioTPlatformProductId;
let filedType = formValues?.filedType; const filedType = formValues?.filedType;
// 如果表单值中没有,尝试从其他字段获取 // 如果表单值中没有,尝试从其他字段获取
if (!platform && formValues?.ioTPlatform) { if (!platform && formValues?.ioTPlatform) {
@ -768,6 +831,47 @@ export const getEditThingModelFormSchema = (
style: { width: 'auto' }, style: { width: 'auto' },
}, },
}, },
{
component: 'ApiSelect',
fieldName: 'accessMode',
label: $t('abp.thingModelInfos.AccessMode'),
componentProps: {
api: getCommonGetSelectList,
params: {
query: {
typeName: 'DevicePropertyAccessMode',
},
},
labelField: 'value',
valueField: 'key',
optionsPropName: 'options',
immediate: true,
allowClear: true,
placeholder:
$t('common.pleaseSelect') + $t('abp.thingModelInfos.AccessMode'),
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 [];
},
},
},
{
component: 'Switch',
fieldName: 'isOperableIdentifier',
label: $t('abp.thingModelInfos.IsOperableIdentifier'),
componentProps: {
style: { width: 'auto' },
},
},
{ {
component: 'ApiSelect', component: 'ApiSelect',
fieldName: 'ioTPlatformRawFieldDataType', fieldName: 'ioTPlatformRawFieldDataType',