完善设备数据查询
This commit is contained in:
parent
3384c9de4e
commit
7abca2781b
@ -82,6 +82,7 @@
|
|||||||
"dataType": "Data Type",
|
"dataType": "Data Type",
|
||||||
"deviceType": "Device Type",
|
"deviceType": "Device Type",
|
||||||
"deviceId": "Device ID",
|
"deviceId": "Device ID",
|
||||||
|
"deviceInfo": "Device Info",
|
||||||
"timestamps": "Timestamps",
|
"timestamps": "Timestamps",
|
||||||
"manualOrNot": "Manual Operation",
|
"manualOrNot": "Manual Operation",
|
||||||
"isTimeout": "Timeout Status",
|
"isTimeout": "Timeout Status",
|
||||||
@ -223,8 +224,7 @@
|
|||||||
"DeviceType": "DeviceType",
|
"DeviceType": "DeviceType",
|
||||||
"pointData": "pointData",
|
"pointData": "pointData",
|
||||||
"archivesIssued": "archivesIssued"
|
"archivesIssued": "archivesIssued"
|
||||||
}
|
},
|
||||||
,
|
|
||||||
"IoTDBBase": {
|
"IoTDBBase": {
|
||||||
"SystemName": "SystemName",
|
"SystemName": "SystemName",
|
||||||
"ProjectId": "ProjectId",
|
"ProjectId": "ProjectId",
|
||||||
|
|||||||
@ -81,6 +81,7 @@
|
|||||||
"projectId": "项目编码",
|
"projectId": "项目编码",
|
||||||
"dataType": "数据类型",
|
"dataType": "数据类型",
|
||||||
"deviceType": "设备类型",
|
"deviceType": "设备类型",
|
||||||
|
"deviceInfo": "设备信息",
|
||||||
"deviceId": "设备ID",
|
"deviceId": "设备ID",
|
||||||
"timestamps": "时标",
|
"timestamps": "时标",
|
||||||
"manualOrNot": "是否手动操作",
|
"manualOrNot": "是否手动操作",
|
||||||
|
|||||||
@ -2,12 +2,13 @@ import type { VxeGridProps } from '#/adapter/vxe-table';
|
|||||||
|
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
|
||||||
import dayjs from 'dayjs';
|
import {
|
||||||
|
getSelectResultList,
|
||||||
|
postFocusesPage,
|
||||||
|
postMetersPage,
|
||||||
|
} from '#/api-client';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
|
||||||
import { getSelectResultList } from '#/api-client';
|
|
||||||
|
|
||||||
export const querySchema = computed(() => [
|
export const querySchema = computed(() => [
|
||||||
{
|
{
|
||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
@ -25,7 +26,6 @@ export const querySchema = computed(() => [
|
|||||||
optionsPropName: 'options',
|
optionsPropName: 'options',
|
||||||
immediate: true,
|
immediate: true,
|
||||||
afterFetch: (res: any) => {
|
afterFetch: (res: any) => {
|
||||||
console.log('ApiSelect afterFetch result:', res);
|
|
||||||
// 确保返回的是数组格式
|
// 确保返回的是数组格式
|
||||||
if (Array.isArray(res)) {
|
if (Array.isArray(res)) {
|
||||||
return res;
|
return res;
|
||||||
@ -44,9 +44,156 @@ export const querySchema = computed(() => [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'Input',
|
component: 'ApiSelect',
|
||||||
|
fieldName: 'DeviceType',
|
||||||
|
label: $t('abp.IoTDBBase.DeviceType'),
|
||||||
|
componentProps: {
|
||||||
|
api: getSelectResultList,
|
||||||
|
params: {
|
||||||
|
query: {
|
||||||
|
TypeName: 'MeterTypeEnum',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
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 [];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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: 'ApiSelect',
|
||||||
fieldName: 'FocusAddress',
|
fieldName: 'FocusAddress',
|
||||||
label: $t('abp.focus.focusAddress'),
|
label: $t('abp.focus.focusAddress'),
|
||||||
|
componentProps: {
|
||||||
|
api: postFocusesPage,
|
||||||
|
params: {
|
||||||
|
body: {
|
||||||
|
pageIndex: 1,
|
||||||
|
pageSize: 1000, // 获取足够多的数据用于下拉选择
|
||||||
|
},
|
||||||
|
},
|
||||||
|
labelField: 'name',
|
||||||
|
valueField: 'focusAddress',
|
||||||
|
optionsPropName: 'options',
|
||||||
|
immediate: true,
|
||||||
|
showSearch: true,
|
||||||
|
allowClear: true,
|
||||||
|
placeholder: $t('common.pleaseSelect') + $t('abp.focus.focusAddress'),
|
||||||
|
filterOption: false, // 禁用本地过滤,使用服务端搜索
|
||||||
|
optionFilterProp: 'label', // 根据 label 进行过滤
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
// 如果是包装在 data.items 中的,提取出来
|
||||||
|
if (res && res.data && Array.isArray(res.data.items)) {
|
||||||
|
return res.data.items;
|
||||||
|
}
|
||||||
|
// 如果都不是,返回空数组
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'ApiSelect',
|
||||||
|
fieldName: 'DeviceId',
|
||||||
|
label: $t('abp.log.deviceInfo'),
|
||||||
|
componentProps: {
|
||||||
|
api: postMetersPage,
|
||||||
|
params: {
|
||||||
|
body: {
|
||||||
|
pageIndex: 1,
|
||||||
|
pageSize: 1000, // 获取足够多的数据用于下拉选择
|
||||||
|
},
|
||||||
|
},
|
||||||
|
labelField: 'name',
|
||||||
|
valueField: 'focusAddress',
|
||||||
|
optionsPropName: 'options',
|
||||||
|
immediate: true,
|
||||||
|
showSearch: true,
|
||||||
|
allowClear: true,
|
||||||
|
placeholder: $t('common.pleaseSelect') + $t('abp.log.deviceInfo'),
|
||||||
|
filterOption: false, // 禁用本地过滤,使用服务端搜索
|
||||||
|
optionFilterProp: 'label', // 根据 label 进行过滤
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
// 如果是包装在 data.items 中的,提取出来
|
||||||
|
if (res && res.data && Array.isArray(res.data.items)) {
|
||||||
|
return res.data.items;
|
||||||
|
}
|
||||||
|
// 如果都不是,返回空数组
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
||||||
@ -56,13 +203,16 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
|||||||
title: $t('abp.IoTDBBase.Timestamps'),
|
title: $t('abp.IoTDBBase.Timestamps'),
|
||||||
minWidth: '150',
|
minWidth: '150',
|
||||||
},
|
},
|
||||||
{ field: 'SystemName', title: $t('abp.IoTDBBase.SystemName'), minWidth: '150' },
|
{
|
||||||
|
field: 'SystemName',
|
||||||
|
title: $t('abp.IoTDBBase.SystemName'),
|
||||||
|
minWidth: '150',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'ProjectId',
|
field: 'ProjectId',
|
||||||
title: $t('abp.IoTDBBase.ProjectId'),
|
title: $t('abp.IoTDBBase.ProjectId'),
|
||||||
minWidth: '150',
|
minWidth: '150',
|
||||||
}
|
},
|
||||||
,
|
|
||||||
{
|
{
|
||||||
field: 'DeviceType',
|
field: 'DeviceType',
|
||||||
title: $t('abp.IoTDBBase.DeviceType'),
|
title: $t('abp.IoTDBBase.DeviceType'),
|
||||||
@ -72,11 +222,10 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
|||||||
field: 'IoTDataType',
|
field: 'IoTDataType',
|
||||||
title: $t('abp.IoTDBBase.IoTDataType'),
|
title: $t('abp.IoTDBBase.IoTDataType'),
|
||||||
minWidth: '150',
|
minWidth: '150',
|
||||||
}
|
},
|
||||||
,
|
|
||||||
{
|
{
|
||||||
field: 'DeviceId',
|
field: 'DeviceId',
|
||||||
title: $t('abp.IoTDBBase.DeviceId'),
|
title: $t('abp.IoTDBBase.DeviceId'),
|
||||||
minWidth: '150',
|
minWidth: '150',
|
||||||
}
|
},
|
||||||
]);
|
]);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user