Commit bc718d23 by 前端

commit

1 parent d61df7f5
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<div class="input-tag-wrapper"> <div class="input-tag-wrapper">
<div class="tag-box"> <div class="tag-box">
<el-tag v-for="(label, idx) in userList" :key="idx" type="info" closable :disable-transitions="false" @close="remove(ids)"> <el-tag v-for="(label, idx) in userList" :key="idx" type="info" closable :disable-transitions="false" @close="remove(ids)">
{{ label.staffName }} {{ label.name }}
</el-tag> </el-tag>
</div> </div>
</div> </div>
...@@ -48,7 +48,7 @@ export default { ...@@ -48,7 +48,7 @@ export default {
defaultProps: { defaultProps: {
children: 'children', children: 'children',
label: 'staffName' label: 'name'
} }
} }
}, },
...@@ -101,8 +101,8 @@ export default { ...@@ -101,8 +101,8 @@ export default {
let params = { addChildrensFlag: true, queryMerchantId: this.merchantId } let params = { addChildrensFlag: true, queryMerchantId: this.merchantId }
let data = await this.$apis.battle.getlistDepartmentTree(params) let data = await this.$apis.battle.getlistDepartmentTree(params)
this.ids = [] this.ids = []
data[0].entmicroStaffResponses = data[0].children this.departmentList = data
this.departmentList = this.transformData(data) this.initData(this.departmentList)
this.expandedKeys = [this.departmentList[0].id] this.expandedKeys = [this.departmentList[0].id]
this.$nextTick(() => { this.$nextTick(() => {
if (this.selectlist.length > 0) { if (this.selectlist.length > 0) {
...@@ -110,34 +110,66 @@ export default { ...@@ -110,34 +110,66 @@ export default {
} }
}) })
}, },
transformData(treeData) { initData(data) {
let children = [] data.forEach((item, index) => {
treeData.forEach((item, index) => { this.$set(item, 'name', item.staffName ? item.staffName : item.departmentName)
if (item.entmicroStaffResponses && item.entmicroStaffResponses.length > 0) { const entmicroStaffResponses = item.entmicroStaffResponses || []
children.push({ entmicroStaffResponses.forEach(staff => {
staffName: item.departmentName, if (staff.staffName) {
id: item.id, this.$set(staff, 'name', staff.staffName)
children: this.transformData(item.entmicroStaffResponses) } else {
this.$set(staff, 'name', staff.departmentName)
}
this.ids.push(staff.staffId)
}) })
const child = item.children || []
child.forEach(staff => {
if (staff.staffName) {
console.log(staff.staffName)
this.$set(staff, 'name', staff.staffName)
} else { } else {
children.push({ this.$set(staff, 'name', staff.departmentName)
staffName: item.staffName, }
id: item.staffId, this.ids.push(staff.staffId)
userId: item.userId,
staffId: item.staffId
}) })
this.ids.push(item.staffId) const children = [...child, ...entmicroStaffResponses]
item.children = children
//清除没有员工的部门
if (item.children.length == 0 && item.entmicroStaffResponses === null) {
// console.log(item, item.entmicroStaffResponses)
data.splice(index, 1)
} }
this.initData(children)
}) })
return children
}, },
// transformData(treeData) {
// let children = []
// treeData.forEach((item, index) => {
// if (item.entmicroStaffResponses && item.entmicroStaffResponses.length > 0) {
// children.push({
// staffName: item.departmentName,
// id: item.id,
// children: this.transformData(item.entmicroStaffResponses)
// })
// } else {
// children.push({
// staffName: item.staffName,
// id: item.staffId,
// userId: item.userId,
// staffId: item.staffId
// })
// this.ids.push(item.staffId)
// }
// })
// return children
// },
filterNode(value, data) { filterNode(value, data) {
if (!value) return true if (!value) return true
return data.label.indexOf(value) !== -1 return data.label.indexOf(value) !== -1
}, },
search() {}, search() {},
handleNodeClick() { handleNodeClick() {
this.userList = this.$refs.tree.getCheckedNodes().filter(item => !item.children) this.userList = this.$refs.tree.getCheckedNodes().filter(item => item.children.length == 0)
this.isIndeterminate = this.userList.length > 0 && this.userList.length < this.ids.length this.isIndeterminate = this.userList.length > 0 && this.userList.length < this.ids.length
this.checkAll = this.userList.length === this.ids.length this.checkAll = this.userList.length === this.ids.length
}, },
......
<!-- 专区管理 --> <!-- 专区管理 -->
<template> <template>
<div class="activity p-t-20"> <div class="activity">
<GLTabs v-model="activeName" :tabPaneList="tabPaneList" @tab-click="handleClick"></GLTabs> <GLTabs v-model="activeName" :tabPaneList="tabPaneList" @tab-click="handleClick"></GLTabs>
<!-- 表格区域 开始 --> <!-- 表格区域 开始 -->
<div class="container"> <div class="container">
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<el-radio v-model="radio" label="2">指定人员</el-radio> <el-radio v-model="radio" label="2">指定人员</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="所属企业:" required> <el-form-item label="所属企业:">
<el-radio-group v-model="merchantId" @change="changeRadio"> <el-radio-group v-model="merchantId" @change="changeRadio">
<template v-for="(item, index) in merchantList"> <template v-for="(item, index) in merchantList">
<el-radio :key="index" :label="item.merchantId">{{ item.merchantName }}</el-radio> <el-radio :key="index" :label="item.merchantId">{{ item.merchantName }}</el-radio>
...@@ -91,11 +91,10 @@ export default { ...@@ -91,11 +91,10 @@ export default {
staffType: '2', staffType: '2',
getListApi: this.$apis.battle.getActivitylist, getListApi: this.$apis.battle.getActivitylist,
tableParams: { tableParams: {
hasNum: true,
// btnId: new Date().getTime() + parseInt(Math.random() * 1000), // btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list', listName: 'list',
tableOption: true, tableOption: true,
// 行数据的key // // 行数据的key
mutiSelectUniqueKey: 'activityId', mutiSelectUniqueKey: 'activityId',
// 多选ref的名称 // 多选ref的名称
mutiSelectName: 'activity', mutiSelectName: 'activity',
...@@ -118,7 +117,9 @@ export default { ...@@ -118,7 +117,9 @@ export default {
formatter: val => { formatter: val => {
return val.reportStaffs.length > 0 ? val.reportStaffs.map(item => item.staffName).join('、') : '--' return val.reportStaffs.length > 0 ? val.reportStaffs.map(item => item.staffName).join('、') : '--'
}, },
prop: 'reportStaffs' prop: 'reportStaffs',
line: 1,
width: 300
} }
] ]
}, },
...@@ -130,12 +131,23 @@ export default { ...@@ -130,12 +131,23 @@ export default {
this.getMerchantList() this.getMerchantList()
}, },
watch: { watch: {
activeName(val) { activeName: {
handler(val) {
if (val == 'first') { if (val == 'first') {
this.tableParams.tableOption = true this.tableParams.tableOption = true
this.$nextTick(() => {
this.tableParams.mutiSelectUniqueKey = 'activityId'
this.tableParams.mutiSelectName = 'activityId'
})
} else { } else {
this.tableParams.tableOption = false this.tableParams.tableOption = false
this.$nextTick(() => {
this.tableParams.mutiSelectUniqueKey = ''
this.tableParams.mutiSelectName = ''
})
} }
},
immediate: true
} }
}, },
methods: { methods: {
...@@ -153,8 +165,8 @@ export default { ...@@ -153,8 +165,8 @@ export default {
getMerchantList() { getMerchantList() {
this.$apis.battle.getMerchantList({}).then(res => { this.$apis.battle.getMerchantList({}).then(res => {
this.merchantList = res this.merchantList = res
this.merchantId = this.merchantList[0].merchantId this.merchantId = this.merchantList && this.merchantList[0].merchantId
this.merchantName = this.merchantList[0].merchantName this.merchantName = this.merchantList && this.merchantList[0].merchantName
}) })
}, },
changeType(val) { changeType(val) {
...@@ -220,6 +232,13 @@ export default { ...@@ -220,6 +232,13 @@ export default {
// } // }
}, },
handlebattleConfirm() { handlebattleConfirm() {
if (this.userList.length == 0) {
this.$message({
message: '请先选择专员',
type: 'error'
})
return
}
let staffRequestList = [] let staffRequestList = []
let batchstaffRequestList = [] let batchstaffRequestList = []
this.userList.forEach(item => { this.userList.forEach(item => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!