diff --git a/apps/web-antd/src/api-client/schemas.gen.ts b/apps/web-antd/src/api-client/schemas.gen.ts index f05fa74..d92c38a 100644 --- a/apps/web-antd/src/api-client/schemas.gen.ts +++ b/apps/web-antd/src/api-client/schemas.gen.ts @@ -7537,30 +7537,11 @@ export const PageDeviceUpgradeRecordInputSchema = { 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' + format: 'date-time', + nullable: true }, upgradeSource: { '$ref': '#/components/schemas/DeviceUpgradeSourceTypeEnum' diff --git a/apps/web-antd/src/api-client/types.gen.ts b/apps/web-antd/src/api-client/types.gen.ts index c4ea5ea..5bbf896 100644 --- a/apps/web-antd/src/api-client/types.gen.ts +++ b/apps/web-antd/src/api-client/types.gen.ts @@ -4074,26 +4074,10 @@ export type PageDeviceUpgradeRecordInput = { * 是否分页 */ isPage?: boolean; - /** - * 设备名称 - */ - deviceName?: (string) | null; - /** - * 设备地址 - */ - deviceAddress?: (string) | null; - /** - * 旧的固件版本 - */ - oldFirmwareVersion?: (string) | null; - /** - * 当前固件版本 - */ - nowFirmwareVersion?: (string) | null; /** * 升级日期 */ - upgradeDate?: string; + upgradeDate?: (string) | null; upgradeSource?: DeviceUpgradeSourceTypeEnum; /** * 搜索关键字 diff --git a/apps/web-antd/src/views/devicemanagement/deviceupgraderecord/index.vue b/apps/web-antd/src/views/devicemanagement/deviceupgraderecord/index.vue index e69de29..5ebf6b2 100644 --- a/apps/web-antd/src/views/devicemanagement/deviceupgraderecord/index.vue +++ b/apps/web-antd/src/views/devicemanagement/deviceupgraderecord/index.vue @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + {{ $t('common.delete') }} + + + + + + + diff --git a/apps/web-antd/src/views/devicemanagement/deviceupgraderecord/schema.ts b/apps/web-antd/src/views/devicemanagement/deviceupgraderecord/schema.ts index 0a802fa..32dfd4d 100644 --- a/apps/web-antd/src/views/devicemanagement/deviceupgraderecord/schema.ts +++ b/apps/web-antd/src/views/devicemanagement/deviceupgraderecord/schema.ts @@ -1,6 +1,191 @@ -/* - * @Description: 文件内容描述 - * @Author: 陈益 - * @Date: 2025-12-31 14:25:04 - * @LastEditors: 陈益 - */ +import type { VxeGridProps } from '#/adapter/vxe-table'; + +import { computed } from 'vue'; + +import dayjs from 'dayjs'; + +import { getCommonGetSelectList } from '#/api-client'; +import { $t } from '#/locales'; + +export const querySchema = computed(() => [ + { + component: 'Input', + fieldName: 'searchKeyword', + label: '搜索关键字', + componentProps: { + placeholder: '请输入搜索关键字', + }, + }, + { + component: 'ApiSelect', + fieldName: 'upgradeSource', + label: '升级来源', + componentProps: { + api: getCommonGetSelectList, + params: { + query: { + typeName: 'DeviceUpgradeSourceTypeEnum', + }, + }, + labelField: 'value', + valueField: 'key', + optionsPropName: 'options', + immediate: true, + allowClear: true, + placeholder: '请选择升级来源', + 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: 'upgradeResult', + label: '升级结果', + componentProps: { + api: getCommonGetSelectList, + params: { + query: { + typeName: 'DeviceUpgradeStatusTypeEnum', + }, + }, + labelField: 'value', + valueField: 'key', + optionsPropName: 'options', + immediate: true, + allowClear: true, + placeholder: '请选择升级结果', + 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: 'Input', + fieldName: 'upgradeIdentifier', + label: '升级标识符号', + componentProps: { + placeholder: '请输入升级标识符号', + onInput: (e: Event) => { + const target = e.target as HTMLInputElement; + // 只允许输入数字 + const value = target.value.replace(/[^\d]/g, ''); + if (target.value !== value) { + target.value = value; + // 触发 input 事件,确保表单值更新 + target.dispatchEvent(new Event('input', { bubbles: true })); + } + }, + }, + }, + { + component: 'DatePicker', + fieldName: 'upgradeDate', + label: '升级日期', + componentProps: { + placeholder: '请选择升级日期', + format: 'YYYY-MM-DD', + valueFormat: 'YYYY-MM-DD', + allowClear: true, + }, + }, +]); + +export const tableSchema: any = computed((): VxeGridProps['columns'] => [ + { title: $t('common.seq'), type: 'seq', width: 50 }, + { + field: 'deviceName', + title: '设备名称', + minWidth: '150', + }, + { + field: 'deviceAddress', + title: '设备地址', + minWidth: '150', + }, + { + field: 'oldFirmwareVersion', + title: '旧固件版本', + minWidth: '150', + }, + { + field: 'nowFirmwareVersion', + title: '当前固件版本', + minWidth: '150', + }, + { + field: 'upgradeDate', + title: '升级日期', + minWidth: '180', + formatter: ({ cellValue }) => { + return cellValue ? dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss') : ''; + }, + }, + { + field: 'upgradeSourceTypeName', + title: '升级来源', + minWidth: '120', + }, + { + field: 'upgradeStatusName', + title: '升级状态', + minWidth: '120', + slots: { default: 'upgradeStatus' }, + }, + { + field: 'upgradeResultName', + title: '升级结果', + minWidth: '120', + slots: { default: 'upgradeResult' }, + }, + { + field: 'upgradeIdentifier', + title: '升级标识符', + minWidth: '120', + }, + { + field: 'upgradeMessage', + title: '升级信息', + minWidth: '200', + showOverflow: 'tooltip', + }, + { + field: 'firmwareSignature', + title: '签名校验值', + minWidth: '200', + showOverflow: 'tooltip', + }, + { + 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: '150', + slots: { default: 'action' }, + }, +]);