实时数据逻辑优化
This commit is contained in:
parent
8280b6f4ca
commit
f150ea3be4
@ -564,17 +564,8 @@ const getTableData = () => {
|
|||||||
const value = tsnapshotVoObject[itemKey]?.[attributeCodeLower];
|
const value = tsnapshotVoObject[itemKey]?.[attributeCodeLower];
|
||||||
let formattedValue = value !== undefined ? (value % 1 === 0 ? value : value.toFixed(3)) : '-';
|
let formattedValue = value !== undefined ? (value % 1 === 0 ? value : value.toFixed(3)) : '-';
|
||||||
if (enumStore.keys.includes(item1.attributeCode)) {
|
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'||
|
if(attributeCodeLower==='ipitchangle'||
|
||||||
attributeCodeLower==='ipitchangle1'||
|
attributeCodeLower==='ipitchangle1'||
|
||||||
attributeCodeLower==='ipitchangle2'||
|
attributeCodeLower==='ipitchangle2'||
|
||||||
@ -582,7 +573,6 @@ const getTableData = () => {
|
|||||||
arr[i] = { ...item, [attributeCodeLower]: formattedValue,[ipitchangle]: ipitchanglevalue};
|
arr[i] = { ...item, [attributeCodeLower]: formattedValue,[ipitchangle]: ipitchanglevalue};
|
||||||
}else{
|
}else{
|
||||||
arr[i] = { ...item, [attributeCodeLower]: formattedValue};
|
arr[i] = { ...item, [attributeCodeLower]: formattedValue};
|
||||||
//arr[i]=newItem
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -606,11 +596,32 @@ const downFun=(tableColumn,tableData)=>{
|
|||||||
const { id, ...rest } = item;
|
const { id, ...rest } = item;
|
||||||
return rest;
|
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 = {}
|
let addobj = {}
|
||||||
tableColumn.map((v, i) => {
|
tableColumn.map((v, i) => {
|
||||||
addobj['rowData' + i] = v.label
|
addobj['rowData' + i] = v.label
|
||||||
})
|
})
|
||||||
let tableDatadown = JSON.parse(JSON.stringify(itemsWithoutAge))
|
let tableDatadown = JSON.parse(JSON.stringify(result))
|
||||||
tableDatadown.unshift(addobj)
|
tableDatadown.unshift(addobj)
|
||||||
let str = ``;
|
let str = ``;
|
||||||
for(let i = 0; i < tableDatadown.length; i++) {
|
for(let i = 0; i < tableDatadown.length; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user