Commit d5c88a07 by 杨明

fixed

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