历史数据:修改使用模板数据同步

This commit is contained in:
高云鹏 2025-01-14 15:04:59 +08:00
parent b4143608d8
commit dc260a5c8d

View File

@ -245,7 +245,7 @@ const templateOptions = ref<
time: string[] time: string[]
id: string id: string
interval: string interval: string
column: { label: string; prop: string }[] column: { label: string; prop: string; id: string }[]
windBlowerList: string[] windBlowerList: string[]
}[] }[]
>([]) >([])
@ -259,6 +259,24 @@ const changeTemplate = () => {
// selectWindBlower.value = templateData?.windBlowerList ?? selectWindBlower.value // selectWindBlower.value = templateData?.windBlowerList ?? selectWindBlower.value
submitParams.windBlowerList = templateData?.windBlowerList ?? selectWindBlower.value submitParams.windBlowerList = templateData?.windBlowerList ?? selectWindBlower.value
submitParams.column = templateData?.column ?? multipleSelection.value submitParams.column = templateData?.column ?? multipleSelection.value
const selectList: any = []
if (templateData?.column) {
templateData.column.forEach((item: { label: string; prop: string; id: string }) => {
const realProp = item.prop.split('--')
const exist = selectList.find((v: any) => v.attributeCode === realProp[0])
if (exist) {
exist[realProp[1]] = true
} else {
selectList.push({
id: item.id,
attributeCode: realProp[0],
attributeName: item.label,
[realProp[1]]: true,
})
}
})
}
selectRowList.value = selectList
} }
} }
@ -672,30 +690,34 @@ const getcurrentPageForPointDialog = () => {
} }
const getAddColumn = () => { const getAddColumn = () => {
const dynamicColumn: { label: string; prop: string }[] = [] const dynamicColumn: { label: string; prop: string; id: string }[] = []
for (let item of selectRowList.value) { for (let item of selectRowList.value) {
if (item.interpolation) { if (item.interpolation) {
dynamicColumn.push({ dynamicColumn.push({
label: item.attributeName, label: item.attributeName,
prop: item.attributeCode + '--interpolation', prop: item.attributeCode + '--interpolation',
id: item.id,
}) })
} }
if (item.average) { if (item.average) {
dynamicColumn.push({ dynamicColumn.push({
label: item.attributeName + '-平均值', label: item.attributeName + '-平均值',
prop: item.attributeCode + '--average', prop: item.attributeCode + '--average',
id: item.id,
}) })
} }
if (item.max) { if (item.max) {
dynamicColumn.push({ dynamicColumn.push({
label: item.attributeName + '-最大值', label: item.attributeName + '-最大值',
prop: item.attributeCode + '--max', prop: item.attributeCode + '--max',
id: item.id,
}) })
} }
if (item.min) { if (item.min) {
dynamicColumn.push({ dynamicColumn.push({
label: item.attributeName + '-最小值', label: item.attributeName + '-最小值',
prop: item.attributeCode + '--min', prop: item.attributeCode + '--min',
id: item.id,
}) })
} }
} }
@ -710,7 +732,7 @@ const submitParams: {
windBlowerList: [], windBlowerList: [],
} }
const multipleSelection = ref<{ label: string; prop: string }[]>([]) const multipleSelection = ref<{ label: string; prop: string; id: string }[]>([])
const moveUp = (index: number) => { const moveUp = (index: number) => {
const temp = multipleSelection.value[index] const temp = multipleSelection.value[index]
multipleSelection.value[index] = multipleSelection.value[index - 1] multipleSelection.value[index] = multipleSelection.value[index - 1]
@ -726,7 +748,7 @@ const moveRemove = (index: number, item: { label: string; prop: string }) => {
const realProp = item.prop.split('--') const realProp = item.prop.split('--')
const type = realProp[1] as 'interpolation' | 'average' | 'max' | 'min' const type = realProp[1] as 'interpolation' | 'average' | 'max' | 'min'
const selectRowIndex = selectRowList.value.findIndex((row) => row.attributeCode === realProp[0])! const selectRowIndex = selectRowList.value.findIndex((row) => row.attributeCode === realProp[0])!
if(selectRowIndex > -1){ if (selectRowIndex > -1) {
selectRowList.value[selectRowIndex][type] = false selectRowList.value[selectRowIndex][type] = false
} }
if ( if (
@ -963,12 +985,10 @@ const exportExcel = () => {
} }
} }
} }
} }
.templateOption { .templateOption {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
</style> </style>