完善设备物模型绑定和平台端物模型管理
This commit is contained in:
parent
569f75e96d
commit
dce95f9e7b
@ -446,7 +446,15 @@ export const BatchCreateDeviceAggregationInputSchema = {
|
||||
items: {
|
||||
type: 'string'
|
||||
},
|
||||
description: '表通信地址集合'
|
||||
description: '设备地址不能为空'
|
||||
},
|
||||
deviceInfos: {
|
||||
type: 'array',
|
||||
items: {
|
||||
'$ref': '#/components/schemas/OpenApiDeviceInfoInput'
|
||||
},
|
||||
description: '设备信息',
|
||||
nullable: true
|
||||
},
|
||||
ioTPlatform: {
|
||||
'$ref': '#/components/schemas/IoTPlatformTypeEnum'
|
||||
@ -456,8 +464,11 @@ export const BatchCreateDeviceAggregationInputSchema = {
|
||||
type: 'string',
|
||||
description: '集中器在物联网平台中对应的产品Id'
|
||||
},
|
||||
deviceSourceTypeEnum: {
|
||||
deviceSourceType: {
|
||||
'$ref': '#/components/schemas/DeviceSourceTypeEnum'
|
||||
},
|
||||
deviceType: {
|
||||
'$ref': '#/components/schemas/DeviceTypeEnum'
|
||||
}
|
||||
},
|
||||
additionalProperties: false,
|
||||
@ -1442,6 +1453,9 @@ export const CreateDeviceAggregationInputSchema = {
|
||||
type: 'string',
|
||||
description: '表通信地址'
|
||||
},
|
||||
deviceInfos: {
|
||||
'$ref': '#/components/schemas/OpenApiDeviceInfoInput'
|
||||
},
|
||||
ioTPlatform: {
|
||||
'$ref': '#/components/schemas/IoTPlatformTypeEnum'
|
||||
},
|
||||
@ -1450,8 +1464,11 @@ export const CreateDeviceAggregationInputSchema = {
|
||||
type: 'string',
|
||||
description: '设备在物联网平台中对应的产品Id'
|
||||
},
|
||||
deviceSourceTypeEnum: {
|
||||
deviceSourceType: {
|
||||
'$ref': '#/components/schemas/DeviceSourceTypeEnum'
|
||||
},
|
||||
deviceType: {
|
||||
'$ref': '#/components/schemas/DeviceTypeEnum'
|
||||
}
|
||||
},
|
||||
additionalProperties: false,
|
||||
@ -2422,10 +2439,10 @@ export const DeviceManagementInfoDtoSchema = {
|
||||
format: 'date-time',
|
||||
nullable: true
|
||||
},
|
||||
securityKey: {
|
||||
type: 'string',
|
||||
description: '设备接入鉴权key',
|
||||
nullable: true
|
||||
subDeviceCapacity: {
|
||||
type: 'integer',
|
||||
description: '子设备容量',
|
||||
format: 'int32'
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
@ -2519,7 +2536,7 @@ export const DeviceTableModelDataInfoPageInputSchema = {
|
||||
ioTDataType: {
|
||||
type: 'string',
|
||||
description: `数据类型,用于构建存储路径
|
||||
JiShe.ServicePro.Consts.IoTDBDataTypeConst`,
|
||||
JiShe.ServicePro.Core.IoTDBDataTypeConst`,
|
||||
nullable: true
|
||||
},
|
||||
deviceType: {
|
||||
@ -3521,7 +3538,7 @@ export const DeviceTreeModelDataInfoInputSchema = {
|
||||
ioTDataType: {
|
||||
type: 'string',
|
||||
description: `数据类型,用于构建存储路径
|
||||
JiShe.ServicePro.Consts.IoTDBDataTypeConst`,
|
||||
JiShe.ServicePro.Core.IoTDBDataTypeConst`,
|
||||
nullable: true
|
||||
},
|
||||
deviceType: {
|
||||
@ -3547,6 +3564,16 @@ export const DeviceTreeModelDataInfoInputSchema = {
|
||||
isNeedPaging: {
|
||||
type: 'boolean',
|
||||
description: '是否需要分页, 默认为true'
|
||||
},
|
||||
subDeviceAddress: {
|
||||
type: 'string',
|
||||
description: '子设备地址',
|
||||
nullable: true
|
||||
},
|
||||
deviceEvent: {
|
||||
type: 'string',
|
||||
description: '设备事件类型名称',
|
||||
nullable: true
|
||||
}
|
||||
},
|
||||
additionalProperties: false,
|
||||
@ -3761,11 +3788,11 @@ export const DeviceUpgradeRecordDtoPagedResultDtoSchema = {
|
||||
} as const;
|
||||
|
||||
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',
|
||||
description: '设备升级结果枚举',
|
||||
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;
|
||||
|
||||
export const DeviceUpgradeSourceTypeEnumSchema = {
|
||||
@ -5922,6 +5949,15 @@ export const IoTPlatformThingModelCreateInputSchema = {
|
||||
type: 'string',
|
||||
description: '物联网平台中对应产品物模型标识符扩展,用于扩展结构体类型',
|
||||
nullable: true
|
||||
},
|
||||
isOperableIdentifier: {
|
||||
type: 'boolean',
|
||||
description: '是否可操作物模型标识符'
|
||||
},
|
||||
accessMode: {
|
||||
type: 'string',
|
||||
description: '物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode',
|
||||
nullable: true
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
@ -6056,6 +6092,15 @@ export const IoTPlatformThingModelInfoDtoSchema = {
|
||||
type: 'string',
|
||||
description: '物模型属性或者事件类型名称',
|
||||
nullable: true
|
||||
},
|
||||
isOperableIdentifier: {
|
||||
type: 'boolean',
|
||||
description: '是否可操作物模型标识符'
|
||||
},
|
||||
accessMode: {
|
||||
type: 'string',
|
||||
description: '物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode',
|
||||
nullable: true
|
||||
}
|
||||
},
|
||||
additionalProperties: false,
|
||||
@ -6128,6 +6173,11 @@ export const IoTPlatformThingModelPageInputSchema = {
|
||||
type: 'string',
|
||||
description: '物联网平台中对应产品物模型属性或者事件类型 JiShe.ServicePro.Core.DataDictionaryTypeConst',
|
||||
nullable: true
|
||||
},
|
||||
isOperableIdentifier: {
|
||||
type: 'boolean',
|
||||
description: '是否可操作标识符',
|
||||
nullable: true
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
@ -6187,6 +6237,15 @@ export const IoTPlatformThingModelUpdateInputSchema = {
|
||||
description: '物联网平台中对应产品物模型标识符扩展,用于扩展结构体类型',
|
||||
nullable: true
|
||||
},
|
||||
isOperableIdentifier: {
|
||||
type: 'boolean',
|
||||
description: '是否可操作物模型标识符'
|
||||
},
|
||||
accessMode: {
|
||||
type: 'string',
|
||||
description: '物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode',
|
||||
nullable: true
|
||||
},
|
||||
id: {
|
||||
type: 'string',
|
||||
format: 'uuid'
|
||||
@ -6441,7 +6500,7 @@ export const MeterReadingPacketInfoPageInputSchema = {
|
||||
ioTDataType: {
|
||||
type: 'string',
|
||||
description: `数据类型,用于构建存储路径
|
||||
JiShe.ServicePro.Consts.IoTDBDataTypeConst`,
|
||||
JiShe.ServicePro.Core.IoTDBDataTypeConst`,
|
||||
nullable: true
|
||||
},
|
||||
deviceType: {
|
||||
@ -6489,7 +6548,7 @@ export const MeterReadingPacketInfoPageOutputSchema = {
|
||||
ioTDataType: {
|
||||
type: 'string',
|
||||
description: `数据类型,用于构建存储路径
|
||||
JiShe.ServicePro.Consts.IoTDBDataTypeConst`,
|
||||
JiShe.ServicePro.Core.IoTDBDataTypeConst`,
|
||||
nullable: true
|
||||
},
|
||||
deviceType: {
|
||||
@ -7435,6 +7494,51 @@ export const OneNetProductInfoModifyInputSchema = {
|
||||
description: '修改OneNET产品'
|
||||
} 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 = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
@ -9773,6 +9877,9 @@ export const PropertyApiDescriptionModelSchema = {
|
||||
regex: {
|
||||
type: 'string',
|
||||
nullable: true
|
||||
},
|
||||
isNullable: {
|
||||
type: 'boolean'
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
@ -9812,7 +9919,7 @@ export const QueryCTWingAepReceiveMessageInputSchema = {
|
||||
ioTDataType: {
|
||||
type: 'string',
|
||||
description: `数据类型,用于构建存储路径
|
||||
JiShe.ServicePro.Consts.IoTDBDataTypeConst`,
|
||||
JiShe.ServicePro.Core.IoTDBDataTypeConst`,
|
||||
nullable: true
|
||||
},
|
||||
deviceType: {
|
||||
@ -9860,7 +9967,7 @@ export const QueryCTWingAepReceiveMessageOutputSchema = {
|
||||
ioTDataType: {
|
||||
type: 'string',
|
||||
description: `数据类型,用于构建存储路径
|
||||
JiShe.ServicePro.Consts.IoTDBDataTypeConst`,
|
||||
JiShe.ServicePro.Core.IoTDBDataTypeConst`,
|
||||
nullable: true
|
||||
},
|
||||
deviceType: {
|
||||
@ -10029,7 +10136,7 @@ export const QueryOneNETReceiveMessageInputSchema = {
|
||||
ioTDataType: {
|
||||
type: 'string',
|
||||
description: `数据类型,用于构建存储路径
|
||||
JiShe.ServicePro.Consts.IoTDBDataTypeConst`,
|
||||
JiShe.ServicePro.Core.IoTDBDataTypeConst`,
|
||||
nullable: true
|
||||
},
|
||||
deviceType: {
|
||||
@ -10077,7 +10184,7 @@ export const QueryOneNETReceiveMessageOutputSchema = {
|
||||
ioTDataType: {
|
||||
type: 'string',
|
||||
description: `数据类型,用于构建存储路径
|
||||
JiShe.ServicePro.Consts.IoTDBDataTypeConst`,
|
||||
JiShe.ServicePro.Core.IoTDBDataTypeConst`,
|
||||
nullable: true
|
||||
},
|
||||
deviceType: {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -161,15 +161,20 @@ export type AuthTypeEnum = 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9;
|
||||
*/
|
||||
export type BatchCreateDeviceAggregationInput = {
|
||||
/**
|
||||
* 表通信地址集合
|
||||
* 设备地址不能为空
|
||||
*/
|
||||
addressList: Array<(string)>;
|
||||
/**
|
||||
* 设备信息
|
||||
*/
|
||||
deviceInfos?: Array<OpenApiDeviceInfoInput> | null;
|
||||
ioTPlatform: IoTPlatformTypeEnum;
|
||||
/**
|
||||
* 集中器在物联网平台中对应的产品Id
|
||||
*/
|
||||
ioTPlatformProductId: string;
|
||||
deviceSourceTypeEnum?: DeviceSourceTypeEnum;
|
||||
deviceSourceType?: DeviceSourceTypeEnum;
|
||||
deviceType?: DeviceTypeEnum;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -355,12 +360,14 @@ export type CreateDeviceAggregationInput = {
|
||||
* 表通信地址
|
||||
*/
|
||||
deviceAddress: string;
|
||||
deviceInfos?: OpenApiDeviceInfoInput;
|
||||
ioTPlatform: IoTPlatformTypeEnum;
|
||||
/**
|
||||
* 设备在物联网平台中对应的产品Id
|
||||
*/
|
||||
ioTPlatformProductId: string;
|
||||
deviceSourceTypeEnum?: DeviceSourceTypeEnum;
|
||||
deviceSourceType?: DeviceSourceTypeEnum;
|
||||
deviceType?: DeviceTypeEnum;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1352,9 +1359,9 @@ export type DeviceManagementInfoDto = {
|
||||
*/
|
||||
upgradeDate?: (string) | null;
|
||||
/**
|
||||
* 设备接入鉴权key
|
||||
* 子设备容量
|
||||
*/
|
||||
securityKey?: (string) | null;
|
||||
subDeviceCapacity?: number;
|
||||
};
|
||||
|
||||
export type DeviceManagementInfoDtoPagedResultDto = {
|
||||
@ -1412,7 +1419,7 @@ export type DeviceTableModelDataInfoPageInput = {
|
||||
isPage?: boolean;
|
||||
/**
|
||||
* 数据类型,用于构建存储路径
|
||||
* JiShe.ServicePro.Consts.IoTDBDataTypeConst
|
||||
* JiShe.ServicePro.Core.IoTDBDataTypeConst
|
||||
*/
|
||||
ioTDataType?: (string) | null;
|
||||
deviceType?: DeviceTypeEnum;
|
||||
@ -2054,7 +2061,7 @@ export type DeviceTreeModelDataInfoInput = {
|
||||
isPage?: boolean;
|
||||
/**
|
||||
* 数据类型,用于构建存储路径
|
||||
* JiShe.ServicePro.Consts.IoTDBDataTypeConst
|
||||
* JiShe.ServicePro.Core.IoTDBDataTypeConst
|
||||
*/
|
||||
ioTDataType?: (string) | null;
|
||||
deviceType?: DeviceTypeEnum;
|
||||
@ -2074,6 +2081,14 @@ export type DeviceTreeModelDataInfoInput = {
|
||||
* 是否需要分页, 默认为true
|
||||
*/
|
||||
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;
|
||||
/**
|
||||
* 是否可操作物模型标识符
|
||||
*/
|
||||
isOperableIdentifier?: boolean;
|
||||
/**
|
||||
* 物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode
|
||||
*/
|
||||
accessMode?: (string) | null;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -3129,6 +3152,14 @@ export type IoTPlatformThingModelInfoDto = {
|
||||
* 物模型属性或者事件类型名称
|
||||
*/
|
||||
filedTypeName?: (string) | null;
|
||||
/**
|
||||
* 是否可操作物模型标识符
|
||||
*/
|
||||
isOperableIdentifier?: boolean;
|
||||
/**
|
||||
* 物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode
|
||||
*/
|
||||
accessMode?: (string) | null;
|
||||
};
|
||||
|
||||
export type IoTPlatformThingModelInfoDtoPagedResultDto = {
|
||||
@ -3173,6 +3204,10 @@ export type IoTPlatformThingModelPageInput = {
|
||||
* 物联网平台中对应产品物模型属性或者事件类型 JiShe.ServicePro.Core.DataDictionaryTypeConst
|
||||
*/
|
||||
filedType?: (string) | null;
|
||||
/**
|
||||
* 是否可操作标识符
|
||||
*/
|
||||
isOperableIdentifier?: (boolean) | null;
|
||||
};
|
||||
|
||||
export type IoTPlatformThingModelUpdateInput = {
|
||||
@ -3217,6 +3252,14 @@ export type IoTPlatformThingModelUpdateInput = {
|
||||
* 物联网平台中对应产品物模型标识符扩展,用于扩展结构体类型
|
||||
*/
|
||||
ioTPlatformRawFieldExtension?: (string) | null;
|
||||
/**
|
||||
* 是否可操作物模型标识符
|
||||
*/
|
||||
isOperableIdentifier?: boolean;
|
||||
/**
|
||||
* 物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode
|
||||
*/
|
||||
accessMode?: (string) | null;
|
||||
id?: string;
|
||||
};
|
||||
|
||||
@ -3378,7 +3421,7 @@ export type MeterReadingPacketInfoPageInput = {
|
||||
isPage?: boolean;
|
||||
/**
|
||||
* 数据类型,用于构建存储路径
|
||||
* JiShe.ServicePro.Consts.IoTDBDataTypeConst
|
||||
* JiShe.ServicePro.Core.IoTDBDataTypeConst
|
||||
*/
|
||||
ioTDataType?: (string) | null;
|
||||
deviceType?: DeviceTypeEnum;
|
||||
@ -3414,7 +3457,7 @@ export type MeterReadingPacketInfoPageOutput = {
|
||||
dataBaseName?: (string) | null;
|
||||
/**
|
||||
* 数据类型,用于构建存储路径
|
||||
* JiShe.ServicePro.Consts.IoTDBDataTypeConst
|
||||
* JiShe.ServicePro.Core.IoTDBDataTypeConst
|
||||
*/
|
||||
ioTDataType?: (string) | null;
|
||||
/**
|
||||
@ -3985,6 +4028,40 @@ export type OneNetProductInfoModifyInput = {
|
||||
thingModelFileName?: (string) | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* 开放接口单个设备入参信息
|
||||
*/
|
||||
export type OpenApiDeviceInfoInput = {
|
||||
/**
|
||||
* 网关设备或直连设备地址,此数据自研设备在生产的时候就已经入库
|
||||
*/
|
||||
deviceAddress?: (string) | null;
|
||||
/**
|
||||
* 业务系统设备数据Id,一般指集中器Id
|
||||
*/
|
||||
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;
|
||||
maximum?: (string) | null;
|
||||
regex?: (string) | null;
|
||||
isNullable?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -5341,7 +5419,7 @@ export type QueryCTWingAepReceiveMessageInput = {
|
||||
isPage?: boolean;
|
||||
/**
|
||||
* 数据类型,用于构建存储路径
|
||||
* JiShe.ServicePro.Consts.IoTDBDataTypeConst
|
||||
* JiShe.ServicePro.Core.IoTDBDataTypeConst
|
||||
*/
|
||||
ioTDataType?: (string) | null;
|
||||
deviceType?: DeviceTypeEnum;
|
||||
@ -5377,7 +5455,7 @@ export type QueryCTWingAepReceiveMessageOutput = {
|
||||
dataBaseName?: (string) | null;
|
||||
/**
|
||||
* 数据类型,用于构建存储路径
|
||||
* JiShe.ServicePro.Consts.IoTDBDataTypeConst
|
||||
* JiShe.ServicePro.Core.IoTDBDataTypeConst
|
||||
*/
|
||||
ioTDataType?: (string) | null;
|
||||
/**
|
||||
@ -5501,7 +5579,7 @@ export type QueryOneNETReceiveMessageInput = {
|
||||
isPage?: boolean;
|
||||
/**
|
||||
* 数据类型,用于构建存储路径
|
||||
* JiShe.ServicePro.Consts.IoTDBDataTypeConst
|
||||
* JiShe.ServicePro.Core.IoTDBDataTypeConst
|
||||
*/
|
||||
ioTDataType?: (string) | null;
|
||||
deviceType?: DeviceTypeEnum;
|
||||
@ -5537,7 +5615,7 @@ export type QueryOneNETReceiveMessageOutput = {
|
||||
dataBaseName?: (string) | null;
|
||||
/**
|
||||
* 数据类型,用于构建存储路径
|
||||
* JiShe.ServicePro.Consts.IoTDBDataTypeConst
|
||||
* JiShe.ServicePro.Core.IoTDBDataTypeConst
|
||||
*/
|
||||
ioTDataType?: (string) | null;
|
||||
/**
|
||||
@ -6612,6 +6690,16 @@ export type GetAggregationDeviceDownloadFirmwareResponse = (RemoteStreamContent)
|
||||
|
||||
export type GetAggregationDeviceDownloadFirmwareError = unknown;
|
||||
|
||||
export type PostAggregationDeviceBindingDeviceThingModelData = {
|
||||
query?: {
|
||||
input?: BindingDeviceThingModelInput;
|
||||
};
|
||||
};
|
||||
|
||||
export type PostAggregationDeviceBindingDeviceThingModelResponse = (boolean);
|
||||
|
||||
export type PostAggregationDeviceBindingDeviceThingModelError = unknown;
|
||||
|
||||
export type PostFirmwareInfoCreateAsyncData = {
|
||||
query?: {
|
||||
input?: CreateDeviceFirmwareInfoInput;
|
||||
@ -6706,16 +6794,6 @@ export type PostDeviceInfoCacheDeviceDataToRedisResponse = (boolean);
|
||||
|
||||
export type PostDeviceInfoCacheDeviceDataToRedisError = unknown;
|
||||
|
||||
export type PostDeviceInfoBindingDeviceThingModelData = {
|
||||
query?: {
|
||||
input?: BindingDeviceThingModelInput;
|
||||
};
|
||||
};
|
||||
|
||||
export type PostDeviceInfoBindingDeviceThingModelResponse = (boolean);
|
||||
|
||||
export type PostDeviceInfoBindingDeviceThingModelError = unknown;
|
||||
|
||||
export type PostDeviceThingModelManagementCreateAsyncData = {
|
||||
query?: {
|
||||
input?: DeviceThingModelCreateInput;
|
||||
@ -7204,6 +7282,16 @@ export type PostIoTplatformThingModelInfoStandardThingModelPageAsyncResponse = (
|
||||
|
||||
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 PostLanguagesAllError = (RemoteServiceErrorResponse);
|
||||
|
||||
@ -226,6 +226,8 @@
|
||||
"StandardFieldName": "StandardFieldName",
|
||||
"StandardFieldDisplayName": "StandardFieldDisplayName",
|
||||
"IsValueNeedConvert": "IsValueNeedConvert",
|
||||
"AccessMode": "AccessMode",
|
||||
"IsOperableIdentifier": "IsOperableIdentifier",
|
||||
"StandardFieldValueType": "StandardFieldValueType",
|
||||
"copyStandardThingModel": "CopyStandardThingModel",
|
||||
"copyAnotherThingModelModal": "CopyAnotherThingModelModal"
|
||||
|
||||
@ -219,6 +219,8 @@
|
||||
"StandardFieldName": "标准物模型编码",
|
||||
"StandardFieldDisplayName": "标准物模型名称",
|
||||
"IsValueNeedConvert": "是否需要值类型转换",
|
||||
"AccessMode": "访问模式",
|
||||
"IsOperableIdentifier": "是否可操作物模型标识符",
|
||||
"StandardFieldValueType": "标准物模型值类型",
|
||||
"copyStandardThingModel": "复制标准模型",
|
||||
"copyAnotherThingModelModal": "复制已有模型"
|
||||
|
||||
@ -22,6 +22,7 @@ import { useVbenForm } from '#/adapter/form';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
postAggregationDeviceBatchCreateAsync,
|
||||
postAggregationDeviceBindingDeviceThingModel,
|
||||
postAggregationDeviceCreateAsync,
|
||||
postAggregationDeviceDeleteAsync,
|
||||
postAggregationDeviceDeviceBatchUpgradeForApiAsync,
|
||||
@ -29,7 +30,6 @@ import {
|
||||
postAggregationDeviceDeviceUpgradeForApiAsync,
|
||||
postAggregationDeviceGetDevicePropertyValueForApiAsync,
|
||||
postAggregationDeviceRepushDeviceInfoToIoTplatform,
|
||||
postDeviceInfoBindingDeviceThingModel,
|
||||
postDeviceInfoCacheDeviceDataToRedis,
|
||||
postDeviceInfoPage,
|
||||
postIoTplatformThingModelInfoPageAsync,
|
||||
@ -345,6 +345,10 @@ const commandTableColumns = computed(() => [
|
||||
key: 'commandValue',
|
||||
width: 200,
|
||||
customRender: ({ record }: any) => {
|
||||
// 只读模式(r)时隐藏指令内容输入框
|
||||
if (record.accessMode === 'r') {
|
||||
return h('span', { style: { color: '#999' } }, '只读属性,无法设置指令');
|
||||
}
|
||||
return h(Input, {
|
||||
value: record.commandValue,
|
||||
placeholder: '请输入指令内容',
|
||||
@ -388,15 +392,11 @@ const commandTableColumns = computed(() => [
|
||||
width: 200,
|
||||
fixed: 'right' as const,
|
||||
customRender: ({ record }: any) => {
|
||||
return h(
|
||||
'div',
|
||||
{
|
||||
style: {
|
||||
display: 'flex',
|
||||
gap: '8px',
|
||||
},
|
||||
},
|
||||
[
|
||||
const buttons = [];
|
||||
|
||||
// 读写模式(rw)和只写模式(w)都可以发送指令
|
||||
if (record.accessMode === 'rw' || record.accessMode === 'w') {
|
||||
buttons.push(
|
||||
h(
|
||||
Button,
|
||||
{
|
||||
@ -407,6 +407,12 @@ const commandTableColumns = computed(() => [
|
||||
},
|
||||
{ default: () => '发送指令' },
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 只读模式(r)和读写模式(rw)可以抄读数据,只写模式(w)不能抄读
|
||||
if (record.accessMode === 'r' || record.accessMode === 'rw') {
|
||||
buttons.push(
|
||||
h(
|
||||
Button,
|
||||
{
|
||||
@ -416,7 +422,18 @@ const commandTableColumns = computed(() => [
|
||||
},
|
||||
{ default: () => '抄读数据' },
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
return h(
|
||||
'div',
|
||||
{
|
||||
style: {
|
||||
display: 'flex',
|
||||
gap: '8px',
|
||||
},
|
||||
},
|
||||
buttons,
|
||||
);
|
||||
},
|
||||
},
|
||||
@ -434,6 +451,7 @@ interface ThingModelProperty {
|
||||
result: string; // 返回结果
|
||||
loading?: boolean; // 是否正在加载
|
||||
selected?: boolean; // 是否选中
|
||||
accessMode?: string; // 访问模式:rw-读写,r-只读
|
||||
}
|
||||
|
||||
const thingModelProperties = ref<ThingModelProperty[]>([]);
|
||||
@ -467,6 +485,7 @@ const fetchThingModelProperties = async (row: Record<string, any>) => {
|
||||
pageIndex: 1,
|
||||
pageSize: 1000, // 获取所有数据
|
||||
IsPage: false, // 不分页
|
||||
IsOperableIdentifier: true, // 不分页
|
||||
ioTPlatform:
|
||||
typeof row.ioTPlatform === 'string'
|
||||
? Number.parseInt(row.ioTPlatform)
|
||||
@ -487,6 +506,7 @@ const fetchThingModelProperties = async (row: Record<string, any>) => {
|
||||
result: '',
|
||||
loading: false,
|
||||
selected: false,
|
||||
accessMode: item.accessMode || '', // 保存访问模式
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error('获取平台物模型属性失败:', error);
|
||||
@ -508,17 +528,19 @@ const [UserModal, userModalApi] = useVbenModal({
|
||||
|
||||
// 批量发送指令
|
||||
const submitBatchCommand = async () => {
|
||||
// 获取所有选中的行,并过滤掉值为空的
|
||||
// 获取所有选中的行,并过滤掉值为空的,同时排除只读属性(accessMode === 'r')
|
||||
// 允许读写模式(rw)和只写模式(w)
|
||||
const selectedProperties = thingModelProperties.value.filter(
|
||||
(prop) =>
|
||||
prop.selected &&
|
||||
prop.ioTPlatformRawFieldName &&
|
||||
(prop.accessMode === 'rw' || prop.accessMode === 'w') && // 允许读写模式和只写模式
|
||||
prop.commandValue &&
|
||||
prop.commandValue.trim() !== '',
|
||||
);
|
||||
|
||||
if (selectedProperties.length === 0) {
|
||||
Message.warning('请至少选择一个已填写指令内容的属性');
|
||||
Message.warning('请至少选择一个已填写指令内容的可写属性(只读属性无法发送指令)');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -569,7 +591,8 @@ const submitBatchCommand = async () => {
|
||||
|
||||
const [CommandModal, commandModalApi] = useVbenModal({
|
||||
draggable: true,
|
||||
onConfirm: submitBatchCommand,
|
||||
showCancelButton: false,
|
||||
showOkButton: false,
|
||||
onBeforeClose: () => {
|
||||
commandRow.value = {};
|
||||
thingModelProperties.value = [];
|
||||
@ -585,6 +608,9 @@ const [CommandModal, commandModalApi] = useVbenModal({
|
||||
},
|
||||
});
|
||||
|
||||
// 获取命令弹窗的状态
|
||||
const commandModalState = commandModalApi.useStore();
|
||||
|
||||
// 设备绑定设备端物模型弹窗
|
||||
const [BindModal, bindModalApi] = useVbenModal({
|
||||
draggable: true,
|
||||
@ -1398,9 +1424,7 @@ const openBindModal = async (
|
||||
const allSameModel =
|
||||
allNeedConfig &&
|
||||
!!firstModelId &&
|
||||
selectedRows.every(
|
||||
(row) => row.deviceThingModelDataId === firstModelId,
|
||||
);
|
||||
selectedRows.every((row) => row.deviceThingModelDataId === firstModelId);
|
||||
|
||||
isNeedConfigDevicMdoel = allNeedConfig;
|
||||
deviceThingModelDataId = allSameModel ? String(firstModelId) : undefined;
|
||||
@ -1422,6 +1446,14 @@ const openBindModal = async (
|
||||
|
||||
// 发送指令
|
||||
const sendCommand = async (property: ThingModelProperty) => {
|
||||
// 检查是否为只读属性
|
||||
if (property.accessMode === 'r') {
|
||||
Message.warning('该属性为只读模式,无法发送指令');
|
||||
return;
|
||||
}
|
||||
|
||||
// 只写模式(w)和读写模式(rw)都可以发送指令,这里不需要额外检查
|
||||
|
||||
if (!property.commandValue || property.commandValue.trim() === '') {
|
||||
Message.warning('请输入指令内容');
|
||||
return;
|
||||
@ -1468,6 +1500,12 @@ const sendCommand = async (property: ThingModelProperty) => {
|
||||
|
||||
// 抄读数据
|
||||
const readData = async (property: ThingModelProperty) => {
|
||||
// 检查是否为只写属性
|
||||
if (property.accessMode === 'w') {
|
||||
Message.warning('该属性为只写模式,无法抄读数据');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!property.ioTPlatformRawFieldName) {
|
||||
Message.warning('该属性缺少平台字段名,无法抄读数据');
|
||||
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() {
|
||||
const formValues = await bindFormApi.getValues();
|
||||
@ -1545,7 +1662,7 @@ async function submitBindDeviceThingModel() {
|
||||
|
||||
try {
|
||||
bindModalApi.setState({ loading: true, confirmLoading: true });
|
||||
const result = await postDeviceInfoBindingDeviceThingModel({
|
||||
const result = await postAggregationDeviceBindingDeviceThingModel({
|
||||
body: {
|
||||
devieDataIdList: deviceIds,
|
||||
isNeedConfigDevicMdoel: isNeedConfig,
|
||||
@ -2065,6 +2182,19 @@ const toolbarActions = computed(() => [
|
||||
<Table :columns="commandTableColumns" :data-source="filteredThingModelProperties" :pagination="false"
|
||||
:scroll="{ x: 1000, y: 500 }" row-key="id" size="small" />
|
||||
</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>
|
||||
<UpgradeModal title="设备升级" class="w-[600px]">
|
||||
<UpgradeForm />
|
||||
@ -2075,11 +2205,7 @@ const toolbarActions = computed(() => [
|
||||
已选择 {{ bindRows.length }} 个设备:
|
||||
</div>
|
||||
<div class="max-h-32 overflow-y-auto text-xs text-blue-600">
|
||||
<div
|
||||
v-for="(row, index) in bindRows"
|
||||
:key="row.id || index"
|
||||
class="mb-1"
|
||||
>
|
||||
<div v-for="(row, index) in bindRows" :key="row.id || index" class="mb-1">
|
||||
<div>
|
||||
{{ index + 1 }}.
|
||||
{{ row.deviceName || row.deviceAddress || row.id }}
|
||||
|
||||
@ -50,7 +50,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
},
|
||||
{
|
||||
field: 'propertyArray',
|
||||
title: '属性标识符集合',
|
||||
title: '平台端属性标识符集合',
|
||||
minWidth: 200,
|
||||
showOverflow: 'tooltip',
|
||||
formatter: ({ cellValue }: { cellValue: any }) => {
|
||||
@ -89,13 +89,15 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
if (!deviceThingModelId.value) {
|
||||
return { items: [], totalCount: 0 };
|
||||
}
|
||||
const { data } = await postDeviceThingModelManagementCommandPageAsync({
|
||||
body: {
|
||||
pageIndex: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
deviceThingModelId: deviceThingModelId.value,
|
||||
const { data } = await postDeviceThingModelManagementCommandPageAsync(
|
||||
{
|
||||
body: {
|
||||
pageIndex: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
deviceThingModelId: deviceThingModelId.value,
|
||||
},
|
||||
},
|
||||
});
|
||||
);
|
||||
return data || { items: [], totalCount: 0 };
|
||||
},
|
||||
},
|
||||
@ -121,9 +123,10 @@ const [CommandFormModal, commandFormModalApi] = useVbenModal({
|
||||
// 编辑模式下,加载指令详情
|
||||
nextTick(async () => {
|
||||
try {
|
||||
const { data } = await postDeviceThingModelManagementCommandFindByIdAsync({
|
||||
body: { id: editRow.value.id },
|
||||
});
|
||||
const { data } =
|
||||
await postDeviceThingModelManagementCommandFindByIdAsync({
|
||||
body: { id: editRow.value.id },
|
||||
});
|
||||
if (data) {
|
||||
const values: any = { ...data };
|
||||
// 处理 propertyArray 字段
|
||||
@ -169,13 +172,13 @@ async function loadPropertyOptions() {
|
||||
pageIndex: 1,
|
||||
pageSize: 1000,
|
||||
deviceThingModelId: deviceThingModelId.value,
|
||||
isPage:false
|
||||
isPage: false,
|
||||
},
|
||||
});
|
||||
const items = data?.items || [];
|
||||
propertyOptions.value = items.map((item: any) => ({
|
||||
label: `${item.standardFieldDisplayName || item.standardFieldName} (${item.standardFieldName})`,
|
||||
value: item.ioTPlatformRawFieldName
|
||||
value: item.ioTPlatformRawFieldName,
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error('加载属性列表失败:', error);
|
||||
@ -197,29 +200,35 @@ const [CommandForm, commandFormApi] = useVbenForm({
|
||||
component: 'Input',
|
||||
fieldName: 'commandName',
|
||||
label: '指令名称',
|
||||
rules: z
|
||||
.preprocess((v) => (v == null ? '' : v), z.string().min(1, $t('common.required'))),
|
||||
rules: z.preprocess(
|
||||
(v) => (v == null ? '' : v),
|
||||
z.string().min(1, $t('common.required')),
|
||||
),
|
||||
componentProps: {
|
||||
placeholder: $t('common.pleaseInput') + '指令名称',
|
||||
placeholder: `${$t('common.pleaseInput')}指令名称`,
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Textarea',
|
||||
fieldName: 'issueCommand',
|
||||
label: '下发指令',
|
||||
rules: z
|
||||
.preprocess((v) => (v == null ? '' : v), z.string().min(1, $t('common.required'))),
|
||||
rules: z.preprocess(
|
||||
(v) => (v == null ? '' : v),
|
||||
z.string().min(1, $t('common.required')),
|
||||
),
|
||||
componentProps: {
|
||||
rows: 4,
|
||||
placeholder: $t('common.pleaseInput') + '下发指令(完整的单个下发指令)',
|
||||
placeholder: `${$t('common.pleaseInput')}下发指令(完整的单个下发指令)`,
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
fieldName: 'propertyArray',
|
||||
label: '属性标识符集合',
|
||||
rules: z
|
||||
.preprocess((v) => (v == null ? [] : v), z.array(z.string()).min(1, '请至少选择一个属性标识符')),
|
||||
rules: z.preprocess(
|
||||
(v) => (v == null ? [] : v),
|
||||
z.array(z.string()).min(1, '请至少选择一个属性标识符'),
|
||||
),
|
||||
// 使用函数形式,保证 options 能随着 propertyOptions 的变化而更新
|
||||
componentProps: () => ({
|
||||
mode: 'multiple',
|
||||
@ -264,9 +273,9 @@ async function submitCommand() {
|
||||
// 确保 propertyArray 是数组格式
|
||||
propertyArray: Array.isArray(formValues.propertyArray)
|
||||
? formValues.propertyArray
|
||||
: formValues.propertyArray
|
||||
: (formValues.propertyArray
|
||||
? [formValues.propertyArray]
|
||||
: [],
|
||||
: []),
|
||||
...(isEdit && { id: editRow.value.id }),
|
||||
};
|
||||
|
||||
@ -286,15 +295,11 @@ async function submitCommand() {
|
||||
await gridApi.reload();
|
||||
}
|
||||
} else {
|
||||
Message.error(
|
||||
isEdit ? $t('common.editFail') : $t('common.addFail'),
|
||||
);
|
||||
Message.error(isEdit ? $t('common.editFail') : $t('common.addFail'));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('提交指令失败:', error);
|
||||
Message.error(
|
||||
isEdit ? $t('common.editFail') : $t('common.addFail'),
|
||||
);
|
||||
Message.error(isEdit ? $t('common.editFail') : $t('common.addFail'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -340,50 +345,43 @@ const [Modal, modalApi] = useVbenModal({
|
||||
<Modal :title="`指令管理 - ${deviceModelName || ''}`" class="w-[900px]">
|
||||
<Grid>
|
||||
<template #toolbar-actions>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('common.add'),
|
||||
type: 'primary',
|
||||
icon: 'ant-design:plus-outlined',
|
||||
onClick: openAddCommandModal,
|
||||
auth: ['AbpIdentity.Users.Create'],
|
||||
},
|
||||
]"
|
||||
/>
|
||||
<TableAction :actions="[
|
||||
{
|
||||
label: $t('common.add'),
|
||||
type: 'primary',
|
||||
icon: 'ant-design:plus-outlined',
|
||||
onClick: openAddCommandModal,
|
||||
auth: ['AbpIdentity.Users.Create'],
|
||||
},
|
||||
]" />
|
||||
</template>
|
||||
|
||||
<template #action="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
type: 'link',
|
||||
size: 'small',
|
||||
auth: ['AbpIdentity.Users.Update'],
|
||||
onClick: openEditCommandModal.bind(null, row),
|
||||
<TableAction :actions="[
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
type: 'link',
|
||||
size: 'small',
|
||||
auth: ['AbpIdentity.Users.Update'],
|
||||
onClick: openEditCommandModal.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
icon: 'ant-design:delete-outlined',
|
||||
type: 'link',
|
||||
size: 'small',
|
||||
auth: ['AbpIdentity.Users.Delete'],
|
||||
popConfirm: {
|
||||
title: $t('common.askConfirmDelete'),
|
||||
confirm: onDeleteCommand.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
icon: 'ant-design:delete-outlined',
|
||||
type: 'link',
|
||||
size: 'small',
|
||||
auth: ['AbpIdentity.Users.Delete'],
|
||||
popConfirm: {
|
||||
title: $t('common.askConfirmDelete'),
|
||||
confirm: onDeleteCommand.bind(null, row),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
},
|
||||
]" />
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
<!-- 指令新增/编辑弹窗 -->
|
||||
<CommandFormModal
|
||||
:title="editRow.id ? $t('common.edit') : $t('common.add')"
|
||||
class="w-[800px]"
|
||||
>
|
||||
<CommandFormModal :title="editRow.id ? $t('common.edit') : $t('common.add')" class="w-[800px]">
|
||||
<CommandForm />
|
||||
</CommandFormModal>
|
||||
</Modal>
|
||||
|
||||
@ -237,6 +237,7 @@ const [TestScriptModal, testScriptModalApi] = useVbenModal({
|
||||
footer: true,
|
||||
showCancelButton: true,
|
||||
showConfirmButton: true,
|
||||
confirmText: '函数测试',
|
||||
onConfirm: submitTestScript,
|
||||
onBeforeClose: () => {
|
||||
return true;
|
||||
@ -347,6 +348,11 @@ async function submit() {
|
||||
}
|
||||
|
||||
async function onEdit(record: any) {
|
||||
// 如果已启用函数解析,禁止编辑
|
||||
if (record.functionAnalysisFlag === true) {
|
||||
Message.warning('已启用函数解析的数据不允许编辑');
|
||||
return;
|
||||
}
|
||||
editRow.value = record;
|
||||
thingModelModalApi.open();
|
||||
}
|
||||
@ -625,6 +631,7 @@ onMounted(async () => {
|
||||
type: 'link',
|
||||
size: 'small',
|
||||
auth: ['AbpIdentity.Users.Update'],
|
||||
disabled: row.functionAnalysisFlag === true,
|
||||
onClick: onEdit.bind(null, row),
|
||||
},
|
||||
{
|
||||
@ -694,18 +701,24 @@ onMounted(async () => {
|
||||
</ThingModelModal>
|
||||
|
||||
<!-- 函数脚本测试弹窗 -->
|
||||
<TestScriptModal title="函数脚本测试" class="w-[900px]">
|
||||
<div v-if="testDeviceModelName" class="mb-2 flex items-center justify-between text-base font-semibold">
|
||||
<span>设备端物模型:{{ testDeviceModelName }}</span>
|
||||
<Button v-if="testDeviceThingModelId" type="primary" @click="updateFunctionScript">
|
||||
更新函数
|
||||
</Button>
|
||||
<TestScriptModal title="函数脚本测试(函数代码中的函数名要与函数名称表单值一致)" class="w-[900px]">
|
||||
<div v-if="testDeviceModelName" class="mb-2 text-base font-semibold">
|
||||
设备端物模型:{{ testDeviceModelName }}
|
||||
</div>
|
||||
<TestScriptForm />
|
||||
<div v-if="testResult" class="mt-4">
|
||||
<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>
|
||||
</div>
|
||||
<template #center-footer>
|
||||
<Button
|
||||
v-if="testDeviceThingModelId"
|
||||
type="primary"
|
||||
@click="updateFunctionScript"
|
||||
>
|
||||
更新函数
|
||||
</Button>
|
||||
</template>
|
||||
</TestScriptModal>
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
@ -464,12 +464,6 @@ onMounted(async () => {
|
||||
|
||||
// 新增和编辑提交的逻辑
|
||||
async function submit() {
|
||||
// 检查是否有产品ID
|
||||
if (!productId.value) {
|
||||
Message.error('产品ID不存在,无法保存物模型信息');
|
||||
return;
|
||||
}
|
||||
|
||||
const isEdit = !!editRow.value.id;
|
||||
const formApi = isEdit ? editFormApi : addFormApi;
|
||||
const api = isEdit
|
||||
@ -478,12 +472,55 @@ async function submit() {
|
||||
const { valid } = await formApi.validate();
|
||||
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 fetchParams: any = {
|
||||
...formValues,
|
||||
// 自动添加平台和产品信息
|
||||
ioTPlatform: Number.parseInt(ioTPlatform.value) as 1 | 2,
|
||||
ioTPlatformProductId: productId.value,
|
||||
ioTPlatform: finalPlatform,
|
||||
ioTPlatformProductId: finalProductId,
|
||||
// 编辑时需要添加ID
|
||||
...(isEdit && { id: editRow.value.id }),
|
||||
};
|
||||
|
||||
@ -152,6 +152,7 @@ export const tableSchema = computed(() => [
|
||||
DateTime: '日期时间',
|
||||
Object: 'JSON对象',
|
||||
Array: '数组',
|
||||
Struct: '结构体',
|
||||
};
|
||||
return typeMap[cellValue] || cellValue;
|
||||
},
|
||||
@ -162,6 +163,26 @@ export const tableSchema = computed(() => [
|
||||
minWidth: 120,
|
||||
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',
|
||||
title: $t('common.creationTime'),
|
||||
@ -318,7 +339,7 @@ export const getAddThingModelFormSchema = (
|
||||
// 优先从表单值获取(这是最可靠的方式,因为值是在打开弹窗时设置的)
|
||||
let platform = formValues?._ioTPlatform;
|
||||
let productId = formValues?._ioTPlatformProductId;
|
||||
let filedType = formValues?.filedType;
|
||||
const filedType = formValues?.filedType;
|
||||
|
||||
// 如果表单值中没有,尝试从其他字段获取
|
||||
if (!platform && formValues?.ioTPlatform) {
|
||||
@ -448,6 +469,48 @@ export const getAddThingModelFormSchema = (
|
||||
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',
|
||||
fieldName: 'ioTPlatformRawFieldDataType',
|
||||
@ -639,7 +702,7 @@ export const getEditThingModelFormSchema = (
|
||||
// 优先从表单值获取(这是最可靠的方式,因为值是在打开弹窗时设置的)
|
||||
let platform = formValues?._ioTPlatform;
|
||||
let productId = formValues?._ioTPlatformProductId;
|
||||
let filedType = formValues?.filedType;
|
||||
const filedType = formValues?.filedType;
|
||||
|
||||
// 如果表单值中没有,尝试从其他字段获取
|
||||
if (!platform && formValues?.ioTPlatform) {
|
||||
@ -768,6 +831,47 @@ export const getEditThingModelFormSchema = (
|
||||
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',
|
||||
fieldName: 'ioTPlatformRawFieldDataType',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user