|
|
|
@ -98,6 +98,7 @@ export default defineComponent({ |
|
|
|
return |
|
|
|
|
|
|
|
const normalized = normalizeTrainTime(payload) |
|
|
|
const normalizedPointInfo = normalizePointInfoList(normalized?.pointInfo) |
|
|
|
const previous = model.value || {} |
|
|
|
const merged: any = { |
|
|
|
...previous, |
|
|
|
@ -106,7 +107,9 @@ export default defineComponent({ |
|
|
|
|
|
|
|
if (!Array.isArray(normalized?.trainTime)) |
|
|
|
merged.trainTime = previous?.trainTime ?? [] |
|
|
|
if (!Array.isArray(normalized?.pointInfo)) |
|
|
|
if (normalizedPointInfo) |
|
|
|
merged.pointInfo = normalizedPointInfo |
|
|
|
else if (!Array.isArray(normalized?.pointInfo)) |
|
|
|
merged.pointInfo = previous?.pointInfo ?? [] |
|
|
|
if (normalized?.para === undefined && previous?.para !== undefined) |
|
|
|
merged.para = previous.para |
|
|
|
@ -130,7 +133,7 @@ export default defineComponent({ |
|
|
|
const list = model.value?.pointInfo || [] |
|
|
|
return list.map((p: any) => ({ |
|
|
|
description: p.description ?? p.Description, |
|
|
|
pointId: p.pointId ?? p.PointId, |
|
|
|
PointId: p.PointId ?? p.pointId, |
|
|
|
unit: p.unit ?? p.Unit, |
|
|
|
Upper: p.Upper ?? p.upper, |
|
|
|
Lower: p.Lower ?? p.lower, |
|
|
|
@ -196,7 +199,7 @@ export default defineComponent({ |
|
|
|
startTime: historyTime.value[0].format('YYYY-MM-DD HH:mm:ss'), |
|
|
|
endTime: historyTime.value[1].format('YYYY-MM-DD HH:mm:ss'), |
|
|
|
itemName: model.value?.pointInfo |
|
|
|
.map(item => item.pointId) |
|
|
|
.map(item => item.PointId) |
|
|
|
.join(','), |
|
|
|
interval: model.value.sampling, |
|
|
|
} |
|
|
|
@ -205,7 +208,7 @@ export default defineComponent({ |
|
|
|
const point = model.value?.pointInfo[index] |
|
|
|
return { |
|
|
|
data: [item], |
|
|
|
name: `${index + 1}.${point?.description}(${point?.pointId})`, |
|
|
|
name: `${index + 1}.${point?.description}(${point?.PointId})`, |
|
|
|
} |
|
|
|
}) |
|
|
|
echartsRefs.value = Array.from({ length: historyList.value.length }) |
|
|
|
@ -230,7 +233,7 @@ export default defineComponent({ |
|
|
|
time: timeRange |
|
|
|
.map(t => dayjs(t).format('YYYY-MM-DD HH:mm:ss')) |
|
|
|
.join(','), |
|
|
|
points: model.value.pointInfo.map(t => t.pointId).join(','), |
|
|
|
points: model.value.pointInfo.map(t => t.PointId).join(','), |
|
|
|
interval: model.value.sampling * 1000, |
|
|
|
}, |
|
|
|
} |
|
|
|
@ -257,7 +260,7 @@ export default defineComponent({ |
|
|
|
return [xData[i], t] |
|
|
|
}), |
|
|
|
], |
|
|
|
name: `${index + 1}.${point?.description}(${point?.pointId})`, |
|
|
|
name: `${index + 1}.${point?.description}(${point?.PointId})`, |
|
|
|
} |
|
|
|
}) |
|
|
|
brushActivated.value = new Set() |
|
|
|
@ -269,6 +272,19 @@ export default defineComponent({ |
|
|
|
return Array.from({ length: count }, (_, i) => t1.add(i * intervalMs, 'millisecond').valueOf()) |
|
|
|
} |
|
|
|
|
|
|
|
function normalizePointInfoList(pointInfo: any) { |
|
|
|
if (!Array.isArray(pointInfo)) |
|
|
|
return undefined |
|
|
|
return pointInfo.map((item: any) => { |
|
|
|
const PointId = item?.PointId ?? item?.pointId |
|
|
|
return { |
|
|
|
...item, |
|
|
|
PointId, |
|
|
|
pointId: PointId, |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
function normalizeTrainTime(modelInfo: any) { |
|
|
|
if (!modelInfo?.trainTime || !Array.isArray(modelInfo.trainTime)) |
|
|
|
return modelInfo |
|
|
|
@ -535,7 +551,7 @@ export default defineComponent({ |
|
|
|
percent: modelInfo.rate, |
|
|
|
}, |
|
|
|
Train_Data: { |
|
|
|
points: pointInfo.map(item => item.pointId).join(','), |
|
|
|
points: pointInfo.map(item => item.PointId).join(','), |
|
|
|
dead: pointInfo.map(item => (item.dead ? '1' : '0')).join(','), |
|
|
|
limit: pointInfo.map(item => (item.limit ? '1' : '0')).join(','), |
|
|
|
uplow: pointInfo |
|
|
|
@ -684,7 +700,7 @@ export default defineComponent({ |
|
|
|
const pageIndex = index |
|
|
|
// 全局 index |
|
|
|
const globalIndex = model.value.pointInfo.findIndex( |
|
|
|
item => item.pointId === record.pointId, |
|
|
|
item => item.PointId === record.PointId, |
|
|
|
) |
|
|
|
openEditPointModal.value = true |
|
|
|
pointEditRecord = record |
|
|
|
@ -750,7 +766,7 @@ export default defineComponent({ |
|
|
|
editModelForm.value.rate = model.value?.rate || 0 |
|
|
|
editModelForm.value.selectedKeys = (model.value?.pointInfo || []).map(item => buildPointKeyFromInfo({ |
|
|
|
description: item.description ?? item.Description, |
|
|
|
pointId: item.pointId ?? item.PointId, |
|
|
|
PointId: item.PointId ?? item.pointId, |
|
|
|
unit: item.unit ?? item.Unit, |
|
|
|
Lower: item.Lower ?? item.lower, |
|
|
|
Upper: item.Upper ?? item.upper, |
|
|
|
@ -765,10 +781,10 @@ export default defineComponent({ |
|
|
|
model.value.sampling = editModelForm.value.sampling |
|
|
|
model.value.rate = editModelForm.value.rate |
|
|
|
model.value.pointInfo = editModelForm.value.selectedKeys.map((key) => { |
|
|
|
const { description, pointId, unit, Lower, Upper } = parsePointKey(key) |
|
|
|
const { description, PointId, unit, Lower, Upper } = parsePointKey(key) |
|
|
|
return { |
|
|
|
description, |
|
|
|
pointId, |
|
|
|
PointId, |
|
|
|
unit, |
|
|
|
Lower, |
|
|
|
Upper, |
|
|
|
|