提交 ccbc4576 编写于 作者: P ph 提交者: ougongchang

fix all select issue

上级 64154380
...@@ -162,6 +162,7 @@ export default { ...@@ -162,6 +162,7 @@ export default {
listSelectAll() { listSelectAll() {
this.operateSelectAll = !this.operateSelectAll; this.operateSelectAll = !this.operateSelectAll;
this.multiSelectedItemNames = {}; this.multiSelectedItemNames = {};
this.selectedNumber = 0;
// Setting the status of list items // Setting the status of list items
if (this.operateSelectAll) { if (this.operateSelectAll) {
if (this.isLimit) { if (this.isLimit) {
...@@ -171,7 +172,7 @@ export default { ...@@ -171,7 +172,7 @@ export default {
break; break;
} }
const listItem = this.checkListArr[i]; const listItem = this.checkListArr[i];
if (listItem.show && !listItem.checked) { if ((listItem.show && !listItem.checked) || listItem.checked) {
listItem.checked = true; listItem.checked = true;
this.multiSelectedItemNames[listItem.label] = true; this.multiSelectedItemNames[listItem.label] = true;
this.selectedNumber++; this.selectedNumber++;
...@@ -216,14 +217,17 @@ export default { ...@@ -216,14 +217,17 @@ export default {
} }
this.valiableSearchInput = this.searchInput; this.valiableSearchInput = this.searchInput;
this.multiSelectedItemNames = {}; this.multiSelectedItemNames = {};
this.selectedNumber = 0;
let itemSelectAll = true; let itemSelectAll = true;
// Filter the tags that do not meet the conditions in the operation bar and hide them // Filter the tags that do not meet the conditions in the operation bar and hide them
this.checkListArr.forEach((listItem) => { this.checkListArr.forEach((listItem) => {
if (listItem.checked) {
this.multiSelectedItemNames[listItem.label] = true;
this.selectedNumber++;
}
if (reg.test(listItem.label)) { if (reg.test(listItem.label)) {
listItem.show = true; listItem.show = true;
if (listItem.checked) { if (!listItem.checked) {
this.multiSelectedItemNames[listItem.label] = true;
} else {
itemSelectAll = false; itemSelectAll = false;
} }
} else { } else {
...@@ -232,7 +236,7 @@ export default { ...@@ -232,7 +236,7 @@ export default {
}); });
// Update the selected status of the Select All button // Update the selected status of the Select All button
if (this.isLimit && !itemSelectAll) { if (this.isLimit && !itemSelectAll) {
itemSelectAll = this.selectedNumber >= this.limitNum; itemSelectAll = this.selectedNumber >= this.limitNum || this.selectedNumber >= this.checkListArr.length;
} }
this.operateSelectAll = itemSelectAll; this.operateSelectAll = itemSelectAll;
this.$emit('selectedChange', this.multiSelectedItemNames); this.$emit('selectedChange', this.multiSelectedItemNames);
...@@ -271,7 +275,7 @@ export default { ...@@ -271,7 +275,7 @@ export default {
} }
}); });
if (this.isLimit && !itemSelectAll) { if (this.isLimit && !itemSelectAll) {
itemSelectAll = this.selectedNumber >= this.limitNum; itemSelectAll = this.selectedNumber >= this.limitNum || this.selectedNumber >= this.checkListArr.length;
} }
this.operateSelectAll = itemSelectAll; this.operateSelectAll = itemSelectAll;
// Return a dictionary containing selected items. // Return a dictionary containing selected items.
...@@ -323,7 +327,7 @@ export default { ...@@ -323,7 +327,7 @@ export default {
listItem.show = false; listItem.show = false;
} }
} }
if (this.selectedNumber >= this.limitNum) { if (this.selectedNumber >= this.limitNum || this.selectedNumber >= this.checkListArr.length) {
itemSelectAll = true; itemSelectAll = true;
} else { } else {
itemSelectAll = false; itemSelectAll = false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册