Commit 4a8d5c4d by 杨明

fixed

1 parent b2f6ad32
import { getCustomersList, exportLabelList } from '@/api/modules/tagsManage'
export default {
data() {
return {
tagHeight: 0,
tagCheckItem: [],
allListParams: [],
crowdForm: {
crowdName: '',
crowdDesc: ''
}
}
},
mounted() {
this.getCustomersListData()
},
watch: {
tagCheckItem: {
handler() {
if (this.tagCheckItem.length == 0) {
setTimeout(() => {
this.tagHeight = 0
}, 300)
}
this.allListParams = []
const tagNode = this.$common.utils.deepClone(this.tagCheckItem)
tagNode.forEach(group_item => {
group_item.children.forEach(label_item => {
if (label_item) {
this.allListParams.push({
groupId: group_item.id,
groupName: group_item.name,
groupType: group_item.labelType,
labelId: label_item.id,
labelName: label_item.name
})
}
})
})
this.getCustomersListData()
},
deep: true
}
},
methods: {
//删除标签组
removeItem(index) {
this.tagCheckItem.splice(index, 1)
this.$refs.tagTree.getTreeNode(this.tagCheckItem)
},
//获取选中的标签并排序
getCheckItem(item) {
const tree_id = []
const labelTree = this.$refs.tagTree.labelTree
labelTree.forEach(tree_node => {
tree_node.children.forEach(t_node => {
tree_id.push(t_node.id)
})
})
this.tagCheckItem = []
let group_all = item.getCheckedNodes().filter(item => item.labelType)
let group_Label = item.getCheckedNodes().filter(item => !item.children)
let label_id = []
group_Label.forEach(item => {
label_id.push(item.id)
})
let group_half = item.getHalfCheckedNodes().filter(item => item.labelType)
let group = [...group_half, ...group_all].sort((a, b) => {
return tree_id.indexOf(a.id) - tree_id.indexOf(b.id)
})
this.tagCheckItem = this.$common.utils.deepClone(group)
group.forEach((tag, idx) => {
tag.children.forEach((item, index) => {
if (!label_id.includes(item.id)) {
this.tagCheckItem[idx].children[index] = null
}
})
})
},
//导出
handleExport() {
const params = {
...JSON.parse(JSON.stringify({ tagLists: this.allListParams }))
}
exportLabelList(params).then(res => {
this.$Utils.exportFn(res)
})
},
//客户列表
getCustomersListData() {
const tagLists = this.$common.utils.deepClone(this.allListParams)
this.userLoading = true
const params = {
...JSON.parse(JSON.stringify({ tagLists })),
pageSize: this.$refs.viewCustomers.page.pageSize,
pageNum: this.$refs.viewCustomers.page.pageNum
}
getCustomersList(params).then(res => {
this.userLoading = false
this.tableData = res.data
this.tableTotal = res.count
})
},
//创建人群
groupConfirmDialog() {
console.log(this.allListParams)
if (this.tagCheckItem.length == 0) {
this.$message.error('必须选择一个标签')
return
}
if (!this.crowdForm.crowdName) {
this.$message.error('请输入人群名称')
return
}
const tagCombine = this.allListParams.reduce((prev, cur) => {
const index = prev.findIndex(group => cur.groupId == group.groupId)
if (index == -1) {
return prev.concat({ groupId: cur.groupId, labelIdList: [cur.labelId] })
} else {
prev[index].labelIdList.push(cur.labelId)
return prev
}
}, [])
const params = {
'req.merchantId': this.merchantId,
'req.crowdType': 2, //类型 1-推荐 2-自定义
'req.crowdName': this.crowdForm.crowdName,
'req.crowdDesc': this.crowdForm.crowdDesc,
'req.tagCombine': JSON.stringify(tagCombine)
}
this.$apis.crowdManage
.addCrowd(params)
.then(res => {
if (res) {
this.$message({
type: 'success',
message: '操作成功!'
})
this.groupVisible = false
} else {
this.$message({
type: 'error',
message: '操作失败'
})
}
})
.catch(err => {
this.$message({
type: 'error',
message: err.message
})
})
}
}
}
<template>
<div class="content-wrap">
<div class="content-wrap" v-loading="loading">
<div class="tree-input">
<el-input placeholder="请输入标签组或标签关键字" v-model="filterText" size="small"><i slot="suffix" class="el-input__icon el-icon-search"></i></el-input>
<span @click="resetTree">重置</span>
......@@ -76,6 +76,7 @@ export default {
edition: this.$globalState.session.merchantModel
}
}
this.loading = true
getTableList(params).then(res => {
const labelTreeRets = res.labelTreeRets.map(item => {
return {
......@@ -92,13 +93,15 @@ export default {
this.labelTree.push({
id: item.id + '000',
name: item.labelType,
children: [item]
children: [item],
sort: item.labelType == '系统标签' ? 1 : item.labelType == '企业标签' ? 2 : 3
})
} else {
this.labelTree[index].children.push(item)
}
})
// console.log(this.labelTree)
this.labelTree = this.labelTree.sort((a, b) => a.sort - b.sort)
this.loading = false
})
}
},
......@@ -127,7 +130,7 @@ export default {
}
.tag-tree {
margin-top: 20px;
height: calc(100% - 100px);
height: calc(100% - 80px);
overflow-y: auto;
/deep/ {
.el-tree-node {
......
......@@ -50,8 +50,17 @@
<el-tag effect="plain" slot="reference" type="info" class="select-tagGroup" v-for="(item, idx) in tagCheckItem" :key="idx" closable :disable-transitions="false" @close="removeItem(idx)">
<label>{{ item.name }}:</label>
<template v-for="(tag, index) in item.children">
<div class="select-tagLabel" :key="index" v-if="tag">{{ tag.name }}</div>
<div class="select-tagLabel" :key="index" v-if="tag && index < 3">{{ tag.name }}</div>
</template>
<el-popover placement="top" trigger="hover" class="select-popover-tag">
<div class="select-popover-box">
<template v-for="(tag, index) in item.children">
<div class="select-tagLabel" :key="index" v-if="tag">{{ tag.name }}</div>
</template>
</div>
<div class="select-tagLabel" slot="reference" v-if="item.children.length > 3">+ {{ item.children.length - 3 }}</div>
</el-popover>
</el-tag>
</div>
<div class="client-expand" v-if="tagHeight">
......@@ -70,37 +79,58 @@
<el-button type="primary" @click="searchTable">查询</el-button>
</span>
</search-form>
<div class="clientNumExp">
<div class="clientNum">
<!-- {{ labelGroupName }} -->
<!-- <div class="clientListNew">标签组客户列表</div>
<div class="clientNumText">{{ tableTotal }}个</div> -->
<div class="clientListNew">客户列表({{ tableTotal }}人)</div>
</div>
<div>
<el-button class="export" size="small" type="primary" @click="handleExport">导出</el-button>
<el-button
plain
size="small"
@click="
groupVisible = true
crowdForm = {
crowdName: '',
crowdDesc: ''
}
"
>
保存为人群
</el-button>
</div>
</div>
<!-- noDataText="你当前还没有添加的标签" -->
<GLTable @setTableFinishFun="setTableFinishFun" v-if="isReload" ref="tagsManage" :hasNum="false" :getListApi="getListApi" :searchForm="searchForm" :pageConf="pageConf" :noDataImg="url" :tableParams="tableParams" :headerStyle="{ height: '54px', background: '#F4F6FC', color: '#333333', fontSize: '14px' }">
<span slot="labelGroup" slot-scope="scope">
<span>{{ scope.scope.labelGroup.name }}</span>
</span>
<span slot="labelList" slot-scope="scope">
<!-- :class="[expande ? 'expande' : 'close']" -->
<div id="allTagsWrap" class="allTagsWrap">
<span v-for="(item, index) in showTagArray(scope.scope.labelList)" :key="index" class="ellipsis-1 tag-box-wrap">
<el-tooltip class="item" :content="item.name" placement="top">
<span>{{ item.name }}</span>
</el-tooltip>
<GLTable @setTableFinishFun="setTableFinishFun" v-if="isReload" ref="viewCustomers" :layout="layout" :hasNum="true" :tableData="tableData" :tableTotal="tableTotal" :noDataImg="url" :pageConf="pageConf" :searchForm="searchFormTable" @refreshTable="getCustomersListData" :tableParams="tableParams">
<!-- 企微名称 -->
<div slot="nickNameList" slot-scope="scope" class="expandImg">
<div v-for="(list, idx) in scope.scope.nickNameList" :key="idx">
<div v-if="idx == 0">
<span>{{ list.nickName }}</span>
<span class="smallFontSize" :class="[list.type == 1 ? 'pure-green-text' : '', list.type == 2 ? 'pure-yello-text' : '']">@{{ list.corpName }}</span>
</div>
<span v-if="idx == 1">
<el-popover placement="right-start" trigger="hover">
<div v-for="(i, index) in scope.scope.nickNameList" style="padding-bottom:3px !important" :key="index">
<span>{{ i.nickName }}</span>
<span style="height: 20px; font-size: 12px; letter-spacing: 0; line-height: 20px; font-weight: 400;margin-left:2px" :class="[i.type == 1 ? 'pure-green-text' : '', i.type == 2 ? 'pure-yello-text' : '']">@{{ i.corpName }}</span>
</div>
<img class="imgEll" src="@/assets/tagsManage/ellipsis.png" alt="" slot="reference" />
</el-popover>
</span>
<el-popover v-if="scope.scope.labelList.length > 9" class="ellipsis-1 tag-box-wrap" placement="top" width="800" trigger="hover" content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。">
<span slot="reference">...({{ scope.scope.labelList.length }})</span>
<div class="entmicro-hover" style="height: 214px; overflow-y: auto">
<el-tag type="info" class="ellipsis-1" style="margin-right: 10px; margin-bottom: 10px; max-width: 200px" v-for="(i, sindex) in scope.scope.labelList" :key="sindex" :disable-transitions="false">
<el-tooltip class="item" :content="i.name" placement="top">
<span>{{ i.name }}</span>
</el-tooltip>
</el-tag>
</div>
</el-popover>
</div>
</div>
<span slot="status" slot-scope="scope">
<span class="statusText" :class="scope.scope.status ? CLIENTSTATUS[scope.scope.status].split(',')[1] : ''">{{ scope.scope.status ? CLIENTSTATUS[scope.scope.status].split(',')[0] : '--' }}</span>
</span>
<span slot="isJoin" slot-scope="scope">
<span>{{ scope.scope.isJoin ? '是' : '否' }}</span>
</span>
<template slot="xxx" slot-scope="scope">
<!-- //这版关掉自店标签 1.0.1允许集团的门店打字店标签,也可以编辑-->
<!-- v-if="scope.scope.labelType != '系统标签' && isShowEditBtn(scope.scope)" -->
<span @click="btnClick('edit', scope.scope)" v-if="scope.scope.labelType != '系统标签' && isShowEditBtn(scope.scope)" class="blue-text">编辑标签组</span>
<GLButton class="blue-text leftDistance" type="text" fn="查看客户" v-if="userType !== 2" @click="toViewCustomer(scope.scope)">查看客户</GLButton>
<template slot="auth-button" slot-scope="scope" :data="scope.scope">
<span @click="goDetail(scope.scope.id, scope.scope.custGroupName)" class="blue-text">详情</span>
</template>
</GLTable>
</div>
......@@ -207,16 +237,47 @@
</rule-form>
</slot>
</basic-dialog>
<basic-dialog class="group-box" title="保存为人群" :isVisible="groupVisible" @confirmDialog="groupConfirmDialog" @closeDialog="groupVisible = false">
<div class="dialog-form">
<div class="dialog-form-item">
<label>
<span style="color: #ff0000">*</span>
人群名称:
</label>
<el-input v-model.trim="crowdForm.crowdName" size="small" placeholder="请输入人群名称:" maxlength="30"></el-input>
</div>
<div class="form-tips">
最多30个字符
<span>{{ crowdForm.crowdName.length }}/30</span>
</div>
</div>
<div class="dialog-form">
<div class="dialog-form-item">
<label>人群描述:</label>
<el-input v-model.trim="crowdForm.crowdDesc" size="small" placeholder="请输入人群描述" maxlength="100"></el-input>
</div>
<div class="form-tips">
最多100个字符
<span>{{ crowdForm.crowdDesc.length }}/100</span>
</div>
</div>
</basic-dialog>
<div class="loading-containner" v-if="userLoading">
<div class="loading-box">客户列表加载中</div>
</div>
</div>
</template>
<script>
import { getTableList, getTableTagNum, newAddTag, updateTag, queryLabelListByGroupId } from '@/api/modules/tagsManage'
import { getTableTagNum, newAddTag, updateTag } from '@/api/modules/tagsManage'
import { getLoginCount } from '@/api/modules/loginCount'
import tagGroup from './components/tagGroup.vue'
import url from '@/assets/clientDataOverview/nodata.png'
import tag from '@/mixins/tag'
// import { debounce } from '@/utils/index'
export default {
mixins: [tag],
name: 'tagsManage',
data() {
......@@ -250,11 +311,10 @@ export default {
}
}
return {
userLoading: false,
dialogRuleVisible: false,
expand: false,
tagHeight: 0,
heightBox: 0,
tagCheckItem: [],
isReload: true,
isAllowCloseDialog: false,
isHasSameTag: false,
......@@ -280,44 +340,67 @@ export default {
clearable: true
}
],
pageConf: { pageSize: 'labelTreeReq.pageSize', pageNum: 'labelTreeReq.pageNum', totalCount: 'labelGroupCount' },
layout: 'sizes, prev, pager, next, jumper, ->, total',
tableTotal: 0,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
tableParams: {
// btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'labelTreeRets',
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'data',
tableColumns: [
{
label: '标签组',
prop: 'labelGroup',
addHtml: 'labelGroup',
width: 230
label: '客户姓名',
prop: 'customerName',
minWidth: 150
},
{
label: '企微名称',
prop: 'nickNameList',
addHtml: 'nickNameList',
minWidth: 200
},
{
label: '联系电话',
prop: 'customerPhone',
minWidth: 110
},
{
label: '标签组类型',
prop: 'labelType',
width: 180
label: '车牌号',
prop: 'carNumber'
// width: 160
},
{
label: '标签',
prop: 'labelList',
addHtml: 'labelList',
align: 'center'
label: '车架号',
prop: 'carVin',
minWidth: '110'
},
{
label: '操作',
prop: 'xxx',
fixed: 'right',
addHtml: 'xxx',
width: 180
label: '车系',
prop: 'audi'
// width: 160
},
{
label: '跟进员工',
prop: 'followStaff',
minWidth: 120
},
{
label: '是否加企微',
prop: 'isJoin',
addHtml: 'isJoin',
minWidth: 100
},
{
label: '添加时间',
prop: 'addTime',
minWidth: 150
}
]
// tableOption: {
// width: 120
// }
},
getListApi: getTableList,
tableData: [],
// 弹窗数据
tagDialogTitle: '添加标签组',
tagVisible: false,
groupVisible: false,
tagForm: {
tagsName: '',
initTagsGroup: 1,
......@@ -441,51 +524,7 @@ export default {
// }
// }, 200)
},
watch: {
tagCheckItem: {
handler() {
if (this.tagCheckItem.length == 0) {
setTimeout(() => {
this.tagHeight = 0
}, 300)
}
},
deep: true
}
},
methods: {
removeItem(index) {
this.tagCheckItem.splice(index, 1)
this.$refs.tagTree.getTreeNode(this.tagCheckItem)
},
getCheckItem(item) {
const tree_id = []
const labelTree = this.$refs.tagTree.labelTree
labelTree.forEach(tree_node => {
tree_node.children.forEach(t_node => {
tree_id.push(t_node.id)
})
})
this.tagCheckItem = []
let group_all = item.getCheckedNodes().filter(item => item.labelType)
let group_Label = item.getCheckedNodes().filter(item => !item.children)
let label_id = []
group_Label.forEach(item => {
label_id.push(item.id)
})
let group_half = item.getHalfCheckedNodes().filter(item => item.labelType)
let group = [...group_half, ...group_all].sort((a, b) => {
return tree_id.indexOf(a.id) - tree_id.indexOf(b.id)
})
this.tagCheckItem = this.$common.utils.deepClone(group)
group.forEach((tag, idx) => {
tag.children.forEach((item, index) => {
if (!label_id.includes(item.id)) {
this.tagCheckItem[idx].children[index] = null
}
})
})
},
// toViewCustomer(info) {
// this.$router.push('/tagsManage/viewCustomers')
// },
......@@ -513,6 +552,7 @@ export default {
let isHasSameTag = this.editTagList.some(ele => ele.name == e)
if (isHasSameTag) {
this.$message.error('不允许输入已存在的标签')
return e
}
return this.$Utils.cutMaxCharStr(e)
......@@ -629,7 +669,6 @@ export default {
this.tagForm.tagsName = rowData.labelGroup.name //标签组名
this.tagForm.initTagsGroup = rowData.labelType == '企业标签' ? 1 : rowData.labelType == '自店标签' ? 2 : '' //标签组类型
},
handleConfirm() {
console.log(this.$refs.tagForm.$children, 'kkk')
this.$refs.tagForm.$children[0].validate(valid => {
......@@ -849,6 +888,49 @@ export default {
<style lang="scss" scoped>
@import '@/styles/variables.scss';
@import '@/styles/resetelement.scss';
.loading-containner {
top: 0px;
left: 0px;
position: fixed;
width: 100%;
background: rgba(255, 255, 255, 0.1);
z-index: 5000;
height: 100%;
.loading-box {
position: absolute;
top: 50%;
left: 50%;
margin-top: -28px;
margin-left: -88px;
width: 176px;
font-size: 14px;
color: #ffffff;
line-height: 54px;
text-align: center;
height: 54px;
background: #666666;
border-radius: 2px;
&::after {
content: '';
position: absolute;
top: 0%;
bottom: 0;
animation: dot 3s infinite steps(3, start);
color: #ffffff;
}
}
}
@keyframes dot {
33.33% {
content: '.';
}
66.67% {
content: '. .';
}
100% {
content: '. . .';
}
}
.leftDistance {
margin-left: 10px;
}
......@@ -860,6 +942,29 @@ export default {
color: #333333;
line-height: 21px;
}
.expandImg {
display: flex;
justify-content: center;
.smallFontSize {
margin-left: 2px;
height: 20px;
font-size: 12px;
letter-spacing: 0;
line-height: 20px;
font-weight: 400;
}
.imgEll {
margin-left: 6.5px;
cursor: pointer;
// margin-bottom:3px;
}
}
.pure-green-text {
color: #61cc43;
}
.pure-yello-text {
color: #fb8f28;
}
.crowd-dialog-wrap {
.condition {
margin-bottom: 16px;
......@@ -1029,10 +1134,10 @@ export default {
border-radius: 4px;
border: 1px solid #e8e8ea;
padding: 4px 8px;
line-height: 20px;
line-height: 24px;
margin-right: 8px;
margin-bottom: 8px;
height: 38px;
height: 36px;
box-sizing: border-box;
/deep/ {
.el-icon-close {
......@@ -1049,7 +1154,7 @@ export default {
background: #fafbfe;
border-radius: 4px;
border: 1px solid #e8e8ea;
padding: 3px 8px;
padding: 0px 8px;
line-height: 20px;
margin-right: 4px;
}
......@@ -1064,7 +1169,38 @@ export default {
.el-button + .el-button {
margin-left: 10px;
}
.clientNumExp {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 14px;
padding-bottom: 20px;
letter-spacing: 1px;
.clientNum {
// display: flex;
// align-items: center;
.clientListNew {
display: flex;
align-items: center;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 600;
color: #333333;
font-size: 20px;
}
.clientNumText {
margin-left: 6px;
height: 20px;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #5850ff;
line-height: 20px;
padding-top: 2px;
}
}
.export {
}
}
.allTagsWrap {
position: relative;
// display: -webkit-box;
......@@ -1250,4 +1386,41 @@ export default {
}
}
}
.dialog-form {
padding: 0px 20px;
margin: 20px;
&-item {
display: flex;
align-items: center;
label {
width: 100px;
text-align: right;
}
}
.form-tips {
margin-top: 6px;
padding-left: 80px;
font-size: 12px;
font-weight: 400;
color: #999999;
line-height: 17px;
display: flex;
justify-content: space-between;
}
}
</style>
<style lang="scss">
.select-popover-box {
max-width: 600px;
.select-tagLabel {
display: inline-block;
background: #fafbfe;
border-radius: 4px;
border: 1px solid #e8e8ea;
padding: 0px 8px;
line-height: 20px;
margin-right: 4px;
margin-bottom: 5px;
}
}
</style>
......@@ -148,7 +148,7 @@
</template>
<script>
import { getTableList, getTableTagNum, newAddTag, updateTag, queryLabelListByGroupId } from '@/api/modules/tagsManage'
import { getTableList, getTableTagNum, newAddTag, updateTag, exportLabelList } from '@/api/modules/tagsManage'
import { getLoginCount } from '@/api/modules/loginCount'
import url from '@/assets/clientDataOverview/nodata.png'
// import { debounce } from '@/utils/index'
......@@ -585,6 +585,15 @@ export default {
this.tagVisible = !this.tagVisible
},
//导出
handleExport() {
const params = {
...JSON.parse(JSON.stringify(this.exportParams))
}
exportLabelList(params).then(res => {
this.$Utils.exportFn(res)
})
},
newAddTagFun() {
//满足条件进行提交
let params = {}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!