Commit 33c78aa0 by 张立顺

解决合并冲突

2 parents 4bfdebb3 850fb81d
{
"name": "scrm-micro-activity-center",
"name": "activityCenter",
"version": "1.0.0",
"description": "A Vue.js project",
"private": true,
......
......@@ -54,16 +54,16 @@ const getStaffList = params => {
sign: true
})
}
// 企微高级群聊列表
const getGroupList = params => {
params.method = `entmicro.api.wechatcloudcontrol.batchmessaging.group.list`
return http({
url: url1,
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// const insertZoneApi = params => {
// params.method = `${defaultPath}zoneInfo.insertOrUpdate`
// return http({
// url,
// method: 'POST',
// data: params,
// sign: true,
// returnAll: true
// })
// }
export default { getStaffList, getMerchantList, getlistDepartmentTree, getActivitylist, insertStaff }
export default { getStaffList, getMerchantList, getlistDepartmentTree, getActivitylist, insertStaff, getGroupList }
......@@ -19,12 +19,8 @@ export const fetchConfig = function(isEnv = true) {
// return Promise.resolve(cfg)
// }
//return window.fetch('https://', {}).then(res => res.json())
// request({ url: 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config/oss_commodity_center', method: 'get' })
// return new Http().get('https://oss-config.glsx.com.cn/mock/635fc7a254298ae78614407a/battles/config')
// debugger
// debugger
// console.log(new Http().get('http://192.168.3.171:7300/mock/6345096902322627d6b83e83/battles/config'))
return new Http().get('http://192.168.3.171:7300/mock/6345096902322627d6b83e83/battles/config')
// return new Http().get('https://oss-config.dev.glsx.com.cn/mock/6345096902322627d6b83e83/battles/config')
return new Http().get('https://oss-config.glsx.com.cn/mock/635fc7a254298ae78614407a/battles/config')
}
export const config = {
install(vue, cfg) {
......
......@@ -11,9 +11,10 @@ let router = null
let instance = null
Vue.use(ElementUI)
Vue.use(GLTable)
export async function bootstrap({ history, common, messenger, globalState, routerBase }) {
const { response, request, sign, secret, sign_common, request_common } = await fetchConfig()
export async function bootstrap({ history, common, messenger, globalState }) {
const { response, request, sign, secret, sign_common, request_common, merchantId } = await fetchConfig()
Vue.prototype.$history = history
Vue.prototype.$merchantId = merchantId
Vue.prototype.$messenger = messenger
Vue.prototype.$globalState = globalState
Vue.prototype.$common = common
......
......@@ -68,6 +68,7 @@ export default {
},
watch: {
filterText(val) {
console.log(val)
this.$refs.tree.filter(val)
},
selectlist(val) {
......@@ -99,7 +100,8 @@ export default {
})
},
async getDepartmentTree() {
let params = { addChildrensFlag: true, queryMerchantId: this.merchantId }
// let params = { addChildrensFlag: true, queryMerchantId: this.merchantId }
let params = { addChildrensFlag: true, queryMerchantId: '44210895' }
let data = await this.$apis.battle.getlistDepartmentTree(params)
this.ids = []
this.departmentList = data
......@@ -156,7 +158,7 @@ export default {
},
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
return data.name.indexOf(value) !== -1
},
search() {},
handleNodeClick() {
......
<template>
<div class="el-select-dropdown el-popper group-select" :style="groupStyle">
<slot></slot>
</div>
</template>
<script>
export default {
name: 'ElSelectDropdown',
props: {
appendToBody: {
type: Boolean,
default: true
},
domEl: {
type: Object,
default: () => {}
}
},
componentName: 'selectyy',
data() {
return {
groupStyle: '',
includeData:['el-input__inner','placeholder','el-select__caret el-input__icon el-icon-arrow-up']
}
},
mounted() {
if (this.appendToBody) document.body.appendChild(this.$el)
this.getBoundingClientRect()
window.addEventListener('resize', this.getBoundingClientRect)
document.addEventListener('click', e => {
if (!this.includeData.includes(e.target.className)) {
this.removeEl()
}
})
},
methods: {
getBoundingClientRect() {
let { left, top } = this.domEl.getBoundingClientRect()
this.groupStyle = { left: left + 'px', top: top + 45 + 'px' }
},
removeEl() {
document.body.contains(this.$el) && document.body.removeChild(this.$el)
this.$emit('changeStatu')
}
},
beforeDestroy() {
this.removeEl()
}
}
</script>
<style lang="scss" scoped>
.group-select {
min-width: 284px;
transform-origin: center top;
z-index: 10000;
position: fixed;
top: 740px;
left: 600px;
/deep/ .el-select-dropdown__item {
width: 236px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
}
</style>
......@@ -12,7 +12,6 @@
</div>
<GLTable ref="battleRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun" @selectionTable="selectionTable">
<div slot="activityTime" slot-scope="scope">{{ dateFormatFun(scope.scope.startTime) }}-{{ dateFormatFun(scope.scope.endTime) }}</div>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" v-if="scope.scope.reportStaffs.length == 0" @click="handlebattleOn(scope.scope)">配置</el-button>
<el-button type="text" v-else @click="handlebattleOn(scope.scope, 'edit')">编辑</el-button>
......@@ -23,19 +22,19 @@
<div class="gl-form-page gl-form-min">
<el-form ref="form" label-width="154px">
<el-form-item label="发送人员:">
<el-radio-group v-model="staffType" @change="changeType">
<el-radio-group v-model="config.staffType" @change="changeType">
<el-radio v-model="radio" label="1">全部人员</el-radio>
<el-radio v-model="radio" label="2">指定人员</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="所属企业:">
<el-radio-group v-model="merchantId" @change="changeRadio">
<el-radio-group v-model="config.merchantId" @change="changeRadio">
<template v-for="(item, index) in merchantList">
<el-radio :key="index" :label="item.merchantId">{{ item.merchantName }}</el-radio>
</template>
</el-radio-group>
</el-form-item>
<el-form-item label="人员选择:" v-show="staffType == 2">
<el-form-item label="人员选择:" v-show="config.staffType == 2">
<el-button size="small" @click="openMembers">
<i class="el-icon-plus"></i>
选择成员
......@@ -44,11 +43,69 @@
<GLFull :label="tag.staffName" :identi="`${tag.id}`" labelWidth="110" textType="user" :haveClose="true" v-for="(tag, idx) in userList" :key="idx" @handleRemove="removeStaff(idx)"></GLFull>
</div>
</el-form-item>
<!-- 战报自动发送 -->
<el-form-item class="select-wrap" label="战报自动发送:">
<div class="common el-form-item__content">
<div class="el-input" ref="automaticRef">
<div class="el-input__inner" @click="openAutomatic">
<span v-if="wechat.automaticName == ''" class="placeholder">选择成员</span>
{{ wechat.automaticName }}
</div>
<span class="el-input__suffix" @click="openAutomatic">
<span class="el-input__suffix-inner"><i :class="['el-select__caret', 'el-input__icon', 'el-icon-arrow-up', isAutomatic ? 'is-reverse' : '']"></i></span>
</span>
</div>
</div>
<transition name="el-zoom-in-top" v-if="!isAutomatic">
<gl-select-menu :domEl="automaticEl" @changeStatu="hideSelect">
<el-form-item class="search-groomname">
<el-input placeholder="请输入搜索关键词" v-model="filterText"></el-input>
</el-form-item>
<div class="el-select-dropdown__wrap el-scrollbar__wrap">
<template v-if="automaticData.length > 0">
<el-tree class="filter-tree" :data="automaticData" node-key="id" :default-expanded-keys="expandedKeys" :props="defaultProps" default-expand-all :filter-node-method="filterNode" ref="tree" @node-click="handleNodeClick"></el-tree>
</template>
<div class="empty" v-else>暂无数据</div>
</div>
</gl-select-menu>
</transition>
</el-form-item>
<!-- 关联群 -->
<el-form-item class="select-wrap" label="关联群:">
<div class="common el-form-item__content">
<div class="el-input" ref="groupRef">
<div class="el-input__inner" @click="openGroup">
<span class="placeholder" v-if="wechat.roomName == ''">选择选择群</span>
{{ wechat.roomName }}
</div>
<span class="el-input__suffix" @click="openGroup">
<span class="el-input__suffix-inner"><i :class="['el-select__caret', 'el-input__icon', 'el-icon-arrow-up', isgroup ? 'is-reverse' : '']"></i></span>
</span>
</div>
</div>
<transition name="el-zoom-in-top" v-if="!isgroup">
<gl-select-menu :domEl="domEl" @changeStatu="hideSelect">
<el-form-item class="search-groomname">
<el-input placeholder="请输入搜索关键词" prefix-icon="el-icon-search" v-model="roomName"></el-input>
</el-form-item>
<div class="el-select-dropdown__wrap el-scrollbar__wrap">
<ul class="el-scrollbar__view el-select-dropdown__list">
<template v-if="groupList.length > 0">
<li v-for="i in roomName == '' ? groupList : stageList" class="el-select-dropdown__item" :key="i" @click="selectGroup(i)">
<span>{{ i.roomName }}</span>
</li>
</template>
<div class="empty" v-else>暂无数据</div>
</ul>
</div>
</gl-select-menu>
</transition>
</el-form-item>
</el-form>
</div>
</GLDialog>
<GLDialog :mode="mode" title="选择员工" @onOk="handlestaffbattleConfirm" @onCancel="handlestaffbattleClose" :visible.sync="battlestaffVisible">
<SelectMember ref="selectMember" :selectlist="userList" v-if="battlestaffVisible" :merchantId="merchantId"></SelectMember>
<SelectMember ref="selectMember" :selectlist="userList" v-if="battlestaffVisible" :merchantId="config.merchantId"></SelectMember>
</GLDialog>
</div>
</template>
......@@ -58,12 +115,16 @@ import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
import { dateFormat } from '../../utils/index'
import SelectMember from '../battle/components/SelectMember.vue'
import GlSelectMenu from '../battle/components/select-dropdown.vue'
export default {
components: {
SelectMember
SelectMember,
GlSelectMenu
},
data() {
return {
isgroup: true,
isAutomatic: true,
merchantId: '',
merchantName: '',
activeName: 'first',
......@@ -74,6 +135,7 @@ export default {
url: url,
setectList: [],
merchantList: [],
groupList: [],
tabPaneList: [
{
label: '进行中',
......@@ -88,7 +150,7 @@ export default {
// 表格
userList: [],
selectArray: [],
staffType: '2',
getListApi: this.$apis.battle.getActivitylist,
tableParams: {
// btnId: new Date().getTime() + parseInt(Math.random() * 1000),
......@@ -123,13 +185,38 @@ export default {
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
defaultProps: {
children: 'children',
label: 'name'
},
expandedKeys: [],
filterText: '',
automaticData: [],
stageList: [],
roomName: '',
config: {
merchantId: '',
staffType: '2'
},
wechat: {
automaticName: '',
roomName: ''
}
}
},
mounted() {
this.getMerchantList()
},
computed: {
domEl() {
return this.$refs.groupRef
},
automaticEl() {
return this.$refs.automaticRef
}
},
watch: {
activeName: {
handler(val) {
......@@ -148,15 +235,66 @@ export default {
}
},
immediate: true
},
filterText(val) {
this.$refs.tree.filter(val)
},
roomName(val) {
this.filterRoomName(val)
}
},
methods: {
clearData() {
this.setectList = []
this.config.merchantId = this.merchantId
this.config.staffType = '2'
this.wechat = {
automaticName: '',
roomName: ''
}
this.hideSelect()
},
filterNode(value, data) {
if (!value) return true
return data.name.indexOf(value) !== -1
},
filterRoomName(value) {
this.stageList = this.groupList.filter(item => {
if (item.roomName.indexOf(value) !== -1) {
return item
}
})
},
handleNodeClick(data) {
this.hideSelect()
this.wechat.automaticName = data.name
this.wechat.staffId = data.staffId
this.wechat.roomName = ''
this.getGroupList(this.wechat.staffId)
},
hideSelect() {
this.isgroup = true
this.isAutomatic = true
},
selectGroup(data) {
this.hideSelect()
this.wechat.roomName = data.roomName
this.wechat.groupId = data.roomChatId
},
openGroup(e) {
this.isAutomatic = true
this.isgroup = !this.isgroup
},
openAutomatic() {
this.isgroup = true
this.isAutomatic = !this.isAutomatic
},
removeStaff(index) {
this.userList.splice(index, 1)
},
//所属企业
changeRadio(val) {
if (this.staffType == 1) this.getDepartmentTree()
if (this.config.staffType == 1) this.getDepartmentTree()
this.merchantList.forEach(item => {
item.merchantId == val ? (this.merchantName = item.merchantName) : ''
})
......@@ -165,6 +303,7 @@ export default {
getMerchantList() {
this.$apis.battle.getMerchantList({}).then(res => {
this.merchantList = res
this.config.merchantId = this.merchantList && this.merchantList[0].merchantId
this.merchantId = this.merchantList && this.merchantList[0].merchantId
this.merchantName = this.merchantList && this.merchantList[0].merchantName
})
......@@ -176,34 +315,10 @@ export default {
this.userList = []
}
},
async getDepartmentTree() {
let params = { addChildrensFlag: true, queryMerchantId: this.merchantId }
let data = await this.$apis.battle.getlistDepartmentTree(params)
this.initData(data)
},
initData(data) {
this.userList = []
for (let i = 0; i < data.length; i++) {
for (let j = 0; j < data[i].children.length; j++) {
if (data[i].children[j].entmicroStaffResponses) {
data[i].children[j].children = data[i].children[j].entmicroStaffResponses
data[i].children[j].children.forEach(item => {
this.userList.push({
staffId: item.staffId,
staffName: item.staffName,
merchantId: this.merchantId,
merchantName: this.merchantName,
userId: item.userId
})
})
}
}
}
},
battleSetHandle() {
if (this.setectList.length == 0) {
this.$message({
message: '请先选择专员',
message: '请选择活动',
type: 'error'
})
return
......@@ -220,7 +335,6 @@ export default {
handlestaffbattleConfirm() {
this.battlestaffVisible = false
this.userList = this.$refs.selectMember.userList
console.log(this.userList)
},
handlestaffbattleClose() {
this.battlestaffVisible = false
......@@ -234,18 +348,24 @@ export default {
handlebattleConfirm() {
if (this.userList.length == 0) {
this.$message({
message: '请先选择专员',
message: '请选择专员',
type: 'error'
})
return
}
if (this.wechat.automaticName !== ''&&this.wechat.roomName == '') {
this.$message({
message: '请选择关联群',
type: 'error'
})
}
let staffRequestList = []
let batchstaffRequestList = []
this.userList.forEach(item => {
staffRequestList.push({
staffId: item.staffId,
staffName: item.staffName,
merchantId: this.merchantId,
merchantId: this.config.merchantId,
merchantName: this.merchantName,
userId: item.userId
})
......@@ -253,11 +373,16 @@ export default {
this.setectList.forEach(item => {
batchstaffRequestList.push({
activityId: item.activityId,
autoStaffId: this.wechat.staffId,
autoStaffName: this.wechat.automaticName,
autoGroupId: this.wechat.groupId,
autoGroupName: this.wechat.roomName,
autoGroupMerchantId: this.$merchantId,
staffRequestList
})
})
this.$apis.battle.insertStaff({ batchstaffRequestList, staffType: this.staffType }).then(res => {
this.$apis.battle.insertStaff({ batchstaffRequestList, staffType: this.config.staffType }).then(res => {
this.$message({
message: res.code == '0' ? '配置成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
......@@ -266,10 +391,12 @@ export default {
this.battleVisible = false
this.handleSearch()
this.activeName = 'first'
this.clearData()
}
})
},
handlebattleClose() {
this.clearData()
this.battleVisible = false
},
handleDetails() {},
......@@ -279,14 +406,26 @@ export default {
this.setectList.push(data)
this.battleVisible = true
if (sign) this.getStaffList(data)
this.getDepartmentTree()
},
//获取编辑
getStaffList(data) {
this.$apis.battle.getStaffList({ id: data.activityId }).then(res => {
console.log(res, '00000000')
this.config.merchantId = res.staffs[0].merchantId
this.merchantId = res.staffs[0].merchantId
this.merchantName = res.staffs[0].merchantName
this.userList = res.staffs
this.staffType = res.staffType + ''
this.config.staffType = res.staffType + ''
this.wechat.staffId = res.autoStaffId
this.wechat.automaticName = res.autoStaffName
this.wechat.groupId = res.autoGroupId
this.wechat.roomName = res.autoGroupName
this.getGroupList(this.wechat.staffId)
})
},
getGroupList(id) {
this.$apis.battle.getGroupList({ msgStaffIdList: id }).then(res => {
if (res.code == 0) this.groupList = res.data
})
},
handleSetting() {
......@@ -314,6 +453,58 @@ export default {
handleSearch() {
this.$refs.battleRef.refreshTable()
},
async getDepartmentTree() {
// let params = { addChildrensFlag: true, queryMerchantId: this.config.merchantId,loginStatus:1 }
let params = { addChildrensFlag: true, queryMerchantId: this.$merchantId, loginStatus: 1 }
let data = await this.$apis.battle.getlistDepartmentTree(params)
this.ids = []
this.automaticData = data
await this.initData(this.automaticData)
this.expandedKeys = [this.automaticData[0].id]
},
initData(data) {
data.forEach((item, index) => {
this.$set(item, 'name', item.staffName ? item.staffName : item.departmentName)
let entmicroStaffResponses = this.$common.utils.deepClone(item.entmicroStaffResponses) || []
entmicroStaffResponses = entmicroStaffResponses.filter((staff, idx) => {
if (staff.staffName) {
this.$set(staff, 'name', staff.staffName)
} else {
this.$set(staff, 'name', staff.departmentName)
}
if (staff.staffId && !this.ids.includes(staff.staffId)) {
this.ids.push(staff.staffId)
return true
} else if (staff.staffId && this.ids.includes(staff.staffId)) {
return false
}
})
let child = this.$common.utils.deepClone(item.children) || []
child = child.filter((staff, idx) => {
if (staff.staffName) {
this.$set(staff, 'name', staff.staffName)
} else {
this.$set(staff, 'name', staff.departmentName)
}
if (staff.staffId && !this.ids.includes(staff.staffId)) {
this.ids.push(staff.staffId)
return true
} else if (staff.staffId && this.ids.includes(staff.staffId)) {
return false
} else if (staff.entmicroStaffResponses) {
staff.staffId = staff.id
return true
}
})
const children = [...child, ...entmicroStaffResponses]
item.children = children
//清除没有员工的部门
if (!item.staffName && item.entmicroStaffResponses === null) {
// data.splice(index, 1)
}
children.length && this.initData(children)
})
}
}
}
......@@ -367,5 +558,45 @@ export default {
margin-bottom: 4px;
}
}
.select-wrap {
.common {
margin: 4px 0;
height: 40px !important;
overflow: hidden;
/deep/ .el-input {
height: 40px !important;
line-height: 40px !important;
}
/deep/ .el-input__suffix {
height: 40px !important;
margin-top: -4px;
.is-reverse {
transform: rotate(180deg);
}
}
}
}
}
.search-groomname {
width: 252px;
margin: 12px 16px 0;
/deep/.el-input {
width: 252px;
}
}
.filter-tree {
padding: 0 16px;
}
.empty {
padding: 10px 0;
margin: 0;
text-align: center;
color: #999;
font-size: 13px;
}
.placeholder {
font-size: 14px;
color: #c0c6ce;
line-height: 20px;
}
</style>
......@@ -9,7 +9,7 @@ const cdn = {
js: [`${CDN_DOMAIN}ajax/libs/vue/2.6.11/vue.min.js`, `${CDN_DOMAIN}ajax/libs/vue-router/3.2.0/vue-router.min.js`, `${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/index.js`, `${CDN_DOMAIN}ajax/libs/vuex/3.6.2/vuex.min.js`, `${CDN_DOMAIN}ajax/libs/echarts/5.1.2/echarts.min.js`, 'https://webapi.amap.com/loader.js']
}
module.exports = {
outputDir: `../dist/${packageName}`,
outputDir: `dist`,
publicPath,
assetsDir: 'static',
productionSourceMap: false,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!