Commit 84c8367c by 王志慧

commit

1 parent 990effd6
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</div> </div>
<img src="./assets/logo.png" alt="" srcset="" /> <img src="./assets/logo.png" alt="" srcset="" />
</div> --> </div> -->
<keep-alive exclude="clientDetail,clientGroupDetail,tagsManage,clientDataOverview,guestGroup,guestGroupAdd,guestGroupDetail,group,viewCustomers"> <keep-alive exclude="clientDetail,clientGroupDetail,tagsManage,clientDataOverview,guestGroup,guestGroupAdd,guestGroupDetail,group,viewCustomers,crowdDetail,crowdAdd,crowdManage">
<router-view></router-view> <router-view></router-view>
</keep-alive> </keep-alive>
</div> </div>
......
...@@ -6,17 +6,85 @@ ...@@ -6,17 +6,85 @@
* @param {*} params * @param {*} params
* @returns * @returns
*/ */
import { http3 } from '@/main' import {http, http3 } from '@/main'
// http 对应的域名http://ismv.branch.glsx.com.cn
// 查询推荐人群和自定义人群列表 // 查询推荐人群和自定义人群列表
export function getCrowdList(params) { const getCrowdList=(params)=> {
params.method = 'scrm.api.datahub.user.queryCrowdTree' params.method = 'scrm.api.datahub.user.queryCrowdTree'
return http3({ return http({
// url: '/rop-scrm-datahub/router', url: '/rop-scrm-datahub/router',
url:'http://192.168.3.181:9636/rop-scrm-datahub/router', // url:'http://192.168.3.181:9636/rop-scrm-datahub/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true, sign: true,
returnAll: true returnAll: true
}) })
}
\ No newline at end of file \ No newline at end of file
}
//通过人群Id查询人群详情
const getCrowdDetails=(params) =>{
params.method = 'scrm.api.datahub.user.queryCrowdDetailsById'
return http({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//创建人群
const addCrowd=(params) =>{
params.method = 'scrm.api.datahub.user.addCrowd'
return http({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//根据标签组合查询人群客户数
const getCrowdCount=(params) =>{
params.method = 'scrm.api.datahub.user.queryCrowdCountByTagCombine'
return http({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//搜索框查询
const getSearchBox=(params) =>{
params.method = 'scrm.api.datahub.labelgroup.querySearchBox'
return http({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//标签组树查询
const getLabelTreeList=(params) =>{
params.method = 'scrm.api.datahub.labelgroup.queryLabelGroupTree'
return http({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default {
getCrowdList,
getCrowdDetails,
addCrowd,
getCrowdCount,
getSearchBox,
getLabelTreeList
}
...@@ -17,9 +17,10 @@ export const fetchConfig = function (isEnv = true) { ...@@ -17,9 +17,10 @@ export const fetchConfig = function (isEnv = true) {
Object.assign(request, { timeout }) Object.assign(request, { timeout })
return Promise.resolve(cfg) return Promise.resolve(cfg)
} }
// https://oss-config.test.glsx.com.cn/mock/6136bea6ceeb5a5c2bec6950/base
// https://oss-config.test.glsx.com.cn/mock/616d3b131072f92988f05a01/custom/config // return new Http({request:{timeout:3000}}).get('https://oss-config.test.glsx.com.cn/mock/616d3b131072f92988f05a01/custom/config2')
return new Http({request:{timeout:3000}}).get('https://oss-config.test.glsx.com.cn/mock/616d3b131072f92988f05a01/custom/config2') //开发环境mock
return new Http({ request: { timeout: 3000 } }).get('http://192.168.3.171:7300/mock/616d3b131072f92988f05a01/custom/config2')
} }
export const config = { export const config = {
install(vue, cfg) { install(vue, cfg) {
......
...@@ -4,21 +4,21 @@ ...@@ -4,21 +4,21 @@
<div> <div>
<div class="title">创建人群</div> <div class="title">创建人群</div>
<div class="info-box"> <div class="info-box">
<el-form class="create-form" :model="groupForm" :rules="groupRules" ref="groupForm" label-width="118px"> <el-form class="create-form" :model="crowdForm" :rules="crowdRules" ref="crowdForm" label-width="118px">
<div class="el-form-line"> <div class="el-form-line">
<el-form-item label="人群名称:" prop="groupName"> <el-form-item label="人群名称:" prop="crowdName">
<el-input v-model.trim="groupForm.groupName" size="small" placeholder="请输入人群名称" maxlength="30"></el-input> <el-input v-model.trim="crowdForm.crowdName" size="small" placeholder="请输入人群名称" maxlength="60"></el-input>
</el-form-item> </el-form-item>
<span class="limited">最多30个字符</span> <span class="limited">最多30个字符</span>
</div> </div>
<div class="el-form-line"> <div class="el-form-line">
<el-form-item label="人群描述:" prop="groupNameRule"> <el-form-item label="人群描述:">
<el-input v-model.trim="groupForm.groupName" size="small" placeholder="请输入人群描述" maxlength="30"></el-input> <el-input v-model.trim="crowdForm.crowdDesc" size="small" placeholder="请输入人群描述" maxlength="60"></el-input>
</el-form-item> </el-form-item>
<span class="limited">最多30个字符</span> <span class="limited">最多30个字符</span>
</div> </div>
<div class="el-form-line"> <div class="el-form-line">
<el-form-item label="标签筛选:" prop="groupNameRule" class="label-word"> <el-form-item label="标签筛选:" class="label-word">
<div class="flex"> <div class="flex">
<div class="font-14 color-58 mr2 hand" @click="open('dialogRuleVisible')">人群规则说明</div> <div class="font-14 color-58 mr2 hand" @click="open('dialogRuleVisible')">人群规则说明</div>
<div class="font-14 color-58 hand" @click="open('dialogLogicVisible')">人群规则逻辑</div> <div class="font-14 color-58 hand" @click="open('dialogLogicVisible')">人群规则逻辑</div>
...@@ -32,21 +32,21 @@ ...@@ -32,21 +32,21 @@
<div class="select-label-wrap font-14 flex-start" id="tagBox"> <div class="select-label-wrap font-14 flex-start" id="tagBox">
<div class="select-label color-3">已选标签:</div> <div class="select-label color-3">已选标签:</div>
<div class="flex"> <div class="flex">
<div class="selects" v-for="(selectTag, index) in selectedArray" :key="index"> <div class="selects" v-for="(selectTag, index) in selectedArray" :key="index" @click="labelFilter(selectTag)">
<template v-if="selectTag.labelGroupName.name.length + selectTag.combination.length <= 20"> <template v-if="selectTag.groupName.length + selectTag.combination.length <= 20">
<div class="label-group-name color-3 hand" @click="labelFilter(selectTag)"> <div class="label-group-name color-3 hand">
<span class="color-9">{{ selectTag.labelGroupName.name }}:</span> <span class="color-9">{{ selectTag.groupName }}:</span>
{{ selectTag.combinationtext }} {{ selectTag.combinationtext }}
<i class="el-icon-close" @click.stop="closeTag(selectTag, index)"></i> <i class="el-icon-close" @click.stop="closeTag(selectTag, index)"></i>
</div> </div>
</template> </template>
<template v-else> <template v-else>
<el-tooltip placement="top"> <el-tooltip placement="top">
<div slot="content" class="tooltip-text">{{ selectTag.labelGroupName.name }}:{{ selectTag.combination }}</div> <div slot="content" class="tooltip-text">{{ selectTag.groupName }}:{{ selectTag.combination }}</div>
<div class="label-group-name color-3 hand" style="padding-right: 60px" @click="labelFilter(selectTag)"> <div class="label-group-name color-3 hand" style="padding-right: 60px">
<span class="color-9">{{ selectTag.labelGroupName.name }}:</span> <span class="color-9">{{ selectTag.groupName }}:</span>
{{ selectTag.combinationtext }} {{ selectTag.combinationtext }}
<div class="select-num">+{{ selectTag.children.length }}</div> <div class="select-num">+{{ selectTag.labelUnitList.length }}</div>
<i class="el-icon-close" @click.stop="closeTag(selectTag, index)"></i> <i class="el-icon-close" @click.stop="closeTag(selectTag, index)"></i>
</div> </div>
</el-tooltip> </el-tooltip>
...@@ -55,21 +55,30 @@ ...@@ -55,21 +55,30 @@
</div> </div>
</div> </div>
</template> </template>
<el-form :model="searchForm" size="small" :inline="true" @submit.native.prevent label-position="right" label-width="auto"> <el-form class="search-tag-form" :model="searchForm" size="small" filterable :inline="true" @submit.native.prevent label-position="right" label-width="auto">
<el-form-item label="标签组名称"> <el-form-item label="标签组名称">
<el-select v-model="searchForm.labelTypesStr" filterable placeholder="请选择"> <el-select v-model="searchForm.groupName" clearable filterable placeholder="请选择" @change="getLabelList" @clear="getLabelList">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option> <el-option v-for="item in groupArray" :key="item" :label="item" :value="item"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="标签名称"> <el-form-item label="标签名称">
<el-select v-model="searchForm.labelGroupName" filterable placeholder="请选择"> <el-select v-model="searchForm.labelName" clearable filterable placeholder="请选择">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option> <el-option v-for="item in labelArray" :key="item" :label="item" :value="item"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="resetTable" plain>重置</el-button> <el-button @click="resetTable" plain>重置</el-button>
<el-button type="primary" @click="searchTable">查询</el-button> <el-button type="primary" @click="searchTable">查询</el-button>
</el-form-item> </el-form-item>
<div class="color-3 font-14 forecast">
查看预估人数
<template v-if="crowdCount === ''">
<span class="color-58" @click="getCrowdCount">查看</span>
</template>
<template v-else>
<span class="color-58">{{ crowdCount }}</span>
</template>
</div>
</el-form> </el-form>
<div class="expande-button-wrap" v-if="isFixed"> <div class="expande-button-wrap" v-if="isFixed">
<div class="expande-button" @click="expandeClick" v-if="!expande && isDom"> <div class="expande-button" @click="expandeClick" v-if="!expande && isDom">
...@@ -83,16 +92,12 @@ ...@@ -83,16 +92,12 @@
</div> </div>
</div> </div>
<div class="pageContent"> <div class="pageContent">
<div class="color-3 font-14 forecast">查看预估人数<span class="color-58">刷新</span></div> <GLTable @setTableFinishFun="setTableFinishFun" v-if="isReload" ref="crowdManage" :hasNum="false" :tableTotal="tableTotal" :tableData="tableData" :searchForm="searchForm" :pageConf="pageConf" :noDataImg="url" @refreshTable="refreshTable" :tableParams="tableParams" :headerStyle="{ height: '54px', background: '#F4F6FC', color: '#333333', fontSize: '14px' }">
<GLTable @setTableFinishFun="setTableFinishFun" v-if="isReload" ref="tagsManage" :hasNum="false" :tableTotal="tableTotal" :tableData="tableData" :searchForm="searchForm" :pageConf="pageConf" :noDataImg="url" @refreshTable="refreshTable" :tableParams="tableParams" :headerStyle="{ height: '54px', background: '#F4F6FC', color: '#333333', fontSize: '14px' }"> <span slot="labelUnitList" slot-scope="scope">
<span slot="labelGroup" slot-scope="scope">
<span>{{ scope.scope.labelGroup.name }}</span>
</span>
<span slot="labelList" slot-scope="scope">
<div class="allTagsWrap flex"> <div class="allTagsWrap flex">
<template v-for="(item, index) in scope.scope.labelList"> <template v-for="(item, index) in scope.scope.labelUnitList">
<span :class="['label', 'color-3', 'white-hide', 'mt10', item.checked ? 'isChecked' : '']" :key="index" @click="selectTag(item, index)"> <span :class="['label', 'color-3', 'white-hide', 'mt10', item.checked ? 'isChecked' : '']" :key="index" @click="selectTag(item, index)">
{{ item.name }} {{ item.labelName }}
<template v-if="item.checked"> <template v-if="item.checked">
<img src="@/assets/clientDetail/select-icon.png" class="select-icon" alt /> <img src="@/assets/clientDetail/select-icon.png" class="select-icon" alt />
</template> </template>
...@@ -106,15 +111,11 @@ ...@@ -106,15 +111,11 @@
</div> </div>
</div> </div>
</div> </div>
<div <div class="footer-panel">
class="footer-panel" <div>
:style="{ <el-button type="primary" @click="handleSubmit">确定</el-button>
left: footerLeft + 'px', <el-button @click="handleCancel">取消</el-button>
width: footerWidth + 'px' </div>
}"
>
<el-button type="primary" @click="handleSubmit">确定</el-button>
<el-button @click="handleCancel">取消</el-button>
</div> </div>
<el-dialog title="人群规则说明" class="crowd-dialog" width="720px" :before-close="handleClose" :visible.sync="dialogRuleVisible" :show-close="isShowCloseBtn"> <el-dialog title="人群规则说明" class="crowd-dialog" width="720px" :before-close="handleClose" :visible.sync="dialogRuleVisible" :show-close="isShowCloseBtn">
<div class="crowd-dialog-wrap color-3"> <div class="crowd-dialog-wrap color-3">
...@@ -148,11 +149,11 @@ ...@@ -148,11 +149,11 @@
</div> </div>
<div class="crowd-logic-wrap" id="crowd-logic-wrap" :style="{ 'margin-left': this.selectedArray.length > 1 ? '20px' : '55px' }"> <div class="crowd-logic-wrap" id="crowd-logic-wrap" :style="{ 'margin-left': this.selectedArray.length > 1 ? '20px' : '55px' }">
<div class="crowd-logic-labels" v-for="(logicTag, index) in this.selectedArray" :key="index"> <div class="crowd-logic-labels" v-for="(logicTag, index) in this.selectedArray" :key="index">
<div class="crowd-logic-label-group-name font-14 color-3">{{ logicTag.labelGroupName.name }}:</div> <div class="crowd-logic-label-group-name font-14 color-3">{{ logicTag.groupName }}:</div>
<div class="flex"> <div class="flex">
<template v-for="(tag, id) in logicTag.children"> <template v-for="(tag, id) in logicTag.labelUnitList">
<div class="crowd-logic-tag color-6 font-14" :key="id">{{ tag.name }}</div> <div class="crowd-logic-tag color-6 font-14" :key="id">{{ tag.labelName }}</div>
<template v-if="id < logicTag.children.length - 1"> <template v-if="id < logicTag.labelUnitList.length - 1">
<div class="color-3 perhaps" :key="id">或</div> <div class="color-3 perhaps" :key="id">或</div>
</template> </template>
</template> </template>
...@@ -165,7 +166,6 @@ ...@@ -165,7 +166,6 @@
</template> </template>
<script> <script>
import { getTableList } from '@/api/modules/tagsManage'
export default { export default {
name: 'crowdAdd', name: 'crowdAdd',
data() { data() {
...@@ -180,65 +180,45 @@ export default { ...@@ -180,65 +180,45 @@ export default {
isReload: true, isReload: true,
dialogRuleVisible: false, dialogRuleVisible: false,
dialogLogicVisible: false, dialogLogicVisible: false,
groupForm: { crowdForm: {
groupName: '' crowdName: '',
crowdDesc: ''
}, },
groupRules: { crowdRules: {
groupName: [{ required: true, message: '请输入人群名称', trigger: 'blur' }] crowdName: [{ required: true, message: '请输入人群名称', trigger: 'blur' }]
},
searchForm: {
groupName: '',
labelName: ''
},
groupArray: [], //标签组列表
labelArray: [], //标签列表
crowdCount: '', //预估人数
page: {
'req.pageSize': 10,
'req.pageNum': 1
}, },
searchForm: {},
tagsPartFormList: [
{
type: 'select',
prop: 'labelTreeReq.labelTypesStr',
label: '标签组',
placeholder: '请选择标签组类型',
options: [
{
label: '企业标签',
value: '企业标签'
},
{
label: '自店标签',
value: '自店标签'
},
{
label: '系统标签',
value: '系统标签'
}
]
},
{
type: 'input',
inputType: 'text',
prop: 'labelTreeReq.labelGroupName',
label: '搜索',
placeholder: '请输入标签名称',
clearable: true
}
],
page: {},
tableTotal: '', tableTotal: '',
pageConf: { pageSize: 'labelTreeReq.pageSize', pageNum: 'labelTreeReq.pageNum', totalCount: 'labelGroupCount' }, pageConf: { pageSize: 'req.pageSize', pageNum: 'req.pageNum' },
tableParams: { tableParams: {
listName: 'labelTreeRets',
tableColumns: [ tableColumns: [
{ {
label: '标签组', label: '标签组',
prop: 'labelGroup', prop: 'groupName',
addHtml: 'labelGroup', width: 180,
width: 180 align: ''
}, },
{ {
label: '标签组类型', label: '标签组类型',
prop: 'labelType', prop: 'groupType',
width: 180 width: 180,
//align: 'left'
}, },
{ {
label: '标签', label: '标签',
prop: 'labelList', prop: 'labelUnitList',
addHtml: 'labelList', addHtml: 'labelUnitList',
align: 'center' //align: 'left'
} }
] ]
}, },
...@@ -249,38 +229,39 @@ export default { ...@@ -249,38 +229,39 @@ export default {
if (window.__POWERED_BY_QIANKUN__) { if (window.__POWERED_BY_QIANKUN__) {
//运行在qiankun容器中 //运行在qiankun容器中
this.merchantId = this.$globalState.session.merchantId this.merchantId = this.$globalState.session.merchantId
this.merchantModel = this.$globalState.session.merchantModel
this.accountLevel = this.$globalState.session.accountLevel
this.userType = this.$globalState.session.userType
} }
this.searchForm = { 'labelTreeReq.shopId': this.merchantId, 'labelTreeReq.edition': 2 } //获取标签组列表
this.page[this.pageConf.pageNum] = 1 this.getGroupList()
this.page[this.pageConf.pageSize] = 10 //获取标签列表
this.getLabelList()
//获取标签数据 //获取标签数据
this.getLabelData() this.getLabelData()
}, },
watch: { watch: {
selectedArray: function () { selectedArray: function () {
this.$nextTick(() => { this.crowdCount = '' //初始化查看预估人数
//条件重置 if (this.selectedArray.length > 0) {
document.getElementById('tagBox').style.height = 'auto' this.$nextTick(() => {
if (!this.isFixed) { //条件重置
//判断是否可以触发 document.getElementById('tagBox').style.height = 'auto'
this.isClick = false if (!this.isFixed) {
this.expande = false //判断是否可以触发
} this.isClick = false
if (!this.isClick || !this.isFixed) { this.expande = false
//获取当前元素的高
let height = document.getElementById('tagBox').offsetHeight
if (height > 127) {
document.getElementById('tagBox').style.height = 128 + 'px'
this.isDom = true
} else {
document.getElementById('tagBox').style.height = 'auto'
this.isDom = false
} }
} if (!this.isClick || !this.isFixed) {
}) //获取当前元素的高
let height = document.getElementById('tagBox').offsetHeight
if (height > 127) {
document.getElementById('tagBox').style.height = 128 + 'px'
this.isDom = true
} else {
document.getElementById('tagBox').style.height = 'auto'
this.isDom = false
}
}
})
}
} }
}, },
mounted() { mounted() {
...@@ -288,13 +269,102 @@ export default { ...@@ -288,13 +269,102 @@ export default {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.boxHeight = clientHeight - 200 this.boxHeight = clientHeight - 200
//初始化数据
window.addEventListener('scroll', this.initHeight, true) window.addEventListener('scroll', this.initHeight, true)
this.$nextTick(() => { this.$nextTick(() => {
this.offsetTop = document.querySelector('#boxFixed').offsetTop this.offsetTop = document.querySelector('#boxFixed').offsetTop
}) })
}, },
methods: { methods: {
getGroupList() {
let params = {
'req.merchantId': this.merchantId,
'req.searchBoxType': 1 //搜索框类型 1-标签组搜索框 2-标签搜索框
}
this.$apis.crowdManage.getSearchBox(params).then(res => {
if (res.code == 0) {
this.groupArray = res.data.resultList
}
})
},
getLabelList() {
let params = {
'req.merchantId': this.merchantId,
'req.searchBoxType': 2, //搜索框类型 1-标签组搜索框 2-标签搜索框
'req.groupName': this.searchForm.groupName
}
this.$apis.crowdManage.getSearchBox(params).then(res => {
if (res.code == 0) {
this.labelArray = res.data.resultList
this.searchForm.labelName = ''
}
})
},
handleParameters() {
let tagCombine = []
this.selectedArray.forEach(label => {
tagCombine.push({
groupId: label.groupId,
labelIdList: label.labelIdList
})
})
return tagCombine
},
//创建人群
handleSubmit() {
this.$refs.crowdForm.validate(valid => {
if (valid) {
let tagCombine = this.handleParameters()
if (tagCombine.length == 0) {
this.$message.error('必须选择一个标签')
return
}
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.$router.push('/crowdManage/index')
} else {
this.$message({
type: 'error',
message: '操作失败'
})
}
})
.catch(err => {
this.$message({
type: 'error',
message: err.message
})
})
}
})
},
//根据标签组合查询人群客户数
getCrowdCount() {
if (this.selectedArray.length > 0) {
let params = {
'req.merchantId': this.merchantId,
'req.tagCombine': JSON.stringify(this.handleParameters())
}
this.$apis.crowdManage.getCrowdCount(params).then(res => {
if (res.code == 0) {
this.crowdCount = res.data.total
}
})
}
},
delayScrollFunc(fn, delay) { delayScrollFunc(fn, delay) {
const now = new Date().getTime() const now = new Date().getTime()
if (now - this.lastScrollCall < delay) return if (now - this.lastScrollCall < delay) return
...@@ -305,6 +375,15 @@ export default { ...@@ -305,6 +375,15 @@ export default {
}, 60) // 在实际项目中,我发现这里再延迟一点时间执行效果更好(针对监听scroll) }, 60) // 在实际项目中,我发现这里再延迟一点时间执行效果更好(针对监听scroll)
}, },
open(value) { open(value) {
if (value == 'dialogLogicVisible' && this.selectedArray.length == 0) {
this.$confirm('当前有内容信息未保存,是否继续返回?', '提示', {
confirmButtonText: '确定',
type: 'warning'
})
.then(() => {})
.catch(() => {})
return
}
this[value] = true this[value] = true
if (this.dialogLogicVisible == true && this.selectedArray.length > 1) { if (this.dialogLogicVisible == true && this.selectedArray.length > 1) {
this.$nextTick(() => { this.$nextTick(() => {
...@@ -339,24 +418,35 @@ export default { ...@@ -339,24 +418,35 @@ export default {
} }
}, },
initHeight() { initHeight() {
var scrollTop = document.querySelector('#container').scrollTop var timeOut = null
this.isFixed = scrollTop > this.offsetTop ? true : false if (timeOut) {
clearTimeout(timeOut)
}
timeOut = setTimeout(() => {
var scrollTop = document.querySelector('#container').scrollTop
this.isFixed = scrollTop > this.offsetTop ? true : false
console.log(this.isFixed)
}, 200)
}, },
//获取标签数据 //获取标签数据
getLabelData() { getLabelData() {
let params = { let params = {
...this.searchForm, 'req.merchantId': this.merchantId,
'req.groupName': this.searchForm.groupName,
'req.labelName': this.searchForm.labelName,
...this.page ...this.page
} }
getTableList(params).then(res => { this.$apis.crowdManage.getLabelTreeList(params).then(res => {
res.labelTreeRets.forEach(item => { if (res.code == 0) {
item.labelList.forEach(label => { res.data.groupUnitList.forEach(item => {
label.checked = false item.labelUnitList.forEach(label => {
label.checked = false
})
}) })
}) this.tableData = res.data.groupUnitList
this.tableData = res.labelTreeRets this.tableTotal = res.data.total
this.tableTotal = res.labelGroupCount this.getHistoryLabel()
this.getHistoryLabel() }
}) })
}, },
//已选择标签状态保存 //已选择标签状态保存
...@@ -364,14 +454,14 @@ export default { ...@@ -364,14 +454,14 @@ export default {
let selectId = [] let selectId = []
if (this.selectedArray.length > 0) { if (this.selectedArray.length > 0) {
for (let i = 0; i < this.selectedArray.length; i++) { for (let i = 0; i < this.selectedArray.length; i++) {
for (let k = 0; k < this.selectedArray[i].children.length; k++) { for (let k = 0; k < this.selectedArray[i].labelUnitList.length; k++) {
selectId.push(this.selectedArray[i].children[k].id) selectId.push(this.selectedArray[i].labelUnitList[k].labelId)
} }
} }
for (let m = 0; m < this.tableData.length; m++) { for (let m = 0; m < this.tableData.length; m++) {
for (let n = 0; n < this.tableData[m].labelList.length; n++) { for (let n = 0; n < this.tableData[m].labelUnitList.length; n++) {
if (selectId.indexOf(this.tableData[m].labelList[n].id) != -1) { if (selectId.indexOf(this.tableData[m].labelUnitList[n].labelId) != -1) {
this.tableData[m].labelList[n].checked = true this.tableData[m].labelUnitList[n].checked = true
} }
} }
} }
...@@ -380,8 +470,8 @@ export default { ...@@ -380,8 +470,8 @@ export default {
//选择标签 //选择标签
selectTag(data) { selectTag(data) {
this.tableData.forEach(item => { this.tableData.forEach(item => {
item.labelList.forEach(label => { item.labelUnitList.forEach(label => {
if (label.id == data.id) { if (label.labelId == data.labelId) {
label.checked = !label.checked label.checked = !label.checked
this.selectedLabelFn(item, data) this.selectedLabelFn(item, data)
} }
...@@ -392,28 +482,30 @@ export default { ...@@ -392,28 +482,30 @@ export default {
selectedLabelFn(groupData, data) { selectedLabelFn(groupData, data) {
if (this.selectedArray.length > 0) { if (this.selectedArray.length > 0) {
for (let i = 0; i < this.selectedArray.length; i++) { for (let i = 0; i < this.selectedArray.length; i++) {
if (this.selectedArray[i].labelGroupName.name == groupData.labelGroup.name) { if (this.selectedArray[i].groupId == groupData.groupId) {
if (data.checked) { if (data.checked) {
this.selectedArray[i].children.push(data) this.selectedArray[i].labelUnitList.push(data)
} else { } else {
for (let k = 0; k < this.selectedArray[i].children.length; k++) { for (let k = 0; k < this.selectedArray[i].labelUnitList.length; k++) {
if (this.selectedArray[i].children[k].id == data.id) { if (this.selectedArray[i].labelUnitList[k].labelId == data.labelId) {
this.selectedArray[i].children.splice(k--, 1) this.selectedArray[i].labelUnitList.splice(k--, 1)
} }
} }
} }
} }
} }
if (!this.selectedArray.some(tag => tag.labelGroupName.name == groupData.labelGroup.name)) { if (!this.selectedArray.some(tag => tag.groupId == groupData.groupId)) {
this.selectedArray.push({ this.selectedArray.push({
labelGroupName: groupData.labelGroup, groupId: groupData.groupId,
children: [data] groupName: groupData.groupName,
labelUnitList: [data]
}) })
} }
} else { } else {
this.selectedArray.push({ this.selectedArray.push({
labelGroupName: groupData.labelGroup, groupId: groupData.groupId,
children: [data] groupName: groupData.groupName,
labelUnitList: [data]
}) })
} }
...@@ -423,15 +515,21 @@ export default { ...@@ -423,15 +515,21 @@ export default {
handleLabel() { handleLabel() {
for (let i = 0; i < this.selectedArray.length; i++) { for (let i = 0; i < this.selectedArray.length; i++) {
let array = [] let array = []
if (this.selectedArray[i].children.length == 0) { let idArray = []
if (this.selectedArray[i].labelUnitList.length == 0) {
this.selectedArray.splice(i--, 1) this.selectedArray.splice(i--, 1)
} }
for (let j = 0; j < this.selectedArray[i].children.length; j++) { for (let j = 0; j < this.selectedArray[i].labelUnitList.length; j++) {
array.push(this.selectedArray[i].children[j].name) array.push(this.selectedArray[i].labelUnitList[j].labelName)
idArray.push(this.selectedArray[i].labelUnitList[j].labelId)
} }
this.selectedArray[i].labelIdList = idArray
this.selectedArray[i].combination = array.join('、') this.selectedArray[i].combination = array.join('、')
let length = 20 - this.selectedArray[i].labelGroupName.name.length console.log(this.checkName(this.selectedArray[i].groupName))
this.selectedArray[i].combinationtext = this.selectedArray[i].combination.substring(0, length) let length = 40 - this.checkName(this.selectedArray[i].groupName)
console.log(length)
this.selectedArray[i].combinationtext = this.cutMaxCharStr(this.selectedArray[i].combination, length)
console.log(this.selectedArray[i].combinationtext)
this.$set(this.selectedArray, i, this.selectedArray[i]) this.$set(this.selectedArray, i, this.selectedArray[i])
} }
}, },
...@@ -439,8 +537,8 @@ export default { ...@@ -439,8 +537,8 @@ export default {
closeTag(data, index) { closeTag(data, index) {
this.selectedArray.splice(index, 1) this.selectedArray.splice(index, 1)
this.tableData.forEach(t => { this.tableData.forEach(t => {
if (t.labelGroup.id == data.labelGroupName.id) { if (t.groupId == data.groupId) {
t.labelList.forEach(m => { t.labelUnitList.forEach(m => {
m.checked = false m.checked = false
}) })
} }
...@@ -456,20 +554,87 @@ export default { ...@@ -456,20 +554,87 @@ export default {
this.isDom = false this.isDom = false
} }
}, },
//标签组搜索 //点击标签组搜索
labelFilter(data) {}, labelFilter(data) {
//搜索表格 this.searchForm.groupName = data.groupName
this.searchForm.labelName = ''
//获取标签列表
this.getLabelList()
this.getLabelData()
},
//标签查询
searchTable() { searchTable() {
this.$refs.tagsManage.refreshTable() this.getLabelData()
}, },
//重置表格 //重置表格
resetTable() { resetTable() {
// this.isReload = false this.searchForm = {
this.searchForm = { 'labelTreeReq.shopId': this.merchantId, 'labelTreeReq.edition': this.merchantModel } groupName: '',
this.$refs.tagsManage.refreshTable() labelName: ''
// this.$nextTick(() => { }
// this.isReload = true this.page = {
// }) 'req.pageSize': 10,
'req.pageNum': 1
}
this.$refs.crowdManage.page[this.pageConf.pageSize] = 10
this.$refs.crowdManage.page[this.pageConf.pageNum] = 1
this.getLabelData()
},
handleCancel() {
this.$router.push('/crowdManage/index')
},
checkName(value) {
// 一个汉字2个字符,字母数字1个字符
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
}
}
return len
},
cutMaxCharStr: function (e, unit) {
//e为传入字符串
let str = e
var len = 0
var singleNum = 0
var doubleNum = 0
for (var i = 0; i < e.length; i++) {
var c = e.charCodeAt(i)
//单字节加1
if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) {
len++
} else {
len += 2
}
}
if (len > unit) {
var subLen = 0
var subLen1 = 0
var subLen2 = 0
for (var v = 0; v < e.length; v++) {
var ch = e.charCodeAt(v)
//单字节
if ((ch >= 0x0001 && ch <= 0x007e) || (0xff60 <= ch && ch <= 0xff9f)) {
singleNum += 1
subLen1++
} else {
doubleNum += 2
subLen2++
}
if (singleNum + doubleNum >= unit) {
subLen = subLen1 + subLen2
break
}
}
return str.substr(0, subLen)
}
return str
} }
}, },
destroyed() { destroyed() {
...@@ -570,6 +735,9 @@ export default { ...@@ -570,6 +735,9 @@ export default {
.is_auto { .is_auto {
height: auto !important; height: auto !important;
} }
.search-tag-form {
position: relative;
}
.select-label-wrap { .select-label-wrap {
margin-bottom: 20px; margin-bottom: 20px;
overflow: hidden; overflow: hidden;
...@@ -629,16 +797,15 @@ export default { ...@@ -629,16 +797,15 @@ export default {
padding: 0 0 2px 0; padding: 0 0 2px 0;
} }
.pageContent { .pageContent {
position:relative;
padding: 0 30px; padding: 0 30px;
} }
.forecast{ .forecast {
position: absolute; position: absolute;
right:40px; right: 40px;
top:-56px; top: 0;
line-height: 36px; line-height: 36px;
span{ span {
margin-left:4px; margin-left: 4px;
cursor: pointer; cursor: pointer;
} }
} }
...@@ -694,15 +861,23 @@ export default { ...@@ -694,15 +861,23 @@ export default {
} }
.footer-panel { .footer-panel {
display: flex; // display: flex;
align-items: center; // align-items: center;
justify-content: center; // justify-content: center;
position: fixed; position: fixed;
bottom: 0px; bottom: 0px;
height: 64px; height: 64px;
left: 220px;
width: 100%; width: 100%;
background: #ffffff; background: #ffffff;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1); box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
div{
width:150px;
position: absolute;
// transform: translate(-50%,-50%);
left:50%;
// top:50%;
}
} }
.label-text { .label-text {
margin-left: 10px; margin-left: 10px;
......
...@@ -2,17 +2,17 @@ ...@@ -2,17 +2,17 @@
<div class="scrm-sub-client-container"> <div class="scrm-sub-client-container">
<div class="container"> <div class="container">
<div> <div>
<div class="title">创建人群</div> <div class="title">人群详情</div>
<div class="info-box"> <div class="info-box">
<el-form class="create-form" :model="groupForm" :rules="groupRules" ref="groupForm" label-width="118px"> <el-form class="create-form" :model="crowdForm" :rules="crowdRules" label-width="118px">
<div class="el-form-line"> <div class="el-form-line">
<el-form-item label="人群名称:" prop="groupName" class="label-word"> <el-form-item label="人群名称:" prop="crowdName" class="label-word">
<div class="color-3">年龄为2—40岁,奥迪3系、奔驰4系,2</div> <div class="color-3">{{ crowdForm.crowdName }}</div>
</el-form-item> </el-form-item>
</div> </div>
<div class="el-form-line"> <div class="el-form-line">
<el-form-item label="人群描述:" prop="groupNameRule" class="label-word"> <el-form-item label="人群描述:" prop="groupNameRule" class="label-word">
<div class="color-3">人群描述</div> <div class="color-3">{{ crowdForm.crowdDesc }}</div>
</el-form-item> </el-form-item>
</div> </div>
<div class="el-form-line"> <div class="el-form-line">
...@@ -26,15 +26,12 @@ ...@@ -26,15 +26,12 @@
<div class="el-form-line"> <div class="el-form-line">
<el-form-item label="已选标签:" prop="groupNameRule" class="label-word"> <el-form-item label="已选标签:" prop="groupNameRule" class="label-word">
<div class="pageContent"> <div class="pageContent">
<GLTable :tableTotal="tableTotal" :tableData="tableData" :hasNum="hasNum" :hasPage="hasPage" :tableParams="tableParams" :headerStyle="{ height: '54px', background: '#F4F6FC', color: '#333333', fontSize: '14px' }"> <GLTable :tableData="selectedArray" :hasNum="hasNum" :hasPage="hasPage" :tableParams="tableParams" :headerStyle="{ height: '54px', background: '#F4F6FC', color: '#333333', fontSize: '14px' }">
<span slot="labelGroup" slot-scope="scope"> <span slot="labelUnitList" slot-scope="scope">
<span>{{ scope.scope.labelGroup.name }}</span>
</span>
<span slot="labelList" slot-scope="scope">
<div class="allTagsWrap flex"> <div class="allTagsWrap flex">
<template v-for="(item, index) in scope.scope.labelList"> <template v-for="(item, index) in scope.scope.labelUnitList">
<span :class="['label', 'color-6', 'white-hide', 'mt10']" :key="index"> <span :class="['label', 'color-6', 'white-hide', 'mt10']" :key="index">
{{ item.name }} {{ item.labelName }}
</span> </span>
</template> </template>
</div> </div>
...@@ -79,11 +76,11 @@ ...@@ -79,11 +76,11 @@
</div> </div>
<div class="crowd-logic-wrap" id="crowd-logic-wrap" :style="{ 'margin-left': this.selectedArray.length > 1 ? '20px' : '55px' }"> <div class="crowd-logic-wrap" id="crowd-logic-wrap" :style="{ 'margin-left': this.selectedArray.length > 1 ? '20px' : '55px' }">
<div class="crowd-logic-labels" v-for="(logicTag, index) in this.selectedArray" :key="index"> <div class="crowd-logic-labels" v-for="(logicTag, index) in this.selectedArray" :key="index">
<div class="crowd-logic-label-group-name font-14 color-3">{{ logicTag.labelGroupName.name }}:</div> <div class="crowd-logic-label-group-name font-14 color-3">{{ logicTag.groupName }}:</div>
<div class="flex"> <div class="flex">
<template v-for="(tag, id) in logicTag.children"> <template v-for="(tag, id) in logicTag.labelUnitList">
<div class="crowd-logic-tag color-6 font-14" :key="id">{{ tag.name }}</div> <div class="crowd-logic-tag color-6 font-14" :key="id">{{ tag.labelName }}</div>
<template v-if="id < logicTag.children.length - 1"> <template v-if="id < logicTag.labelUnitList.length - 1">
<div class="color-3 perhaps" :key="id">或</div> <div class="color-3 perhaps" :key="id">或</div>
</template> </template>
</template> </template>
...@@ -96,77 +93,71 @@ ...@@ -96,77 +93,71 @@
</template> </template>
<script> <script>
import { getTableList } from '@/api/modules/tagsManage'
export default { export default {
name: 'crowdDetail', name: 'crowdDetail',
data() { data() {
return { return {
groupForm: { crowdForm: {
groupName: '' crowdName: '',
crowdDesc: ''
}, },
pageConf: { pageSize: 'labelTreeReq.pageSize', pageNum: 'labelTreeReq.pageNum', totalCount: 'labelGroupCount' }, crowdId: this.$route.params.id ? this.$route.params.id : '',
tableTotal: '', tableTotal: '',
isShowCloseBtn: true, isShowCloseBtn: true,
dialogRuleVisible: false,
dialogLogicVisible: false,
tableData: [], tableData: [],
hasPage: false, hasPage: false,
hasNum: false, hasNum: false,
page: {}, page: {},
tableParams: { tableParams: {
listName: 'labelTreeRets',
tableColumns: [ tableColumns: [
{ {
label: '标签组', label: '标签组',
prop: 'labelGroup', prop: 'groupName',
addHtml: 'labelGroup', width: 180,
width: 180 //align: 'left'
}, },
{ {
label: '标签组类型', label: '标签组类型',
prop: 'labelType', prop: 'groupType',
width: 180 width: 180,
//align: 'left'
}, },
{ {
label: '标签', label: '标签',
prop: 'labelList', prop: 'labelUnitList',
addHtml: 'labelList', addHtml: 'labelUnitList',
align: 'center' //align: 'left'
} }
] ]
}, },
crowdRules: {
crowdName: [{ required: true }]
},
selectedArray: [] selectedArray: []
} }
}, },
created() { created() {
if (window.__POWERED_BY_QIANKUN__) { console.log('this.$route.params.id', this.$route.params.id)
//运行在qiankun容器中 // 通过人群Id查询人群详情
this.merchantId = this.$globalState.session.merchantId this.getCrowdDetails()
this.merchantModel = this.$globalState.session.merchantModel
this.accountLevel = this.$globalState.session.accountLevel
this.userType = this.$globalState.session.userType
}
this.searchForm = { 'labelTreeReq.shopId': this.merchantId, 'labelTreeReq.edition': 2 }
this.page[this.pageConf.pageNum] = 1
this.page[this.pageConf.pageSize] = 10
//获取标签数据
this.getLabelData()
console.log(4444444444444444444444)
}, },
mounted() {}, mounted() {},
methods: { methods: {
//获取标签数据 //获取标签数据
getLabelData() { getCrowdDetails() {
console.log(333333333333)
let params = { let params = {
...this.searchForm, 'req.crowdId': this.crowdId
...this.page
} }
getTableList(params).then(res => { this.$apis.crowdManage.getCrowdDetails(params).then(res => {
res.labelTreeRets.forEach(item => { console.log(res.code, res)
item.labelList.forEach(label => { if (res.code == 0) {
label.checked = false this.crowdForm.crowdName = res.data.crowdName
}) this.crowdForm.crowdDesc = res.data.crowdDesc
}) console.log(JSON.parse(res.data.tagCombine))
this.tableData = res.labelTreeRets this.selectedArray = res.data.tagCombine ? JSON.parse(res.data.tagCombine) : []
}
}) })
}, },
handleClose() { handleClose() {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<el-tabs v-model="activeName" @tab-click="handleClick()"> <el-tabs v-model="activeName" @tab-click="handleClick()">
<el-tab-pane label="推荐人群" name="first"></el-tab-pane> <el-tab-pane label="推荐人群" name="first"></el-tab-pane>
<el-tab-pane label="自定义人群" name="second"> <el-tab-pane label="自定义人群" name="second">
<GLButton class="addBtn" fn="新建人群" @click="addClick">+ 新建人群</GLButton> <GLButton class="addBtn" fn="新建人群" v-if="!admin" @click="addClick">+ 新建人群</GLButton>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<div class="pageContent"> <div class="pageContent">
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
</template> </template>
<script> <script>
import { getCrowdList } from '@/api/modules/crowdManage'
import url from '@/assets/clientDataOverview/nodata.png' import url from '@/assets/clientDataOverview/nodata.png'
export default { export default {
name: 'crowdManage', name: 'crowdManage',
...@@ -57,31 +56,31 @@ export default { ...@@ -57,31 +56,31 @@ export default {
label: '人群名称', label: '人群名称',
prop: 'crowdName', prop: 'crowdName',
// addHtml: 'crowdName', // addHtml: 'crowdName',
align: 'left' //align: 'left'
}, },
{ {
label: '人群描述', label: '人群描述',
prop: 'crowdDesc', prop: 'crowdDesc',
align: 'left' //align: 'left'
// width: 180 // width: 180
}, },
{ {
label: '人数', label: '人数',
prop: 'total', prop: 'total',
// addHtml: 'total', // addHtml: 'total',
align: 'left' //align: 'left'
}, },
{ {
label: '操作', label: '操作',
prop: 'xxx', prop: 'xxx',
fixed: 'right', fixed: 'right',
addHtml: 'xxx', addHtml: 'xxx',
align: 'left', //align: 'left',
width: 180 width: 180
} }
] ]
}, },
getListApi: getCrowdList, getListApi: this.$apis.crowdManage.getCrowdList,
expande: true, expande: true,
needShowExpande: false needShowExpande: false
} }
...@@ -91,7 +90,7 @@ export default { ...@@ -91,7 +90,7 @@ export default {
if (window.__POWERED_BY_QIANKUN__) { if (window.__POWERED_BY_QIANKUN__) {
//运行在qiankun容器中 //运行在qiankun容器中
this.merchantId = this.$globalState.session.merchantId this.merchantId = this.$globalState.session.merchantId
// this.accountLevel = this.$globalState.session.accountLevel this.admin = this.$globalState.session.admin
this.userType = this.$globalState.session.userType this.userType = this.$globalState.session.userType
} }
this.searchForm = { 'req.merchantId': this.merchantId, 'req.crowdType': this.crowdType } this.searchForm = { 'req.merchantId': this.merchantId, 'req.crowdType': this.crowdType }
......
...@@ -199,33 +199,33 @@ export default { ...@@ -199,33 +199,33 @@ export default {
label: '客户', label: '客户',
prop: 'customerName', prop: 'customerName',
addHtml: 'customerName', addHtml: 'customerName',
align: 'left' //align: 'left'
// width: 200 // width: 200
}, },
{ {
label: '创建时间', label: '创建时间',
prop: 'createdTime', prop: 'createdTime',
align: 'left' //align: 'left'
// width: 200 // width: 200
}, },
{ {
label: '现群名称', label: '现群名称',
prop: 'chatName', prop: 'chatName',
align: 'left' //align: 'left'
}, },
{ {
label: '现群主', label: '现群主',
prop: 'createdBy', prop: 'createdBy',
// minWidth: '180px', // minWidth: '180px',
addHtml: 'groupOwner', addHtml: 'groupOwner',
align: 'left' //align: 'left'
}, },
{ {
label: '状态', label: '状态',
prop: 'status', prop: 'status',
addHtml: 'status', addHtml: 'status',
// width: 250, // width: 250,
align: 'left' //align: 'left'
} }
] ]
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!