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

This commit is contained in:
leonine 2017-02-23 16:51:43 +08:00
parent c731509853
commit cd85c67510
2 changed files with 14 additions and 20 deletions

View file

@ -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: {

View file

@ -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;
}