Commit e63390c3 by 前端

战报自动发送功能

1 parent 06d06691
......@@ -55,16 +55,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,8 +19,8 @@ export const fetchConfig = function(isEnv = true) {
// return Promise.resolve(cfg)
// }
//return window.fetch('https://', {}).then(res => res.json())
// 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')
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) {
......
......@@ -100,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
......
<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: ''
}
},
mounted() {
if (this.appendToBody) document.body.appendChild(this.$el)
this.getBoundingClientRect()
window.addEventListener('resize', this.getBoundingClientRect)
document.addEventListener('click', e => {
console.log(this.$options.componentName)
if (e.target.className != 'group-select') {
// this.removeEl()
}
})
},
methods: {
getBoundingClientRect() {
let { left, top } = this.domEl.getBoundingClientRect()
this.groupStyle = { left: left + 'px', top: top + 45 + 'px' }
},
removeEl() {
console.log(document.body.contains(this.$el))
document.body.contains(this.$el) && document.body.removeChild(this.$el)
}
},
beforeDestroy() {
this.removeEl()
}
}
</script>
<style lang="scss" scoped>
.group-select {
min-width: 284px;
transform-origin: center top;
z-index: 2005;
position: fixed;
top: 740px;
left: 600px;
/deep/ .el-select-dropdown__item {
width: 236px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
}
</style>
......@@ -44,6 +44,52 @@
<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">{{automaticName}}</div>
<span class="el-input__suffix">
<span class="el-input__suffix-inner"><i :class="['el-select__caret', 'el-input__icon', 'el-icon-arrow-up', openAutomatic ? 'is-reverse' : '']"></i></span>
</span>
</div>
</div>
<transition name="el-zoom-in-top" v-if="!isAutomatic">
<gl-select-menu :domEl="automaticEl">
<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">
<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>
</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">{{}}</div>
<span class="el-input__suffix">
<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">
<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-for="i in 20">
<li class="el-select-dropdown__item" :key="i"><span>群名称超长显示标华福特众筹活动…群名称超长显示标华福特众筹活动…</span></li>
</template>
</ul>
</div>
</gl-select-menu>
</transition>
</el-form-item>
</el-form>
</div>
</GLDialog>
......@@ -58,12 +104,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 +124,7 @@ export default {
url: url,
setectList: [],
merchantList: [],
groupList: [],
tabPaneList: [
{
label: '进行中',
......@@ -123,13 +174,32 @@ export default {
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
defaultProps: {
children: 'children',
label: 'name'
},
expandedKeys: [],
filterText: '',
automaticData: [],
automaticName:''
}
},
mounted() {
document.addEventListener('click', e => {
console.log(this.$options.componentName)
})
this.getMerchantList()
},
computed: {
domEl() {
return this.$refs.groupRef
},
automaticEl() {
return this.$refs.automaticRef
}
},
watch: {
activeName: {
handler(val) {
......@@ -148,9 +218,27 @@ export default {
}
},
immediate: true
},
filterText(val) {
this.$refs.tree.filter(val)
}
},
methods: {
filterNode(value, data) {
if (!value) return true
console.log(data)
return data.label.indexOf(value) !== -1
},
handleNodeClick(data) {
console.log(data)
this.automaticName = data.name
},
openGroup(e) {
this.isgroup = !this.isgroup
},
openAutomatic() {
this.isAutomatic = !this.isAutomatic
},
removeStaff(index) {
this.userList.splice(index, 1)
},
......@@ -176,30 +264,6 @@ 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({
......@@ -266,7 +330,7 @@ export default {
this.battleVisible = false
this.handleSearch()
this.activeName = 'first'
this.setectList = []
this.setectList = []
}
})
},
......@@ -281,6 +345,8 @@ export default {
this.setectList.push(data)
this.battleVisible = true
if (sign) this.getStaffList(data)
// this.getGroupList()
this.getDepartmentTree()
},
getStaffList(data) {
this.$apis.battle.getStaffList({ id: data.activityId }).then(res => {
......@@ -290,6 +356,11 @@ export default {
this.staffType = res.staffType + ''
})
},
getGroupList() {
this.$apis.battle.getGroupList({}).then(res => {
console.log(res)
})
},
handleSetting() {
this.drawer = true
},
......@@ -315,6 +386,63 @@ export default {
handleSearch() {
this.$refs.battleRef.refreshTable()
},
async getDepartmentTree() {
// let params = { addChildrensFlag: true, queryMerchantId: this.merchantId,loginStatus:1 }
let params = { addChildrensFlag: true, queryMerchantId: '44210895',loginStatus:1 }
let data = await this.$apis.battle.getlistDepartmentTree(params)
console.log(data)
this.ids = []
this.automaticData = data
await this.initData(this.automaticData)
console.log(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) || []
console.log(child,index)
child = child.filter((staff, idx) => {
console.log(staff)
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]
console.log(children)
item.children = children
//清除没有员工的部门
if (!item.staffName && item.entmicroStaffResponses === null) {
// data.splice(index, 1)
}
children.length && this.initData(children)
})
}
}
}
......@@ -368,5 +496,33 @@ 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;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!