1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
| import type { VbenFormSchema } from '#/adapter/form';
| import type { VxeTableGridOptions } from '#/adapter/vxe-table';
| import type { MesDvTelemetryApi } from '#/api/mes/dv/telemetry';
|
| /** 是否异常选项(布尔值,后端直接接收) */
| export const ANOMALY_OPTIONS = [
| { label: '正常', value: false },
| { label: '异常', value: true },
| ];
|
| /** 历史记录搜索表单 */
| export function useHistoryGridFormSchema(): VbenFormSchema[] {
| return [
| {
| fieldName: 'deviceName',
| label: '设备名称',
| component: 'Input',
| componentProps: { allowClear: true, placeholder: '请输入设备名称' },
| },
| {
| fieldName: 'paramName',
| label: '信号名称',
| component: 'Input',
| componentProps: { allowClear: true, placeholder: '请输入信号名称' },
| },
| {
| fieldName: 'whetherAnomaly',
| label: '是否异常',
| component: 'Select',
| componentProps: {
| allowClear: true,
| options: ANOMALY_OPTIONS,
| placeholder: '请选择是否异常',
| },
| },
| {
| fieldName: 'telemetryDataTime',
| label: '遥测时间',
| component: 'RangePicker',
| componentProps: { class: '!w-full', valueFormat: 'YYYY-MM-DD HH:mm:ss' },
| },
| ];
| }
|
| /** 实时数据字段 */
| export function useLatestColumns(): VxeTableGridOptions<MesDvTelemetryApi.Telemetry>['columns'] {
| return [
| { field: 'deviceName', title: '设备名称', minWidth: 140 },
| { field: 'paramName', title: '信号名称', minWidth: 140 },
| { field: 'timelyValue', title: '信号值(实时)', width: 120 },
| {
| field: 'whetherAnomaly',
| title: '是否异常',
| width: 100,
| slots: { default: 'anomaly' },
| },
| { field: 'shiftName', title: '班次', width: 100 },
| {
| field: 'telemetryDataTime',
| title: '遥测时间',
| width: 180,
| formatter: 'formatDateTime',
| },
| { field: 'standardValue', title: '标准值', width: 110 },
| { field: 'avgValue', title: '均值', width: 110 },
| { field: 'maxValue', title: '最大值', width: 110 },
| { field: 'minValue', title: '最小值', width: 110 },
| ];
| }
|
| /** 历史记录字段 */
| export function useHistoryColumns(): VxeTableGridOptions<MesDvTelemetryApi.Telemetry>['columns'] {
| return [
| { field: 'deviceName', title: '设备名称', minWidth: 140 },
| { field: 'paramName', title: '信号名称', minWidth: 140 },
| { field: 'timelyValue', title: '信号值', width: 110 },
| {
| field: 'whetherAnomaly',
| title: '是否异常',
| width: 100,
| slots: { default: 'anomaly' },
| },
| { field: 'shiftName', title: '班次', width: 100 },
| { field: 'billNo', title: '单据号', minWidth: 120 },
| {
| field: 'telemetryDataTime',
| title: '遥测时间',
| width: 180,
| formatter: 'formatDateTime',
| },
| {
| field: 'pullTime',
| title: '拉取时间',
| width: 180,
| formatter: 'formatDateTime',
| },
| ];
| }
|
|