提交 84fb9585 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!236 UI Fix multiSelectComponent filter result incorrect

Merge pull request !236 from 夏易凡/yf-master
...@@ -48,7 +48,8 @@ limitations under the License. ...@@ -48,7 +48,8 @@ limitations under the License.
popper-class="tooltip-show-content" popper-class="tooltip-show-content"
:content="item.label" :content="item.label"
placement="top"> placement="top">
<span class="select-disable"><i title="CACHING" v-if="item.loading" <span class="select-disable"><i title="CACHING"
v-if="item.loading"
class="el-icon-loading"></i>{{item.label}}</span> class="el-icon-loading"></i>{{item.label}}</span>
</el-tooltip> </el-tooltip>
</span> </span>
...@@ -79,7 +80,8 @@ limitations under the License. ...@@ -79,7 +80,8 @@ limitations under the License.
popper-class="tooltip-show-content" popper-class="tooltip-show-content"
:content="item.label" :content="item.label"
placement="top"> placement="top">
<span class="select-disable"><i title="CACHING" v-if="item.loading" <span class="select-disable"><i title="CACHING"
v-if="item.loading"
class="el-icon-loading"></i>{{item.label}}</span> class="el-icon-loading"></i>{{item.label}}</span>
</el-tooltip> </el-tooltip>
</span> </span>
...@@ -172,7 +174,12 @@ export default { ...@@ -172,7 +174,12 @@ export default {
break; break;
} }
const listItem = this.checkListArr[i]; const listItem = this.checkListArr[i];
if ((listItem.show && !listItem.checked) || listItem.checked) { if (listItem.checked) {
this.selectedNumber++;
if (listItem.show) {
this.multiSelectedItemNames[listItem.label] = true;
}
} else if (listItem.show) {
listItem.checked = true; listItem.checked = true;
this.multiSelectedItemNames[listItem.label] = true; this.multiSelectedItemNames[listItem.label] = true;
this.selectedNumber++; this.selectedNumber++;
...@@ -222,13 +229,14 @@ export default { ...@@ -222,13 +229,14 @@ export default {
// 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) { if (listItem.checked) {
this.multiSelectedItemNames[listItem.label] = true;
this.selectedNumber++; this.selectedNumber++;
} }
if (reg.test(listItem.label)) { if (reg.test(listItem.label)) {
listItem.show = true; listItem.show = true;
if (!listItem.checked) { if (!listItem.checked) {
itemSelectAll = false; itemSelectAll = false;
} else {
this.multiSelectedItemNames[listItem.label] = true;
} }
} else { } else {
listItem.show = false; listItem.show = false;
...@@ -236,7 +244,9 @@ export default { ...@@ -236,7 +244,9 @@ 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 || this.selectedNumber >= this.checkListArr.length; 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);
...@@ -275,7 +285,9 @@ export default { ...@@ -275,7 +285,9 @@ export default {
} }
}); });
if (this.isLimit && !itemSelectAll) { if (this.isLimit && !itemSelectAll) {
itemSelectAll = this.selectedNumber >= this.limitNum || this.selectedNumber >= this.checkListArr.length; 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.
...@@ -307,9 +319,9 @@ export default { ...@@ -307,9 +319,9 @@ export default {
reg = new RegExp(this.valiableSearchInput); reg = new RegExp(this.valiableSearchInput);
} }
this.multiSelectedItemNames = {}; this.multiSelectedItemNames = {};
this.selectedNumber = 0;
let itemSelectAll = true; let itemSelectAll = true;
if (this.isLimit) { if (this.isLimit) {
this.selectedNumber = 0;
const loopCount = this.checkListArr.length; const loopCount = this.checkListArr.length;
for (let i = 0; i < loopCount; i++) { for (let i = 0; i < loopCount; i++) {
const listItem = this.checkListArr[i]; const listItem = this.checkListArr[i];
...@@ -317,17 +329,22 @@ export default { ...@@ -317,17 +329,22 @@ export default {
if (this.selectedNumber >= this.limitNum) { if (this.selectedNumber >= this.limitNum) {
listItem.checked = false; listItem.checked = false;
} else { } else {
this.multiSelectedItemNames[listItem.label] = true;
this.selectedNumber++; this.selectedNumber++;
} }
} }
if (reg.test(listItem.label)) { if (reg.test(listItem.label)) {
listItem.show = true; listItem.show = true;
if (listItem.checked) {
this.multiSelectedItemNames[listItem.label] = true;
}
} else { } else {
listItem.show = false; listItem.show = false;
} }
} }
if (this.selectedNumber >= this.limitNum || this.selectedNumber >= this.checkListArr.length) { 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.
先完成此消息的编辑!
想要评论请 注册