Commit cd85c675101d8f2e566fe0f389d8d876ed48bb9d

Authored by leonine
1 parent c7315098

修改_checked=true 时,在_disabled=true的时候被取消了选中的状态的问题

src/components/table/table-head.vue
... ... @@ -84,23 +84,15 @@
84 84 },
85 85 isSelectAll () {
86 86 let isSelectAll = true;
87   - let isAllDisabled = true;
88 87 if (!this.data.length) isSelectAll = false;
89   -
90 88 for (let i = 0; i < this.data.length; i++) {
91   - if(this.objData[this.data[i]._index]._isDisabled){
92   - isAllDisabled = isAllDisabled && true;
93   - continue;
94   - }else{
95   - isAllDisabled = isAllDisabled && false;
96   - }
97   - if (!this.objData[this.data[i]._index]._isChecked ) {
  89 + if (!this.objData[this.data[i]._index]._isChecked && !this.objData[this.data[i]._index]._isDisabled) {
98 90 isSelectAll = false;
99 91 break;
100 92 }
101 93 }
102 94  
103   - return isAllDisabled ? false : isSelectAll;
  95 + return isSelectAll;
104 96 }
105 97 },
106 98 methods: {
... ...
src/components/table/table.vue
... ... @@ -391,15 +391,21 @@
391 391 this.$emit('on-selection-change', selection);
392 392 },
393 393 selectAll (status) {
394   - this.rebuildData.forEach((data) => {
  394 + // this.rebuildData.forEach((data) => {
  395 + // if(this.objData[data._index]._isDisabled){
  396 + // this.objData[data._index]._isChecked = false;
  397 + // }else{
  398 + // this.objData[data._index]._isChecked = status;
  399 + // }
  400 +
  401 + // });
  402 + for(const data of this.rebuildData){
395 403 if(this.objData[data._index]._isDisabled){
396   - this.objData[data._index]._isChecked = false;
  404 + continue;
397 405 }else{
398 406 this.objData[data._index]._isChecked = status;
399 407 }
400   -
401   - });
402   -
  408 + }
403 409 const selection = this.getSelection();
404 410 if (status) {
405 411 this.$emit('on-select-all', selection);
... ... @@ -559,11 +565,7 @@
559 565 newRow._isDisabled = false;
560 566 }
561 567 if (newRow._checked) {
562   - if(newRow._isDisabled){
563   - newRow._isChecked = false;
564   - }else{
565   - newRow._isChecked = newRow._checked;
566   - }
  568 + newRow._isChecked = newRow._checked;
567 569 } else {
568 570 newRow._isChecked = false;
569 571 }
... ...