Commit 54beea8f by 王志慧

feat

1 parent e404c667
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* @param {*} params * @param {*} params
* @returns * @returns
*/ */
import { http2,http3 } from '@/main' import { http,http3 } from '@/main'
export function getTableList (params){ export function getTableList (params){
params.method='entmicro.api.customer.base.page' params.method='entmicro.api.customer.base.page'
...@@ -159,4 +159,26 @@ export function potentialClientExportApi(params){ ...@@ -159,4 +159,26 @@ export function potentialClientExportApi(params){
data: params, data: params,
sign: true sign: true
}) })
}
// 群标签列表
export function getCustomerTag(params){
params.method='entmicro.api.customer.base.tag'
return http3({
url: '/rop-scrm-entmicro/router',
method: 'POST',
data: params,
sign: true,
returnAll:true
})
}
//编辑客户群标签(包含标签新增列表和删除列表)
export function addSingleClientTag(params) {
params.method = 'entmicro.api.customer.base.tag.edit'
return http3({
url: '/rop-scrm-entmicro/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
} }
\ No newline at end of file \ No newline at end of file
/**
* 新增参数sign 判断接口是否需要sign签名(默认有,不必写)
*/
/**
* 用法 : this.$apis.demo.GETLISTDEVICEFILEUNSTOCK(...)
* @param {*} params
* @returns
*/
import { http, http3 } from '@/main'
// const url = 'http://192.168.3.181:9636/rop-scrm-datahub/router'
export function getTableList(params) {
// params.method='scrm.api.datahub.label.querylabeltree'
params.method = 'scrm.api.datahub.labelgroup.queryLabelTree'
return http({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true
})
}
//计算表格上面的数量
export function getTableTagNum(params) {
// params.method='scrm.api.datahub.label.queryLabelCount'
params.method = 'scrm.api.datahub.labelgroup.queryLabelCount'
return http({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true
})
}
export function newAddTag(params) {
// params.method='scrm.api.datahub.label.addlabel'
params.method = 'scrm.api.datahub.labelgroup.addLabel'
return http({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//修改标签
export function updateTag(params) {
// params.method='scrm.api.datahub.label.updatelabel'
params.method = 'scrm.api.datahub.labelgroup.updateLabel'
return http({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//获取单条数据labelList数组
export function queryLabelListByGroupId(params) {
// params.method='scrm.api.datahub.label.queryLabelListByGroupId'
params.method = 'scrm.api.datahub.labelgroup.queryLabelListByGroupId'
return http({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 根据标签获取客户群列表
export function getCustomersList(params) {
params.method = 'entmicro.api.customer.base.getCustomerBasePageByTag'
return http3({
url: '/rop-scrm-entmicro/router',
method: 'POST',
data: params,
sign: true
})
}
//根据groupId查询标签列表
export function getLabelList(params) {
params.method = 'scrm.api.datahub.labelgroup.queryLabelDetailByGroupId'
return http({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true
})
}
// 根据标签获取客户列表导出
export function exportLabelList(params) {
params.method = 'entmicro.api.customer.customerPageByTagExport'
return http3({
url: '/rop-scrm-entmicro/router',
method: 'POST',
data: params,
sign: true
})
}
import {
getCustomersList,
exportLabelList
} from '@/api/modules/groupTag'
import {
getStaffList
} from '@/api/modules/clientManage'
export default {
data() {
return {
tagHeight: 0,
tagHeightStatus: false,
tagCheckItem: [],
allListParams: [],
crowdForm: {
crowdName: '',
crowdDesc: ''
}
}
},
mounted() {
this.getStaffList()
this.getCustomersListData()
},
watch: {
tagCheckItem: {
handler() {
if (this.tagCheckItem.length == 0) {
this.tagHeight = 0
}
this.allListParams = []
this.sopListParams = []
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.sopListParams.push({
labelGroupName: group_item.name,
labelName: label_item.name
})
}
})
})
this.getCustomersListData()
},
deep: true
},
tagHeight: {
handler(val) {
if (val == 0) {
setTimeout(() => {
this.tagHeightStatus = false
}, 300)
} else {
this.tagHeightStatus = true
}
},
deep: true
}
},
methods: {
//获取跟进员工
getStaffList() {
getStaffList({}).then(res => {
if (res.length == 0) {
return ''
}
const id = this.tagsPartFormList.findIndex(item => {
return item.name == 'followStaff'
})
const staff = res.map(item => {
return {
label: item.staffName,
value: item.staffName
}
})
staff.unshift({
label: '全部',
value: ''
})
this.$nextTick(() => {
this.tagsPartFormList[id].optionList = staff
})
})
},
tagLength(children) {
return children.filter(item => item).length
},
goDetail(scope) {
this.$router.push('/clientManage/clientDetail?id=' + scope.oneId)
},
goGroupDetail(scope) {
this.$router.push('/clientGroupManage/clientGroupDetail?id=' + scope.oneId)
},
jumpGroup() {
this.$router.push({
path: '/crowdManage/index',
query: {
selectTab: 1
}
})
},
//删除标签组
removeItem(index) {
this.tagCheckItem.splice(index, 1)
this.$refs.tagTree.getTreeNode(this.tagCheckItem)
},
treeScroll(id) {
const h = document.querySelector('.node_' + id).offsetTop
this.$refs.tagTree.handleScroll(h)
},
//获取选中的标签并排序
getCheckItem(item) {
const tree_id = []
const labelTree = this.$common.utils.deepClone(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
}
})
})
this.tagCheckItem.forEach(tag => {
tag.children = tag.children.filter(item => item)
})
},
//导出
handleExport() {
const params = {
...JSON.parse(JSON.stringify({
tagLists: this.allListParams
})),
...this.searchForm,
combineType: 2
}
exportLabelList(params).then(res => {
this.$Utils.exportFn(res)
})
},
//客户列表
getCustomersListData() {
if (this.searchForm.createTime) {
this.searchForm.beginCarBuyDate = new Date(this.searchForm.createTime[0]).toLocaleDateString().replace(/-/g, '/')
this.searchForm.endCarBuyDate = new Date(this.searchForm.createTime[1]).toLocaleDateString().replace(/-/g, '/')
}
delete this.searchForm.createTime
const tagLists = this.$common.utils.deepClone(this.allListParams)
this.userLoading = true
const params = {
...JSON.parse(JSON.stringify({
tagLists
})),
...JSON.parse(JSON.stringify(this.searchForm)),
combineType: 2,
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
this.$nextTick(() => {
if (tagLists.length == 0) {
document.querySelector('.noDataText').innerText = '当前未选择标签,快去选择标签查看客户吧!'
} else {
document.querySelector('.noDataText') ? (document.querySelector('.noDataText').innerText = '暂无数据') : ''
}
})
if (this.tableData == 0) {
this.$refs.viewCustomers.setTableHeightFun()
} else {
this.$refs.viewCustomers.tableHeightValues = ''
}
})
.catch(err => {
this.userLoading = false
})
},
//创建人群
groupConfirmDialog() {
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.data.code == 0) {
this.groupVisible = false
this.successVisible = true
} else {
this.$message({
type: 'error',
message: res.data.message
})
}
})
.catch(err => {
this.$message({
type: 'error',
message: err.message
})
})
}
}
}
\ No newline at end of file \ No newline at end of file
...@@ -97,6 +97,9 @@ export default { ...@@ -97,6 +97,9 @@ export default {
goDetail(scope) { goDetail(scope) {
this.$router.push('/clientManage/clientDetail?id=' + scope.oneId) this.$router.push('/clientManage/clientDetail?id=' + scope.oneId)
}, },
goGroupDetail(scope) {
this.$router.push('/clientGroupManage/clientGroupDetail?id=' + scope.oneId)
},
jumpGroup() { jumpGroup() {
this.$router.push({ this.$router.push({
path: '/crowdManage/index', path: '/crowdManage/index',
......
...@@ -72,6 +72,12 @@ const staticRoutes = Object.freeze([ ...@@ -72,6 +72,12 @@ const staticRoutes = Object.freeze([
meta: {} meta: {}
}, },
{ {
name: 'groupTagsManage',
path: '/groupTagsManage/index',
component: resolve => require([`@/views/groupTagsManage/index.vue`], resolve),
meta: {}
},
{
name: 'viewCustomers', name: 'viewCustomers',
path: '/tagsManage/viewCustomers/:info/:type', path: '/tagsManage/viewCustomers/:info/:type',
component: resolve => require([`@/views/tagsManage/viewCustomers.vue`], resolve), component: resolve => require([`@/views/tagsManage/viewCustomers.vue`], resolve),
......
...@@ -67,6 +67,9 @@ ...@@ -67,6 +67,9 @@
<template v-if="currentIndex == 3"> <template v-if="currentIndex == 3">
<potential-client ref="childCompPotential" :url="url"></potential-client> <potential-client ref="childCompPotential" :url="url"></potential-client>
</template> </template>
<template v-if="currentIndex == 4">
<group-tag ref="childCompPotential" :url="url"></group-tag>
</template>
<GLDialog mode="small" :visible.sync="dialogVisible"> <GLDialog mode="small" :visible.sync="dialogVisible">
<div class="content-body"> <div class="content-body">
<p>该客户暂无员工跟进,无法查看该客户详情,</p> <p>该客户暂无员工跟进,无法查看该客户详情,</p>
...@@ -87,6 +90,7 @@ import client from '@/views/clientGroupManage/components/client.vue' ...@@ -87,6 +90,7 @@ import client from '@/views/clientGroupManage/components/client.vue'
import followEmployee from '@/views/clientGroupManage/components/followEmployee.vue' import followEmployee from '@/views/clientGroupManage/components/followEmployee.vue'
import leaveGroupClient from '@/views/clientGroupManage/components/leaveGroupClient.vue' import leaveGroupClient from '@/views/clientGroupManage/components/leaveGroupClient.vue'
import potentialClient from '@/views/clientGroupManage/components/potentialClient.vue' import potentialClient from '@/views/clientGroupManage/components/potentialClient.vue'
import groupTag from '@/views/clientGroupManage/components/groupTag.vue'
import url from '@/assets/clientDataOverview/nodata.png' import url from '@/assets/clientDataOverview/nodata.png'
export default { export default {
name: 'clientGroupDetail', name: 'clientGroupDetail',
...@@ -94,7 +98,8 @@ export default { ...@@ -94,7 +98,8 @@ export default {
client, client,
followEmployee, followEmployee,
leaveGroupClient, leaveGroupClient,
potentialClient potentialClient,
groupTag
}, },
data() { data() {
return { return {
...@@ -116,6 +121,10 @@ export default { ...@@ -116,6 +121,10 @@ export default {
{ {
name: '潜在客户', name: '潜在客户',
personNum: 0 personNum: 0
},
{
name: '群标签',
personNum: 0
} }
], ],
currentIndex: 0, currentIndex: 0,
...@@ -136,9 +145,9 @@ export default { ...@@ -136,9 +145,9 @@ export default {
// deep: true, // deep: true,
// // immediate:true, // // immediate:true,
// handler(val) { // handler(val) {
// //
// if(val){ // if(val){
// //
// this.searchTable() // this.searchTable()
// } // }
// } // }
...@@ -167,7 +176,7 @@ export default { ...@@ -167,7 +176,7 @@ export default {
}, },
async getTableDetail(id = this.$route.query.id) { async getTableDetail(id = this.$route.query.id) {
const res = await getTableDetail({ id: id, pageNum: 1, pageSize: 10 }) const res = await getTableDetail({ id: id, pageNum: 1, pageSize: 10 })
if (!res) { if (!res) {
return false return false
} }
...@@ -351,14 +360,14 @@ export default { ...@@ -351,14 +360,14 @@ export default {
} }
} }
} }
.content-body { .content-body {
font-size: 18px; font-size: 18px;
text-align: center; text-align: center;
font-weight: 400; font-weight: 400;
color: #333333; color: #333333;
.bottomText { .bottomText {
margin-top: 10px; margin-top: 10px;
}
} }
}
} }
</style> </style>
<template>
<div class="clientTagsWrap">
<el-button type="primary" plain class="addTagBtn" size="small" @click="btnClick('create')">
设置标签
</el-button>
<GLTable class="table" ref="clientTagsListRef" :hasNum="false" :noDataImg="url" noDataText="客户群暂无已添加的标签" :tableData="clientTagsList" :hasPage="false" :tableParams="tagsParams" :headerStyle="{ height: '54px' }">
<span slot="labelGroupInfo" slot-scope="scope">
<span>{{ scope.scope.labelGroupInfo.labelGroupName }}</span>
</span>
<span slot="labelInfoList" slot-scope="scope">
<div id="allTagsWrap" class="allTagsWrap">
<span v-for="(item, index) in showTagArray(scope.scope.labelInfoList)" :key="index" class="ellipsis-1 tag-box-wrap">
<el-tooltip class="item" :content="item.labelName" placement="top">
<span>{{ item.labelName }}</span>
</el-tooltip>
</span>
<el-popover v-if="scope.scope.labelInfoList.length > 9" class="ellipsis-1 tag-box-wrap" placement="top" width="600" trigger="hover" content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。">
<span slot="reference">...({{ scope.scope.labelInfoList.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.labelInfoList" :key="sindex" :disable-transitions="false">
<el-tooltip class="item" :content="i.labelName" placement="top">
<span>{{ i.labelName }}</span>
</el-tooltip>
</el-tag>
</div>
</el-popover>
</div>
</span>
</GLTable>
<GLDialog class="tags" :title="tagsDialogTitle" :isDestroyClose="true" :btnLoading="sloading" :isShowThirdBtn="true" :isShowCloseBtn="true" @btnEvent="goNewTag" :visible.sync="tagsVisible">
<div>
<p class="hint-text color-6">
<span class="color-3">说明:</span>
仅支持{{ '企业' | tagType }}标签
<span v-if="merchantModel == 1">和自店标签</span>
进行人工维护和设置
</p>
<p class="hint-text mg10">系统标签通过大数据算法进行自动更新,不支持人工维护和编辑</p>
<div class="labels-wrap" v-for="(group, index) in allTagsList" :key="index">
<template v-if="(merchantModel == 2 && group.labelType != '自店标签') || merchantModel == 1">
<div class="label-wrap">
<div class="label-group-name">{{ group.labelType }}</div>
<div class="labels" v-for="(labels, ids) in group.children" :key="ids">
<div class="label-name white-hide color-71 mt10">{{ labels.labelGroup.name }}:</div>
<div class="label-value flex">
<template v-for="(label, i) in labels.labelList">
<div :class="['label', 'color-3', 'white-hide', 'mt10', label.checked ? 'isChecked' : '']" :style="{ width: label.name.length > 10 ? '145px' : auto }" :key="label.id" @click="choose(index, ids, i)">
<template v-if="label.name.length < 10">{{ label.name }}</template>
<el-tooltip class="item" :content="label.name" placement="top" v-else>
<span>{{ label.name }}</span>
</el-tooltip>
<template v-if="label.checked">
<img src="@/assets/clientDetail/select-icon.png" class="select-icon" alt />
</template>
</div>
</template>
</div>
</div>
</div>
</template>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button plain size="small" class="btn-three" @click="handleClose">取 消</el-button>
<el-button type="primary" size="small" @click="handleConfirm">确 定</el-button>
</span>
</GLDialog>
</div>
</template>
<script>
import { getCustomerTag, addSingleClientTag } from '@/api/modules/clientGroupManage'
import { getAllTagTree } from '@/api/modules/clientManage'
import url from '@/assets/clientDetail/noDataBox.png'
export default {
data() {
return {
id: this.$route.query.id,
url: url,
clientTagsList: [],
labelIdList: [], //存放用户被标记标签的id
allTagsList: [], //企业自店的所有的加起来
sloading: false,
tagsVisible: false,
tagsDialogTitle: '设置标签',
tagsParams: {
listName: 'labelInfos',
tableOption: false,
tableColumns: [
{
label: '标签组',
prop: 'labelGroupInfo',
addHtml: 'labelGroupInfo',
width: '230'
},
{
label: '标签组类型',
prop: 'labelGroupInfo',
formatter: cellValue => {
return cellValue.labelGroupInfo.labelGroupType == '企业标签' && this.$globalState.session.merchantModel == 1 ? '集团标签' : cellValue.labelGroupInfo.labelGroupType
},
width: '160'
},
{
label: '已打标签',
prop: 'labelInfoList',
addHtml: 'labelInfoList',
align: 'left'
}
]
}
}
},
created() {
if (window.__POWERED_BY_QIANKUN__) {
//运行在qiankun容器中
this.merchantId = this.$globalState.session.merchantId
this.merchantModel = this.$globalState.session.merchantModel
}
this.getCustomerTag()
},
methods: {
getCustomerTag() {
getCustomerTag({ id: this.id }).then(res => {
if (res.code == 0) {
this.clientTagsList = res.data
this.labelIdList = this.handleLabelId(res.data)
}
})
},
handleLabelId(data) {
let array = []
data &&
data.forEach(label => {
label.labelInfoList.forEach(info => {
array.push(info.labelId)
})
})
return array
},
goNewTag() {
this.$router.push({ path: '/tagsManage/index' })
},
btnClick(pType, scope) {
switch (pType) {
case 'create':
this.tagsDialogTitle = '设置标签'
this.getAllTags()
// this.handleClose();
break
case 'edit':
this.tagsDialogTitle = '编辑标签'
//调编辑的接口
}
},
choose(index1, index2, index3) {
this.allTagsList[index1].children[index2].labelList[index3].checked = !this.allTagsList[index1].children[index2].labelList[index3].checked
},
getAllTags() {
getAllTagTree({
'labelTreeReq.shopId': this.merchantId,
'labelTreeReq.edition': this.merchantModel,
'labelTreeReq.pageNum': 1,
'labelTreeReq.pageSize': 3000
})
.then(res => {
if (res.code == 0) {
let allTagsList = [
{
labelType: '',
children: []
},
{
labelType: '',
children: []
}
]
res.data.labelTreeRets.forEach(labels => {
labels.labelList.forEach(ele => {
ele.checked = false
ele.original = false
this.labelIdList.forEach(id => {
if (id == ele.id) {
ele.checked = true
ele.old = 1
}
})
})
if (labels.labelType == '企业标签') {
allTagsList[0].labelType = this.$globalState.session.merchantModel == 1 ? '集团标签' : '企业标签'
allTagsList[0].children.push(labels)
} else if (labels.labelType == '自店标签') {
allTagsList[1].labelType = '自店标签'
allTagsList[1].children.push(labels)
}
})
this.allTagsList = allTagsList
//
} else {
this.$message.error(res.message)
}
})
.catch(err => {
console.error(err, '捕获错误')
})
this.handleClose()
},
showTagArray(list) {
if (list.length == 0) {
return []
}
return list.slice(0, 9)
},
handleConfirm() {
this.sloading = true
let labelIdAddList = [] // 新增的标签
this.allTagsList.forEach(labels => {
labels.children.forEach(ele => {
ele.labelList.forEach(tag => {
if (tag.checked) {
labelIdAddList.push(tag.id)
}
})
})
})
let param = {
id: this.id,
tagIds: labelIdAddList
}
addSingleClientTag(param)
.then(res => {
if (res.code == 0) {
this.sloading = false
this.$message.success('设置成功')
this.handleClose()
this.getCustomerTag() //刷新当前页面
} else {
this.sloading = false
this.$message.error(res.data.message)
}
})
.catch(err => {
this.sloading = false
console.error(err, '错误捕获')
})
.finally(() => {
this.sloading = false
})
},
handleClose() {
this.tagsVisible = !this.tagsVisible
this.allTagsList = []
}
}
}
</script>
<style lang="scss" scoped>
@import '@/styles/variables.scss';
@import '@/styles/resetelement.scss';
.addTagBtn {
margin-bottom: 10px;
margin-left: 20px;
position:relative;
left: calc(100% - 110px);
}
.tags {
/deep/ .app-dialog {
.container {
padding: 32px 74px;
}
}
.hint-text {
font-size: 12px;
font-weight: 400;
// color: #666;
line-height: 18px;
}
.mg10 {
margin-left: 38px;
}
.mt10 {
margin-top: 10px;
}
.labels-wrap {
font-size: 14px;
font-weight: 500;
color: #333333;
line-height: 20px;
margin-top: 20px;
.label-group-name {
margin-bottom: 2px;
font-weight: 600;
}
.labels {
.label-name {
box-sizing: border-box;
font-weight: 400;
}
.label {
height: 26px;
background: #fafbfe;
border-radius: 4px;
border: 1px solid #e8e8ea;
line-height: 26px;
text-align: center;
margin-right: 10px;
position: relative;
padding: 0 16px;
box-sizing: border-box;
cursor: pointer;
}
.isChecked {
border: 1px solid #5850ff !important;
.select-icon {
width: 16px;
height: 16px;
position: absolute;
top: 0;
right: 0;
}
}
}
}
}
.allTagsWrap {
position: relative;
.tag-box-wrap {
display: inline-block;
margin-right: 10px;
// margin-bottom: 2px;
padding: 0 10px;
box-sizing: border-box;
min-width: 76px;
max-width: 200px;
height: 26px;
line-height: 26px;
border-radius: 4px;
border: 1px solid #e8e8ea;
background: #fafbfe;
text-align: center;
font-size: 14px;
font-weight: 400;
color: #666666;
max-width: 245px;
cursor: pointer;
}
}
</style>
<template>
<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>
</div>
<el-tree @node-expand="nodeExpand" accordion @check="checkChange" class="tag-tree" ref="tagTree" :data="labelTree" :props="defaultProps" @node-click="nodeClick" show-checkbox node-key="id" :default-expanded-keys="expandId" :expand-on-click-node="false" :filter-node-method="filterNode">
<div class="custom-tree-node" slot-scope="{ node, data }">
<el-tooltip placement="top" v-if="hoverId == data.id && hoverStatus">
<span :class="['tree-node', `node_${data.id}`]" slot="content">
{{ node.label }}
</span>
<span :class="['tree-node', `node_${data.id}`]">
{{ node.label }}
</span>
</el-tooltip>
<span :class="['tree-node', `node_${data.id}`]" v-else @mouseenter="hoverFun(data)">
{{ node.label }}
</span>
<span v-if="data.labelType && data.labelType != '系统标签' && isShowEditBtn(data.labelDTO)" @click.stop="editTree(data)">
<i class="el-icon-edit-outline"></i>
</span>
</div>
</el-tree>
</div>
</template>
<script>
import { getTableList } from '@/api/modules/tagsManage'
export default {
name: 'tagGroup',
data() {
return {
hoverId: '',
hoverStatus: false,
expandId: [],
loading: false,
heightBox: 200,
dialogVisible: false,
filterText: '',
selectNum: 0,
searchStatus: false,
labelTree: [],
defaultProps: {
children: 'children',
label: 'name'
}
}
},
watch: {
filterText(val) {
this.$refs.tagTree.filter(val)
}
},
methods: {
hoverFun(data) {
this.hoverId = data.id
this.hoverStatus = document.querySelector(`.node_${data.id}`).scrollWidth > 140
},
isShowEditBtn(row) {
const { userType, accountLevel, merchantModel } = this.$globalState.session
//集团模式下,只有集团能可以编辑企业,自店,其他只能编辑自店
//单店模式下,仅门店和员工可以编辑
if (row.labelType == '自店标签' && !(merchantModel == 1 && (accountLevel == 2 || accountLevel == 3 || accountLevel == 4))) {
return false
}
if (merchantModel == 1) {
if (accountLevel == 1 && userType == 1) {
return true
}
if (accountLevel !== 1) {
//如果是企业标签不显示
if (row.labelType == '企业标签' || row.labelType == '集团标签') {
return false
}
return true
}
}
return true //门店版都显示编辑按钮
},
nodeClick(data) {
!data.sort && document.querySelector(`.node_${data.id}`).parentElement.previousElementSibling.click()
},
handleScroll(height) {
document.querySelector('.tag-tree').scrollTop = height
},
resetTree() {
this.filterText = ''
this.$parent.searchForm = {}
this.$refs.tagTree.setCheckedKeys([])
this.$nextTick(() => {
this.$emit('getCheckItem', this.$refs.tagTree)
})
},
filterNode(value, data, node) {
if (!value) return true
return data.name.indexOf(value) !== -1
// let val = value.toLowerCase()
// this.$nextTick(() => {
// this.setTreeHeight()
// })
// return this.chooseNode(val, data, node) // 调用过滤二层方法
},
chooseNode(value, data, node) {
if (data.name.indexOf(value) !== -1) {
return true
}
const level = node.level
// 如果传入的节点本身就是一级节点就不用校验了
if (level === 1) {
return false
}
// 先取当前节点的父节点
let parentData = node.parent
// 遍历当前节点的父节点
let index = 0
while (index < level - 1) {
// 如果匹配到直接返回,此处name值是中文字符,enName是英文字符。判断匹配中英文过滤
if (parentData.data.name.indexOf(value) !== -1) {
return true
}
// 否则的话再往上一层做匹配
parentData = parentData.parent
index++
}
// 没匹配到返回false
return false
},
//勾选
checkChange() {
this.$emit('getCheckItem', this.$refs.tagTree)
},
getTreeNode(item) {
let tree_id = []
item.forEach(group_item => {
group_item.children.forEach(label_item => {
label_item && tree_id.push(label_item.id)
})
})
this.$refs.tagTree.setCheckedKeys(tree_id)
},
editTree(data) {
this.$emit('editTag', 'edit', data.labelDTO)
},
updateTreeNode() {
this.getTreeNode(this.$parent.tagCheckItem)
this.$emit('getCheckItem', this.$refs.tagTree)
},
// 获取标签树
getTableList(status) {
this.labelTree = []
let params = {
belongType: 2,
labelTreeReq: {
pageNum: 1,
pageSize: 10000,
shopId: this.$globalState.session.merchantId,
labelGroupName: this.filterText,
edition: this.$globalState.session.merchantModel
}
}
this.loading = true
getTableList(params).then(res => {
const labelTreeRets = res.labelTreeRets.map(item => {
return {
id: item.labelGroup.id,
name: item.labelGroup.name,
children: item.labelList,
labelType: item.labelType == '企业标签' && this.$globalState.session.merchantModel == 1 ? '集团标签' : item.labelType,
labelDTO: item
}
})
const labelType = this.$globalState.session.merchantModel == 1 ? '集团标签' : '企业标签'
labelTreeRets.forEach(item => {
const index = this.labelTree.findIndex(ret => ret.name == item.labelType)
if (index == -1) {
this.labelTree.push({
id: item.labelType == '系统标签' ? 1 : item.labelType == labelType ? 2 : 3,
name: item.labelType,
children: [item],
sort: item.labelType == '系统标签' ? 1 : item.labelType == labelType ? 2 : 3
})
} else {
this.labelTree[index].children.push(item)
}
})
this.labelTree = this.labelTree.sort((a, b) => a.sort - b.sort)
this.expandId = []
if (this.labelTree && this.labelTree.length) {
this.labelTree[0].children.forEach(item => {
this.expandId.push(item.id)
})
}
this.$nextTick(() => {
status && this.updateTreeNode()
this.setTreeHeight()
})
this.loading = false
})
},
setTreeHeight(domNode) {
const nodeHeight = document.querySelectorAll('.el-tree>.el-tree-node').length * 30
if (domNode) {
domNode.style.maxHeight = this.$parent.heightBox - 80 - nodeHeight + 'px'
domNode.style.overflow = 'auto'
} else {
document.querySelector('.el-tree>.el-tree-node.is-expanded .el-tree-node__children').style.maxHeight = this.$parent.heightBox - 80 - nodeHeight + 'px'
document.querySelector('.el-tree>.el-tree-node.is-expanded .el-tree-node__children').style.overflow = 'auto'
}
},
nodeExpand(data, node, target) {
if (data.sort) {
this.$nextTick(() => {
const domNode = target.$refs.node.lastElementChild
this.setTreeHeight(domNode)
})
}
}
},
mounted() {
this.getTableList()
}
}
</script>
<style lang="scss" scoped>
.content-wrap {
padding: 16px 3px 0px 16px;
box-sizing: border-box;
height: 100%;
.tree-input {
display: flex;
align-items: center;
span {
display: inline-block;
color: #5850ff;
font-size: 14px;
width: 40px;
margin-left: 6px;
cursor: pointer;
}
}
.tag-tree {
margin-top: 20px;
overflow-y: auto;
/deep/ {
.el-tree-node {
.el-tree-node__content {
height: 30px;
> .el-checkbox {
display: none;
}
}
}
.el-tree-node__children {
.el-tree-node__content {
.el-checkbox {
display: block;
}
}
}
.custom-tree-node {
font-size: 14px;
color: #333;
}
.tree-node {
width: 140px;
display: inline-block;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.el-tree-node__expand-icon {
font-size: 15px;
margin-top: -2px;
color: #000000;
}
.el-tree-node__expand-icon.is-leaf {
color: transparent;
}
.el-checkbox__inner {
margin-right: 10px;
}
.el-icon-edit-outline {
color: #999;
font-size: 15px;
cursor: pointer;
&:hover {
color: #5850ff;
}
}
}
}
}
</style>
<template>
<div class="scrm-sub-client-container">
<!-- <p class="pageTitle">标签管理</p> -->
<button class="addTagsBtn" @click="btnClick('create')">添加群标签组</button>
<!-- <button class="addTagsBtn" @click="btnClick('edit')">修改标签组</button> -->
<span class="toptips">
<!-- v-if="!((merchantModel==2 && accountLevel==4) || (merchantModel==1 && accountLevel==1))" -->
<span>
共有{{ numberObj.groupCount || 0 }}个标签组
<!-- v-if="!(merchantModel == 1 && accountLevel == 4)" -->
<template>,{{ numberObj.bizLabelCount || 0 }}个{{ '企业' | tagType }}标签</template>
<template v-if="!((merchantModel == 2 && accountLevel == 4) || (merchantModel == 1 && accountLevel == 1))">,{{ numberObj.rcLabelCount || 0 }}个自店标签</template>
<template>,{{ numberObj.traLabelCount || 0 }}个系统标签</template>
</span>
<span class="iconPanelWrap" v-if="!isFirstShow">
<el-popover placement="top" width="666" trigger="hover">
<!-- v-if="!(merchantModel == 1 && accountLevel == 4)" -->
<div>{{ '企业' | tagType }}标签为全局标签,员工可在企微APP端客户详情、客户跟进等模块查看和打标签,最多3000个;</div>
<div v-if="!((merchantModel == 2 && accountLevel == 4) || (merchantModel == 1 && accountLevel == 1))">自店标签为企业商户自有标签,员工可在企微APP端客户跟进等模块查看和打标签,最多3000个;</div>
<div>系统标签为通过大数据算法规则生成的标签</div>
<img src="@/assets/tagsManage/question.png" slot="reference" alt="" />
</el-popover>
</span>
</span>
<div class="initPanel" v-if="isFirstShow">
<template>{{ '企业' | tagType }}标签为全局标签,员工可在企微APP端客户详情、客户跟进等模块查看和打标签,最多3000个;</template>
<template v-if="!((merchantModel == 2 && accountLevel == 4) || (merchantModel == 1 && accountLevel == 1))">自店标签为企业商户自有标签,员工可在企微APP端客户跟进等模块查看和打标签,最多3000个;</template>
系统标签为通过大数据算法规则生成的标签
<img src="@/assets/tagsManage/Shape.png" alt="" />
<i class="el-icon-close" @click="closeInitPanel"></i>
</div>
<div class="client-main-box">
<div class="client-tag">
<tag-group @getCheckItem="getCheckItem" ref="tagTree" @editTag="btnClick"></tag-group>
</div>
<div class="client-tabel">
<div class="client-title-panel">
<div class="client-tabel-title">
<div class="client-tabel-label">
已选标签
<span @click="dialogRuleVisible = true">人群规则说明</span>
</div>
<div class="client-expand" v-if="!tagHeight && tagCheckItem.length">
<el-button type="text" size="small" @click="tagHeight = 180">
<span>展开</span>
<i class="expand el-icon-arrow-down"></i>
</el-button>
</div>
</div>
<div class="select-tag-panel" :style="{ 'max-height': tagHeight + 'px', 'margin-top': tagHeight ? '10px' : '0px' }">
<el-tag effect="plain" slot="reference" type="info" class="select-tagGroup" v-for="(item, idx) in tagCheckItem" :key="idx" closable :disable-transitions="false" @click="treeScroll(item.id)" @close="removeItem(idx)">
<label>{{ item.name }}:</label>
<template v-for="(tag, index) in item.children">
<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="tagHeightStatus">
<el-button type="text" size="small" @click="tagHeight = 0">
<span>收起</span>
<i class="expand el-icon-arrow-up"></i>
</el-button>
</div>
</div>
<div class="pageContent" :style="{ height: heightBox - 115 + 'px' }">
<GLCombiForm ref="formSearch" :formObj="searchForm" :formData="tagsPartFormList" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="clientNumExp">
<div class="clientNum">
<div class="clientListNew">客户列表({{ tableTotal }}人)</div>
</div>
<div>
<GLButton size="small" @click="handleExport" class="export" fn="导出">导出</GLButton>
<el-button
plain
size="small"
:disabled="tagCheckItem.length == 0"
@click="
groupVisible = true
crowdForm = {
crowdName: '',
crowdDesc: ''
}
"
>
保存为人群
</el-button>
<el-button plain size="small" @click="createMarketSOP()">
营销SOP
</el-button>
</div>
</div>
<!-- noDataText="你当前还没有添加的标签" -->
<GLTable @setTableFinishFun="setTableFinishFun" @refreshTable="getCustomersListData" ref="viewCustomers" :layout="layout" :hasNum="true" :tableData="tableData" :tableTotal="tableTotal" :noDataImg="url" :pageConf="pageConf" :tableParams="tableParams">
<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="delFlag" slot-scope="scope">
<span :class="{ circleStatusGreen: scope.scope.delFlag == 0, circleStatusGray: scope.scope.delFlag == -1 }"></span>
<span>{{ scope.scope.delFlag == -1 ? '已解散' : scope.scope.delFlag == 0 ? '正常' : '' }}</span>
</span>
<div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button type="text" @click="goGroupDetail(scope.scope)" class="blue-text">详情</el-button>
</div>
</GLTable>
</div>
</div>
</div>
<GLDialog title="人群规则说明" :visible.sync="dialogRuleVisible" :hasFooter="false">
<div class="crowd-dialog-wrap color-3">
<div class="condition font-14">
<b>说明:</b>
<br />
<span>
标签组内已选标签取
<b>并集(或)</b>
,即满足一个条件即可、标签组之间取
<b>交集(且)</b>
,即同时满足标签组条件。
</span>
</div>
<div class="flex-between">
<div class="static-image">
<img src="@/assets/crowdManage/sum.png" alt="" />
</div>
<div class="static-image">
<img src="@/assets/crowdManage/intersection.png" alt="" />
</div>
</div>
</div>
</GLDialog>
<GLDialog class="role" :title="tagDialogTitle" :visible.sync="tagVisible">
<div class="form-title">
<span>说明:</span>
此处添加的标签均为人工标签,即后续标签更新由员工更新打标签
</div>
<rule-form :ruleForm="tagForm" :rules="tagRules" :ruleData="tagDialogData" ref="tagForm">
<div slot="tagsGroup-type">
<el-select v-model="tagForm.initTagsGroup" placeholder="请选择" :disabled="tagDialogTitle != '添加标签组'" @change="handleSelect">
<el-option v-for="item in tagsGroupList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
<!-- id="tagTipMsgRef" -->
<span class="tagTipMsg" v-if="tagDialogTitle == '添加标签组' && !tagForm.initTagsGroup">
<template v-if="!(merchantModel == 1 && (accountLevel == 2 || accountLevel == 3 || accountLevel == 4))">{{ '企业' | tagType }}标签</template>
<template v-if="!((merchantModel == 2 && accountLevel == 4) || (merchantModel == 1 && accountLevel == 1))">
<template v-if="!(merchantModel == 1 && (accountLevel == 2 || accountLevel == 3 || accountLevel == 4))">和</template>
自店标签分别
</template>
最多3000个
</span>
<span class="tagTipMsg" v-if="tagDialogTitle == '添加标签组' && tagForm.initTagsGroup == 1">
{{ '企业' | tagType }}标签已创建
<span class="pure-blue-text">{{ numberObj.bizLabelCount }}</span>
个
</span>
<span class="tagTipMsg" v-if="tagDialogTitle == '添加标签组' && tagForm.initTagsGroup == 2">
自店标签已创建
<span class="pure-blue-text">{{ numberObj.rcLabelCount }}</span>
个
</span>
<span class="tagTipMsg" v-if="tagDialogTitle == '编辑标签组'">
{{ tagForm.initTagsGroup == 1 ? (merchantModel == 1 ? '集团标签' : '企业标签') : '自店标签' }}最多3000个,已创建
<span class="pure-blue-text">{{ tagForm.initTagsGroup == 1 ? numberObj.bizLabelCount : numberObj.rcLabelCount }}</span>
个
</span>
<!-- 企业标签最多3000个,已创建3个 -->
<!-- 自店标签最多3000个,已创建3个 -->
</div>
<div slot="modeType">
<el-input v-model.trim="tagForm.mode" disabled></el-input>
</div>
<div slot="tagsInput-type">
<div class="tagsWrap" v-if="tagDialogTitle == '编辑标签组'">
<div class="tagsWrapInput">
<span class="tag" :class="{ inputWrapShow: item.inputVisible }" v-for="item in editTagList" :key="item.id">
<!-- maxlength="30" show-word-limit -->
<el-input class="input-new-tag" v-if="item.inputVisible" v-model.trim="item.name" ref="saveTagInput" size="small" @blur="item.name = handleInputConfirm(item.name, item.id)" @keyup.enter.native="item.name = handleInputConfirm(item.name, item.id)"></el-input>
<el-tooltip class="item" :content="item.name" placement="top">
<span class="ellipsis-1" v-if="!item.inputVisible">{{ item.name }}</span>
</el-tooltip>
<img class="editIcon" src="@/assets/tagsManage/edit.png" @click="showInput(item.id)" alt="" v-show="!item.inputVisible" />
</span>
</div>
</div>
<div class="row-tag" v-for="(item, index) in tagForm.tagsList" :key="index">
<!-- :onkeyup="(item.name = item.name.replace(/\s+/g, ''))" maxlength="30" show-word-limit @input="checkInputContent"-->
<el-input v-model.trim="item.name" placeholder="添加标签名称(至少添加一个标签)" @keyup.native="item.name = checkInputContent(item.name)"></el-input>
<span class="el-icon-circle-close" @click="deleteRow(index)"></span>
</div>
<!-- 需要后台告诉已经创建多少个标签了 -->
<div class="addtagIcon" v-if="tagForm.initTagsGroup == 1" :style="{ color: numberObj.bizLabelCount >= 3000 ? '#EEE' : '' }" @click="addRow(tagForm.initTagsGroup)">
<i class="el-icon-circle-plus-outline"></i>
<span class="addTagText">新增标签</span>
</div>
<div class="addtagIcon" v-if="tagForm.initTagsGroup == 2" :style="{ color: numberObj.rcLabelCount >= 3000 ? '#EEE' : '' }" @click="addRow(tagForm.initTagsGroup)">
<i class="el-icon-circle-plus-outline"></i>
<span class="addTagText">新增标签</span>
</div>
<div class="addtagIcon" v-if="tagForm.initTagsGroup == ''" @click="addRow(tagForm.initTagsGroup)">
<i class="el-icon-circle-plus-outline"></i>
<span class="addTagText">新增标签</span>
</div>
<!-- v-if="tagNameRules" -->
<div class="el-form-item__error" v-if="tagNameRules">请至少添加一个标签</div>
</div>
</rule-form>
<span slot="footer" class="dialog-footer">
<el-button plain size="small" class="btn-three" @click="handleClose">取消</el-button>
<el-button type="primary" size="small" @click="handleConfirm">确定</el-button>
</span>
</GLDialog>
<GLDialog title="保存为人群" :visible.sync="groupVisible" :hasFooter="true">
<div class="gl-form-page gl-form-min">
<el-form :model="crowdForm" :rules="crowdFormRules">
<el-form-item label="人群名称:" prop="crowdName">
<el-input class="crowdName" v-model.trim="crowdForm.crowdName" size="small" placeholder="请输入人群名称:" maxlength="30" show-word-limit></el-input>
</el-form-item>
<el-form-item label="人群描述:">
<el-input class="crowdDesc" type="textarea" v-model.trim="crowdForm.crowdDesc" size="small" placeholder="请输入人群描述" maxlength="100" show-word-limit></el-input>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button plain size="small" class="btn-three" @click="groupVisible = false">取消</el-button>
<el-button type="primary" size="small" @click="groupConfirmDialog">确定</el-button>
</span>
</GLDialog>
<GLDialog title="提示" mode="small" :visible.sync="successVisible" :hasFooter="false">
<div class="success-panel">
<i class="el-icon-circle-check"></i>
</div>
<div class="success-tips">
<div class="success-tips-h1">已保存为人群</div>
<div class="success-tips-h2" @click="jumpGroup">立即前往“人群管理”></div>
</div>
</GLDialog>
<div class="loading-containner" v-if="userLoading">
<div class="loading-box">客户列表加载中</div>
</div>
</div>
</template>
<script>
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/groupTag'
import { utils } from 'glsx-common'
export default {
mixins: [tag],
name: 'tagsManage',
data() {
//这里就是整个checkName啦,就是方法一的使用
var checkName = (rule, value, callback) => {
var len = 0
for (var i = 0; i < value.length; i++) {
var c = value.charCodeAt(i)
//单字节加1
if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) {
len++
} else {
len += 2
}
}
if (len > 30) {
//重点重点,下面就是填写提示的文字 (len < 4 && len> 0) ||
// callback(new Error('名称长度为4-30个字符,一个中文字等于2个字符。'));
callback(new Error('字数已达上限'))
} else {
callback()
}
}
var checkTagsInput = (rule, value, callBack) => {
if (value && value.length == 0) {
return callBack(new Error('请添加标签'))
} else {
return callBack()
}
}
return {
isShowCloseBtn: true,
dialogMode: 'mid',
successVisible: false,
userLoading: false,
dialogRuleVisible: false,
expand: false,
heightBox: 0,
// isReload: true,
isAllowCloseDialog: false,
isHasSameTag: false,
tagNameRules: false,
numberObj: {},
url: url,
isFirstShow: false,
crowdFormRules: {
crowdName: [{ required: true, message: '请输入人群名称', trigger: 'blur' }]
},
searchForm: {
customerPhone: '',
nickName: '',
customerName: '',
followStaff: '',
audi: '',
carNumber: '',
isJoin: ''
},
tagsPartFormList: [
{
type: 'select',
name: 'followStaff',
optionId: 'value',
optionLabel: 'label',
optionList: [],
label: '跟进员工'
},
{
type: 'input',
name: 'customerPhone',
label: '联系电话'
},
{
type: 'input',
name: 'nickName',
label: '企微名称'
},
{
type: 'input',
name: 'customerName',
label: '客户名称'
},
{
type: 'select',
name: 'isJoin',
label: '是否加企微',
optionId: 'value',
optionLabel: 'label',
placeholder: '请选择',
optionList: [
{
value: '',
label: '全部'
},
{
value: '1',
label: '是'
},
{
value: '0',
label: '否'
}
]
},
{
type: 'datePicker',
// prop: 'daterange',
name: 'createTime',
label: '购车时间',
valueFormat: 'yyyy-MM-dd',
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
}
}
},
{
type: 'input',
inputType: 'text',
name: 'carVin',
label: '车架号'
},
{
type: 'input',
inputType: 'text',
name: 'carNumber',
label: '车牌号'
}
],
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: 'data',
tableColumns: [
{
label: '群聊名称',
prop: 'custGroupName',
line: 1,
width: 160
},
{
label: '当前成员总数',
prop: 'allMembers',
minWidth: 140
},
{
label: '当前客户数',
prop: 'totalCount',
minWidth: 110
},
{
label: '当日新增入群客户数',
prop: 'newCustomerCount',
minWidth: 170
},
{
label: '当日新增退群客户数',
prop: 'delCustomerCount',
minWidth: 170
},
{
label: '当前跟进员工数',
prop: 'staffs',
minWidth: 140
},
{
label: '群主',
prop: 'groupHostName',
minWidth: 130
},
{
label: '管理员',
prop: 'groupAdminName',
minWidth: 100
},
{
label: '创建方式',
prop: 'creationMethod',
formatter: cellValue => {
return cellValue.creationMethod == 1 ? '手动拉群' : cellValue.creationMethod == 2 ? '一客一群' : ''
},
minWidth: 140
},
{
label: '群聊状态',
prop: 'delFlag',
width: 120,
addHtml: 'delFlag'
},
{
label: '创建时间',
prop: 'addTime',
width: 180
},
{
label: '操作',
prop: 'optionBtns',
width: '65px',
addHtml: 'optionBtns',
fixed: 'right'
}
]
},
tableData: [],
// 弹窗数据
tagDialogTitle: '添加标签组',
tagVisible: false,
groupVisible: false,
tagForm: {
tagsName: '',
initTagsGroup: 1,
mode: '人工',
tagsList: []
},
tagDialogData: [
{
label: '标签组名称:',
prop: 'tagsName',
type: 'input',
placeholder: '最多30个字符,1个汉字为2个字符',
disabled: false,
clickFunc: this.watchInput
},
{
label: '标签组类型:',
prop: 'initTagsGroup',
type: 'customize',
slotName: 'tagsGroup-type'
},
{
label: '更新方式:',
prop: 'initTagsGroup',
type: 'customize',
slotName: 'modeType'
},
{
label: '标签:',
prop: 'tagsList',
type: 'customize',
slotName: 'tagsInput-type',
class: 'is-required' //添加红色标志
}
],
tagRules: {
tagsName: [{ required: true, message: '请输入名称', trigger: 'blur' }],
initTagsGroup: [{ required: true, message: '请选择标签组类型', trigger: 'change' }]
// tagsList: [{ required: true }]
},
tagsGroupList: [
{ id: 1, name: this.$globalState.session.merchantModel == 1 ? '集团标签' : '企业标签' },
{ id: 2, name: '自店标签' }
],
modeList: [{ id: 1, name: '人工' }],
//编辑便签输入的值
editTagList: [],
tagGroupId: 0, //标签组id,编辑提交接口要用
//控制展开收起按钮
expande: true,
needShowExpande: false,
merchantId: 10001001, //子系统默认这个门店id
merchantModel: 1, //集团:1,门店:2
accountLevel: 0, //1,2,3,4工厂,省代,市代,门店
userType: 0 //1是商户,2是员工
}
},
components: {
tagGroup
},
computed: {
classIcon() {
return !this.expand ? 'el-icon-arrow-down' : 'el-icon-arrow-up'
}
},
created() {
if (window.__POWERED_BY_QIANKUN__) {
//运行在qiankun容器中
this.merchantId = this.$globalState.session.merchantId
this.merchantModel = this.$globalState.session.merchantModel
this.accountLevel = this.$globalState.session.accountLevel
this.userType = this.$globalState.session.userType
// if (this.merchantModel == 1) {
// if (!(this.accountLevel == 1 && this.userType == 1)) this.tagsGroupList.splice(0, 1) //只能创建自店标签
// }
//1.0.1集团下的省代、市代,门店只能创建自店标签
if (this.merchantModel == 1) {
if (this.accountLevel == 2 || this.accountLevel == 3 || this.accountLevel == 4) {
this.tagsGroupList.splice(0, 1) //只能创建自店标签
// this.tagsPartFormList[0].options.splice(0, 1)
}
}
if (this.merchantModel == 1) {
if (this.accountLevel == 1) {
//集团下的工厂只能创建企微标签,自店标签不要了
this.tagsGroupList.splice(1, 1)
// this.tagsPartFormList[0].options.splice(1, 1)
}
}
// 集团授权模式下的门店账号,拥有标签管理模块权限,修改为:去掉门店的“标签管理”模块权限
// 单店授权模式下的门店账号,创建标签组时,可创建企业标签和自店标签,修改为:创建标签组时,仅能选择企业标签,去掉自店标签选项;
if (this.merchantModel == 2) {
if (this.accountLevel == 4) {
this.tagsGroupList.splice(1, 1)
// this.tagsPartFormList[0].options.splice(1, 1)
}
}
}
this.searchForm = { 'labelTreeReq.shopId': this.merchantId, 'labelTreeReq.edition': this.merchantModel }
this.getLoginCountFun()
this.getTableTagNumFun()
},
mounted() {
let clientHeight = document.documentElement.clientHeight
this.heightBox = clientHeight - 122
},
methods: {
// toViewCustomer(info) {
// this.$router.push('/tagsManage/viewCustomers')
// },
// 跳转到营销SOP
createMarketSOP() {
let getDatas = JSON.parse(
JSON.stringify(this.allListParams)
.replace(/groupId/g, 'labelGroupId')
// .replace(/groupName/g, 'labelGroupName')
.replace(/groupType/g, 'labelGroupType')
)
let mergeDatas = getDatas.map((item, index) => {
return { ...item, ...this.sopListParams[index] }
})
var params = {
addOrEdit: 'add',
fromPage: '/custom/tagsManage/index',
$title: encodeURI('新建SOP'),
info: {
// 标签
customerOptType: 3,
labelList: [...mergeDatas]
}
}
this.$common.utils.storage.set('sopInfo', params)
this.$history.push({
path: 'marketing/sop/editSop'
})
},
toViewCustomer(info) {
const id = info.labelGroup.id
const type = info.labelType
this.$router.push({
// path:`/tagsManage/viewCustomers/530`
path: `/tagsManage/viewCustomers/${id}/${type}`
})
},
watchInput() {},
showTagArray(list) {
if (list.length == 0) {
return []
}
// return list
return list.slice(0, 9)
},
checkInputContent: function(e) {
//确保每个输入框的内容不和已存在的编辑标签相同
let isHasSameTag = this.editTagList.some(ele => ele.name == e)
if (isHasSameTag) {
// this.$message.error('不允许输入已存在的标签')
return e
}
return this.$Utils.cutMaxCharStr(e)
},
isShowEditBtn(row) {
//集团模式下,只有集团能可以编辑企业,自店,其他只能编辑自店
//单店模式下,仅门店和员工可以编辑
if (row.labelType == '自店标签' && !(this.merchantModel == 1 && (this.accountLevel == 2 || this.accountLevel == 3 || this.accountLevel == 4))) {
return false
}
if (this.merchantModel == 1) {
if (this.accountLevel == 1 && this.userType == 1) {
return true
}
if (this.accountLevel !== 1) {
//如果是企业标签不显示
if (row.labelType == '企业标签' || row.labelType == '集团标签') {
return false
}
return true
}
}
return true //门店版都显示编辑按钮
},
expandeClick() {
this.expande = !this.expande
},
closeInitPanel() {
this.isFirstShow = false
},
setTableHeightEvent() {
this.$refs.tagsManage.setTableHeightFun()
},
getLoginCountFun() {
//loginType:3是查客户数据概览浏览次数
getLoginCount({ loginType: 3 }).then(res => {
//获取是否第一次点击该页面
this.isFirstShow = res
})
},
getTableTagNumFun() {
getTableTagNum({ 'labelStatReq.shopId': this.merchantId, 'labelStatReq.edition': this.merchantModel, belongType: 2 }).then(res => {
if (!res) {
return false
}
this.numberObj = res
})
},
//搜索表格
handleSearch() {
this.getCustomersListData()
},
//重置表格
handleReset() {
this.searchForm = {}
this.getCustomersListData()
},
btnClick(pType, rowData) {
switch (pType) {
case 'create':
this.tagDialogTitle = '添加标签组'
this.tagForm.tagsForm = ''
this.tagForm.initTagsGroup = 1 //默认改成,企业标签
if (this.merchantModel == 1 && (this.accountLevel == 2 || this.accountLevel == 3 || this.accountLevel == 4)) {
this.tagForm.initTagsGroup = 2
}
this.$set(this.tagDialogData[0], 'disabled', false)
this.handleClose()
break
case 'edit':
this.tagDialogTitle = '编辑标签组'
// this.$set(this.tagDialogData[0], 'disabled', true)
this.editEvent(rowData)
break
}
},
isHasSome(array) {
var temp = [] //一个新的临时数组
for (var i = 0; i < array.length; i++) {
if (temp.indexOf(array[i]) !== -1) {
return true
}
if (temp.indexOf(array[i]) == -1) {
temp.push(array[i])
}
}
return false
},
//编辑触发事件
editEvent(rowData) {
this.handleClose()
this.tagsForm = JSON.parse(JSON.stringify(rowData))
this.editTagList = rowData.labelList.map(item => {
return { ...item, inputVisible: false }
})
this.tagGroupId = rowData.labelGroup.id //标签组id
this.tagForm.tagsName = rowData.labelGroup.name //标签组名
this.tagForm.initTagsGroup = rowData.labelType == '企业标签' || rowData.labelType == '集团标签' ? 1 : rowData.labelType == '自店标签' ? 2 : '' //标签组类型
},
handleConfirm: utils.debounce(function() {
this.$refs.tagForm.$children[0].validate(valid => {
if (!valid) {
if (this.tagForm.tagsList.length <= 0 && this.tagDialogTitle == '添加标签组') {
this.tagNameRules = true
this.$message.error('至少要添加一个标签')
// return
}
return
}
if (this.tagForm.tagsList.length <= 0 && this.tagDialogTitle == '添加标签组') {
this.tagNameRules = true
this.$message.error('至少要添加一个标签')
return
}
if (this.tagDialogTitle == '添加标签组') {
//过滤掉没有输入值得标签输入框
this.tagForm.tagsList = this.tagForm.tagsList.filter(item => item.name != '')
if (this.tagForm.tagsList.length <= 0) {
this.$message.error('不能提交空标签')
return
}
//如果存在添加标签的输入框的内容的标签相同则不提交
let isSameTagFlag = false
var tempArr = this.tagForm.tagsList.map(item => item.name)
isSameTagFlag = this.isHasSome(tempArr)
if (isSameTagFlag) {
this.$message.error('不能提交相同的标签,请修改')
return
}
this.newAddTagFun(1)
//this.handleClose() //这里不管
} else {
//修改标签(允许同时增加标签)
let isHasEmpty = this.editTagList.some(ele => ele.name == '')
if (isHasEmpty) {
this.$message.error('不能提交空的编辑标签')
return
}
if (this.tagForm.tagsList.length > 0) {
//过滤掉没有输入值得标签输入框
this.tagForm.tagsList = this.tagForm.tagsList.filter(item => item.name != '')
//如果存在添加标签的输入框的内容和可编辑的标签相同则不提交
let ishasSameTagFlag = false
this.editTagList.forEach(item => {
for (let i = 0; i < this.tagForm.tagsList.length; i++) {
if (this.tagForm.tagsList[i].name == item.name) {
ishasSameTagFlag = true
}
}
})
if (ishasSameTagFlag) {
this.$message.error('不能提交已存在的标签,请修改')
return
}
}
this.updateTagFun()
this.newAddTagFun()
// this.handleClose()
}
})
}, 300),
handleRuleClose() {
this.dialogRuleVisible = false
},
handleClose() {
this.tagNameRules = false
if (!this.tagVisible && this.$refs.tagForm) {
this.$refs.tagForm.$children[0].resetFields()
this.tagForm.initTagsGroup = 1
if (this.merchantModel == 1 && (this.accountLevel == 2 || this.accountLevel == 3 || this.accountLevel == 4)) {
this.tagForm.initTagsGroup = 2
}
this.tagForm.tagsName = ''
}
this.tagForm.tagsList = [] //取消时清空新增标签
this.tagVisible = !this.tagVisible
},
newAddTagFun(status) {
//满足条件进行提交
let params = {}
params.belongType = 2
params['labelDTO.dataFrom'] = 'cs'
params['labelDTO.shopId'] = this.merchantId
params['labelDTO.edition'] = this.merchantModel
// params.staffId = '员工A'
params['labelDTO.labelGroup.name'] = this.tagForm.tagsName
params['labelDTO.labelType'] = this.tagForm.initTagsGroup == 1 ? (this.$globalState.session.merchantModel == 1 ? '集团标签' : '企业标签') : '自店标签'
params['labelDTO.labelList'] = this.tagForm.tagsList
params['labelDTO.isAddLabelGroupEnter'] = this.tagDialogTitle == '添加标签组' ? true : false
newAddTag(params).then(res => {
if (!res) {
return
}
if (res.data.code == 0) {
if (this.tagForm.tagsList.length > 0) {
// this.$message.success('添加成功')
status && this.$message.success('添加成功')
}
if (this.tagDialogTitle == '编辑标签组') {
this.tagForm.tagsName = ''
this.tagForm.initTagsGroup = ''
this.tagForm.tagsList = []
}
this.handleClose()
} else if (res.data.code == 1) {
this.$message.error(`${res.data.message}`)
} else if (res.data.code == 2) {
//编辑弹框, 空标签调接口返回信息
if (this.tagDialogTitle == '编辑标签组') {
this.tagForm.tagsName = ''
this.tagForm.initTagsGroup = ''
this.tagForm.tagsList = []
}
this.handleClose()
}
this.$refs.tagTree.getTableList(true) //刷新下表格
this.getTableTagNumFun()
})
},
updateTagFun() {
let param = {}
param.belongType = 2
param['labelDTO.dataFrom'] = 'cs'
param['labelDTO.edition'] = this.merchantModel
param['labelDTO.labelGroup.id'] = this.tagGroupId
param['labelDTO.labelGroup.name'] = this.tagForm.tagsName
param['labelDTO.labelType'] = this.tagForm.initTagsGroup == 1 ? (this.$globalState.session.merchantModel == 1 ? '集团标签' : '企业标签') : '自店标签'
param['labelDTO.shopId'] = this.merchantId
let editTagList = this.editTagList.map(item => {
return {
id: item.id,
name: item.name
}
})
param['labelDTO.labelList'] = editTagList
updateTag(param).then(res => {
if (!res) {
return
}
this.$message.success('修改成功')
// this.tagForm.tagsName = ''
// this.tagForm.initTagsGroup = ''
// this.tagForm.tagsList = []
// this.$refs.tagTree.getTableList(true) //刷新下表格 //重复请求了
})
},
//删除一行标签
deleteRow(index) {
this.tagForm.tagsList.splice(index, 1)
},
//添加一行标签
addRow(type) {
const typeLabel = this.$globalState.session.merchantModel == 1 ? '集团标签' : '企业标签'
this.tagNameRules = false
if (type == 1 && this.numberObj.bizLabelCount >= 3000) {
this.$message.error(`${typeLabel}数量已达上限`)
return
}
if (type == 2 && this.numberObj.rcLabelCount >= 3000) {
this.$message.error('自店标签数量已达上限')
return
}
this.tagForm.tagsList.push({ name: '' })
},
showInput(id) {
// this.inputVisible = true
this.editTagList.forEach(item => {
if (item.id == id) {
item.inputVisible = true
}
})
//聚焦到输入框
this.$nextTick(_ => {
this.$refs.saveTagInput[0].focus()
})
},
handleInputConfirm(inputValue, id) {
this.editTagList.forEach(i => {
if (i.id == id) {
i.inputVisible = false
}
})
return this.$Utils.cutMaxCharStr(inputValue)
},
handleSelect(value) {}
//注意问问他们后台怎么处理转义字符
//限制输入特殊字符
// keyUp(e) {
// e.target.value = e.target.value.replace(/[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/g, '')
// },
// // 只能输入汉字、英文、数字
// keydown(e) {
// e.target.value = e.target.value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5]/g, '')
// }
}
}
</script>
<style lang="scss" scoped>
@import '@/styles/variables.scss';
@import '@/styles/resetelement.scss';
.crowdName {
padding-right: 50px;
}
.crowdDesc {
padding-right: 58px;
}
.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: '. . .';
}
}
.success-panel {
display: flex;
justify-content: center;
margin-top: 40px;
.el-icon-circle-check {
color: #2cca74;
font-size: 36px;
}
}
.success-tips {
color: #5850ff;
text-align: center;
margin: 10px 0px 30px;
line-height: 20px;
&-h1 {
font-size: 16px;
color: #333333;
}
&-h2 {
cursor: pointer;
margin-top: 30px;
font-size: 14px;
color: #5850ff;
}
}
.success-footer {
text-align: center;
}
.leftDistance {
margin-left: 10px;
}
.form-title {
padding-left: 30px;
margin-bottom: 15px;
font-size: 12px;
font-weight: 400;
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;
line-height: 21px;
b {
color: #666666;
}
// span {
// white-space: nowrap;
// }
}
.static-image {
width: 335px;
height: 325px;
img {
width: 100%;
}
}
}
.scrm-sub-client-container {
/deep/.search-form .el-form-item__content {
width: auto;
}
// // el-form-item__label
// /deep/.el-table tbody tr:hover > td {
// background-color: #f4f3ff;
// }
.pageTitle {
position: relative;
// margin-top: 30px;
margin-bottom: 20px;
height: 20px;
font-size: 20px;
font-weight: 700;
color: #333333;
line-height: 20px;
letter-spacing: 1px;
}
.addTagsBtn {
height: 32px;
background: $btnBlue;
border-radius: 4px;
padding: 0 20px;
color: #fff;
font-size: 14px;
&:hover {
background-color: $lightBtnBlue;
}
}
.toptips {
display: inline-block;
position: relative;
margin-left: 10px;
height: 20px;
min-width: 440px;
font-size: 14px;
font-weight: 400;
color: #666666;
line-height: 20px;
.tipsPanel {
position: absolute;
display: inline-block;
padding: 6px 10px 10px;
box-sizing: border-box;
font-size: 14px;
font-weight: 400;
color: #999999;
line-height: 22px;
display: none;
z-index: 100;
background: #fff;
width: 560px;
height: 82px;
right: -280px;
top: -84px;
}
.iconPanelWrap {
img {
display: inline-block;
margin-left: 20px;
vertical-align: middle;
}
&:hover {
.tipsPanel {
display: block !important;
}
}
}
}
.initPanel {
position: relative;
margin-top: 20px;
width: 708px;
min-height: 80px;
box-sizing: border-box;
background: #e6e9ff;
border: 1px solid $btnBlue;
border-radius: 4px;
padding: 10px 42px;
height: 60px;
font-size: 14px;
font-weight: 400;
color: rgba(0, 0, 0, 0.65);
line-height: 20px;
img {
position: absolute;
left: 16px;
top: 13px;
}
i {
position: absolute;
top: 14px;
right: 18px;
width: 9px;
height: 9px;
cursor: pointer;
}
}
.client-main-box {
display: flex;
.client-tag {
width: 260px;
margin-right: 10px;
margin-top: 10px;
background-color: #fff;
}
.client-tabel {
flex: 1;
overflow: hidden;
.client-expand {
text-align: center;
}
.client-title-panel {
padding: 16px;
margin-top: 10px;
background-color: #fff;
}
&-title {
font-size: 16px;
font-weight: 600;
color: #333333;
line-height: 22px;
display: flex;
justify-content: space-between;
span {
font-size: 14px;
font-weight: 400;
color: #5850ff;
line-height: 20px;
cursor: pointer;
}
}
.select-tag-panel {
display: flex;
flex-wrap: wrap;
font-size: 14px;
transition: all 0.3s linear;
overflow-y: auto;
.select-tagGroup {
display: inline-block;
background: #ffffff;
border-radius: 4px;
border: 1px solid #e8e8ea;
padding: 4px 8px;
line-height: 24px;
margin-right: 8px;
margin-bottom: 8px;
height: 36px;
box-sizing: border-box;
/deep/ {
.el-icon-close {
right: 0px;
}
}
label {
color: #333333;
font-weight: 600;
}
}
.select-tagLabel {
display: inline-block;
background: #fafbfe;
border-radius: 4px;
border: 1px solid #e8e8ea;
padding: 0px 8px;
line-height: 20px;
margin-right: 4px;
}
}
}
}
.pageContent {
overflow-y: auto;
padding: 20px 20px 30px;
margin-top: 10px;
background-color: #fff;
.el-button + .el-button {
margin-left: 10px;
}
.clientNumExp {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 14px;
padding-bottom: 10px;
letter-spacing: 1px;
.clientNum {
// display: flex;
// align-items: center;
.clientListNew {
display: flex;
align-items: center;
font-weight: 600;
color: #333333;
font-size: 16px;
}
.clientNumText {
margin-left: 6px;
height: 20px;
font-size: 14px;
font-weight: 400;
color: #5850ff;
line-height: 20px;
padding-top: 2px;
}
}
.export {
color: #5850ff;
border: 1px solid #5850ff;
}
}
.allTagsWrap {
position: relative;
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
padding-bottom: -2px;
box-sizing: border-box;
&:hover {
-webkit-line-clamp: 9999;
}
.tag-box-wrap {
display: inline-block;
margin-right: 10px;
margin-top: 5px;
margin-bottom: 5px;
padding: 0 10px;
box-sizing: border-box;
min-width: 76px;
max-width: 200px;
height: 26px;
line-height: 26px;
border-radius: 4px;
border: 1px solid #e8e8ea;
background: #fafbfe;
text-align: center;
font-size: 14px;
font-weight: 400;
color: #666666;
max-width: 245px;
cursor: pointer;
}
.expande-button-wrap {
position: absolute;
right: 0;
bottom: 0;
.expande-button {
color: $btnBlue;
cursor: pointer;
i {
height: 8px;
}
span {
height: 20px;
font-size: 14px;
font-weight: 400;
color: $btnBlue;
line-height: 20px;
}
}
}
}
.close {
overflow: hidden;
height: 65px;
}
}
.role {
/deep/.tagTipMsg {
font-size: 12px;
display: flex;
color: #999999;
margin-left: 150px;
}
.tagsWrap {
display: flex;
flex-wrap: wrap;
align-content: flex-start;
padding-top: 3px;
.tagsWrapInput {
border: 1px solid rgb(229, 229, 229);
padding: 8px;
width: 423px;
max-height: 75px;
overflow-y: auto;
}
img {
display: none;
}
::v-deep .tag {
text-align: center;
display: inline-block;
padding: 0 10px;
min-width: 68px;
max-width: 200px;
margin-right: 6px;
margin-bottom: 6px;
height: 26px;
line-height: 26px;
background: #fafbfe;
border-radius: 4px;
border: 1px solid #e8e8ea;
position: relative;
box-sizing: border-box;
/deep/.input-new-tag {
// position: relative;
width: 100%;
}
.el-input--small .el-input__inner {
height: 26px;
line-height: 26px;
font-size: 14px;
}
.ellipsis-1 {
display: inline-block;
width: 100%;
font-weight: 400;
color: #666666;
font-size: 14px;
}
&:hover {
.editIcon {
display: inline-block;
cursor: pointer;
position: absolute;
top: -8px;
right: -8px;
// z-index: 9999;
}
}
.el-input {
max-width: 200px;
}
}
.inputWrapShow {
//显示输入框时,不显示外面框的左右边距
padding: 0 0;
border: 0;
}
}
.row-tag {
display: flex;
&:not(:first-child) {
margin-top: 5px;
margin-left: 154px;
}
align-items: center;
.el-icon-circle-close {
margin-left: 15px;
font-size: 18px;
color: #999999;
cursor: pointer;
}
}
.addtagIcon {
width: 75px;
height: 40px;
display: flex;
justify-content: space-between;
align-items: center;
color: $btnBlue;
cursor: pointer;
margin-left: 150px;
i {
font-size: 20px;
}
.addTagText {
font-size: 12px;
}
}
}
}
.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>
<template>
<div v-loading="loading2">
<div class="scrm-sub-client-container">
<div class="pageContent">
<div class="labelSet">
<div class="labelSetLeft">标签组:{{ labelGroupName }}</div>
<div class="labelSetLeftRight">
{{ labelUpdateType }}
</div>
</div>
<div class="choiceLabel">
<div class="choiceLabelLeft">
<div class="addLabelStyle">标签:</div>
<button class="addTagsBtn" @click="choiceLabel">选择标签</button>
</div>
<button class="backBtn" @click="goBack">返回标签管理</button>
<!-- <span>(默认显示标签组已打标签所有客户)</span> -->
</div>
<!-- <div class="clientList">
标签组客户列表(100人)
</div> -->
<!-- <search-form class="searchTop border-shadow" :isHasSyncBtn="true" :showDefaultTime="false" :merchantModel="merchantModel" :accountLevel="accountLevel" :formModel="searchForm" :formList="clientGroupFormList" @setTableHeightEvent="setTableHeightEvent" @resetTable="resetTable" @searchTable="searchTable" @handleExport="handleExport" @syncClick="syncClick">
<span class="inline-b" slot="form-slot">
<el-button plain @click="resetTable">重置</el-button>
<el-button type="primary" @click="searchTable">查询</el-button>
<el-button type="primary" @click="handleExport">导出</el-button>
</span>
</search-form> -->
</div>
</div>
<div class="scrm-sub-client-container">
<div class="pageContent">
<div>
<div class="clientNumExp">
<div class="clientNum">
<!-- {{ labelGroupName }} -->
<!-- <div class="clientListNew">标签组客户列表</div>
<div class="clientNumText">{{ tableTotal }}个</div> -->
<div class="clientListNew">
标签组客户列表
<div class="clientNumText">{{ tableTotal }}个</div>
</div>
</div>
<el-button class="export" size="small" @click="handleExport">导出</el-button>
</div>
<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">
<span slot="qiweimingcheng" slot-scope="scope">
<span>{{ myStandNo(scope.scope.carVin) }}</span>
</span>
<!-- 企微名称 -->
<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" content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。">
<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>
</div>
</div>
<span slot="carVin" slot-scope="scope">
<span>{{ myStandNo(scope.scope.carVin) }}</span>
</span>
<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="auth-button" slot-scope="scope" :data="scope.scope">
<span @click="goDetail(scope.scope.id, scope.scope.custGroupName)" class="blue-text">详情</span>
</template>
</GLTable>
</div>
</div>
</div>
<GLTable title="选择标签" :visible.sync="dialogVisible">
<el-input placeholder="请输入搜索关键字" v-model="searchLabel" clearable>
<i slot="suffix" class="el-input__icon el-icon-search"></i>
</el-input>
<div class="labelCombination">
<div class="iconLabels">
<img src="@/assets/tagsManage/doc.png" alt="" />
<span class="iconLabelstext">{{ labelGroupName }}</span>
</div>
<div class="label-panle" :style="{ height: boxHeight + 'px' }" v-if="items.length > 0">
<template v-for="(item, index) in items">
<div class="iconLabelsName" :class="{ active: checkedId == item.labelId }" :key="index" @click="seletLabelActive(item.labelId, item)">
<img src="@/assets/tagsManage/label.png" alt="" />
<span :title="item.labelName.length > 10 ? 'item.labelName' : ''" class="LabelsNameTxt">{{ item.labelName }}</span>
<img v-if="checkedId == item.labelId" class="labelChecked" src="@/assets/tagsManage/checked.png" alt="" />
</div>
</template>
</div>
<div class="noRelatedLabel" v-else>
<img src="@/assets/tagsManage/noData.png" alt="" />
<div>暂无 {{ searchLabel }} 相关内容</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button plain size="small" class="btn-three" @click="resetSearch">重置</el-button>
<el-button type="primary" size="small" @click="searchClientData">确定123</el-button>
</span>
</GLTable>
</div>
</template>
<script>
import { getCustomersList, getLabelList, exportLabelList } from '@/api/modules/tagsManage'
import url from '@/assets/clientDataOverview/nodata.png'
export default {
name: 'viewCustomers',
components: {},
data() {
return {
loading2: false,
checkedId: '',
allListParams: {
tagLists: []
},
allLabeltags: [],
customerListsNum: 0,
checkedTag: [],
isActive: -1,
groupId: '',
groupType: '',
tagLists: [], //查询
searchLabel: '', //搜索标签
labelGroupName: '', //标签组名称
labelList: [], //存放标签
dialogVisible: false,
labelType: '',
isReload: true,
noRelatedLabel: false,
url: url,
sloading: false,
searchForm: {},
searchForm3: {},
searchFormTable: {},
boxHeight: 200,
exportParams: {},
clientGroupFormList: [
{
type: 'input',
inputType: 'text',
prop: 'phoneNumber',
label: '联系电话',
placeholder: ''
},
{
type: 'input',
inputType: 'text',
prop: 'registrationNumber',
label: '车牌号',
placeholder: ''
},
{
type: 'input',
inputType: 'text',
prop: 'vin',
label: '车架号',
placeholder: ''
},
{
type: 'input',
inputType: 'text',
prop: 'customerName',
label: '客户名称',
placeholder: ''
},
{
type: 'select',
prop: 'joinQW',
label: '是否加企微',
placeholder: '请选择',
options: [
{
label: '全部',
value: null
},
{
label: '是',
value: 1
},
{
label: '否',
value: 2
}
]
},
{
type: 'select',
prop: 'followUpStaffs',
label: '跟进员工',
placeholder: '请选择',
options: [
{
label: '全部',
value: null
},
{
label: '张三',
value: 1
},
{
label: '李四',
value: 2
},
{
label: '王五',
value: 3
}
]
},
{
type: 'input',
inputType: 'text',
prop: 'carSeries',
label: '车系',
placeholder: ''
}
],
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: 'data',
tableColumns: [
{
label: '客户姓名',
prop: 'customerName',
minWidth: 150
},
{
label: '企微名称',
prop: 'nickNameList',
addHtml: 'nickNameList',
minWidth: 200
},
{
label: '联系电话',
prop: 'customerPhone',
minWidth: 140
},
{
label: '车牌号',
prop: 'carNumber',
width: 140
},
{
label: '车架号(后6位)',
prop: 'carVin',
addHtml: 'carVin',
minWidth: 140
},
{
label: '车系',
prop: 'audi',
minWidth: 140
},
{
label: '跟进员工',
prop: 'followStaff',
minWidth: 180
},
{
label: '是否加企微',
prop: 'isJoin',
addHtml: 'isJoin',
minWidth: 120
},
{
label: '添加时间',
prop: 'addTime',
minWidth: 170
}
]
},
tableData: [],
merchantModel: 1,
flushTime: false
// items
}
},
created() {
this.groupId = this.$route.params.info ? this.$route.params.info : ''
this.groupType = this.$route.params.type ? this.$route.params.type : ''
this.getLabelList()
if (window.__POWERED_BY_QIANKUN__) {
//运行在qiankun容器中
this.merchantModel = this.$globalState.session.merchantModel
this.accountLevel = this.$globalState.session.accountLevel
}
},
beforeDestroy() {
this.$message.closeAll()
},
mounted() {
let clientHeight = document.documentElement.clientHeight
this.boxHeight = clientHeight - 250
},
watch: {
labelType(val) {
switch (val) {
case '企业标签':
this.labelUpdateType = '企业标签 | 手动更新'
break
case '自店标签':
this.labelUpdateType = '自店标签 | 手动更新'
break
case '系统标签':
this.labelUpdateType = '系统标签 | 自动更新'
break
}
},
searchLabel(val) {
if (this.allLabeltags.indexOf(val) == -1) {
this.noRelatedLabel = true
} else {
this.noRelatedLabel = false
}
}
},
computed: {
items: function() {
var _search = this.searchLabel
const labelList = this.labelList.filter(item => item.labelName.indexOf(_search) > -1)
return labelList
}
},
methods: {
myStandNo(carVin) {
if (!carVin) {
return ''
}
return carVin.substring(carVin.length - 6)
},
getCustomersListData() {
const params = {
...JSON.parse(JSON.stringify(this.allListParams)),
pageSize: this.$refs.viewCustomers.page.pageSize,
pageNum: this.$refs.viewCustomers.page.pageNum,
belongType:2
}
this.exportParams = { ...JSON.parse(JSON.stringify(this.allListParams)) }
this.loading2 = true
getCustomersList(params).then(res => {
this.tableData = res.data
this.tableTotal = res.count
if (res.data.length == 0) {
this.$refs.viewCustomers.setTableHeightFun()
}
setTimeout(() => {
this.loading2 = false
}, 300)
})
},
//获取标签组
getLabelList() {
let params = {
belongType:2,
// 'labelByGroupIdReq.labelGroupId': this.groupId
'labelByGroupIdReq.labelGroupId': this.groupId,
'labelByGroupIdReq.labelGroupType': this.groupType
}
getLabelList(params).then(res => {
this.labelGroupName = res.groupName
this.labelList = res.labelNameIds
this.labelType = res.groupType
this.groupId = res.groupId
this.labelList.forEach(item => {
// this.allLabeltags.push(item.labelName)
item.isHidden = true
let res = this.getListParams(item.labelId, item.labelName)
this.allListParams.tagLists.push(res)
})
this.startParams = this.$common.utils.deepClone(this.allListParams)
this.searchForm = {
...this.allListParams
}
this.getCustomersListData()
})
},
seletLabelActive(id, arr) {
if (id == this.checkedId) {
this.checkedId = ''
this.tagLists = []
this.allListParams = this.startParams
return
}
this.checkedId = id
const labelId = arr.labelId
const labelName = arr.labelName
let res = this.getListParams(labelId, labelName)
if (this.tagLists.length > 0) {
// this.checkedTag.shift()
this.tagLists.shift()
}
this.tagLists.push(res)
},
// 首次加载页面显示所有客户数据
getAllClientList(allListParams) {
this.searchForm = {
...allListParams
}
// this.exportParams = {...allListParams}
this.getCustomersListData()
this.tagLists = []
},
// 根据标签获取客户列表
searchClientData() {
this.$refs.viewCustomers.page.pageNum = 1
this.dialogVisible = false
if (!this.tagLists.length) {
// this.exportParams = {...this.allListParams}
this.getAllClientList(this.allListParams)
} else {
this.allListParams = {
tagLists: this.tagLists
}
// this.exportParams = {...this.allListParams}
this.getCustomersListData()
}
},
getListParams(id, name) {
const params = {}
params.groupId = this.groupId
params.groupName = this.labelGroupName
params.groupType = this.labelType
params.labelId = id
params.labelName = name
return params
},
// 重置按钮
resetSearch() {
this.searchLabel = ''
this.checkedId = ''
this.tagLists = []
this.allListParams = this.startParams
// this.$refs.viewCustomers.page.pageNum = 1
// this.$refs.viewCustomers.page.pageSize = 10
// this.getCustomersListData()
// this.dialogVisible = false
},
filterNode(val, labelData) {
if (!val) return true
return labelData.label.indexOf(val) !== -1
},
// 输入框匹配label数据
searchIuputLabel() {
},
handleDialogClose() {
this.dialogVisible = false
},
choiceLabel() {
this.dialogVisible = true
},
handleNodeClick(data) {
},
goBack() {
this.$router.go(-1)
},
setTableHeightEvent() {
this.$refs.viewCustomers.setTableHeightFun()
},
setTableFinishFun(content) {
this.customerListsNum = this.$refs.viewCustomers.total
this.$refs.viewCustomers.data.length ? (this.$refs.viewCustomers.tableHeightValues = '') : this.$refs.viewCustomers.setTableHeightFun()
},
//导出
handleExport() {
const params = {
belongType:2,
...JSON.parse(JSON.stringify(this.exportParams))
}
exportLabelList(params).then(res => {
this.$Utils.exportFn(res)
})
},
searchTable() {
this.$refs.viewCustomers.refreshTable()
},
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
return params
},
beforeSearchFn() {
return new Promise((resolve, reject) => {
this.searchFormTable = this.getParams()
resolve()
})
}
}
}
</script>
<style lang="scss" scoped>
@import '@/styles/variables.scss';
@import '@/styles/resetelement.scss';
.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;
}
.noRelatedLabel {
margin-top: 59px;
text-align: center;
div {
margin-top: 12px;
font-size: 14px;
font-weight: 400;
color: #000000;
}
}
.active {
border: 1px solid rgba(88, 80, 255, 1) !important;
.labelChecked {
position: absolute;
top: 0px;
right: 0px;
}
}
.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-weight: 600;
color: #333333;
font-size: 20px;
}
.clientNumText {
margin-left: 6px;
height: 20px;
font-size: 14px;
font-weight: 400;
color: #5850ff;
line-height: 20px;
padding-top: 2px;
}
}
.export {
color: #5850ff;
border: 1px solid #5850ff;
}
}
::v-deep .el-dialog {
height: 100%;
margin-right: 0px;
margin-top: 0 !important;
// margin-bottom: 0 !important;
position: relative;
}
::v-deep .el-dialog__wrapper {
margin-right: -6px;
}
::v-deep .el-dialog__footer {
position: absolute;
bottom: 0px;
width: 100%;
}
::v-deep .el-button + .el-button {
margin-left: 20px;
margin-right: 30px;
}
::v-deep .el-input {
margin-top: -10px;
}
.scrm-sub-client-container {
.pageTitle {
position: relative;
margin-bottom: 20px;
height: 20px;
font-size: 20px;
font-weight: 700;
color: #333333;
line-height: 20px;
letter-spacing: 1px;
}
.pageContent {
.labelSet {
display: flex;
justify-content: space-between;
padding-top: 15px;
letter-spacing: 1px;
.labelSetLeft {
font-size: 20px;
font-weight: 600;
color: #333333;
line-height: 20px;
letter-spacing: 1px;
}
.labelSetLeftRight {
font-size: 14px;
font-weight: 400;
color: #333333;
line-height: 20px;
}
}
.choiceLabel {
display: flex;
justify-content: space-between;
letter-spacing: 1px;
padding: 15px 0px 0px 20px;
.choiceLabelLeft {
display: flex;
align-items: center;
font-size: 20px;
.addLabelStyle {
font-weight: 600;
}
.addTagsBtn {
height: 32px;
background: $btnBlue;
border-radius: 4px;
padding: 0 20px;
color: #fff;
font-size: 14px;
&:hover {
background-color: $lightBtnBlue;
}
}
}
.backBtn {
border-radius: 4px;
height: 32px;
font-size: 14px;
background: #fff;
border: 1px solid rgba(88, 80, 255, 1) !important;
color: $btnBlue;
padding: 0 20px;
border: none;
&:hover {
background-color: $lightBtnBlue;
}
}
}
.clientList {
margin-top: 15px;
font-size: 20px;
}
.glsx-table {
// min-width: 1250px;
/deep/ .el-table__fixed,
/deep/ .el-table__fixed-right {
height: 100% !important; //设置高优先,以覆盖内联样式
}
}
padding: 6px 20px 30px;
// min-width: 1300px;
background-color: #fff;
.el-button + .el-button {
margin-left: 10px;
}
}
.el-message--info {
height: 40px;
background: #e6e9ff;
border: 1px solid $btnBlue;
border-radius: 4px;
font-size: 14px;
color: rgba(0, 0, 0, 0.65);
}
.el-message .el-icon-info {
color: $btnBlue;
font-size: 16px;
}
}
.labelDialog {
overflow: hidden;
.labelCombination {
.iconLabels {
margin-top: 20px;
display: flex;
align-items: center;
img {
width: 16px;
height: 16px;
}
.iconLabelstext {
font-size: 14px;
font-weight: 600;
color: #333333;
}
}
.label-panle {
min-width: 300px;
height: calc(100% - 200px);
overflow-y: auto;
}
.iconLabelsName {
position: relative;
margin-left: 15px;
display: flex;
align-items: center;
height: 26px;
background: #f4f6fc;
border: 1px solid rgba(232, 232, 234, 1);
border-radius: 4px;
margin-top: 12px;
width: fit-content;
width: -webkit-fit-content;
width: -moz-fit-content;
padding: 0 12px 0 5px;
img {
width: 16px;
height: 16px;
}
.LabelsNameTxt {
max-width: 100%;
margin-left: 5px;
font-weight: 400;
font-size: 14px;
color: #666666;
text-align: right;
}
}
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!