From 1371ec60d97847d5735a023a0054f3ec9c2e0670 Mon Sep 17 00:00:00 2001 From: likunming Date: Tue, 29 Jul 2025 15:07:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=91=E8=A1=A8=E6=A0=BC=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=8B=BE=E9=80=89=E7=AD=96=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../grid/TreeGridFirstTdContent.vue | 7 +++++-- .../components/grid/ts/function/RowData.ts | 21 +++++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/io.sc.platform.core.frontend/src/platform/components/grid/TreeGridFirstTdContent.vue b/io.sc.platform.core.frontend/src/platform/components/grid/TreeGridFirstTdContent.vue index e4e35ed6..d6b472e3 100644 --- a/io.sc.platform.core.frontend/src/platform/components/grid/TreeGridFirstTdContent.vue +++ b/io.sc.platform.core.frontend/src/platform/components/grid/TreeGridFirstTdContent.vue @@ -184,8 +184,11 @@ const selectedFun = (value, event) => { } else { row[tickedField] = false; } - selectedChildren(row, value); - selectedParent(row, value); + if (tools.props.treeTickStrategy === 'leaf') { + // 勾选策略为包含子节点 + selectedChildren(row, value); + selectedParent(row, value); + } if (tools.props.onUpdateTicked) { tools.props.onUpdateTicked(event, row); } diff --git a/io.sc.platform.core.frontend/src/platform/components/grid/ts/function/RowData.ts b/io.sc.platform.core.frontend/src/platform/components/grid/ts/function/RowData.ts index 94d04d84..0263aea1 100644 --- a/io.sc.platform.core.frontend/src/platform/components/grid/ts/function/RowData.ts +++ b/io.sc.platform.core.frontend/src/platform/components/grid/ts/function/RowData.ts @@ -269,15 +269,18 @@ export class RowData extends Base { item.children.forEach((child) => { item[Constant.FIELD_NAMES.CHILDREN_TICKED_COUNT] += child[Constant.FIELD_NAMES.TICKED_COUNT]; }); - if (item[Constant.FIELD_NAMES.CHILDREN_TICKED_COUNT] === 0) { - item[this.props.tickedField] = false; - item[Constant.FIELD_NAMES.TICKED_COUNT] = 0; - } else if (item[Constant.FIELD_NAMES.CHILDREN_TICKED_COUNT] === item.children.length) { - item[this.props.tickedField] = true; - item[Constant.FIELD_NAMES.TICKED_COUNT] = 1; - } else { - item[this.props.tickedField] = null; - item[Constant.FIELD_NAMES.TICKED_COUNT] = 0; + if (this.props.treeTickStrategy === 'leaf') { + // 树勾选策略包含子节点才重新处理其勾选状态。 + if (item[Constant.FIELD_NAMES.CHILDREN_TICKED_COUNT] === 0) { + item[this.props.tickedField] = false; + item[Constant.FIELD_NAMES.TICKED_COUNT] = 0; + } else if (item[Constant.FIELD_NAMES.CHILDREN_TICKED_COUNT] === item.children.length) { + item[this.props.tickedField] = true; + item[Constant.FIELD_NAMES.TICKED_COUNT] = 1; + } else { + item[this.props.tickedField] = null; + item[Constant.FIELD_NAMES.TICKED_COUNT] = 0; + } } } });