2025-06-25 17:29:57 +08:00
|
|
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
|
|
|
|
|
|
|
|
|
import { computed } from 'vue';
|
|
|
|
|
|
|
|
|
|
import dayjs from 'dayjs';
|
|
|
|
|
|
2025-07-17 15:26:23 +08:00
|
|
|
import { getSelectResultList } from '#/api-client';
|
2025-06-25 17:29:57 +08:00
|
|
|
import { $t } from '#/locales';
|
|
|
|
|
|
|
|
|
|
export const querySchema = computed(() => [
|
|
|
|
|
{
|
2025-07-17 10:23:38 +08:00
|
|
|
component: 'ApiSelect',
|
|
|
|
|
fieldName: 'SystemName',
|
|
|
|
|
label: $t('abp.IoTDBBase.SystemName'),
|
|
|
|
|
componentProps: {
|
|
|
|
|
api: getSelectResultList,
|
|
|
|
|
params: {
|
|
|
|
|
query: {
|
|
|
|
|
TypeName: 'BusinessSystemEnum',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
labelField: 'secondValue',
|
|
|
|
|
valueField: 'value',
|
|
|
|
|
optionsPropName: 'options',
|
|
|
|
|
immediate: true,
|
|
|
|
|
afterFetch: (res: any) => {
|
|
|
|
|
// 确保返回的是数组格式
|
|
|
|
|
if (Array.isArray(res)) {
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
// 如果是包装在 items 中的,提取出来
|
|
|
|
|
if (res && Array.isArray(res.items)) {
|
|
|
|
|
return res.items;
|
|
|
|
|
}
|
|
|
|
|
// 如果是包装在 data 中的,提取出来
|
|
|
|
|
if (res && Array.isArray(res.data)) {
|
|
|
|
|
return res.data;
|
|
|
|
|
}
|
|
|
|
|
// 如果都不是,返回空数组
|
|
|
|
|
return [];
|
|
|
|
|
},
|
|
|
|
|
},
|
2025-07-11 00:15:57 +08:00
|
|
|
},
|
|
|
|
|
{
|
2025-07-17 10:23:38 +08:00
|
|
|
component: 'ApiSelect',
|
2025-07-11 00:15:57 +08:00
|
|
|
fieldName: 'DeviceType',
|
|
|
|
|
label: $t('abp.IoTDBBase.DeviceType'),
|
2025-07-17 10:23:38 +08:00
|
|
|
componentProps: {
|
|
|
|
|
api: getSelectResultList,
|
|
|
|
|
params: {
|
|
|
|
|
query: {
|
|
|
|
|
TypeName: 'MeterTypeEnum',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
labelField: 'value',
|
|
|
|
|
valueField: 'key',
|
|
|
|
|
optionsPropName: 'options',
|
|
|
|
|
immediate: true,
|
|
|
|
|
afterFetch: (res: any) => {
|
|
|
|
|
// 确保返回的是数组格式
|
|
|
|
|
if (Array.isArray(res)) {
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
// 如果是包装在 items 中的,提取出来
|
|
|
|
|
if (res && Array.isArray(res.items)) {
|
|
|
|
|
return res.items;
|
|
|
|
|
}
|
|
|
|
|
// 如果是包装在 data 中的,提取出来
|
|
|
|
|
if (res && Array.isArray(res.data)) {
|
|
|
|
|
return res.data;
|
|
|
|
|
}
|
|
|
|
|
// 如果都不是,返回空数组
|
|
|
|
|
return [];
|
|
|
|
|
},
|
|
|
|
|
},
|
2025-07-11 00:15:57 +08:00
|
|
|
},
|
|
|
|
|
{
|
2025-07-17 10:23:38 +08:00
|
|
|
component: 'ApiSelect',
|
|
|
|
|
fieldName: 'IoTDataType',
|
|
|
|
|
label: $t('abp.IoTDBBase.IoTDataType'),
|
|
|
|
|
componentProps: {
|
|
|
|
|
api: getSelectResultList,
|
|
|
|
|
params: {
|
|
|
|
|
query: {
|
|
|
|
|
TypeName: 'IoTDBDataTypeConst',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
labelField: 'value',
|
|
|
|
|
valueField: 'key',
|
|
|
|
|
optionsPropName: 'options',
|
|
|
|
|
immediate: true,
|
|
|
|
|
afterFetch: (res: any) => {
|
|
|
|
|
// 确保返回的是数组格式
|
|
|
|
|
if (Array.isArray(res)) {
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
// 如果是包装在 items 中的,提取出来
|
|
|
|
|
if (res && Array.isArray(res.items)) {
|
|
|
|
|
return res.items;
|
|
|
|
|
}
|
|
|
|
|
// 如果是包装在 data 中的,提取出来
|
|
|
|
|
if (res && Array.isArray(res.data)) {
|
|
|
|
|
return res.data;
|
|
|
|
|
}
|
|
|
|
|
// 如果都不是,返回空数组
|
|
|
|
|
return [];
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
component: 'DeviceSelect',
|
|
|
|
|
fieldName: 'DeviceId',
|
|
|
|
|
label: $t('abp.log.deviceInfo'),
|
|
|
|
|
componentProps: {
|
|
|
|
|
placeholder: $t('common.pleaseSelect') + $t('abp.log.deviceInfo'),
|
|
|
|
|
allowClear: true,
|
|
|
|
|
},
|
2025-07-11 00:15:57 +08:00
|
|
|
},
|
2025-07-17 10:23:38 +08:00
|
|
|
// 新增开始时间选择器
|
2025-07-11 00:15:57 +08:00
|
|
|
{
|
2025-07-17 10:23:38 +08:00
|
|
|
component: 'DatePicker',
|
|
|
|
|
fieldName: 'StartCreationTime',
|
|
|
|
|
label: '开始时间',
|
|
|
|
|
componentProps: {
|
|
|
|
|
placeholder: '开始时间',
|
|
|
|
|
format: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
|
showTime: true,
|
|
|
|
|
allowClear: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
// 新增结束时间选择器
|
|
|
|
|
{
|
|
|
|
|
component: 'DatePicker',
|
|
|
|
|
fieldName: 'EndCreationTime',
|
|
|
|
|
label: '结束时间',
|
|
|
|
|
componentProps: {
|
|
|
|
|
placeholder: '结束时间',
|
|
|
|
|
format: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
|
showTime: true,
|
|
|
|
|
allowClear: true,
|
|
|
|
|
},
|
2025-06-25 17:29:57 +08:00
|
|
|
},
|
|
|
|
|
]);
|
2025-07-11 00:15:57 +08:00
|
|
|
|
2025-06-25 17:29:57 +08:00
|
|
|
export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
2025-07-17 10:23:38 +08:00
|
|
|
{ title: $t('common.seq'), type: 'seq', width: 50, slots: {} },
|
2025-06-25 17:29:57 +08:00
|
|
|
{
|
2025-07-11 11:48:12 +08:00
|
|
|
field: 'timestamps',
|
|
|
|
|
title: $t('abp.IoTDBBase.Timestamps'),
|
2025-07-11 00:15:57 +08:00
|
|
|
minWidth: 150,
|
2025-07-17 10:23:38 +08:00
|
|
|
slots: {},
|
2025-06-25 17:29:57 +08:00
|
|
|
},
|
2025-07-17 15:26:23 +08:00
|
|
|
{
|
|
|
|
|
field: 'formattedTimestamps',
|
|
|
|
|
title: $t('abp.IoTDBBase.FormattedTimestamps'),
|
|
|
|
|
minWidth: '150',
|
|
|
|
|
formatter: ({ cellValue }) => {
|
|
|
|
|
return cellValue ? dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss') : '';
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'systemName',
|
|
|
|
|
title: $t('abp.IoTDBBase.SystemName'),
|
|
|
|
|
minWidth: 150,
|
|
|
|
|
slots: {},
|
|
|
|
|
},
|
2025-06-25 17:29:57 +08:00
|
|
|
{
|
|
|
|
|
field: 'deviceType',
|
2025-07-11 00:15:57 +08:00
|
|
|
title: $t('abp.IoTDBBase.DeviceType'),
|
|
|
|
|
minWidth: 150,
|
2025-07-17 10:23:38 +08:00
|
|
|
slots: {},
|
2025-07-11 00:15:57 +08:00
|
|
|
},
|
|
|
|
|
{
|
2025-07-11 11:48:12 +08:00
|
|
|
field: 'ioTDataType',
|
|
|
|
|
title: $t('abp.IoTDBBase.IoTDataType'),
|
2025-07-11 00:15:57 +08:00
|
|
|
minWidth: 150,
|
2025-07-17 10:23:38 +08:00
|
|
|
slots: {},
|
2025-06-25 17:29:57 +08:00
|
|
|
},
|
|
|
|
|
{
|
2025-07-11 11:48:12 +08:00
|
|
|
field: 'deviceId',
|
|
|
|
|
title: $t('abp.IoTDBBase.DeviceId'),
|
2025-07-11 00:15:57 +08:00
|
|
|
minWidth: 150,
|
2025-07-17 10:23:38 +08:00
|
|
|
slots: {},
|
2025-06-25 17:29:57 +08:00
|
|
|
},
|
2025-07-11 00:15:57 +08:00
|
|
|
{
|
|
|
|
|
field: 'platformTenantId',
|
|
|
|
|
title: $t('abp.CTWingLog.PlatformTenantId'),
|
|
|
|
|
minWidth: 150,
|
2025-07-17 10:23:38 +08:00
|
|
|
slots: {},
|
2025-07-11 00:15:57 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'serviceId',
|
|
|
|
|
title: $t('abp.CTWingLog.ServiceId'),
|
|
|
|
|
minWidth: 150,
|
2025-07-17 10:23:38 +08:00
|
|
|
slots: {},
|
2025-07-11 00:15:57 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'messageType',
|
|
|
|
|
title: $t('abp.CTWingLog.MessageType'),
|
2025-07-11 13:51:31 +08:00
|
|
|
minWidth: 180,
|
2025-07-17 10:23:38 +08:00
|
|
|
slots: {},
|
2025-07-11 00:15:57 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'protocol',
|
|
|
|
|
title: $t('abp.CTWingLog.Protocol'),
|
|
|
|
|
minWidth: 100,
|
2025-07-17 10:23:38 +08:00
|
|
|
slots: {},
|
2025-07-11 00:15:57 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'rawMessage',
|
|
|
|
|
title: $t('abp.CTWingLog.RawMessage'),
|
|
|
|
|
minWidth: 200,
|
2025-07-17 10:23:38 +08:00
|
|
|
slots: {},
|
2025-07-11 00:15:57 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'receivedPayload',
|
|
|
|
|
title: $t('abp.CTWingLog.ReceivedPayload'),
|
|
|
|
|
minWidth: 200,
|
2025-07-17 10:23:38 +08:00
|
|
|
slots: {},
|
2025-07-11 00:15:57 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'receivedTime',
|
|
|
|
|
title: $t('abp.CTWingLog.ReceivedTime'),
|
|
|
|
|
minWidth: 150,
|
2025-07-17 10:23:38 +08:00
|
|
|
slots: {},
|
2025-07-11 00:15:57 +08:00
|
|
|
formatter: ({ cellValue }) => {
|
|
|
|
|
return cellValue ? dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss') : '';
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'imsi',
|
|
|
|
|
title: $t('abp.CTWingLog.IMSI'),
|
|
|
|
|
minWidth: 150,
|
2025-07-17 10:23:38 +08:00
|
|
|
slots: {},
|
2025-07-11 00:15:57 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'imei',
|
|
|
|
|
title: $t('abp.CTWingLog.IMEI'),
|
|
|
|
|
minWidth: 150,
|
2025-07-17 10:23:38 +08:00
|
|
|
slots: {},
|
2025-07-11 00:15:57 +08:00
|
|
|
},
|
2025-06-25 17:29:57 +08:00
|
|
|
]);
|