Commit e1d8abd8 by member

Merge branch 'dev-dingdang' into dev

parents 2b676e87 fe7d1dae
......@@ -10,7 +10,14 @@
已选标签
<span class="color-c0c4cc font-14">(同一个输入框内标签关系为且)</span>
</div>
<tags-group-list :selectedTagsData="ruleForm.selectedTags" :tagsGroupRelation="ruleForm.tagsGroupRelation" :showAddMenu="true" @addTags="addTags" @editTags="editTags" />
<tags-group-list
:selectedTagsData="ruleForm.selectedTags"
:tagsGroupRelation="ruleForm.tagsGroupRelation"
:activeTagsGroupIndex.sync="activeTagsGroupIndex"
:showAddMenu="true"
@addTags="addTags"
@editTags="editTags"
/>
</el-form-item>
<el-form-item label="" prop="groupName" class="w-220">
<div>分组名称</div>
......@@ -129,6 +136,7 @@ export default {
updateDay: '',
effectiveStatus: 1
},
activeTagsGroupIndex: 0,
// 有效期时间选择器的配置
pickerOptions: {
disabledDate(time) {
......@@ -228,7 +236,7 @@ export default {
// 添加标签
addTags(data) {
console.log(`添加标签,标签组的索引是${data.tagsGroupIndex}`);
console.log(`添加标签,标签组的索引是${this.activeTagsGroupIndex}`);
},
// 编辑标签
......
......@@ -8,7 +8,7 @@
:tagsGroupIndex="index"
:tagsRelation="tagsGroupRelation[index]"
:showAddMenu="showAddMenu"
:active="activeTagsGroup === index"
:active="activeTagsGroupIndex === index"
@addTags="addTags"
@delTags="delTags"
@editTags="editTags"
......@@ -69,6 +69,11 @@ import { getMemberTagCount } from '@/request/memberGroup.js';
export default {
name: 'tags-detail',
props: {
// 标签组选中状态的索引
activeTagsGroupIndex: {
type: Number,
default: 0
},
// 标签数据
selectedTagsData: Array,
// 标签组之间的关系
......@@ -91,8 +96,6 @@ export default {
tagsList: [],
// 一组标签的数据
tagsGroupList: [],
// 标签组选中状态的索引
activeTagsGroup: 0,
// 分页相关
pageNum: 1,
......@@ -108,39 +111,40 @@ export default {
this.selectedTagsData.length > 1 && this.tagsGroupRelation.push('or');
}
// this.$emit('addTagsGroup');
this.activeTagsGroup = this.selectedTagsData.length - 1;
this.checkTagsGroup({ tagsGroupIndex: this.selectedTagsData.length - 1 });
},
// 删除一个标签组
delTagsGroup(data) {
this.tagsGroupRelation.splice(data.tagsGroupIndex === this.selectedTagsData.length - 1 ? data.tagsGroupIndex - 1 : data.tagsGroupIndex, 1);
this.selectedTagsData.splice(data.tagsGroupIndex, 1);
this.activeTagsGroup = 0;
this.checkTagsGroup({ tagsGroupIndex: 0 });
},
// 添加标签
addTags(data) {
// 添加之前先判断已选中的标签中是否存在即将添加的标签
this.activeTagsGroup = data.tagsGroupIndex;
this.showAddTagPop = true;
this.$emit('addTags', { tagsGroupIndex: this.activeTagsGroup });
this.checkTagsGroup({ tagsGroupIndex: data.tagsGroupIndex });
this.$emit('addTags');
},
// 删除标签
delTags(data) {
this.selectedTagsData[data.tagsGroupIndex].splice(data.tagIndex, 1);
this.activeTagsGroup = data.tagsGroupIndex;
this.checkTagsGroup({ tagsGroupIndex: data.tagsGroupIndex });
},
// 编辑一个标签
editTags(data) {
// 保存之前先判断已选中的标签中是否存在即将添加的标签
this.activeTagsGroup = data.tagsGroupIndex;
this.checkTagsGroup({ tagsGroupIndex: data.tagsGroupIndex });
this.$emit('editTags', { tagsGroupIndex: data.tagsGroupIndex, tagIndex: data.tagIndex });
},
// 修改两个标签组之间的关系
changeTagsGroupRelation(data) {
this.tagsGroupRelation[data.relationIndex] = this.tagsGroupRelation[data.relationIndex] === 'or' ? 'andNot' : 'or';
},
// 点击标签组切换标签组的选中状态
// 切换标签组的选中状态
checkTagsGroup(data) {
this.activeTagsGroup = data.tagsGroupIndex;
this.activeTagsGroupIndex = data.tagsGroupIndex;
this.$emit('update:activeTagsGroupIndex', data.tagsGroupIndex);
},
// 获取标签分类
getTagsList() {
......
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