...
|
...
|
@@ -23,7 +23,6 @@ |
23
|
23
|
@deselect="handleDeselect"
|
24
|
24
|
mode="multiple"
|
25
|
25
|
labelInValue
|
26
|
|
- allowClear
|
27
|
26
|
notFoundContent="请选择设备"
|
28
|
27
|
/>
|
29
|
28
|
<div style="margin-top: 1.5vh"></div>
|
...
|
...
|
@@ -66,6 +65,7 @@ |
66
|
65
|
attribute?: string;
|
67
|
66
|
device?: string;
|
68
|
67
|
name?: string;
|
|
68
|
+ attributes?: string | undefined;
|
69
|
69
|
};
|
70
|
70
|
const emit = defineEmits(['success', 'register']);
|
71
|
71
|
const bindDeviceRefObj = {
|
...
|
...
|
@@ -105,8 +105,10 @@ |
105
|
105
|
//设备Select选中
|
106
|
106
|
const handleDeviceChange = (e) => {
|
107
|
107
|
if (unref(isUpdate)) {
|
|
108
|
+ //编辑
|
|
109
|
+ let temp: any = [];
|
108
|
110
|
editDeviceAttr.value.forEach((f) => {
|
109
|
|
- deviceList.value = [f, ...e];
|
|
111
|
+ temp = [f, ...e];
|
110
|
112
|
});
|
111
|
113
|
let deWeightThree = () => {
|
112
|
114
|
let map = new Map();
|
...
|
...
|
@@ -117,7 +119,11 @@ |
117
|
119
|
}
|
118
|
120
|
return [...map.values()];
|
119
|
121
|
};
|
120
|
|
- deviceList.value = deWeightThree();
|
|
122
|
+ temp = deWeightThree();
|
|
123
|
+ deviceList.value = temp;
|
|
124
|
+ if (e.length !== 0) {
|
|
125
|
+ deviceList.value = e;
|
|
126
|
+ }
|
121
|
127
|
} else {
|
122
|
128
|
deviceList.value = e;
|
123
|
129
|
}
|
...
|
...
|
@@ -125,7 +131,7 @@ |
125
|
131
|
//设备取消删除
|
126
|
132
|
const handleDeselect = (e) => {
|
127
|
133
|
if (unref(isUpdate)) {
|
128
|
|
- const eEditDevice = e.key || e.value;
|
|
134
|
+ //编辑
|
129
|
135
|
let deWeightThree = () => {
|
130
|
136
|
let map = new Map();
|
131
|
137
|
for (let item of deviceList.value) {
|
...
|
...
|
@@ -136,8 +142,13 @@ |
136
|
142
|
return [...map.values()];
|
137
|
143
|
};
|
138
|
144
|
deviceList.value = deWeightThree();
|
139
|
|
- const findEditValue = deviceList.value.findIndex((f) => f.value == eEditDevice);
|
|
145
|
+ const findEditValue = deviceList.value.findIndex((f) => f.value == e.value);
|
140
|
146
|
if (findEditValue !== -1) deviceList.value.splice(findEditValue, 1);
|
|
147
|
+ // try {
|
|
148
|
+ // if (deviceList.value[0]?.attributes.length > 0) {
|
|
149
|
+ // deviceList.value.splice(0, 1);
|
|
150
|
+ // }
|
|
151
|
+ // } catch {}
|
141
|
152
|
} else {
|
142
|
153
|
const eDevice = e.key || e.value;
|
143
|
154
|
const findValue = deviceList.value.findIndex((f) => f.value == eDevice);
|
...
|
...
|
@@ -179,12 +190,29 @@ |
179
|
190
|
await setFieldsValue({
|
180
|
191
|
agg: editResData.data.queryCondition?.agg,
|
181
|
192
|
interval: editResData.data.queryCondition?.interval,
|
182
|
|
- limit1: editResData.data.queryCondition?.limit,
|
|
193
|
+ limit: editResData.data.queryCondition?.limit,
|
183
|
194
|
orderBy: editResData.data.queryCondition?.orderBy,
|
184
|
195
|
useStrictDataTypes: editResData.data.queryCondition?.useStrictDataTypes,
|
185
|
196
|
startTs: editResData.data.queryCondition?.startTs,
|
186
|
197
|
endTs: editResData.data.queryCondition?.endTs,
|
|
198
|
+ way: editResData.data?.way,
|
|
199
|
+ queryMode: editResData.data.queryCondition?.queryMode === 0 ? 'latest' : 'timePeriod',
|
|
200
|
+ });
|
|
201
|
+ const endTsTime = editResData.data.queryCondition?.endTs;
|
|
202
|
+ const startTsTime = editResData.data.queryCondition?.startTs;
|
|
203
|
+ const mathFloor = (endTsTime - startTsTime) / 10;
|
|
204
|
+ const multTen = Math.floor(mathFloor) * 10;
|
|
205
|
+ await setFieldsValue({
|
|
206
|
+ startTs: multTen,
|
187
|
207
|
});
|
|
208
|
+ if (editResData.data.queryCondition?.queryMode == 1) {
|
|
209
|
+ await setFieldsValue({
|
|
210
|
+ dataRange: [
|
|
211
|
+ editResData.data.queryCondition?.startTs,
|
|
212
|
+ editResData.data.queryCondition?.endTs,
|
|
213
|
+ ],
|
|
214
|
+ });
|
|
215
|
+ }
|
188
|
216
|
//回显聚合条件
|
189
|
217
|
const dataCompareOpions = [
|
190
|
218
|
{ label: '最小值', value: AggregateDataEnum.MIN },
|
...
|
...
|
@@ -248,6 +276,10 @@ |
248
|
276
|
deviceList.value = editDeviceAttr.value;
|
249
|
277
|
editDeviceList.value = editResData.data.executeAttributes;
|
250
|
278
|
} else {
|
|
279
|
+ setFieldsValue({
|
|
280
|
+ startTs: 1000,
|
|
281
|
+ interval: 1000,
|
|
282
|
+ });
|
251
|
283
|
editId.value = '';
|
252
|
284
|
orgId.value = '';
|
253
|
285
|
selectDevice.value = [];
|
...
|
...
|
@@ -312,13 +344,17 @@ |
312
|
344
|
if (getAttrDevice.value.length === 0) {
|
313
|
345
|
return createMessage.error('请选择设备及其属性');
|
314
|
346
|
}
|
|
347
|
+ } else {
|
|
348
|
+ if (getAttrDevice.value.length === 0) {
|
|
349
|
+ return createMessage.error('请选择设备及其属性');
|
|
350
|
+ }
|
315
|
351
|
}
|
316
|
352
|
if (values.executeWay == 0) {
|
317
|
353
|
executeContent = null;
|
318
|
354
|
} else {
|
319
|
355
|
executeContent = values.cronTime;
|
320
|
356
|
}
|
321
|
|
- if (values.way === QueryWay.LATEST) {
|
|
357
|
+ if (values.queryMode === QueryWay.LATEST) {
|
322
|
358
|
startTs.value = moment().subtract(values.startTs, 'ms').valueOf();
|
323
|
359
|
endTs.value = Date.now();
|
324
|
360
|
} else {
|
...
|
...
|
@@ -335,6 +371,7 @@ |
335
|
371
|
...{
|
336
|
372
|
endTs: endTs.value,
|
337
|
373
|
},
|
|
374
|
+ queryMode: values?.queryMode === 'latest' ? 0 : 1,
|
338
|
375
|
};
|
339
|
376
|
|
340
|
377
|
delete values.devices;
|
...
|
...
|
@@ -347,6 +384,7 @@ |
347
|
384
|
delete values.cronYear;
|
348
|
385
|
delete values.limit1;
|
349
|
386
|
delete values.startTs;
|
|
387
|
+ delete values.queryMode;
|
350
|
388
|
postObj = {
|
351
|
389
|
...values,
|
352
|
390
|
...{
|
...
|
...
|
|