2025-06-25 17:29:57 +08:00
|
|
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
|
|
|
|
|
2025-07-09 17:31:29 +08:00
|
|
|
import { computed } from 'vue';
|
2025-06-25 17:29:57 +08:00
|
|
|
|
|
|
|
|
import dayjs from 'dayjs';
|
|
|
|
|
|
|
|
|
|
import { $t } from '#/locales';
|
|
|
|
|
|
2025-07-09 17:07:25 +08:00
|
|
|
import { getSelectResultList } from '#/api-client';
|
|
|
|
|
|
2025-06-25 17:29:57 +08:00
|
|
|
export const querySchema = computed(() => [
|
|
|
|
|
{
|
|
|
|
|
component: 'Input',
|
|
|
|
|
fieldName: 'FocusAddress',
|
|
|
|
|
label: $t('abp.focus.focusAddress'),
|
|
|
|
|
},
|
2025-07-09 17:07:25 +08:00
|
|
|
{
|
2025-07-09 17:31:29 +08:00
|
|
|
component: 'ApiSelect',
|
2025-07-09 17:07:25 +08:00
|
|
|
fieldName: 'SystemName',
|
|
|
|
|
label: $t('abp.IoTDBBase.SystemName'),
|
2025-07-09 17:31:29 +08:00
|
|
|
componentProps: {
|
|
|
|
|
api: getSelectResultList,
|
|
|
|
|
params: {
|
|
|
|
|
query: {
|
|
|
|
|
TypeName: 'BusinessSystemEnum',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
labelField: 'secondValue',
|
|
|
|
|
valueField: 'value',
|
|
|
|
|
optionsPropName: 'options',
|
|
|
|
|
immediate: true,
|
|
|
|
|
afterFetch: (res: any) => {
|
|
|
|
|
console.log('ApiSelect afterFetch result:', res);
|
|
|
|
|
// 确保返回的是数组格式
|
|
|
|
|
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-09 17:07:25 +08:00
|
|
|
},
|
2025-06-25 17:29:57 +08:00
|
|
|
]);
|
|
|
|
|
export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
|
|
|
|
{ title: $t('common.seq'), type: 'seq', width: 50 },
|
|
|
|
|
{ field: 'systemName', title: $t('abp.log.systemName'), minWidth: '150' },
|
|
|
|
|
{
|
|
|
|
|
field: 'projectId',
|
|
|
|
|
title: $t('abp.log.projectId'),
|
|
|
|
|
minWidth: '150',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'dataType',
|
|
|
|
|
title: $t('abp.log.dataType'),
|
|
|
|
|
minWidth: '150',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'deviceType',
|
|
|
|
|
title: $t('abp.log.deviceType'),
|
|
|
|
|
minWidth: '150',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'times',
|
|
|
|
|
title: $t('abp.log.timestamps'),
|
|
|
|
|
minWidth: '150',
|
|
|
|
|
formatter: ({ cellValue }) => {
|
|
|
|
|
return dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss');
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
]);
|