資產管理 : 過濾無效檔案、更新資產編輯和圖表資料來源的處理邏輯

This commit is contained in:
koko 2025-08-25 11:57:57 +08:00
parent 8243900f96
commit 2dfc2e5297
2 changed files with 12 additions and 8 deletions

View File

@ -148,13 +148,15 @@ const edit = async (id) => {
// changeParams({ ...searchParams.value, main_id: record.id });
const res = await getAssetSingle(id);
if (res.isSuccess) {
res.data.oriFile = res.data.oriFile.map((file, index) => ({
...file,
key: index,
src: file.file_url,
name: file.orgName,
ext: file.saveName.split(".")[file.saveName.split(".").length - 1],
}));
res.data.oriFile = res.data.oriFile
.filter((file) => file.saveName)
.map((file, index) => ({
...file,
key: index,
src: file.file_url,
name: file.orgName,
ext: file.saveName.split(".")[file.saveName.split(".").length - 1],
}));
res.data.sub_device = res.data.sub_device?.map(
({ device_number, points }) => ({
device_number,

View File

@ -32,7 +32,9 @@ const getMenuData = async () => {
const getData = async (id) => {
const res = await getGraphData(id);
if (res.isSuccess) {
dataSource.value = res.data.map((d) => ({ ...d, key: d.id }));
dataSource.value = res.data
.filter((d) => d.oriSavName)
.map((d) => ({ ...d, key: d.id }));
}
};