From 3f49c5b0b1aa70e1514ca48e655ca74da592e169 Mon Sep 17 00:00:00 2001 From: likunming Date: Tue, 5 Mar 2024 14:19:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E4=BC=98=E5=8C=96=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- io.sc.platform.core.frontend/package.json | 2 +- .../src/platform/components/grid/WGrid.vue | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/io.sc.platform.core.frontend/package.json b/io.sc.platform.core.frontend/package.json index e8092c8f..51a439f5 100644 --- a/io.sc.platform.core.frontend/package.json +++ b/io.sc.platform.core.frontend/package.json @@ -1,6 +1,6 @@ { "name": "platform-core", - "version": "8.1.131", + "version": "8.1.132", "description": "前端核心包,用于快速构建前端的脚手架", "//main": "库的主文件", "main": "dist/platform-core.js", diff --git a/io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue b/io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue index f3231424..78848574 100644 --- a/io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue +++ b/io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue @@ -1518,15 +1518,22 @@ const setLocalData = (rows: any) => { state.pagination.rowsNumber = table.rows.length; stickyHeaderColumn(); }; -// 替换单行数据 -const replaceRow = (row) => { - for (let i = 0; i < table.rows.length; i++) { - if (row[rowKey_] === table.rows[i][rowKey_]) { - table.rows[i] = { ...table.rows[i], ...row }; + +const replaceRowHandler = (arr, row) => { + for (let i = 0; i < arr.length; i++) { + if (row[rowKey_] === arr[i][rowKey_]) { + arr[i] = { ...arr[i], ...row }; break; + } else if (props.tree && arr[i].children && arr[i].children.length > 0) { + replaceRowHandler(arr[i].children, row); } } }; +// 替换单行数据 +const replaceRow = (row) => { + replaceRowHandler(table.rows, row); +}; + // 删除选中数据 const removeRows = (rows) => { rows.forEach((item) => {