From 77bcec49093235837db10d4729bfd885f25dca4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BE=E5=91=88?= Date: Wed, 27 Jul 2022 09:55:36 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=A4=8D=E5=90=88?= =?UTF-8?q?=E8=A1=A8=E5=A4=B4=E6=97=A0=E6=B3=95=E6=8B=96=E6=8B=BD=E7=BC=BA?= =?UTF-8?q?=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/table/table-head.vue | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/components/table/table-head.vue b/src/components/table/table-head.vue index 2a0eb8110..444b458ac 100644 --- a/src/components/table/table-head.vue +++ b/src/components/table/table-head.vue @@ -302,8 +302,35 @@ const finalLeft = parseInt(resizeProxy.style.left, 10); const columnWidth = finalLeft - startColumnLeft; + let _column, rightColumn; + + const findDragColumn = (list) => { + list.forEach(item => { + if(item.__id === column.__id) { + _column = item + } else if (item.children && item.children.length) { + findDragColumn(item.children); + } + }) + } + + findDragColumn(table.columns); + + const findRightColumn = (item) => { + if(item.children && item.children.length) { + const childLength = item.children.length; + findRightColumn(item.children[childLength - 1]) + } else { + rightColumn = item; + } + } + + if(_column && _column.children && _column.children.length) { + findRightColumn(_column.children[_column.children.length - 1]) + rightColumn.width = rightColumn.width + columnWidth - startLeft + startColumnLeft + } + - const _column = table.columns.find(item => item.__id === column.__id); if (_column) _column.width = columnWidth; table.$emit('on-column-width-resize', _column.width, startLeft - startColumnLeft, column, event); From 2543ac1bbaba50e5c6732afbb944ab4f61dfbd6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BE=E5=91=88?= Date: Sat, 24 Sep 2022 14:42:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8DTree=E7=BB=84?= =?UTF-8?q?=E4=BB=B6disabled=E7=8A=B6=E6=80=81=E8=BF=98=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bug描述:当children内元素有disabled状态时候,切换顶层checkbox,disabled元素的checkbox也会随着顶层状态做切换 --- src/components/tree/tree.vue | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/components/tree/tree.vue b/src/components/tree/tree.vue index 3e1b1c24f..529a3d2b6 100644 --- a/src/components/tree/tree.vue +++ b/src/components/tree/tree.vue @@ -144,8 +144,22 @@ if (node.checked == parent.checked && node.indeterminate == parent.indeterminate) return; // no need to update upwards if (node.checked == true) { - this.$set(parent, 'checked', parent[this.childrenKey].every(node => node.checked)); - this.$set(parent, 'indeterminate', !parent.checked); + const checkObj = parent[this.childrenKey].reduce((prev, next) => { + if(next.disabled) { + return prev + } else { + return { + checkedStatus: prev.checkedStatus && next.checked, + noCheckedStatus: prev.noCheckedStatus && !next.checked + } + } + }, { + checkedStatus: true, + noCheckedStatus: true + }) + this.$set(parent, 'checked', checkObj.checkedStatus); + const indeterminateStatus = !checkObj.noCheckedStatus && !checkObj.checkedStatus ? true : checkObj.noCheckedStatus && checkObj.checkedStatus + this.$set(parent, 'indeterminate', indeterminateStatus) } else { this.$set(parent, 'checked', false); this.$set(parent, 'indeterminate', parent[this.childrenKey].some(node => node.checked || node.indeterminate)); @@ -187,7 +201,9 @@ } if (node[this.childrenKey]) { node[this.childrenKey].forEach(child => { - this.updateTreeDown(child, changes); + if(!child.disabled) { + this.updateTreeDown(child, changes); + } }); } },