From dc260a5c8d4bb511d2b59f18e88d2c60bc09117c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E4=BA=91=E9=B9=8F?= Date: Tue, 14 Jan 2025 15:04:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=86=E5=8F=B2=E6=95=B0=E6=8D=AE=EF=BC=9A?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=BF=E7=94=A8=E6=A8=A1=E6=9D=BF=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/backend/historyData/index.vue | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/ui/dasadmin/src/views/backend/historyData/index.vue b/ui/dasadmin/src/views/backend/historyData/index.vue index 2d9edf3c..e862597c 100644 --- a/ui/dasadmin/src/views/backend/historyData/index.vue +++ b/ui/dasadmin/src/views/backend/historyData/index.vue @@ -245,7 +245,7 @@ const templateOptions = ref< time: string[] id: string interval: string - column: { label: string; prop: string }[] + column: { label: string; prop: string; id: string }[] windBlowerList: string[] }[] >([]) @@ -259,6 +259,24 @@ const changeTemplate = () => { // selectWindBlower.value = templateData?.windBlowerList ?? selectWindBlower.value submitParams.windBlowerList = templateData?.windBlowerList ?? selectWindBlower.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 dynamicColumn: { label: string; prop: string }[] = [] + const dynamicColumn: { label: string; prop: string; id: string }[] = [] for (let item of selectRowList.value) { if (item.interpolation) { dynamicColumn.push({ label: item.attributeName, prop: item.attributeCode + '--interpolation', + id: item.id, }) } if (item.average) { dynamicColumn.push({ label: item.attributeName + '-平均值', prop: item.attributeCode + '--average', + id: item.id, }) } if (item.max) { dynamicColumn.push({ label: item.attributeName + '-最大值', prop: item.attributeCode + '--max', + id: item.id, }) } if (item.min) { dynamicColumn.push({ label: item.attributeName + '-最小值', prop: item.attributeCode + '--min', + id: item.id, }) } } @@ -710,7 +732,7 @@ const submitParams: { windBlowerList: [], } -const multipleSelection = ref<{ label: string; prop: string }[]>([]) +const multipleSelection = ref<{ label: string; prop: string; id: string }[]>([]) const moveUp = (index: number) => { const temp = multipleSelection.value[index] 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 type = realProp[1] as 'interpolation' | 'average' | 'max' | 'min' const selectRowIndex = selectRowList.value.findIndex((row) => row.attributeCode === realProp[0])! - if(selectRowIndex > -1){ + if (selectRowIndex > -1) { selectRowList.value[selectRowIndex][type] = false } if ( @@ -963,12 +985,10 @@ const exportExcel = () => { } } } - } .templateOption { display: flex; align-items: center; justify-content: space-between; } -