Compare commits
2 Commits
f54c055199
...
c09ca5eab0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c09ca5eab0 | ||
|
|
d672ea04aa |
@ -996,6 +996,7 @@ export const CTWingPrivateProductInfoDtoSchema = {
|
||||
deviceThingModelFileId: {
|
||||
type: 'string',
|
||||
description: '设备物模型文件Id',
|
||||
format: 'uuid',
|
||||
nullable: true
|
||||
},
|
||||
deviceThingModelFileName: {
|
||||
@ -1051,6 +1052,7 @@ export const CTWingPrivateProductInfoInsertInputSchema = {
|
||||
deviceThingModelFileId: {
|
||||
type: 'string',
|
||||
description: '设备物模型文件Id',
|
||||
format: 'uuid',
|
||||
nullable: true
|
||||
},
|
||||
deviceThingModelFileName: {
|
||||
@ -1139,6 +1141,7 @@ export const CTWingPrivateProductInfoModifyInputSchema = {
|
||||
deviceThingModelFileId: {
|
||||
type: 'string',
|
||||
description: '设备物模型文件Id',
|
||||
format: 'uuid',
|
||||
nullable: true
|
||||
},
|
||||
deviceThingModelFileName: {
|
||||
@ -1427,6 +1430,53 @@ export const CreateDeviceAggregationInputSchema = {
|
||||
description: '设备聚合新增设备'
|
||||
} as const;
|
||||
|
||||
export const CreateDeviceFirmwareInfoInputSchema = {
|
||||
required: ['firmwareFileId', 'firmwareFileName', 'firmwareHashCode', 'firmwareLength', 'firmwareVersion', 'ioTPlatform', 'ioTPlatformProductId', 'ioTPlatformProductName'],
|
||||
type: 'object',
|
||||
properties: {
|
||||
ioTPlatform: {
|
||||
'$ref': '#/components/schemas/IoTPlatformTypeEnum'
|
||||
},
|
||||
ioTPlatformProductId: {
|
||||
minLength: 1,
|
||||
type: 'string',
|
||||
description: '物联网平台中对应的产品Id'
|
||||
},
|
||||
ioTPlatformProductName: {
|
||||
minLength: 1,
|
||||
type: 'string',
|
||||
description: '物联网平台中对应的产品名称'
|
||||
},
|
||||
firmwareVersion: {
|
||||
minLength: 1,
|
||||
type: 'string',
|
||||
description: '固件版本'
|
||||
},
|
||||
firmwareFileId: {
|
||||
type: 'string',
|
||||
description: '固件文件Id',
|
||||
format: 'uuid'
|
||||
},
|
||||
firmwareFileName: {
|
||||
minLength: 1,
|
||||
type: 'string',
|
||||
description: '固件文件名称'
|
||||
},
|
||||
firmwareHashCode: {
|
||||
minLength: 1,
|
||||
type: 'string',
|
||||
description: '固件哈希值'
|
||||
},
|
||||
firmwareLength: {
|
||||
type: 'integer',
|
||||
description: '固件文件长度',
|
||||
format: 'int64'
|
||||
}
|
||||
},
|
||||
additionalProperties: false,
|
||||
description: '创建设备固件信息'
|
||||
} as const;
|
||||
|
||||
export const CreateLanguageInputSchema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
@ -1975,6 +2025,144 @@ export const DeviceCommandForApiInputSchema = {
|
||||
description: '设备命令'
|
||||
} as const;
|
||||
|
||||
export const DeviceFirmwareInfoDtoSchema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {
|
||||
type: 'string',
|
||||
format: 'uuid'
|
||||
},
|
||||
creationTime: {
|
||||
type: 'string',
|
||||
format: 'date-time'
|
||||
},
|
||||
creatorId: {
|
||||
type: 'string',
|
||||
format: 'uuid',
|
||||
nullable: true
|
||||
},
|
||||
lastModificationTime: {
|
||||
type: 'string',
|
||||
format: 'date-time',
|
||||
nullable: true
|
||||
},
|
||||
lastModifierId: {
|
||||
type: 'string',
|
||||
format: 'uuid',
|
||||
nullable: true
|
||||
},
|
||||
isDeleted: {
|
||||
type: 'boolean'
|
||||
},
|
||||
deleterId: {
|
||||
type: 'string',
|
||||
format: 'uuid',
|
||||
nullable: true
|
||||
},
|
||||
deletionTime: {
|
||||
type: 'string',
|
||||
format: 'date-time',
|
||||
nullable: true
|
||||
},
|
||||
tenantId: {
|
||||
type: 'string',
|
||||
description: '租户Id',
|
||||
format: 'uuid',
|
||||
nullable: true
|
||||
},
|
||||
remark: {
|
||||
type: 'string',
|
||||
description: '备注',
|
||||
nullable: true
|
||||
},
|
||||
osaCreatorId: {
|
||||
type: 'integer',
|
||||
description: '旧系统授权创建者Id',
|
||||
format: 'int32',
|
||||
nullable: true
|
||||
},
|
||||
osaLastModifierId: {
|
||||
type: 'integer',
|
||||
description: '旧系统授权最后修改者Id',
|
||||
format: 'int32',
|
||||
nullable: true
|
||||
},
|
||||
osaDeleterId: {
|
||||
type: 'integer',
|
||||
description: '旧系统授权最后删除者Id',
|
||||
format: 'int32',
|
||||
nullable: true
|
||||
},
|
||||
extraProperties: {
|
||||
type: 'object',
|
||||
additionalProperties: {},
|
||||
description: '扩展属性,用于存储自定义字段,JSON格式',
|
||||
nullable: true
|
||||
},
|
||||
ioTPlatform: {
|
||||
'$ref': '#/components/schemas/IoTPlatformTypeEnum'
|
||||
},
|
||||
ioTPlatformProductId: {
|
||||
type: 'string',
|
||||
description: '物联网平台中对应的产品Id',
|
||||
nullable: true
|
||||
},
|
||||
ioTPlatformProductName: {
|
||||
type: 'string',
|
||||
description: '物联网平台中对应的产品名称',
|
||||
nullable: true
|
||||
},
|
||||
firmwareVersion: {
|
||||
type: 'string',
|
||||
description: '固件版本',
|
||||
nullable: true
|
||||
},
|
||||
firmwareFileId: {
|
||||
type: 'string',
|
||||
description: '固件文件Id',
|
||||
format: 'uuid'
|
||||
},
|
||||
firmwareFileName: {
|
||||
type: 'string',
|
||||
description: '固件文件名称',
|
||||
nullable: true
|
||||
},
|
||||
firmwareHashCode: {
|
||||
type: 'string',
|
||||
description: '固件哈希值',
|
||||
nullable: true
|
||||
},
|
||||
firmwareLength: {
|
||||
type: 'integer',
|
||||
description: '固件文件长度',
|
||||
format: 'int64'
|
||||
},
|
||||
isEnable: {
|
||||
type: 'boolean',
|
||||
description: '是否启用'
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
} as const;
|
||||
|
||||
export const DeviceFirmwareInfoDtoPagedResultDtoSchema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
items: {
|
||||
type: 'array',
|
||||
items: {
|
||||
'$ref': '#/components/schemas/DeviceFirmwareInfoDto'
|
||||
},
|
||||
nullable: true
|
||||
},
|
||||
totalCount: {
|
||||
type: 'integer',
|
||||
format: 'int64'
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
} as const;
|
||||
|
||||
export const DeviceManagementInfoDtoSchema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
@ -2160,6 +2348,22 @@ export const DeviceManagementInfoDtoSchema = {
|
||||
type: 'string',
|
||||
description: '设备物模型名称',
|
||||
nullable: true
|
||||
},
|
||||
firmwareVersion: {
|
||||
type: 'string',
|
||||
description: '固件版本',
|
||||
nullable: true
|
||||
},
|
||||
upgradeDate: {
|
||||
type: 'string',
|
||||
description: '升级日期',
|
||||
format: 'date-time',
|
||||
nullable: true
|
||||
},
|
||||
securityKey: {
|
||||
type: 'string',
|
||||
description: '设备接入鉴权key',
|
||||
nullable: true
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
@ -3295,6 +3499,219 @@ export const DeviceTypeEnumSchema = {
|
||||
'说明:': '未知=0,网关设备=1,直连设备=2,子设备=3'
|
||||
} as const;
|
||||
|
||||
export const DeviceUpgradeForApiInputSchema = {
|
||||
required: ['id', 'ioTPlatform', 'ioTPlatformProductId', 'nowFirmwareVersionDataId'],
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {
|
||||
type: 'string',
|
||||
format: 'uuid'
|
||||
},
|
||||
ioTPlatform: {
|
||||
'$ref': '#/components/schemas/IoTPlatformTypeEnum'
|
||||
},
|
||||
ioTPlatformProductId: {
|
||||
minLength: 1,
|
||||
type: 'string',
|
||||
description: '物联网平台中对应的产品Id'
|
||||
},
|
||||
nowFirmwareVersionDataId: {
|
||||
type: 'string',
|
||||
description: '固件版本信息',
|
||||
format: 'uuid'
|
||||
}
|
||||
},
|
||||
additionalProperties: false,
|
||||
description: '设备升级'
|
||||
} as const;
|
||||
|
||||
export const DeviceUpgradeRecordDtoSchema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {
|
||||
type: 'string',
|
||||
format: 'uuid'
|
||||
},
|
||||
creationTime: {
|
||||
type: 'string',
|
||||
format: 'date-time'
|
||||
},
|
||||
creatorId: {
|
||||
type: 'string',
|
||||
format: 'uuid',
|
||||
nullable: true
|
||||
},
|
||||
lastModificationTime: {
|
||||
type: 'string',
|
||||
format: 'date-time',
|
||||
nullable: true
|
||||
},
|
||||
lastModifierId: {
|
||||
type: 'string',
|
||||
format: 'uuid',
|
||||
nullable: true
|
||||
},
|
||||
isDeleted: {
|
||||
type: 'boolean'
|
||||
},
|
||||
deleterId: {
|
||||
type: 'string',
|
||||
format: 'uuid',
|
||||
nullable: true
|
||||
},
|
||||
deletionTime: {
|
||||
type: 'string',
|
||||
format: 'date-time',
|
||||
nullable: true
|
||||
},
|
||||
tenantId: {
|
||||
type: 'string',
|
||||
description: '租户Id',
|
||||
format: 'uuid',
|
||||
nullable: true
|
||||
},
|
||||
remark: {
|
||||
type: 'string',
|
||||
description: '备注',
|
||||
nullable: true
|
||||
},
|
||||
osaCreatorId: {
|
||||
type: 'integer',
|
||||
description: '旧系统授权创建者Id',
|
||||
format: 'int32',
|
||||
nullable: true
|
||||
},
|
||||
osaLastModifierId: {
|
||||
type: 'integer',
|
||||
description: '旧系统授权最后修改者Id',
|
||||
format: 'int32',
|
||||
nullable: true
|
||||
},
|
||||
osaDeleterId: {
|
||||
type: 'integer',
|
||||
description: '旧系统授权最后删除者Id',
|
||||
format: 'int32',
|
||||
nullable: true
|
||||
},
|
||||
extraProperties: {
|
||||
type: 'object',
|
||||
additionalProperties: {},
|
||||
description: '扩展属性,用于存储自定义字段,JSON格式',
|
||||
nullable: true
|
||||
},
|
||||
deviceName: {
|
||||
type: 'string',
|
||||
description: '设备名称',
|
||||
nullable: true
|
||||
},
|
||||
deviceAddress: {
|
||||
type: 'string',
|
||||
description: '设备地址',
|
||||
nullable: true
|
||||
},
|
||||
oldFirmwareVersion: {
|
||||
type: 'string',
|
||||
description: '旧的固件版本',
|
||||
nullable: true
|
||||
},
|
||||
nowFirmwareVersion: {
|
||||
type: 'string',
|
||||
description: '固件版本',
|
||||
nullable: true
|
||||
},
|
||||
upgradeDate: {
|
||||
type: 'string',
|
||||
description: '升级日期',
|
||||
format: 'date-time'
|
||||
},
|
||||
upgradeSource: {
|
||||
'$ref': '#/components/schemas/DeviceUpgradeSourceTypeEnum'
|
||||
},
|
||||
upgradeSourceTypeName: {
|
||||
type: 'string',
|
||||
description: '升级来源',
|
||||
nullable: true,
|
||||
readOnly: true
|
||||
},
|
||||
upgradeMessage: {
|
||||
type: 'string',
|
||||
description: '升级信息',
|
||||
nullable: true
|
||||
},
|
||||
upgradeStatus: {
|
||||
'$ref': '#/components/schemas/DeviceUpgradeStatusTypeEnum'
|
||||
},
|
||||
upgradeStatusName: {
|
||||
type: 'string',
|
||||
description: '升级状态',
|
||||
nullable: true,
|
||||
readOnly: true
|
||||
},
|
||||
upgradeIdentifier: {
|
||||
type: 'integer',
|
||||
description: '升级标识符号',
|
||||
format: 'int64'
|
||||
},
|
||||
firmwareSignature: {
|
||||
type: 'string',
|
||||
description: '签名校验值',
|
||||
nullable: true
|
||||
},
|
||||
upgradeResult: {
|
||||
'$ref': '#/components/schemas/DeviceUpgradeResultTypeEnum'
|
||||
},
|
||||
upgradeResultName: {
|
||||
type: 'string',
|
||||
description: '升级结果',
|
||||
nullable: true,
|
||||
readOnly: true
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
} as const;
|
||||
|
||||
export const DeviceUpgradeRecordDtoPagedResultDtoSchema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
items: {
|
||||
type: 'array',
|
||||
items: {
|
||||
'$ref': '#/components/schemas/DeviceUpgradeRecordDto'
|
||||
},
|
||||
nullable: true
|
||||
},
|
||||
totalCount: {
|
||||
type: 'integer',
|
||||
format: 'int64'
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
} 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],
|
||||
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'
|
||||
} as const;
|
||||
|
||||
export const DeviceUpgradeSourceTypeEnumSchema = {
|
||||
enum: [1, 2],
|
||||
type: 'integer',
|
||||
description: '设备升级来源类型枚举',
|
||||
format: 'int32',
|
||||
'说明:': '管理后台=1,业务系统=2'
|
||||
} as const;
|
||||
|
||||
export const DeviceUpgradeStatusTypeEnumSchema = {
|
||||
enum: [1, 2, 3, 4],
|
||||
type: 'integer',
|
||||
description: '设备升级状态枚举',
|
||||
format: 'int32',
|
||||
'说明:': '未升级=1,升级中=2,升级成功=3,升级失败=4'
|
||||
} as const;
|
||||
|
||||
export const DisabledTwoFactorInputSchema = {
|
||||
required: ['code'],
|
||||
type: 'object',
|
||||
@ -3959,6 +4376,11 @@ export const FileObjectDtoSchema = {
|
||||
type: 'string',
|
||||
description: '文件名称',
|
||||
nullable: true
|
||||
},
|
||||
md5Hash: {
|
||||
type: 'string',
|
||||
description: '文件MD5',
|
||||
nullable: true
|
||||
}
|
||||
},
|
||||
additionalProperties: false,
|
||||
@ -6574,6 +6996,7 @@ export const OneNETProductInfoDtoSchema = {
|
||||
deviceThingModelFileId: {
|
||||
type: 'string',
|
||||
description: '设备物模型文件Id',
|
||||
format: 'uuid',
|
||||
nullable: true
|
||||
},
|
||||
deviceThingModelFileName: {
|
||||
@ -6823,6 +7246,7 @@ export const OneNetProductInfoInsertInputSchema = {
|
||||
deviceThingModelFileId: {
|
||||
type: 'string',
|
||||
description: '设备物模型文件Id',
|
||||
format: 'uuid',
|
||||
nullable: true
|
||||
},
|
||||
deviceThingModelFileName: {
|
||||
@ -6921,6 +7345,7 @@ export const OneNetProductInfoModifyInputSchema = {
|
||||
deviceThingModelFileId: {
|
||||
type: 'string',
|
||||
description: '设备物模型文件Id',
|
||||
format: 'uuid',
|
||||
nullable: true
|
||||
},
|
||||
deviceThingModelFileName: {
|
||||
@ -6969,6 +7394,60 @@ export const OpenTypeSchema = {
|
||||
'说明:': '无=10,组件=20,内链=30,外链=40'
|
||||
} as const;
|
||||
|
||||
export const PageDeviceFirmwareInfoInputSchema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
pageIndex: {
|
||||
type: 'integer',
|
||||
description: '当前页面.默认从1开始',
|
||||
format: 'int32'
|
||||
},
|
||||
pageSize: {
|
||||
type: 'integer',
|
||||
description: '每页多少条.每页显示多少记录',
|
||||
format: 'int32'
|
||||
},
|
||||
skipCount: {
|
||||
type: 'integer',
|
||||
description: '跳过多少条',
|
||||
format: 'int32',
|
||||
readOnly: true
|
||||
},
|
||||
sorting: {
|
||||
type: 'string',
|
||||
description: `排序
|
||||
<example>
|
||||
name desc
|
||||
</example>`,
|
||||
nullable: true
|
||||
},
|
||||
isPage: {
|
||||
type: 'boolean',
|
||||
description: '是否分页'
|
||||
},
|
||||
ioTPlatform: {
|
||||
'$ref': '#/components/schemas/IoTPlatformTypeEnum'
|
||||
},
|
||||
firmwareVersion: {
|
||||
type: 'string',
|
||||
description: '固件版本',
|
||||
nullable: true
|
||||
},
|
||||
ioTPlatformProductId: {
|
||||
type: 'string',
|
||||
description: '物联网平台中对应的产品Id',
|
||||
nullable: true
|
||||
},
|
||||
searchKeyword: {
|
||||
type: 'string',
|
||||
description: '搜索关键字',
|
||||
nullable: true
|
||||
}
|
||||
},
|
||||
additionalProperties: false,
|
||||
description: '创建设备固件信息'
|
||||
} as const;
|
||||
|
||||
export const PageDeviceInputSchema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
@ -7027,6 +7506,84 @@ export const PageDeviceInputSchema = {
|
||||
additionalProperties: false
|
||||
} as const;
|
||||
|
||||
export const PageDeviceUpgradeRecordInputSchema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
pageIndex: {
|
||||
type: 'integer',
|
||||
description: '当前页面.默认从1开始',
|
||||
format: 'int32'
|
||||
},
|
||||
pageSize: {
|
||||
type: 'integer',
|
||||
description: '每页多少条.每页显示多少记录',
|
||||
format: 'int32'
|
||||
},
|
||||
skipCount: {
|
||||
type: 'integer',
|
||||
description: '跳过多少条',
|
||||
format: 'int32',
|
||||
readOnly: true
|
||||
},
|
||||
sorting: {
|
||||
type: 'string',
|
||||
description: `排序
|
||||
<example>
|
||||
name desc
|
||||
</example>`,
|
||||
nullable: true
|
||||
},
|
||||
isPage: {
|
||||
type: 'boolean',
|
||||
description: '是否分页'
|
||||
},
|
||||
deviceName: {
|
||||
type: 'string',
|
||||
description: '设备名称',
|
||||
nullable: true
|
||||
},
|
||||
deviceAddress: {
|
||||
type: 'string',
|
||||
description: '设备地址',
|
||||
nullable: true
|
||||
},
|
||||
oldFirmwareVersion: {
|
||||
type: 'string',
|
||||
description: '旧的固件版本',
|
||||
nullable: true
|
||||
},
|
||||
nowFirmwareVersion: {
|
||||
type: 'string',
|
||||
description: '当前固件版本',
|
||||
nullable: true
|
||||
},
|
||||
upgradeDate: {
|
||||
type: 'string',
|
||||
description: '升级日期',
|
||||
format: 'date-time'
|
||||
},
|
||||
upgradeSource: {
|
||||
'$ref': '#/components/schemas/DeviceUpgradeSourceTypeEnum'
|
||||
},
|
||||
searchKeyword: {
|
||||
type: 'string',
|
||||
description: '搜索关键字',
|
||||
nullable: true
|
||||
},
|
||||
upgradeIdentifier: {
|
||||
type: 'integer',
|
||||
description: '升级标识符号',
|
||||
format: 'int64',
|
||||
nullable: true
|
||||
},
|
||||
upgradeResult: {
|
||||
'$ref': '#/components/schemas/DeviceUpgradeResultTypeEnum'
|
||||
}
|
||||
},
|
||||
additionalProperties: false,
|
||||
description: '设备升级记录分页查询输入'
|
||||
} as const;
|
||||
|
||||
export const PageFileObjectInputSchema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
@ -10286,6 +10843,58 @@ export const UpdateDetailInputSchema = {
|
||||
additionalProperties: false
|
||||
} as const;
|
||||
|
||||
export const UpdateDeviceFirmwareInfoInputSchema = {
|
||||
required: ['firmwareFileId', 'firmwareFileName', 'firmwareHashCode', 'firmwareLength', 'firmwareVersion', 'id', 'ioTPlatform', 'ioTPlatformProductId', 'ioTPlatformProductName'],
|
||||
type: 'object',
|
||||
properties: {
|
||||
ioTPlatform: {
|
||||
'$ref': '#/components/schemas/IoTPlatformTypeEnum'
|
||||
},
|
||||
ioTPlatformProductId: {
|
||||
minLength: 1,
|
||||
type: 'string',
|
||||
description: '物联网平台中对应的产品Id'
|
||||
},
|
||||
ioTPlatformProductName: {
|
||||
minLength: 1,
|
||||
type: 'string',
|
||||
description: '物联网平台中对应的产品名称'
|
||||
},
|
||||
firmwareVersion: {
|
||||
minLength: 1,
|
||||
type: 'string',
|
||||
description: '固件版本'
|
||||
},
|
||||
firmwareFileId: {
|
||||
type: 'string',
|
||||
description: '固件文件Id',
|
||||
format: 'uuid'
|
||||
},
|
||||
firmwareFileName: {
|
||||
minLength: 1,
|
||||
type: 'string',
|
||||
description: '固件文件名称'
|
||||
},
|
||||
firmwareHashCode: {
|
||||
minLength: 1,
|
||||
type: 'string',
|
||||
description: '固件哈希值'
|
||||
},
|
||||
firmwareLength: {
|
||||
type: 'integer',
|
||||
description: '固件文件长度',
|
||||
format: 'int64'
|
||||
},
|
||||
id: {
|
||||
type: 'string',
|
||||
description: '数据Id',
|
||||
format: 'uuid'
|
||||
}
|
||||
},
|
||||
additionalProperties: false,
|
||||
description: '更新固件信息'
|
||||
} as const;
|
||||
|
||||
export const UpdateFeatureDtoSchema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -348,6 +348,41 @@ export type CreateDeviceAggregationInput = {
|
||||
deviceSourceTypeEnum?: DeviceSourceTypeEnum;
|
||||
};
|
||||
|
||||
/**
|
||||
* 创建设备固件信息
|
||||
*/
|
||||
export type CreateDeviceFirmwareInfoInput = {
|
||||
ioTPlatform: IoTPlatformTypeEnum;
|
||||
/**
|
||||
* 物联网平台中对应的产品Id
|
||||
*/
|
||||
ioTPlatformProductId: string;
|
||||
/**
|
||||
* 物联网平台中对应的产品名称
|
||||
*/
|
||||
ioTPlatformProductName: string;
|
||||
/**
|
||||
* 固件版本
|
||||
*/
|
||||
firmwareVersion: string;
|
||||
/**
|
||||
* 固件文件Id
|
||||
*/
|
||||
firmwareFileId: string;
|
||||
/**
|
||||
* 固件文件名称
|
||||
*/
|
||||
firmwareFileName: string;
|
||||
/**
|
||||
* 固件哈希值
|
||||
*/
|
||||
firmwareHashCode: string;
|
||||
/**
|
||||
* 固件文件长度
|
||||
*/
|
||||
firmwareLength: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* 创建语言
|
||||
*/
|
||||
@ -1080,6 +1115,81 @@ export type DeviceCommandForApiInput = {
|
||||
};
|
||||
};
|
||||
|
||||
export type DeviceFirmwareInfoDto = {
|
||||
id?: string;
|
||||
creationTime?: string;
|
||||
creatorId?: (string) | null;
|
||||
lastModificationTime?: (string) | null;
|
||||
lastModifierId?: (string) | null;
|
||||
isDeleted?: boolean;
|
||||
deleterId?: (string) | null;
|
||||
deletionTime?: (string) | null;
|
||||
/**
|
||||
* 租户Id
|
||||
*/
|
||||
tenantId?: (string) | null;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark?: (string) | null;
|
||||
/**
|
||||
* 旧系统授权创建者Id
|
||||
*/
|
||||
osaCreatorId?: (number) | null;
|
||||
/**
|
||||
* 旧系统授权最后修改者Id
|
||||
*/
|
||||
osaLastModifierId?: (number) | null;
|
||||
/**
|
||||
* 旧系统授权最后删除者Id
|
||||
*/
|
||||
osaDeleterId?: (number) | null;
|
||||
/**
|
||||
* 扩展属性,用于存储自定义字段,JSON格式
|
||||
*/
|
||||
extraProperties?: {
|
||||
[key: string]: unknown;
|
||||
} | null;
|
||||
ioTPlatform?: IoTPlatformTypeEnum;
|
||||
/**
|
||||
* 物联网平台中对应的产品Id
|
||||
*/
|
||||
ioTPlatformProductId?: (string) | null;
|
||||
/**
|
||||
* 物联网平台中对应的产品名称
|
||||
*/
|
||||
ioTPlatformProductName?: (string) | null;
|
||||
/**
|
||||
* 固件版本
|
||||
*/
|
||||
firmwareVersion?: (string) | null;
|
||||
/**
|
||||
* 固件文件Id
|
||||
*/
|
||||
firmwareFileId?: string;
|
||||
/**
|
||||
* 固件文件名称
|
||||
*/
|
||||
firmwareFileName?: (string) | null;
|
||||
/**
|
||||
* 固件哈希值
|
||||
*/
|
||||
firmwareHashCode?: (string) | null;
|
||||
/**
|
||||
* 固件文件长度
|
||||
*/
|
||||
firmwareLength?: number;
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
isEnable?: boolean;
|
||||
};
|
||||
|
||||
export type DeviceFirmwareInfoDtoPagedResultDto = {
|
||||
items?: Array<DeviceFirmwareInfoDto> | null;
|
||||
totalCount?: number;
|
||||
};
|
||||
|
||||
export type DeviceManagementInfoDto = {
|
||||
id?: string;
|
||||
creationTime?: string;
|
||||
@ -1195,6 +1305,18 @@ export type DeviceManagementInfoDto = {
|
||||
* 设备物模型名称
|
||||
*/
|
||||
deviceThingModelName?: (string) | null;
|
||||
/**
|
||||
* 固件版本
|
||||
*/
|
||||
firmwareVersion?: (string) | null;
|
||||
/**
|
||||
* 升级日期
|
||||
*/
|
||||
upgradeDate?: (string) | null;
|
||||
/**
|
||||
* 设备接入鉴权key
|
||||
*/
|
||||
securityKey?: (string) | null;
|
||||
};
|
||||
|
||||
export type DeviceManagementInfoDtoPagedResultDto = {
|
||||
@ -1921,6 +2043,126 @@ export type DeviceTreeModelDataInfoInput = {
|
||||
*/
|
||||
export type DeviceTypeEnum = 0 | 1 | 2 | 3;
|
||||
|
||||
/**
|
||||
* 设备升级
|
||||
*/
|
||||
export type DeviceUpgradeForApiInput = {
|
||||
id: string;
|
||||
ioTPlatform: IoTPlatformTypeEnum;
|
||||
/**
|
||||
* 物联网平台中对应的产品Id
|
||||
*/
|
||||
ioTPlatformProductId: string;
|
||||
/**
|
||||
* 固件版本信息
|
||||
*/
|
||||
nowFirmwareVersionDataId: string;
|
||||
};
|
||||
|
||||
export type DeviceUpgradeRecordDto = {
|
||||
id?: string;
|
||||
creationTime?: string;
|
||||
creatorId?: (string) | null;
|
||||
lastModificationTime?: (string) | null;
|
||||
lastModifierId?: (string) | null;
|
||||
isDeleted?: boolean;
|
||||
deleterId?: (string) | null;
|
||||
deletionTime?: (string) | null;
|
||||
/**
|
||||
* 租户Id
|
||||
*/
|
||||
tenantId?: (string) | null;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark?: (string) | null;
|
||||
/**
|
||||
* 旧系统授权创建者Id
|
||||
*/
|
||||
osaCreatorId?: (number) | null;
|
||||
/**
|
||||
* 旧系统授权最后修改者Id
|
||||
*/
|
||||
osaLastModifierId?: (number) | null;
|
||||
/**
|
||||
* 旧系统授权最后删除者Id
|
||||
*/
|
||||
osaDeleterId?: (number) | null;
|
||||
/**
|
||||
* 扩展属性,用于存储自定义字段,JSON格式
|
||||
*/
|
||||
extraProperties?: {
|
||||
[key: string]: unknown;
|
||||
} | null;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
deviceName?: (string) | null;
|
||||
/**
|
||||
* 设备地址
|
||||
*/
|
||||
deviceAddress?: (string) | null;
|
||||
/**
|
||||
* 旧的固件版本
|
||||
*/
|
||||
oldFirmwareVersion?: (string) | null;
|
||||
/**
|
||||
* 固件版本
|
||||
*/
|
||||
nowFirmwareVersion?: (string) | null;
|
||||
/**
|
||||
* 升级日期
|
||||
*/
|
||||
upgradeDate?: string;
|
||||
upgradeSource?: DeviceUpgradeSourceTypeEnum;
|
||||
/**
|
||||
* 升级来源
|
||||
*/
|
||||
readonly upgradeSourceTypeName?: (string) | null;
|
||||
/**
|
||||
* 升级信息
|
||||
*/
|
||||
upgradeMessage?: (string) | null;
|
||||
upgradeStatus?: DeviceUpgradeStatusTypeEnum;
|
||||
/**
|
||||
* 升级状态
|
||||
*/
|
||||
readonly upgradeStatusName?: (string) | null;
|
||||
/**
|
||||
* 升级标识符号
|
||||
*/
|
||||
upgradeIdentifier?: number;
|
||||
/**
|
||||
* 签名校验值
|
||||
*/
|
||||
firmwareSignature?: (string) | null;
|
||||
upgradeResult?: DeviceUpgradeResultTypeEnum;
|
||||
/**
|
||||
* 升级结果
|
||||
*/
|
||||
readonly upgradeResultName?: (string) | null;
|
||||
};
|
||||
|
||||
export type DeviceUpgradeRecordDtoPagedResultDto = {
|
||||
items?: Array<DeviceUpgradeRecordDto> | null;
|
||||
totalCount?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* 设备升级结果枚举
|
||||
*/
|
||||
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 DeviceUpgradeSourceTypeEnum = 1 | 2;
|
||||
|
||||
/**
|
||||
* 设备升级状态枚举
|
||||
*/
|
||||
export type DeviceUpgradeStatusTypeEnum = 1 | 2 | 3 | 4;
|
||||
|
||||
export type DisabledTwoFactorInput = {
|
||||
/**
|
||||
* 验证码
|
||||
@ -2161,6 +2403,10 @@ export type FileObjectDto = {
|
||||
* 文件名称
|
||||
*/
|
||||
fileName?: (string) | null;
|
||||
/**
|
||||
* 文件MD5
|
||||
*/
|
||||
md5Hash?: (string) | null;
|
||||
};
|
||||
|
||||
export type FileQoSOptions = {
|
||||
@ -3716,6 +3962,48 @@ export type OpenApiRequest = {
|
||||
*/
|
||||
export type OpenType = 10 | 20 | 30 | 40;
|
||||
|
||||
/**
|
||||
* 创建设备固件信息
|
||||
*/
|
||||
export type PageDeviceFirmwareInfoInput = {
|
||||
/**
|
||||
* 当前页面.默认从1开始
|
||||
*/
|
||||
pageIndex?: number;
|
||||
/**
|
||||
* 每页多少条.每页显示多少记录
|
||||
*/
|
||||
pageSize?: number;
|
||||
/**
|
||||
* 跳过多少条
|
||||
*/
|
||||
readonly skipCount?: number;
|
||||
/**
|
||||
* 排序
|
||||
* <example>
|
||||
* name desc
|
||||
* </example>
|
||||
*/
|
||||
sorting?: (string) | null;
|
||||
/**
|
||||
* 是否分页
|
||||
*/
|
||||
isPage?: boolean;
|
||||
ioTPlatform?: IoTPlatformTypeEnum;
|
||||
/**
|
||||
* 固件版本
|
||||
*/
|
||||
firmwareVersion?: (string) | null;
|
||||
/**
|
||||
* 物联网平台中对应的产品Id
|
||||
*/
|
||||
ioTPlatformProductId?: (string) | null;
|
||||
/**
|
||||
* 搜索关键字
|
||||
*/
|
||||
searchKeyword?: (string) | null;
|
||||
};
|
||||
|
||||
export type PageDeviceInput = {
|
||||
/**
|
||||
* 当前页面.默认从1开始
|
||||
@ -3759,6 +4047,65 @@ export type PageDeviceInput = {
|
||||
searchKeyword?: (string) | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* 设备升级记录分页查询输入
|
||||
*/
|
||||
export type PageDeviceUpgradeRecordInput = {
|
||||
/**
|
||||
* 当前页面.默认从1开始
|
||||
*/
|
||||
pageIndex?: number;
|
||||
/**
|
||||
* 每页多少条.每页显示多少记录
|
||||
*/
|
||||
pageSize?: number;
|
||||
/**
|
||||
* 跳过多少条
|
||||
*/
|
||||
readonly skipCount?: number;
|
||||
/**
|
||||
* 排序
|
||||
* <example>
|
||||
* name desc
|
||||
* </example>
|
||||
*/
|
||||
sorting?: (string) | null;
|
||||
/**
|
||||
* 是否分页
|
||||
*/
|
||||
isPage?: boolean;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
deviceName?: (string) | null;
|
||||
/**
|
||||
* 设备地址
|
||||
*/
|
||||
deviceAddress?: (string) | null;
|
||||
/**
|
||||
* 旧的固件版本
|
||||
*/
|
||||
oldFirmwareVersion?: (string) | null;
|
||||
/**
|
||||
* 当前固件版本
|
||||
*/
|
||||
nowFirmwareVersion?: (string) | null;
|
||||
/**
|
||||
* 升级日期
|
||||
*/
|
||||
upgradeDate?: string;
|
||||
upgradeSource?: DeviceUpgradeSourceTypeEnum;
|
||||
/**
|
||||
* 搜索关键字
|
||||
*/
|
||||
searchKeyword?: (string) | null;
|
||||
/**
|
||||
* 升级标识符号
|
||||
*/
|
||||
upgradeIdentifier?: (number) | null;
|
||||
upgradeResult?: DeviceUpgradeResultTypeEnum;
|
||||
};
|
||||
|
||||
/**
|
||||
* 分页查询文件
|
||||
*/
|
||||
@ -5538,6 +5885,45 @@ export type UpdateDetailInput = {
|
||||
extendedAttribute?: (string) | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* 更新固件信息
|
||||
*/
|
||||
export type UpdateDeviceFirmwareInfoInput = {
|
||||
ioTPlatform: IoTPlatformTypeEnum;
|
||||
/**
|
||||
* 物联网平台中对应的产品Id
|
||||
*/
|
||||
ioTPlatformProductId: string;
|
||||
/**
|
||||
* 物联网平台中对应的产品名称
|
||||
*/
|
||||
ioTPlatformProductName: string;
|
||||
/**
|
||||
* 固件版本
|
||||
*/
|
||||
firmwareVersion: string;
|
||||
/**
|
||||
* 固件文件Id
|
||||
*/
|
||||
firmwareFileId: string;
|
||||
/**
|
||||
* 固件文件名称
|
||||
*/
|
||||
firmwareFileName: string;
|
||||
/**
|
||||
* 固件哈希值
|
||||
*/
|
||||
firmwareHashCode: string;
|
||||
/**
|
||||
* 固件文件长度
|
||||
*/
|
||||
firmwareLength: number;
|
||||
/**
|
||||
* 数据Id
|
||||
*/
|
||||
id: string;
|
||||
};
|
||||
|
||||
export type UpdateFeatureDto = {
|
||||
name?: (string) | null;
|
||||
value?: (string) | null;
|
||||
@ -6141,6 +6527,106 @@ export type PostAggregationDeviceGetDevicePropertyValueForApiAsyncResponse = ({
|
||||
|
||||
export type PostAggregationDeviceGetDevicePropertyValueForApiAsyncError = unknown;
|
||||
|
||||
export type PostAggregationDeviceDeviceUpgradeForApiAsyncData = {
|
||||
query?: {
|
||||
input?: DeviceUpgradeForApiInput;
|
||||
};
|
||||
};
|
||||
|
||||
export type PostAggregationDeviceDeviceUpgradeForApiAsyncResponse = (boolean);
|
||||
|
||||
export type PostAggregationDeviceDeviceUpgradeForApiAsyncError = unknown;
|
||||
|
||||
export type PostAggregationDeviceDownloadFirmwareData = {
|
||||
query?: {
|
||||
input?: IdInput;
|
||||
};
|
||||
};
|
||||
|
||||
export type PostAggregationDeviceDownloadFirmwareResponse = (RemoteStreamContent);
|
||||
|
||||
export type PostAggregationDeviceDownloadFirmwareError = unknown;
|
||||
|
||||
export type GetAggregationDeviceDownloadFirmwareData = {
|
||||
query?: {
|
||||
input?: IdInput;
|
||||
};
|
||||
};
|
||||
|
||||
export type GetAggregationDeviceDownloadFirmwareResponse = (RemoteStreamContent);
|
||||
|
||||
export type GetAggregationDeviceDownloadFirmwareError = unknown;
|
||||
|
||||
export type PostFirmwareInfoCreateAsyncData = {
|
||||
query?: {
|
||||
input?: CreateDeviceFirmwareInfoInput;
|
||||
};
|
||||
};
|
||||
|
||||
export type PostFirmwareInfoCreateAsyncResponse = (DeviceFirmwareInfoDto);
|
||||
|
||||
export type PostFirmwareInfoCreateAsyncError = unknown;
|
||||
|
||||
export type PostFirmwareInfoUpdateAsyncData = {
|
||||
query?: {
|
||||
input?: UpdateDeviceFirmwareInfoInput;
|
||||
};
|
||||
};
|
||||
|
||||
export type PostFirmwareInfoUpdateAsyncResponse = (DeviceFirmwareInfoDto);
|
||||
|
||||
export type PostFirmwareInfoUpdateAsyncError = unknown;
|
||||
|
||||
export type PostFirmwareInfoDeleteAsyncData = {
|
||||
query?: {
|
||||
input?: IdInput;
|
||||
};
|
||||
};
|
||||
|
||||
export type PostFirmwareInfoDeleteAsyncResponse = (boolean);
|
||||
|
||||
export type PostFirmwareInfoDeleteAsyncError = unknown;
|
||||
|
||||
export type PostFirmwareInfoFindByIdAsyncData = {
|
||||
query?: {
|
||||
input?: IdInput;
|
||||
};
|
||||
};
|
||||
|
||||
export type PostFirmwareInfoFindByIdAsyncResponse = (DeviceFirmwareInfoDto);
|
||||
|
||||
export type PostFirmwareInfoFindByIdAsyncError = unknown;
|
||||
|
||||
export type PostFirmwareInfoUpdateStatusByIdAsyncData = {
|
||||
query?: {
|
||||
input?: IdInput;
|
||||
};
|
||||
};
|
||||
|
||||
export type PostFirmwareInfoUpdateStatusByIdAsyncResponse = (DeviceFirmwareInfoDto);
|
||||
|
||||
export type PostFirmwareInfoUpdateStatusByIdAsyncError = unknown;
|
||||
|
||||
export type PostFirmwareInfoFindByDeviceProductIdAsyncData = {
|
||||
query?: {
|
||||
input?: StringIdInput;
|
||||
};
|
||||
};
|
||||
|
||||
export type PostFirmwareInfoFindByDeviceProductIdAsyncResponse = (Array<DeviceFirmwareInfoDto>);
|
||||
|
||||
export type PostFirmwareInfoFindByDeviceProductIdAsyncError = unknown;
|
||||
|
||||
export type PostFirmwareInfoPageData = {
|
||||
query?: {
|
||||
input?: PageDeviceFirmwareInfoInput;
|
||||
};
|
||||
};
|
||||
|
||||
export type PostFirmwareInfoPageResponse = (DeviceFirmwareInfoDtoPagedResultDto);
|
||||
|
||||
export type PostFirmwareInfoPageError = unknown;
|
||||
|
||||
export type PostDeviceInfoFindByDeviceAddressData = {
|
||||
query?: {
|
||||
deviceAddress?: string;
|
||||
@ -6421,6 +6907,26 @@ export type PostDeviceThingModelManagementCacheAllDeviceThingModelToRedisAsyncRe
|
||||
|
||||
export type PostDeviceThingModelManagementCacheAllDeviceThingModelToRedisAsyncError = unknown;
|
||||
|
||||
export type PostUpgradeRecordDeleteAsyncData = {
|
||||
query?: {
|
||||
input?: IdInput;
|
||||
};
|
||||
};
|
||||
|
||||
export type PostUpgradeRecordDeleteAsyncResponse = (boolean);
|
||||
|
||||
export type PostUpgradeRecordDeleteAsyncError = unknown;
|
||||
|
||||
export type PostUpgradeRecordPageData = {
|
||||
query?: {
|
||||
input?: PageDeviceUpgradeRecordInput;
|
||||
};
|
||||
};
|
||||
|
||||
export type PostUpgradeRecordPageResponse = (DeviceUpgradeRecordDtoPagedResultDto);
|
||||
|
||||
export type PostUpgradeRecordPageError = unknown;
|
||||
|
||||
export type PostFeaturesListData = {
|
||||
body?: GetFeatureListResultInput;
|
||||
};
|
||||
@ -6446,12 +6952,17 @@ export type PostFeaturesDeleteResponse = (unknown);
|
||||
export type PostFeaturesDeleteError = (RemoteServiceErrorResponse);
|
||||
|
||||
export type PostFilesPageData = {
|
||||
body?: PageFileObjectInput;
|
||||
query?: {
|
||||
/**
|
||||
* 分页查询文件
|
||||
*/
|
||||
input?: PageFileObjectInput;
|
||||
};
|
||||
};
|
||||
|
||||
export type PostFilesPageResponse = (PageFileObjectOutputPagedResultDto);
|
||||
|
||||
export type PostFilesPageError = (RemoteServiceErrorResponse);
|
||||
export type PostFilesPageError = unknown;
|
||||
|
||||
export type PostFilesUploadData = {
|
||||
body?: {
|
||||
@ -6461,23 +6972,30 @@ export type PostFilesUploadData = {
|
||||
|
||||
export type PostFilesUploadResponse = (Array<FileObjectDto>);
|
||||
|
||||
export type PostFilesUploadError = (RemoteServiceErrorResponse);
|
||||
export type PostFilesUploadError = unknown;
|
||||
|
||||
export type PostFilesDeleteData = {
|
||||
body?: DeleteFileObjectInput;
|
||||
query?: {
|
||||
/**
|
||||
* 删除文件
|
||||
*/
|
||||
input?: DeleteFileObjectInput;
|
||||
};
|
||||
};
|
||||
|
||||
export type PostFilesDeleteResponse = (unknown);
|
||||
|
||||
export type PostFilesDeleteError = (RemoteServiceErrorResponse);
|
||||
export type PostFilesDeleteError = unknown;
|
||||
|
||||
export type PostFilesDownloadData = {
|
||||
body?: DownloadFileObjectInput;
|
||||
query?: {
|
||||
input?: DownloadFileObjectInput;
|
||||
};
|
||||
};
|
||||
|
||||
export type PostFilesDownloadResponse = (RemoteStreamContent);
|
||||
|
||||
export type PostFilesDownloadError = (RemoteServiceErrorResponse);
|
||||
export type PostFilesDownloadError = unknown;
|
||||
|
||||
export type PostIdentitySecurityLogsPageData = {
|
||||
body?: PagingIdentitySecurityLogInput;
|
||||
|
||||
@ -0,0 +1,530 @@
|
||||
<script setup lang="ts">
|
||||
import type { VbenFormProps } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { computed, h, nextTick, ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { Button, message as Message, Modal, Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
postAggregationIoTplatformGetIoTplatformProductInfoAsync,
|
||||
postFirmwareInfoCreateAsync,
|
||||
postFirmwareInfoDeleteAsync,
|
||||
postFirmwareInfoFindByIdAsync,
|
||||
postFirmwareInfoPage,
|
||||
postFirmwareInfoUpdateAsync,
|
||||
postFirmwareInfoUpdateStatusByIdAsync,
|
||||
postFilesDownload,
|
||||
postFilesUpload,
|
||||
} from '#/api-client';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import {
|
||||
addFirmwareFormSchema,
|
||||
editFirmwareFormSchema,
|
||||
querySchema,
|
||||
tableSchema,
|
||||
} from './schema';
|
||||
|
||||
defineOptions({
|
||||
name: 'DeviceFirmwareInfo',
|
||||
});
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
schema: querySchema.value,
|
||||
submitOnChange: false,
|
||||
handleValuesChange: async (values, changedFields) => {
|
||||
// 当平台类型变化时,清除产品ID
|
||||
if (changedFields.includes('ioTPlatform')) {
|
||||
if (gridApi?.formApi) {
|
||||
await gridApi.formApi.setFieldValue('ioTPlatformProductId', undefined);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: tableSchema.value,
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
toolbarConfig: {
|
||||
custom: true,
|
||||
},
|
||||
customConfig: {
|
||||
storage: true,
|
||||
},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
const currentFormValues = gridApi?.formApi
|
||||
? await gridApi.formApi.getValues()
|
||||
: formValues || {};
|
||||
|
||||
const finalFormValues = { ...formValues, ...currentFormValues };
|
||||
|
||||
const { data } = await postFirmwareInfoPage({
|
||||
query: {
|
||||
input: {
|
||||
pageIndex: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...finalFormValues,
|
||||
},
|
||||
},
|
||||
});
|
||||
return data;
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({ formOptions, gridOptions });
|
||||
|
||||
const editRow: Record<string, any> = ref({});
|
||||
|
||||
const [UserModal, userModalApi] = useVbenModal({
|
||||
draggable: true,
|
||||
onConfirm: submit,
|
||||
onBeforeClose: () => {
|
||||
editRow.value = {};
|
||||
// 清除全局文件变量
|
||||
(window as any).__selectedFirmwareFile = null;
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
||||
const [AddForm, addFormApi] = useVbenForm({
|
||||
collapsed: false,
|
||||
commonConfig: {
|
||||
labelWidth: 120,
|
||||
componentProps: {
|
||||
class: 'w-4/5',
|
||||
},
|
||||
},
|
||||
layout: 'horizontal',
|
||||
schema: addFirmwareFormSchema.value,
|
||||
showCollapseButton: false,
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
handleValuesChange: async (values, changedFields) => {
|
||||
// 当平台类型变化时,清除产品ID
|
||||
if (changedFields.includes('ioTPlatform')) {
|
||||
await addFormApi.setFieldValue('ioTPlatformProductId', undefined);
|
||||
}
|
||||
// 当产品选择变化时,自动设置产品名称
|
||||
if (changedFields.includes('ioTPlatformProductId') && values.ioTPlatformProductId && values.ioTPlatform) {
|
||||
const productId = values.ioTPlatformProductId;
|
||||
const platform = values.ioTPlatform;
|
||||
|
||||
// 通过API获取产品信息
|
||||
try {
|
||||
const result = await postAggregationIoTplatformGetIoTplatformProductInfoAsync({
|
||||
body: {
|
||||
ioTPlatformType:
|
||||
typeof platform === 'string'
|
||||
? Number.parseInt(platform)
|
||||
: platform,
|
||||
},
|
||||
});
|
||||
|
||||
let products: any[] = [];
|
||||
if (Array.isArray(result.data)) {
|
||||
products = result.data;
|
||||
} else if (result.data && Array.isArray(result.data.items)) {
|
||||
products = result.data.items;
|
||||
} else if (result.data && Array.isArray(result.data.data)) {
|
||||
products = result.data.data;
|
||||
}
|
||||
|
||||
const selectedProduct = products.find(
|
||||
(p: any) => String(p.ioTPlatformProductId) === String(productId),
|
||||
);
|
||||
|
||||
if (selectedProduct && selectedProduct.productName) {
|
||||
await addFormApi.setFieldValue('ioTPlatformProductName', selectedProduct.productName);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取产品信息失败:', error);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const [EditForm, editFormApi] = useVbenForm({
|
||||
collapsed: false,
|
||||
commonConfig: {
|
||||
labelWidth: 120,
|
||||
componentProps: {
|
||||
class: 'w-4/5',
|
||||
},
|
||||
},
|
||||
layout: 'horizontal',
|
||||
schema: editFirmwareFormSchema.value,
|
||||
showCollapseButton: false,
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
handleValuesChange: async (values, changedFields) => {
|
||||
// 当平台类型变化时,清除产品ID
|
||||
if (changedFields.includes('ioTPlatform')) {
|
||||
await editFormApi.setFieldValue('ioTPlatformProductId', undefined);
|
||||
}
|
||||
// 当产品选择变化时,自动设置产品名称
|
||||
if (changedFields.includes('ioTPlatformProductId') && values.ioTPlatformProductId && values.ioTPlatform) {
|
||||
const productId = values.ioTPlatformProductId;
|
||||
const platform = values.ioTPlatform;
|
||||
|
||||
// 通过API获取产品信息
|
||||
try {
|
||||
const result = await postAggregationIoTplatformGetIoTplatformProductInfoAsync({
|
||||
body: {
|
||||
ioTPlatformType:
|
||||
typeof platform === 'string'
|
||||
? Number.parseInt(platform)
|
||||
: platform,
|
||||
},
|
||||
});
|
||||
|
||||
let products: any[] = [];
|
||||
if (Array.isArray(result.data)) {
|
||||
products = result.data;
|
||||
} else if (result.data && Array.isArray(result.data.items)) {
|
||||
products = result.data.items;
|
||||
} else if (result.data && Array.isArray(result.data.data)) {
|
||||
products = result.data.data;
|
||||
}
|
||||
|
||||
const selectedProduct = products.find(
|
||||
(p: any) => String(p.ioTPlatformProductId) === String(productId),
|
||||
);
|
||||
|
||||
if (selectedProduct && selectedProduct.productName) {
|
||||
await editFormApi.setFieldValue('ioTPlatformProductName', selectedProduct.productName);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取产品信息失败:', error);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
// 新增和编辑提交的逻辑
|
||||
async function submit() {
|
||||
const isEdit = !!editRow.value.id;
|
||||
const formApi = isEdit ? editFormApi : addFormApi;
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) return;
|
||||
|
||||
const formValues = await formApi.getValues();
|
||||
|
||||
// 如果产品名称为空,通过API获取产品名称
|
||||
if (!formValues.ioTPlatformProductName && formValues.ioTPlatformProductId && formValues.ioTPlatform) {
|
||||
try {
|
||||
const result = await postAggregationIoTplatformGetIoTplatformProductInfoAsync({
|
||||
body: {
|
||||
ioTPlatformType:
|
||||
typeof formValues.ioTPlatform === 'string'
|
||||
? Number.parseInt(formValues.ioTPlatform)
|
||||
: formValues.ioTPlatform,
|
||||
},
|
||||
});
|
||||
|
||||
let products: any[] = [];
|
||||
if (Array.isArray(result.data)) {
|
||||
products = result.data;
|
||||
} else if (result.data && Array.isArray(result.data.items)) {
|
||||
products = result.data.items;
|
||||
} else if (result.data && Array.isArray(result.data.data)) {
|
||||
products = result.data.data;
|
||||
}
|
||||
|
||||
const selectedProduct = products.find(
|
||||
(p: any) => String(p.ioTPlatformProductId) === String(formValues.ioTPlatformProductId),
|
||||
);
|
||||
|
||||
if (selectedProduct && selectedProduct.productName) {
|
||||
formValues.ioTPlatformProductName = selectedProduct.productName;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取产品信息失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 检查是否选择了新文件
|
||||
const selectedFile = (window as any).__selectedFirmwareFile;
|
||||
// 默认使用表单中的文件信息(编辑时保留原有文件)
|
||||
let fileId = formValues.firmwareFileId;
|
||||
let fileName = formValues.firmwareFileName;
|
||||
let fileHash = formValues.firmwareHashCode;
|
||||
let fileLength = formValues.firmwareLength;
|
||||
|
||||
// 如果选择了新文件,先上传文件
|
||||
if (selectedFile) {
|
||||
try {
|
||||
userModalApi.setState({ loading: true, confirmLoading: true });
|
||||
const uploadResult = await postFilesUpload({
|
||||
body: {
|
||||
files: [selectedFile],
|
||||
},
|
||||
});
|
||||
|
||||
if (uploadResult.data && uploadResult.data.length > 0) {
|
||||
const uploadedFile = uploadResult.data[0];
|
||||
fileId = uploadedFile.id;
|
||||
fileName = uploadedFile.fileName || selectedFile.name;
|
||||
// 注意:字段名是 md5Hash(小写m),不是 mD5Hash
|
||||
fileHash = uploadedFile.md5Hash || uploadedFile.mD5Hash || '';
|
||||
fileLength = uploadedFile.fileSize || selectedFile.size;
|
||||
} else {
|
||||
Message.error('文件上传失败');
|
||||
userModalApi.setState({ loading: false, confirmLoading: false });
|
||||
return;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('文件上传失败:', error);
|
||||
Message.error('文件上传失败');
|
||||
userModalApi.setState({ loading: false, confirmLoading: false });
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有文件ID,提示错误
|
||||
if (!fileId) {
|
||||
Message.error('请选择固件文件');
|
||||
userModalApi.setState({ loading: false, confirmLoading: false });
|
||||
return;
|
||||
}
|
||||
|
||||
const fetchParams: any = {
|
||||
ioTPlatform:
|
||||
typeof formValues.ioTPlatform === 'string'
|
||||
? Number.parseInt(formValues.ioTPlatform)
|
||||
: formValues.ioTPlatform,
|
||||
ioTPlatformProductId: String(formValues.ioTPlatformProductId),
|
||||
ioTPlatformProductName: formValues.ioTPlatformProductName || '',
|
||||
firmwareVersion: formValues.firmwareVersion,
|
||||
firmwareFileId: fileId,
|
||||
firmwareFileName: fileName,
|
||||
firmwareHashCode: fileHash,
|
||||
firmwareLength: fileLength,
|
||||
};
|
||||
|
||||
if (isEdit) {
|
||||
fetchParams.id = editRow.value.id;
|
||||
}
|
||||
|
||||
try {
|
||||
const api = isEdit
|
||||
? postFirmwareInfoUpdateAsync
|
||||
: postFirmwareInfoCreateAsync;
|
||||
const resp = await api({
|
||||
body: fetchParams,
|
||||
});
|
||||
|
||||
if (resp.data) {
|
||||
Message.success(
|
||||
isEdit ? $t('common.editSuccess') : $t('common.addSuccess'),
|
||||
);
|
||||
userModalApi.close();
|
||||
editRow.value = {};
|
||||
// 清除全局文件变量
|
||||
(window as any).__selectedFirmwareFile = null;
|
||||
gridApi.reload();
|
||||
} else {
|
||||
Message.error(isEdit ? $t('common.editFail') : $t('common.addFail'));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('固件操作失败:', error);
|
||||
Message.error(isEdit ? $t('common.editFail') : $t('common.addFail'));
|
||||
} finally {
|
||||
userModalApi.setState({ loading: false, confirmLoading: false });
|
||||
}
|
||||
}
|
||||
|
||||
async function onEdit(record: any) {
|
||||
editRow.value = record;
|
||||
userModalApi.open();
|
||||
|
||||
// 设置表单值
|
||||
const formValues: any = { ...record };
|
||||
|
||||
// 确保ioTPlatform是字符串格式
|
||||
if (formValues.ioTPlatform !== undefined && formValues.ioTPlatform !== null) {
|
||||
formValues.ioTPlatform = String(formValues.ioTPlatform);
|
||||
}
|
||||
|
||||
// 清除文件选择
|
||||
(window as any).__selectedFirmwareFile = null;
|
||||
|
||||
editFormApi.setValues(formValues);
|
||||
}
|
||||
|
||||
function onDel(row: any) {
|
||||
Modal.confirm({
|
||||
title: `${$t('common.confirmDelete')}固件版本 ${row.firmwareVersion} ?`,
|
||||
onOk: async () => {
|
||||
try {
|
||||
const result = await postFirmwareInfoDeleteAsync({
|
||||
body: { id: row.id },
|
||||
});
|
||||
if (result.data) {
|
||||
gridApi.reload();
|
||||
Message.success($t('common.deleteSuccess'));
|
||||
} else {
|
||||
Message.error($t('common.deleteFail'));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('删除固件失败:', error);
|
||||
Message.error($t('common.deleteFail'));
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// 切换启用/禁用状态
|
||||
async function toggleStatus(row: any) {
|
||||
const action = row.isEnable ? '禁用' : '启用';
|
||||
Modal.confirm({
|
||||
title: `确认${action}固件版本 ${row.firmwareVersion} ?`,
|
||||
onOk: async () => {
|
||||
try {
|
||||
const result = await postFirmwareInfoUpdateStatusByIdAsync({
|
||||
body: { id: row.id },
|
||||
});
|
||||
if (result.data) {
|
||||
gridApi.reload();
|
||||
Message.success(`${action}成功`);
|
||||
} else {
|
||||
Message.error(`${action}失败`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`${action}固件失败:`, error);
|
||||
Message.error(`${action}失败`);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const openAddModal = async () => {
|
||||
editRow.value = {};
|
||||
// 清除文件选择
|
||||
(window as any).__selectedFirmwareFile = null;
|
||||
userModalApi.open();
|
||||
await nextTick();
|
||||
addFormApi.resetForm();
|
||||
};
|
||||
|
||||
// 下载文件函数
|
||||
async function onDownloadFile(row: any) {
|
||||
if (!row.firmwareFileId) {
|
||||
Message.error('文件ID不存在,无法下载');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const { data } = await postFilesDownload({
|
||||
body: { id: row.firmwareFileId },
|
||||
responseType: 'blob',
|
||||
});
|
||||
const url = window.URL.createObjectURL(new Blob([data as Blob]));
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.setAttribute(
|
||||
'download',
|
||||
row.firmwareFileName || 'firmware-file',
|
||||
);
|
||||
document.body.append(link);
|
||||
link.click();
|
||||
link.remove();
|
||||
window.URL.revokeObjectURL(url);
|
||||
Message.success('文件下载成功');
|
||||
} catch (error) {
|
||||
console.error('文件下载失败:', error);
|
||||
Message.error('文件下载失败');
|
||||
}
|
||||
}
|
||||
|
||||
// 工具栏按钮配置
|
||||
const toolbarActions = computed(() => [
|
||||
{
|
||||
label: $t('common.add'),
|
||||
type: 'primary',
|
||||
icon: 'ant-design:plus-outlined',
|
||||
onClick: openAddModal.bind(null),
|
||||
auth: ['AbpIdentity.Users.Create'],
|
||||
},
|
||||
]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<Grid>
|
||||
<template #toolbar-actions>
|
||||
<TableAction :actions="toolbarActions" />
|
||||
</template>
|
||||
|
||||
<template #isEnable="{ row }">
|
||||
<component
|
||||
:is="
|
||||
h(
|
||||
Tag,
|
||||
{ color: row.isEnable ? 'green' : 'red' },
|
||||
() => (row.isEnable ? '启用' : '禁用'),
|
||||
)
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #firmwareFileName="{ row }">
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
style="padding: 0"
|
||||
:disabled="!row.firmwareFileId"
|
||||
@click="onDownloadFile.bind(null, row)()"
|
||||
>
|
||||
{{ row.firmwareFileName || '-' }}
|
||||
</Button>
|
||||
</template>
|
||||
|
||||
<template #action="{ row }">
|
||||
<div style="display: flex; gap: 8px; align-items: center">
|
||||
<Button
|
||||
size="small"
|
||||
type="link"
|
||||
@click="onEdit.bind(null, row)()"
|
||||
>
|
||||
{{ $t('common.edit') }}
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
type="link"
|
||||
:style="{ color: row.isEnable ? '#ff4d4f' : '#52c41a' }"
|
||||
@click="toggleStatus.bind(null, row)()"
|
||||
>
|
||||
{{ row.isEnable ? '禁用' : '启用' }}
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
type="link"
|
||||
style="color: #ff4d4f"
|
||||
@click="onDel.bind(null, row)()"
|
||||
>
|
||||
{{ $t('common.delete') }}
|
||||
</Button>
|
||||
</div>
|
||||
</template>
|
||||
</Grid>
|
||||
<UserModal
|
||||
:title="editRow.id ? $t('common.edit') : $t('common.add')"
|
||||
class="w-[800px]"
|
||||
>
|
||||
<component :is="editRow.id ? EditForm : AddForm" />
|
||||
</UserModal>
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
@ -0,0 +1,561 @@
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { computed, h } from 'vue';
|
||||
|
||||
import { z } from '@vben/common-ui';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import {
|
||||
getCommonGetSelectList,
|
||||
postAggregationIoTplatformGetIoTplatformProductInfoAsync,
|
||||
} from '#/api-client';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
export const querySchema = computed(() => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'searchKeyword',
|
||||
label: '搜索关键字',
|
||||
componentProps: {
|
||||
placeholder: '请输入产品名称',
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
fieldName: 'ioTPlatform',
|
||||
label: $t('abp.deviceInfos.ioTPlatform'),
|
||||
componentProps: {
|
||||
api: getCommonGetSelectList,
|
||||
params: {
|
||||
query: {
|
||||
typeName: 'IoTPlatformTypeEnum',
|
||||
},
|
||||
},
|
||||
labelField: 'value',
|
||||
valueField: 'key',
|
||||
optionsPropName: 'options',
|
||||
immediate: true,
|
||||
allowClear: true,
|
||||
placeholder: `${$t('common.pleaseSelect')}${$t('abp.deviceInfos.ioTPlatform')}`,
|
||||
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: 'ApiSelect',
|
||||
fieldName: 'ioTPlatformProductId',
|
||||
label: $t('common.BelongingProductName'),
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return !!values.ioTPlatform;
|
||||
},
|
||||
triggerFields: ['ioTPlatform'],
|
||||
},
|
||||
componentProps: (formValues: any) => {
|
||||
const platform = formValues?.ioTPlatform;
|
||||
|
||||
return {
|
||||
api: platform
|
||||
? postAggregationIoTplatformGetIoTplatformProductInfoAsync
|
||||
: null,
|
||||
params: platform
|
||||
? {
|
||||
body: {
|
||||
ioTPlatformType:
|
||||
typeof platform === 'string'
|
||||
? Number.parseInt(platform)
|
||||
: platform,
|
||||
},
|
||||
}
|
||||
: {},
|
||||
labelField: 'productName',
|
||||
valueField: 'ioTPlatformProductId',
|
||||
optionsPropName: 'options',
|
||||
immediate: false,
|
||||
allowClear: true,
|
||||
placeholder:
|
||||
$t('common.pleaseSelect') + $t('common.BelongingProductName'),
|
||||
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;
|
||||
}
|
||||
if (res && res.data && Array.isArray(res.data.items)) {
|
||||
return res.data.items;
|
||||
}
|
||||
return [];
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
||||
{ title: $t('common.seq'), type: 'seq', width: 50 },
|
||||
{
|
||||
field: 'ioTPlatform',
|
||||
title: $t('common.BelongingIoTPlatform'),
|
||||
minWidth: '150',
|
||||
formatter: ({ cellValue }) => {
|
||||
const platformMap: Record<string, string> = {
|
||||
'1': 'CTWing',
|
||||
'2': 'OneNET',
|
||||
};
|
||||
return platformMap[String(cellValue)] || cellValue || '-';
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'ioTPlatformProductName',
|
||||
title: $t('common.BelongingProductName'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'firmwareVersion',
|
||||
title: '固件版本',
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'firmwareFileName',
|
||||
title: '固件文件名称',
|
||||
minWidth: '200',
|
||||
slots: { default: 'firmwareFileName' },
|
||||
},
|
||||
{
|
||||
field: 'firmwareLength',
|
||||
title: '文件大小',
|
||||
minWidth: '120',
|
||||
formatter: ({ cellValue }) => {
|
||||
if (!cellValue) return '-';
|
||||
const bytes = Number(cellValue);
|
||||
if (bytes < 1024) return `${bytes} B`;
|
||||
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(2)} KB`;
|
||||
if (bytes < 1024 * 1024 * 1024)
|
||||
return `${(bytes / (1024 * 1024)).toFixed(2)} MB`;
|
||||
return `${(bytes / (1024 * 1024 * 1024)).toFixed(2)} GB`;
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'firmwareHashCode',
|
||||
title: '哈希值',
|
||||
minWidth: '200',
|
||||
showOverflow: 'tooltip',
|
||||
},
|
||||
{
|
||||
field: 'isEnable',
|
||||
title: '是否启用',
|
||||
minWidth: '100',
|
||||
slots: { default: 'isEnable' },
|
||||
},
|
||||
{
|
||||
field: 'creationTime',
|
||||
title: '创建时间',
|
||||
minWidth: '180',
|
||||
formatter: ({ cellValue }) => {
|
||||
return cellValue ? dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss') : '';
|
||||
},
|
||||
},
|
||||
{
|
||||
title: $t('common.action'),
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
width: '200',
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
]);
|
||||
|
||||
export const addFirmwareFormSchema: any = computed(() => [
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
fieldName: 'ioTPlatform',
|
||||
label: $t('abp.deviceInfos.ioTPlatform'),
|
||||
componentProps: {
|
||||
api: getCommonGetSelectList,
|
||||
params: {
|
||||
query: {
|
||||
typeName: 'IoTPlatformTypeEnum',
|
||||
},
|
||||
},
|
||||
labelField: 'value',
|
||||
valueField: 'key',
|
||||
optionsPropName: 'options',
|
||||
immediate: true,
|
||||
allowClear: true,
|
||||
placeholder:
|
||||
$t('common.pleaseSelect') + $t('abp.deviceInfos.ioTPlatform'),
|
||||
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 [];
|
||||
},
|
||||
},
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseSelect')}${$t('abp.deviceInfos.ioTPlatform')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
fieldName: 'ioTPlatformProductId',
|
||||
label: $t('common.BelongingProductName'),
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return !!values.ioTPlatform;
|
||||
},
|
||||
rules(values: any) {
|
||||
if (values.ioTPlatform) {
|
||||
return 'required';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
triggerFields: ['ioTPlatform'],
|
||||
},
|
||||
componentProps: (formValues: any) => {
|
||||
const platform = formValues?.ioTPlatform;
|
||||
|
||||
return {
|
||||
api: platform
|
||||
? postAggregationIoTplatformGetIoTplatformProductInfoAsync
|
||||
: null,
|
||||
params: platform
|
||||
? {
|
||||
body: {
|
||||
ioTPlatformType:
|
||||
typeof platform === 'string'
|
||||
? Number.parseInt(platform)
|
||||
: platform,
|
||||
},
|
||||
}
|
||||
: {},
|
||||
labelField: 'productName',
|
||||
valueField: 'ioTPlatformProductId',
|
||||
optionsPropName: 'options',
|
||||
immediate: false,
|
||||
allowClear: true,
|
||||
placeholder:
|
||||
$t('common.pleaseSelect') + $t('common.BelongingProductName'),
|
||||
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;
|
||||
}
|
||||
if (res && res.data && Array.isArray(res.data.items)) {
|
||||
return res.data.items;
|
||||
}
|
||||
return [];
|
||||
},
|
||||
};
|
||||
},
|
||||
rules: z.string().optional(),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'firmwareVersion',
|
||||
label: '固件版本',
|
||||
componentProps: {
|
||||
placeholder: '请输入固件版本',
|
||||
},
|
||||
rules: z.string().min(1, {
|
||||
message: '请输入固件版本',
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'firmwareFileName',
|
||||
label: '固件文件名称',
|
||||
componentProps: {
|
||||
placeholder: '请选择文件',
|
||||
readonly: true,
|
||||
addonAfter: h(
|
||||
'button',
|
||||
{
|
||||
type: 'button',
|
||||
style:
|
||||
'border: none; background: #1890ff; color: white; padding: 4px 8px; border-radius: 4px; cursor: pointer;',
|
||||
onClick: () => {
|
||||
const input = document.createElement('input');
|
||||
input.type = 'file';
|
||||
input.accept = '*/*';
|
||||
input.addEventListener('change', (e: any) => {
|
||||
const file = e.target.files[0];
|
||||
if (file) {
|
||||
const currentInput = document.querySelector(
|
||||
'input[placeholder="请选择文件"]',
|
||||
) as HTMLInputElement;
|
||||
if (currentInput) {
|
||||
currentInput.value = file.name;
|
||||
currentInput.dispatchEvent(
|
||||
new Event('input', { bubbles: true }),
|
||||
);
|
||||
currentInput.dispatchEvent(
|
||||
new Event('change', { bubbles: true }),
|
||||
);
|
||||
// 存储文件对象到全局变量
|
||||
(window as any).__selectedFirmwareFile = file;
|
||||
}
|
||||
}
|
||||
});
|
||||
input.click();
|
||||
},
|
||||
},
|
||||
'选择文件',
|
||||
),
|
||||
},
|
||||
rules: z.string().min(1, {
|
||||
message: '请选择固件文件',
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'firmwareFileId',
|
||||
label: '',
|
||||
componentProps: {
|
||||
type: 'hidden',
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'firmwareHashCode',
|
||||
label: '',
|
||||
componentProps: {
|
||||
type: 'hidden',
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'firmwareLength',
|
||||
label: '',
|
||||
componentProps: {
|
||||
type: 'hidden',
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'ioTPlatformProductName',
|
||||
label: '',
|
||||
componentProps: {
|
||||
type: 'hidden',
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
export const editFirmwareFormSchema: any = computed(() => [
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
fieldName: 'ioTPlatform',
|
||||
label: $t('abp.deviceInfos.ioTPlatform'),
|
||||
componentProps: {
|
||||
api: getCommonGetSelectList,
|
||||
params: {
|
||||
query: {
|
||||
typeName: 'IoTPlatformTypeEnum',
|
||||
},
|
||||
},
|
||||
labelField: 'value',
|
||||
valueField: 'key',
|
||||
optionsPropName: 'options',
|
||||
immediate: true,
|
||||
allowClear: true,
|
||||
placeholder:
|
||||
$t('common.pleaseSelect') + $t('abp.deviceInfos.ioTPlatform'),
|
||||
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 [];
|
||||
},
|
||||
},
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseSelect')}${$t('abp.deviceInfos.ioTPlatform')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
fieldName: 'ioTPlatformProductId',
|
||||
label: $t('common.BelongingProductName'),
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return !!values.ioTPlatform;
|
||||
},
|
||||
rules(values: any) {
|
||||
if (values.ioTPlatform) {
|
||||
return 'required';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
triggerFields: ['ioTPlatform'],
|
||||
},
|
||||
componentProps: (formValues: any) => {
|
||||
const platform = formValues?.ioTPlatform;
|
||||
|
||||
return {
|
||||
api: platform
|
||||
? postAggregationIoTplatformGetIoTplatformProductInfoAsync
|
||||
: null,
|
||||
params: platform
|
||||
? {
|
||||
body: {
|
||||
ioTPlatformType:
|
||||
typeof platform === 'string'
|
||||
? Number.parseInt(platform)
|
||||
: platform,
|
||||
},
|
||||
}
|
||||
: {},
|
||||
labelField: 'productName',
|
||||
valueField: 'ioTPlatformProductId',
|
||||
optionsPropName: 'options',
|
||||
immediate: false,
|
||||
allowClear: true,
|
||||
placeholder:
|
||||
$t('common.pleaseSelect') + $t('common.BelongingProductName'),
|
||||
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;
|
||||
}
|
||||
if (res && res.data && Array.isArray(res.data.items)) {
|
||||
return res.data.items;
|
||||
}
|
||||
return [];
|
||||
},
|
||||
};
|
||||
},
|
||||
rules: z.string().optional(),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'firmwareVersion',
|
||||
label: '固件版本',
|
||||
componentProps: {
|
||||
placeholder: '请输入固件版本',
|
||||
},
|
||||
rules: z.string().min(1, {
|
||||
message: '请输入固件版本',
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'firmwareFileName',
|
||||
label: '固件文件名称',
|
||||
componentProps: {
|
||||
placeholder: '请选择文件',
|
||||
readonly: true,
|
||||
addonAfter: h(
|
||||
'button',
|
||||
{
|
||||
type: 'button',
|
||||
style:
|
||||
'border: none; background: #1890ff; color: white; padding: 4px 8px; border-radius: 4px; cursor: pointer;',
|
||||
onClick: () => {
|
||||
const input = document.createElement('input');
|
||||
input.type = 'file';
|
||||
input.accept = '*/*';
|
||||
input.addEventListener('change', (e: any) => {
|
||||
const file = e.target.files[0];
|
||||
if (file) {
|
||||
const currentInput = document.querySelector(
|
||||
'input[placeholder="请选择文件"]',
|
||||
) as HTMLInputElement;
|
||||
if (currentInput) {
|
||||
currentInput.value = file.name;
|
||||
currentInput.dispatchEvent(
|
||||
new Event('input', { bubbles: true }),
|
||||
);
|
||||
currentInput.dispatchEvent(
|
||||
new Event('change', { bubbles: true }),
|
||||
);
|
||||
// 存储文件对象到全局变量
|
||||
(window as any).__selectedFirmwareFile = file;
|
||||
}
|
||||
}
|
||||
});
|
||||
input.click();
|
||||
},
|
||||
},
|
||||
'选择文件',
|
||||
),
|
||||
},
|
||||
rules: z.string().min(1, {
|
||||
message: '请选择固件文件',
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'firmwareFileId',
|
||||
label: '',
|
||||
componentProps: {
|
||||
type: 'hidden',
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'firmwareHashCode',
|
||||
label: '',
|
||||
componentProps: {
|
||||
type: 'hidden',
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'firmwareLength',
|
||||
label: '',
|
||||
componentProps: {
|
||||
type: 'hidden',
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'ioTPlatformProductName',
|
||||
label: '',
|
||||
componentProps: {
|
||||
type: 'hidden',
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'id',
|
||||
label: '',
|
||||
componentProps: {
|
||||
type: 'hidden',
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
@ -54,10 +54,26 @@ defineOptions({
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
// 标志:是否正在从路由参数设置表单值(用于防止重复触发搜索)
|
||||
const isSettingFromRoute = ref(false);
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
schema: querySchema.value,
|
||||
submitOnChange: false,
|
||||
handleValuesChange: async (values, changedFields) => {
|
||||
// 如果正在从路由参数设置值,则不触发搜索(避免重复请求)
|
||||
if (isSettingFromRoute.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 当平台类型变化时,清除产品ID(因为不同平台的产品列表不同)
|
||||
if (changedFields.includes('ioTPlatform')) {
|
||||
if (gridApi?.formApi) {
|
||||
await gridApi.formApi.setFieldValue('ioTPlatformProductId', undefined);
|
||||
}
|
||||
}
|
||||
|
||||
// 当产品切换时,触发搜索
|
||||
if (changedFields.includes('ioTPlatformProductId')) {
|
||||
// 延迟一下,确保表单值已更新
|
||||
@ -203,66 +219,89 @@ const editRow: Record<string, any> = ref({});
|
||||
watch(
|
||||
() => route.query,
|
||||
async (newQuery) => {
|
||||
if (newQuery.ioTPlatform || newQuery.ioTPlatformDeviceOpenInfo) {
|
||||
if (newQuery.ioTPlatform || newQuery.ioTPlatformProductId) {
|
||||
// 等待组件初始化的辅助函数
|
||||
const waitForFormApi = async (maxRetries = 10, delay = 100) => {
|
||||
for (let i = 0; i < maxRetries; i++) {
|
||||
if (gridApi?.formApi) {
|
||||
return true;
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, delay));
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// 延迟执行,确保组件完全初始化
|
||||
setTimeout(async () => {
|
||||
try {
|
||||
// 设置标志,防止 handleValuesChange 触发搜索
|
||||
isSettingFromRoute.value = true;
|
||||
|
||||
// 等待表单API初始化
|
||||
const formApiReady = await waitForFormApi();
|
||||
if (!formApiReady) {
|
||||
console.warn('表单API初始化超时,无法设置筛选条件');
|
||||
isSettingFromRoute.value = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置表单筛选条件
|
||||
const filterValues: any = {};
|
||||
|
||||
if (newQuery.ioTPlatform) {
|
||||
filterValues.ioTPlatform = newQuery.ioTPlatform;
|
||||
filterValues.ioTPlatform = String(newQuery.ioTPlatform);
|
||||
}
|
||||
|
||||
if (newQuery.ioTPlatformDeviceOpenInfo) {
|
||||
if (newQuery.ioTPlatformProductId) {
|
||||
// 设置产品ID字段
|
||||
filterValues.ioTPlatformProductId =
|
||||
newQuery.ioTPlatformDeviceOpenInfo;
|
||||
// 同时设置通用字段用于查询
|
||||
filterValues.ioTPlatformDeviceOpenInfo =
|
||||
newQuery.ioTPlatformDeviceOpenInfo;
|
||||
filterValues.ioTPlatformProductId = String(
|
||||
newQuery.ioTPlatformProductId,
|
||||
);
|
||||
}
|
||||
|
||||
// 设置表单值并重新加载数据
|
||||
if (gridApi?.formApi) {
|
||||
await gridApi.formApi.setValues(filterValues);
|
||||
// 等待表单值更新完成后再重新加载数据
|
||||
// 先设置平台类型,等待其选项加载完成
|
||||
if (filterValues.ioTPlatform) {
|
||||
await gridApi.formApi.setFieldValue(
|
||||
'ioTPlatform',
|
||||
filterValues.ioTPlatform,
|
||||
);
|
||||
await nextTick();
|
||||
// 等待平台选择器的选项加载完成(ApiSelect组件需要时间加载选项)
|
||||
await new Promise((resolve) => setTimeout(resolve, 600));
|
||||
}
|
||||
|
||||
// 再设置产品ID(如果有),需要等待产品选择器的选项加载完成
|
||||
if (filterValues.ioTPlatformProductId) {
|
||||
await gridApi.formApi.setFieldValue(
|
||||
'ioTPlatformProductId',
|
||||
filterValues.ioTPlatformProductId,
|
||||
);
|
||||
await nextTick();
|
||||
// 等待产品选择器的选项加载完成
|
||||
await new Promise((resolve) => setTimeout(resolve, 600));
|
||||
}
|
||||
|
||||
// 等待所有表单值更新完成后再重新加载数据
|
||||
await nextTick();
|
||||
await new Promise((resolve) => setTimeout(resolve, 200));
|
||||
|
||||
// 重置标志
|
||||
isSettingFromRoute.value = false;
|
||||
|
||||
// 触发搜索(只触发一次)
|
||||
if (gridApi?.reload) {
|
||||
gridApi.reload();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('设置表单筛选条件时出错:', error);
|
||||
isSettingFromRoute.value = false;
|
||||
}
|
||||
}, 200); // 增加延迟时间,确保ApiSelect组件完全初始化
|
||||
}, 500); // 初始延迟,确保组件开始初始化
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
// 监听产品选择器变化,自动设置ioTPlatformDeviceOpenInfo
|
||||
watch(
|
||||
() => gridApi?.formApi?.getValues,
|
||||
(formValues) => {
|
||||
if (formValues) {
|
||||
const { ioTPlatformProductId } = formValues;
|
||||
|
||||
// 如果选择了产品,设置ioTPlatformDeviceOpenInfo
|
||||
if (ioTPlatformProductId) {
|
||||
console.log('检测到产品选择变化:', ioTPlatformProductId);
|
||||
gridApi?.formApi?.setFieldValue(
|
||||
'ioTPlatformDeviceOpenInfo',
|
||||
ioTPlatformProductId,
|
||||
);
|
||||
console.log('已设置ioTPlatformDeviceOpenInfo为:', ioTPlatformProductId);
|
||||
} else {
|
||||
console.log('清空产品选择');
|
||||
gridApi?.formApi?.setFieldValue('ioTPlatformDeviceOpenInfo', '');
|
||||
}
|
||||
}
|
||||
},
|
||||
{ deep: true },
|
||||
);
|
||||
|
||||
const cacheRefreshLoading = ref(false);
|
||||
const pageLoading = ref(false);
|
||||
const loadingTip = ref('缓存刷新中...');
|
||||
@ -1687,25 +1726,15 @@ const toolbarActions = computed(() => [
|
||||
</div>
|
||||
<div v-else>
|
||||
<div style="margin-bottom: 16px">
|
||||
<Input
|
||||
v-model:value="filterKeyword"
|
||||
placeholder="请输入标准物模型属性名称或平台物模型属性标识符进行筛选"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
>
|
||||
<Input v-model:value="filterKeyword" placeholder="请输入标准物模型属性名称或平台物模型属性标识符进行筛选" allow-clear
|
||||
style="width: 100%">
|
||||
<template #prefix>
|
||||
<Icon icon="ant-design:search-outlined" />
|
||||
</template>
|
||||
</Input>
|
||||
</div>
|
||||
<Table
|
||||
:columns="commandTableColumns"
|
||||
:data-source="filteredThingModelProperties"
|
||||
:pagination="false"
|
||||
:scroll="{ x: 1000, y: 500 }"
|
||||
row-key="id"
|
||||
size="small"
|
||||
/>
|
||||
<Table :columns="commandTableColumns" :data-source="filteredThingModelProperties" :pagination="false"
|
||||
:scroll="{ x: 1000, y: 500 }" row-key="id" size="small" />
|
||||
</div>
|
||||
</CommandModal>
|
||||
<UpgradeModal title="设备升级" class="w-[600px]">
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
/*
|
||||
* @Description: 文件内容描述
|
||||
* @Author: 陈益
|
||||
* @Date: 2025-12-31 14:25:04
|
||||
* @LastEditors: 陈益
|
||||
*/
|
||||
@ -316,7 +316,7 @@ function onDeviceManagement(record: any) {
|
||||
path: '/devicemanagement/deviceinfo',
|
||||
query: {
|
||||
ioTPlatform: '2', // OneNET平台类型为2
|
||||
ioTPlatformDeviceOpenInfo: record.ioTPlatformProductId, // 平台产品ID
|
||||
ioTPlatformProductId: record.ioTPlatformProductId, // 平台产品ID
|
||||
productName: record.productName,
|
||||
},
|
||||
});
|
||||
@ -339,12 +339,15 @@ function onThingModelManagement(record: any) {
|
||||
// 物模型更新函数
|
||||
async function onThingModelUpdate(record: any) {
|
||||
try {
|
||||
const resp = await postAggregationIoTplatformUpdateIoTplatformProductPropertyInfoAsync({
|
||||
const resp =
|
||||
await postAggregationIoTplatformUpdateIoTplatformProductPropertyInfoAsync(
|
||||
{
|
||||
body: {
|
||||
ioTPlatformType: 2, // OneNET 平台类型为 2
|
||||
ioTPlatformProductId: record.ioTPlatformProductId,
|
||||
},
|
||||
});
|
||||
},
|
||||
);
|
||||
if (resp.data) {
|
||||
Message.success('物模型更新成功');
|
||||
gridApi.reload();
|
||||
@ -414,10 +417,12 @@ async function onThingModelUpdate(record: any) {
|
||||
type: 'link',
|
||||
size: 'small',
|
||||
onClick: onThingModelUpdate.bind(null, row),
|
||||
}
|
||||
},
|
||||
]" :drop-down-actions="[
|
||||
{
|
||||
label: row.isEnabled ? $t('common.disabled') : $t('common.enabled'),
|
||||
label: row.isEnabled
|
||||
? $t('common.disabled')
|
||||
: $t('common.enabled'),
|
||||
icon: 'ant-design:edit-filled',
|
||||
type: 'primary',
|
||||
danger: row.isEnabled,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user