Compare commits

..

2 Commits

Author SHA1 Message Date
ChenYi
c09ca5eab0 设备固件管理 2025-12-31 15:08:21 +08:00
ChenYi
d672ea04aa 完善设备信息界面 2025-12-31 14:24:10 +08:00
9 changed files with 2467 additions and 89 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;
// md5Hashm 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>

View File

@ -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',
},
},
]);

View File

@ -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]">

View File

@ -0,0 +1,6 @@
/*
* @Description:
* @Author:
* @Date: 2025-12-31 14:25:04
* @LastEditors:
*/

View File

@ -316,7 +316,7 @@ function onDeviceManagement(record: any) {
path: '/devicemanagement/deviceinfo',
query: {
ioTPlatform: '2', // OneNET2
ioTPlatformDeviceOpenInfo: record.ioTPlatformProductId, // ID
ioTPlatformProductId: record.ioTPlatformProductId, // ID
productName: record.productName,
},
});
@ -330,8 +330,8 @@ function onThingModelManagement(record: any) {
path: '/thingmodelinfo/ioTPlatformThingModelInfo',
query: {
productId: record.ioTPlatformProductId, // ID
productName: record.productName,
ioTPlatform: '2', // OneNET2
productName: record.productName,
ioTPlatform: '2', // OneNET2
},
});
}
@ -339,12 +339,15 @@ function onThingModelManagement(record: any) {
//
async function onThingModelUpdate(record: any) {
try {
const resp = await postAggregationIoTplatformUpdateIoTplatformProductPropertyInfoAsync({
body: {
ioTPlatformType: 2, // OneNET 2
ioTPlatformProductId: record.ioTPlatformProductId,
},
});
const resp =
await postAggregationIoTplatformUpdateIoTplatformProductPropertyInfoAsync(
{
body: {
ioTPlatformType: 2, // OneNET 2
ioTPlatformProductId: record.ioTPlatformProductId,
},
},
);
if (resp.data) {
Message.success('物模型更新成功');
gridApi.reload();
@ -414,30 +417,32 @@ 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'),
icon: 'ant-design:edit-filled',
type: 'primary',
danger: row.isEnabled,
size: 'small',
auth: ['AbpIdentity.Users.Update'],
popConfirm: {
title: `确定要${row.isEnabled ? $t('common.disabled') : $t('common.enabled')}该产品吗?`,
confirm: onStatusChange.bind(null, row),
{
label: row.isEnabled
? $t('common.disabled')
: $t('common.enabled'),
icon: 'ant-design:edit-filled',
type: 'primary',
danger: row.isEnabled,
size: 'small',
auth: ['AbpIdentity.Users.Update'],
popConfirm: {
title: `确定要${row.isEnabled ? $t('common.disabled') : $t('common.enabled')}该产品吗?`,
confirm: onStatusChange.bind(null, row),
},
},
},
{
label: $t('common.delete'),
icon: 'ant-design:delete-outlined',
type: 'primary',
popConfirm: {
title: $t('common.askConfirmDelete'),
confirm: onDel.bind(null, row),
{
label: $t('common.delete'),
icon: 'ant-design:delete-outlined',
type: 'primary',
popConfirm: {
title: $t('common.askConfirmDelete'),
confirm: onDel.bind(null, row),
},
},
},
]" />
]" />
</template>
</Grid>
<UserModal :title="editRow.id ? $t('common.edit') : $t('common.add')" class="w-[800px]">