diff --git a/src/components/table/table-head.vue b/src/components/table/table-head.vue index e0dd1d6..e026b90 100644 --- a/src/components/table/table-head.vue +++ b/src/components/table/table-head.vue @@ -84,23 +84,15 @@ }, isSelectAll () { let isSelectAll = true; - let isAllDisabled = true; if (!this.data.length) isSelectAll = false; - for (let i = 0; i < this.data.length; i++) { - if(this.objData[this.data[i]._index]._isDisabled){ - isAllDisabled = isAllDisabled && true; - continue; - }else{ - isAllDisabled = isAllDisabled && false; - } - if (!this.objData[this.data[i]._index]._isChecked ) { + if (!this.objData[this.data[i]._index]._isChecked && !this.objData[this.data[i]._index]._isDisabled) { isSelectAll = false; break; } } - return isAllDisabled ? false : isSelectAll; + return isSelectAll; } }, methods: { diff --git a/src/components/table/table.vue b/src/components/table/table.vue index 43787fa..fbd7166 100644 --- a/src/components/table/table.vue +++ b/src/components/table/table.vue @@ -391,15 +391,21 @@ this.$emit('on-selection-change', selection); }, selectAll (status) { - this.rebuildData.forEach((data) => { + // this.rebuildData.forEach((data) => { + // if(this.objData[data._index]._isDisabled){ + // this.objData[data._index]._isChecked = false; + // }else{ + // this.objData[data._index]._isChecked = status; + // } + + // }); + for(const data of this.rebuildData){ if(this.objData[data._index]._isDisabled){ - this.objData[data._index]._isChecked = false; + continue; }else{ this.objData[data._index]._isChecked = status; } - - }); - + } const selection = this.getSelection(); if (status) { this.$emit('on-select-all', selection); @@ -559,11 +565,7 @@ newRow._isDisabled = false; } if (newRow._checked) { - if(newRow._isDisabled){ - newRow._isChecked = false; - }else{ - newRow._isChecked = newRow._checked; - } + newRow._isChecked = newRow._checked; } else { newRow._isChecked = false; } -- libgit2 0.21.4