From f150ea3be4ce116c61b0ddadfe88d8006748d2c6 Mon Sep 17 00:00:00 2001 From: fengrong Date: Fri, 8 Nov 2024 17:02:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E6=97=B6=E6=95=B0=E6=8D=AE=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/backend/realData/index.vue | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/ui/dasadmin/src/views/backend/realData/index.vue b/ui/dasadmin/src/views/backend/realData/index.vue index e0ab2891..3c60fbd9 100644 --- a/ui/dasadmin/src/views/backend/realData/index.vue +++ b/ui/dasadmin/src/views/backend/realData/index.vue @@ -564,17 +564,8 @@ const getTableData = () => { const value = tsnapshotVoObject[itemKey]?.[attributeCodeLower]; let formattedValue = value !== undefined ? (value % 1 === 0 ? value : value.toFixed(3)) : '-'; if (enumStore.keys.includes(item1.attributeCode)) { - formattedValue = enumStore.data[item1.attributeCode][formattedValue] + formattedValue = enumStore.data[item1.attributeCode][formattedValue]?enumStore.data[item1.attributeCode][formattedValue]:'-' } - /*const newItem = {}; - for (const key in item) { - if (item.hasOwnProperty(key)) { - //newItem[key] = item[key]; - newItem['id'] = item['id']; - newItem['name'] = item['name']; - } - } - newItem[attributeCodeLower] = formattedValue;*/ if(attributeCodeLower==='ipitchangle'|| attributeCodeLower==='ipitchangle1'|| attributeCodeLower==='ipitchangle2'|| @@ -582,7 +573,6 @@ const getTableData = () => { arr[i] = { ...item, [attributeCodeLower]: formattedValue,[ipitchangle]: ipitchanglevalue}; }else{ arr[i] = { ...item, [attributeCodeLower]: formattedValue}; - //arr[i]=newItem } } } @@ -606,11 +596,32 @@ const downFun=(tableColumn,tableData)=>{ const { id, ...rest } = item; return rest; }); + if (!tableColumn.length || !itemsWithoutAge.length) { + return []; + } + const columnSet = new Set(tableColumn.map(item => item.prop)); + const result = []; + try { + itemsWithoutAge.forEach((item) => { + const newItem = {}; + for (const itemKey in item) { + if (columnSet.has(itemKey)) { + newItem[itemKey] = item[itemKey]; + } + } + if (Object.keys(newItem).length > 0) { + result.push(newItem); + } + }); + } catch (error) { + console.error('Error in code execution:', error); + return []; + } let addobj = {} tableColumn.map((v, i) => { addobj['rowData' + i] = v.label }) - let tableDatadown = JSON.parse(JSON.stringify(itemsWithoutAge)) + let tableDatadown = JSON.parse(JSON.stringify(result)) tableDatadown.unshift(addobj) let str = ``; for(let i = 0; i < tableDatadown.length; i++) {