Commit d5c88a07 by 杨明

fixed

1 parent 28911ba9
......@@ -80,6 +80,61 @@ const getLabelTreeList = params => {
returnAll: true
})
}
//查询分群列表树
const queryCrowdGroupTree = params => {
params.method = 'scrm.api.datahub.crowdgroup.queryCrowdGroupTree'
return http({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//创建分群
const addCrowdGroup = params => {
params.method = 'scrm.api.datahub.crowdgroup.addCrowdGroup'
return http({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//编辑分群
const editCrowdGroup = params => {
params.method = 'scrm.api.datahub.crowdgroup.editCrowdGroup'
return http({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//删除分群
const deleteCrowdGroup = params => {
params.method = 'scrm.api.datahub.crowdgroup.deleteCrowdGroup'
return http({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
//删除分群
const queryCrowdGroupDetailsByCrowdGroupId = params => {
params.method = 'scrm.api.datahub.crowdgroup.queryCrowdGroupDetailsByCrowdGroupId'
return http({
url: '/rop-scrm-datahub/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default {
getCrowdList,
......@@ -87,5 +142,10 @@ export default {
addCrowd,
getCrowdCount,
getSearchBox,
getLabelTreeList
getLabelTreeList,
queryCrowdGroupTree,
addCrowdGroup,
editCrowdGroup,
deleteCrowdGroup,
queryCrowdGroupDetailsByCrowdGroupId
}
......@@ -2,15 +2,16 @@
<div>
<el-dialog :title="dialogTitle" :visible.sync="groupVisible" width="50%" :before-close="handleClose">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="分群名称" prop="name" size="small">
<el-input v-model="ruleForm.name" placeholder="请输入分群名称"></el-input>
<el-form-item label="分群名称" prop="crowdGroupName" size="small">
<el-input v-model="ruleForm.crowdGroupName" placeholder="请输入分群名称" maxlength="30"></el-input>
</el-form-item>
<el-form-item label="分群描述" size="small">
<el-input v-model="ruleForm.remark" placeholder="请输入分群描述"></el-input>
<el-input v-model="ruleForm.crowdGroupDesc" placeholder="请输入分群描述" maxlength="100"></el-input>
</el-form-item>
<el-form-item label="概览是否展示" size="small">
<el-radio-group v-model="ruleForm.expand">
<!-- <el-form-item label="概览是否展示" size="small">
<el-radio-group v-model="ruleForm.isDisplay">
<el-radio label="1">是</el-radio>
<el-radio label="2">否</el-radio>
</el-radio-group>
</el-form-item>
......@@ -18,7 +19,7 @@
<el-select v-model="ruleForm.expandNum" placeholder="请选择">
<el-option v-for="item in 12" :key="item" :label="`${item}号展示位`" :value="item"></el-option>
</el-select>
</el-form-item>
</el-form-item> -->
<el-form-item label="选择人群" size="small">
<div class="group-tree-container">
<div class="group-tree-panel" :style="{ height: heightBox + 'px' }">
......@@ -51,6 +52,9 @@
</div>
</template>
</div>
<div class="el-form-item__error" v-show="crowdStatus">
请选择人群
</div>
<!-- <div class="group-tree-panel" :style="{ height: heightBox + 'px' }">
<el-tree @node-expand="nodeExpand" accordion :data="crowdUnitList" :props="defaultProps" show-checkbox></el-tree>
</div> -->
......@@ -74,15 +78,22 @@ export default {
rightSelectNum: 0,
leftSelectNum: 0,
groupVisible: false,
crowdStatus: false,
dialogTitle: '新建分群',
ruleForm: {
expand: '1'
},
ruleForm: {},
rules: {
name: [{ required: true, message: '请输入分群名称', trigger: 'blur' }]
crowdGroupName: [{ required: true, message: '请输入分群名称', trigger: 'blur' }]
},
crowdUnitList: [],
crowdUnitListChecked: []
crowdUnitListReset: []
}
},
watch: {
crowdUnitList: {
handler(val) {
this.crowdStatus = false
},
deep: true
}
},
props: {
......@@ -98,30 +109,34 @@ export default {
},
methods: {
async getCrowdList() {
const commonParam = { pageSize: 1000, pageNum: 1, merchantId: this.$globalState.session.merchantId }
const params1 = {
req: {
pageSize: 1000,
pageNum: 1,
merchantId: this.$globalState.session.merchantId,
crowdType: 1
crowdType: 1,
...commonParam
}
}
const params2 = {
req: {
pageSize: 1000,
pageNum: 1,
merchantId: this.$globalState.session.merchantId,
...commonParam,
crowdType: 2
}
}
const crowdUnitList1 = this.$apis.crowdManage.getCrowdList(params1)
const crowdUnitList2 = this.$apis.crowdManage.getCrowdList(params2)
const crowdUnitList = await Promise.all([crowdUnitList1, crowdUnitList2])
/*
groupArr: 勾选的人群
checked: 是否展开
isIndeterminateGroup:树节点选中
gruopCheckAll: 全选
selectGroup:右边树的选中数据
*/
this.crowdUnitList = [
{ crowdName: '推荐人群', children: crowdUnitList[0].data.crowdUnitList, groupArr: [], groupArr_right: [], checked: false, checked_right: false, isIndeterminateGroup: false, isIndeterminateGroup_right: false, gruopCheckAll: false, gruopCheckAll_right: false, selectGroup: [] },
{ crowdName: '自定义人群', children: crowdUnitList[1].data.crowdUnitList, groupArr: [], groupArr_right: [], checked: false, checked_right: false, isIndeterminateGroup: false, isIndeterminateGroup_right: false, gruopCheckAll: false, gruopCheckAll_right: false, selectGroup: [] }
]
this.crowdUnitListChecked = this.$common.utils.deepClone(this.crowdUnitList)
this.crowdUnitListReset = this.$common.utils.deepClone(this.crowdUnitList)
},
//判断是否选中
isChecked(crowd, item) {
......@@ -161,14 +176,99 @@ export default {
this.leftSelectNum = 0
})
},
handleSelect() {
this.$refs['ruleForm'].validate(valid => {
if (valid) {
let crowdArr = []
this.crowdUnitList.forEach(crowd => {
Object.assign(crowdArr, crowd.selectGroup)
})
if (crowdArr.length == 0) {
this.crowdStatus = true
return
}
const crowdIdList = []
crowdArr.forEach(arr => {
crowdIdList.push(arr.crowdId)
})
const params = {
req: {
merchantId: this.$globalState.session.merchantId,
crowdGroupType: 2,
crowdIdList
}
}
Object.assign(params.req, this.ruleForm)
let crowdGroup
if (this.ruleForm.crowdGroupId) {
crowdGroup = 'editCrowdGroup'
} else {
crowdGroup = 'addCrowdGroup'
}
this.$apis.crowdManage[crowdGroup](params).then(res => {
this.groupVisible = false
this.$parent.searchTable()
})
}
})
},
init(row) {
this.rightSelectNum = 0
this.leftSelectNum = 0
this.crowdUnitList = this.$common.utils.deepClone(this.crowdUnitListReset)
this.ruleForm = {
isDisplay: 2
}
if (row) {
this.ruleForm.crowdGroupId = row.crowdGroupId
this.dialogTitle = '编辑分群'
this.queryCrowdGroupDetailsByCrowdGroupId(row)
} else {
this.dialogTitle = '新建分群'
}
this.groupVisible = true
},
queryCrowdGroupDetailsByCrowdGroupId(row) {
const { crowdGroupName, crowdGroupDesc, crowdGroupId, crowdUnitList } = row
this.ruleForm = {
crowdGroupName,
crowdGroupDesc,
crowdGroupId
}
const arr1 = [],
arr2 = []
const crowdId1 = [],
crowdId2 = []
this.crowdUnitList[0].children.forEach(item => {
crowdId1.push(item.crowdId)
})
this.crowdUnitList[1].children.forEach(item => {
crowdId2.push(item.crowdId)
})
crowdUnitList.forEach(item => {
if (crowdId1.includes(item.crowdId)) {
arr1.push(item.crowdId)
}
if (crowdId2.includes(item.crowdId)) {
arr2.push(item.crowdId)
}
})
console.log(arr1, arr2)
this.setTreeChecked(arr1, arr2)
},
setTreeChecked(arr1, arr2) {
this.crowdUnitList[0].children.forEach(item => {
if (arr1.includes(item.crowdId)) {
this.crowdUnitList[0].selectGroup.push(item)
}
})
this.crowdUnitList[1].children.forEach(item => {
if (arr2.includes(item.crowdId)) {
this.crowdUnitList[1].selectGroup.push(item)
}
})
},
//左侧展开
handleExpand(index) {
this.crowdUnitList.forEach((item, idx) => {
......@@ -239,8 +339,7 @@ export default {
this.crowdUnitList[index].gruopCheckAll_right = checkedCount === this.crowdUnitList[index].selectGroup.length
this.crowdUnitList[index].isIndeterminateGroup_right = checkedCount > 0 && checkedCount < this.crowdUnitList[index].selectGroup.length
this.leftShow()
},
groupConfirmDialog() {}
}
}
}
</script>
......
......@@ -6,18 +6,18 @@
<div class="pageContent">
<GLCombiForm :formObj="searchForm" :formData="clientGroupFormList" @handleOk="searchTable" @handleRest="resetTable"></GLCombiForm>
<GLTable @setTableFinishFun="setTableFinishFun" v-if="isReload" ref="clientGroupManage" :hasNum="true" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn" :noDataImg="url" :pageConf="pageConf" :searchForm="searchFormTable" :tableParams="tableParams">
<div slot="groupInfo" slot-scope="scope">
<div slot="groupInfo" slot-scope="scope" v-if="scope.scope.crowdUnitList && scope.scope.crowdUnitList.length">
<div class="table-tr">
<div class="tabel-th">人群名称</div>
<div class="tabel-th">人群总人数</div>
<div class="tabel-th">已加企微人数</div>
<div class="tabel-th">未加企微人数</div>
</div>
<div class="table-tr" v-for="item in 4" :key="item">
<div class="tabel-td">1{{ scope.id }}</div>
<div class="tabel-td">2</div>
<div class="tabel-td">3</div>
<div class="tabel-td">4</div>
<div class="table-tr" v-for="item in scope.scope.crowdUnitList" :key="item">
<div class="tabel-td">{{ item.crowdName }}</div>
<div class="tabel-td">{{ item.total }}</div>
<div class="tabel-td">{{ item.wechatTotal }}</div>
<div class="tabel-td">{{ item.notWechatTotal }}</div>
</div>
</div>
<template slot="auth-button" slot-scope="scope" :data="scope.scope">
......@@ -54,7 +54,9 @@ export default {
isReload: true,
url: url,
sloading: false,
searchForm: {},
searchForm: {
keyword: ''
},
searchFormTable: {},
groupParams: {
listName: 'list',
......@@ -82,15 +84,15 @@ export default {
{
type: 'input',
inputType: 'text',
name: 'custGroupName',
name: 'keyword',
label: '分群名称',
placeholder: '请输入分群关键字'
}
],
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
pageConf: { pageSize: 'req.pageSize', pageNum: 'req.pageNum', totalCount: 'data.total' },
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'data',
listName: 'data.crowdGroupUnitList',
tableColumns: [
{
label: '',
......@@ -102,29 +104,29 @@ export default {
},
{
label: '分群名称',
prop: 'custGroupName',
prop: 'crowdGroupName',
line: 1
},
{
label: '分群总人数',
prop: 'allMembers'
prop: 'total'
},
{
label: '已加企微数',
prop: 'totalCount'
prop: 'wechatTotal'
},
{
label: '未加企微数',
prop: 'newCustomerCount'
},
{
label: '概览是否展示',
prop: 'delCustomerCount'
},
{
label: '展示位',
prop: 'staffs'
prop: 'notWechatTotal'
},
// {
// label: '概览是否展示',
// prop: 'delCustomerCount'
// },
// {
// label: '展示位',
// prop: 'staffs'
// },
{
label: '操作',
width: 180,
......@@ -142,7 +144,7 @@ export default {
// // ]
// }
},
getListApi: getTableList,
getListApi: this.$apis.crowdManage.queryCrowdGroupTree,
merchantModel: 1,
accountLevel: 0, //1,2,3,4工厂,省代,市代,门店
......@@ -166,11 +168,9 @@ export default {
type: 'warning'
})
.then(() => {
this.$apis.channel
.deleteChannelCode({
id: scope.id,
codeUuid: scope.codeUuid,
configId: scope.configId
this.$apis.crowdManage
.deleteCrowdGroup({
'req.crowdGroupId': scope.crowdGroupId
})
.then(res => {
if (res) {
......@@ -179,7 +179,7 @@ export default {
message: '删除成功!'
})
}
this.handleSearch()
this.searchTable()
})
})
.catch(() => {})
......@@ -211,12 +211,11 @@ export default {
this.$refs.clientGroupManage.refreshTable()
},
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
if (params.daterange) {
params.beginTime = this.searchForm.daterange[0]
params.endTime = this.searchForm.daterange[1]
} else {
if (params.beginTime) delete params.beginTime && delete params.endTime
var params = {
req: {
merchantId: this.$globalState.session.merchantId,
keyword: this.searchForm.keyword
}
}
console.log('params', params)
delete params.daterange
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!