Commit ee16db82 by 王志慧

commit

1 parent ccc32fa4
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
全选 全选
<label>已选{{ checkList.length }}个客户</label> <label>已选{{ checkList.length }}个客户</label>
</div> </div>
<van-button class="my-button" round color="#5850FF" @click="handleTag">批量打标签</van-button> <van-button class="my-button" round color="#5850FF" @click="handleTag">批量打标签</van-button>
</div> </div>
</template> </template>
</div> </div>
...@@ -150,6 +150,8 @@ export default { ...@@ -150,6 +150,8 @@ export default {
this.customerList.forEach(item => { this.customerList.forEach(item => {
item.isChecked = this.allChecked item.isChecked = this.allChecked
}) })
this.allChecked ? (this.checkList = this.customerList) : (this.checkList = [])
}, },
searchkeyWord(e) { searchkeyWord(e) {
this.keyWord = e this.keyWord = e
......
...@@ -2,32 +2,34 @@ ...@@ -2,32 +2,34 @@
<van-popup v-model="tagShow" position="bottom" :style="{ height: '90%' }"> <van-popup v-model="tagShow" position="bottom" :style="{ height: '90%' }">
<div class="container-pop"> <div class="container-pop">
<search placeholder="请输入关键字" :keyword="keyWord" @search="searchkeyWord"></search> <search placeholder="请输入关键字" :keyword="keyWord" @search="searchkeyWord"></search>
<div class="content" ref="scrollView"> <div class="contentWrap">
<div class="close-container" v-if="checkAll.length > 0"> <van-list :finished="finished" finished-text="" offset="100" :immediate-check="false">
<div class="nav-icon"> <div class="close-container" v-if="checkAll.length > 0">
<img src="../../assets/images/icon/nav-icon.png" /> <div class="nav-icon">
</div> <img src="../../assets/images/icon/nav-icon.png" />
<template v-for="(closeTag, i) in checkAll">
<div class="close-tag" @click="close(closeTag, i)" :key="i">
{{ closeTag.taggingName }}
<img src="../../assets/images/icon/close-icon.png" />
</div>
</template>
</div>
<div class="tag-container">
<template v-if="tagList.length > 0">
<div class="tag-type" v-for="(item, index) in tagList" :key="index">
<div class="tag-title">{{ item.groupName }}</div>
<div class="tag-list">
<template v-for="(tag, ids) in item.taggingList">
<div :key="ids" :class="{ tag: true, active: tag.isChecked }" @click="chooseTag(index, ids)">{{ tag.taggingName }}</div>
</template>
</div> </div>
<template v-for="(closeTag, i) in checkAll">
<div class="close-tag" @click="close(closeTag, i)" :key="i">
{{ closeTag.taggingName }}
<img src="../../assets/images/icon/close-icon.png" />
</div>
</template>
</div>
<div class="tag-container">
<template v-if="tagList.length > 0">
<div class="tag-type" v-for="(item, index) in tagList" :key="index">
<div class="tag-title">{{ item.groupName }}</div>
<div class="tag-list">
<template v-for="(tag, ids) in item.taggingList">
<div :key="ids" :class="{ tag: true, active: tag.isChecked }" @click="chooseTag(index, ids)">{{ tag.taggingName }}</div>
</template>
</div>
</div>
</template>
<empty v-else description="没有找到你搜索的内容" />
</div> </div>
</template> </van-list>
<empty v-else description="没有找到你搜索的内容" />
</div> </div>
</div>
<div class="pop-footer"> <div class="pop-footer">
<div class="reset" @click="reset">重置</div> <div class="reset" @click="reset">重置</div>
<van-button class="my-pop-button" round color="#5850FF" @click="handleTag">打标签</van-button> <van-button class="my-pop-button" round color="#5850FF" @click="handleTag">打标签</van-button>
...@@ -42,6 +44,8 @@ export default { ...@@ -42,6 +44,8 @@ export default {
name: 'make', name: 'make',
data() { data() {
return { return {
loading: false,
finished: false,
keyWord: '', keyWord: '',
tagList: [], tagList: [],
checkAll: [], checkAll: [],
...@@ -75,7 +79,7 @@ export default { ...@@ -75,7 +79,7 @@ export default {
}, },
add(index, ids) { add(index, ids) {
if (this.tagList[index].taggingList[ids].isChecked) { if (this.tagList[index].taggingList[ids].isChecked) {
this.checkAll.push(this.tagList[index].taggingList[ids]) this.checkAll.push({ ...this.tagList[index].taggingList[ids] })
} else { } else {
this.checkAll.splice(index, 1) this.checkAll.splice(index, 1)
} }
...@@ -99,8 +103,7 @@ export default { ...@@ -99,8 +103,7 @@ export default {
keyWord: this.keyWord keyWord: this.keyWord
} }
groupTag.gettagList(obj).then(res => { groupTag.gettagList(obj).then(res => {
console.log(res) if (res.data && res.data.length > 0) {
if (res.data&&res.data.length > 0) {
this.tagList = res.data this.tagList = res.data
if (this.tagList.length > 0) { if (this.tagList.length > 0) {
for (let i = 0; i < this.tagList.length; i++) { for (let i = 0; i < this.tagList.length; i++) {
...@@ -110,16 +113,31 @@ export default { ...@@ -110,16 +113,31 @@ export default {
} }
} }
} }
if (this.checkAll.length > 0 && this.tagList.length > 0) {
this.saveTag()
}
} else { } else {
this.tagList = [] this.tagList = []
} }
console.log( this.tagList)
}) })
}, },
searchkeyWord(e) { searchkeyWord(e) {
this.keyWord = e this.keyWord = e
this.init() this.init()
}, },
//搜素之后保留选中标签
saveTag() {
for (let i = 0; i < this.tagList.length; i++) {
for (let j = 0; j < this.tagList[i].taggingList.length; j++) {
this.checkAll.forEach(item => {
if (item.taggingId == this.tagList[i].taggingList[j].taggingId) {
this.tagList[i].checked = true
this.tagList[i].taggingList[j].isChecked = true
}
})
}
}
},
clearData() { clearData() {
if (this.tagList.length > 0) { if (this.tagList.length > 0) {
for (let i = 0; i < this.tagList.length; i++) { for (let i = 0; i < this.tagList.length; i++) {
...@@ -134,7 +152,6 @@ export default { ...@@ -134,7 +152,6 @@ export default {
}, },
//打标签 //打标签
handleTag() { handleTag() {
console.log(this.externalUserIds)
let taggingInfo = [] let taggingInfo = []
for (let i = 0; i < this.tagList.length; i++) { for (let i = 0; i < this.tagList.length; i++) {
if (this.tagList[i].checked) { if (this.tagList[i].checked) {
...@@ -179,7 +196,7 @@ export default { ...@@ -179,7 +196,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.container-pop { .container-pop {
width: 100%; width: 100%;
.content{ .contentWrap {
height: calc(90vh - 120px); height: calc(90vh - 120px);
overflow-y: scroll; overflow-y: scroll;
} }
...@@ -224,7 +241,7 @@ export default { ...@@ -224,7 +241,7 @@ export default {
justify-content: space-between; justify-content: space-between;
padding: 0 16px; padding: 0 16px;
position: fixed; position: fixed;
bottom: 35px; bottom: 20px;
box-sizing: border-box; box-sizing: border-box;
.reset { .reset {
font-size: 16px; font-size: 16px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!