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++) {