Commit 9d30bb54 by caoyanzhi

修复同一个框里面只能添加一个相同类型的标签

parent c7f91ecc
......@@ -328,17 +328,12 @@ export default {
switch (this.editPopType) {
case 'add':
const isHad = this.ruleForm.selectedTags.some(group => {
return group.some(item => item.tagId === data.tagId);
});
const isHad = this.ruleForm.selectedTags[this.activeTagsGroupIndex].some(item => item.tagId === data.tagId);
if (isHad) {
this.ruleForm.selectedTags = this.ruleForm.selectedTags.map(group => {
return group.map(tag => {
if (tag.tagId === data.tagId) {
tag = data;
}
return tag;
});
this.ruleForm.selectedTags[this.activeTagsGroupIndex].forEach((tag, tagIndex) => {
if (tag.tagId === data.tagId) {
this.ruleForm.selectedTags[this.activeTagsGroupIndex].splice(tagIndex, 1, data);
}
});
} else {
this.ruleForm.selectedTags[this.activeTagsGroupIndex].push(data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment