Commit bc718d23 by 前端

commit

1 parent d61df7f5
......@@ -24,7 +24,7 @@
<div class="input-tag-wrapper">
<div class="tag-box">
<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>
</div>
</div>
......@@ -48,7 +48,7 @@ export default {
defaultProps: {
children: 'children',
label: 'staffName'
label: 'name'
}
}
},
......@@ -101,8 +101,8 @@ export default {
let params = { addChildrensFlag: true, queryMerchantId: this.merchantId }
let data = await this.$apis.battle.getlistDepartmentTree(params)
this.ids = []
data[0].entmicroStaffResponses = data[0].children
this.departmentList = this.transformData(data)
this.departmentList = data
this.initData(this.departmentList)
this.expandedKeys = [this.departmentList[0].id]
this.$nextTick(() => {
if (this.selectlist.length > 0) {
......@@ -110,34 +110,66 @@ export default {
}
})
},
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)
initData(data) {
data.forEach((item, index) => {
this.$set(item, 'name', item.staffName ? item.staffName : item.departmentName)
const entmicroStaffResponses = item.entmicroStaffResponses || []
entmicroStaffResponses.forEach(staff => {
if (staff.staffName) {
this.$set(staff, 'name', staff.staffName)
} 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 {
this.$set(staff, 'name', staff.departmentName)
}
this.ids.push(staff.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) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
search() {},
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.checkAll = this.userList.length === this.ids.length
},
......
<!-- 专区管理 -->
<template>
<div class="activity p-t-20">
<div class="activity">
<GLTabs v-model="activeName" :tabPaneList="tabPaneList" @tab-click="handleClick"></GLTabs>
<!-- 表格区域 开始 -->
<div class="container">
......@@ -28,7 +28,7 @@
<el-radio v-model="radio" label="2">指定人员</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="所属企业:" required>
<el-form-item label="所属企业:">
<el-radio-group v-model="merchantId" @change="changeRadio">
<template v-for="(item, index) in merchantList">
<el-radio :key="index" :label="item.merchantId">{{ item.merchantName }}</el-radio>
......@@ -91,11 +91,10 @@ export default {
staffType: '2',
getListApi: this.$apis.battle.getActivitylist,
tableParams: {
hasNum: true,
// btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: true,
// 行数据的key
// // 行数据的key
mutiSelectUniqueKey: 'activityId',
// 多选ref的名称
mutiSelectName: 'activity',
......@@ -118,7 +117,9 @@ export default {
formatter: val => {
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 {
this.getMerchantList()
},
watch: {
activeName(val) {
if (val == 'first') {
this.tableParams.tableOption = true
} else {
this.tableParams.tableOption = false
}
activeName: {
handler(val) {
if (val == 'first') {
this.tableParams.tableOption = true
this.$nextTick(() => {
this.tableParams.mutiSelectUniqueKey = 'activityId'
this.tableParams.mutiSelectName = 'activityId'
})
} else {
this.tableParams.tableOption = false
this.$nextTick(() => {
this.tableParams.mutiSelectUniqueKey = ''
this.tableParams.mutiSelectName = ''
})
}
},
immediate: true
}
},
methods: {
......@@ -153,8 +165,8 @@ export default {
getMerchantList() {
this.$apis.battle.getMerchantList({}).then(res => {
this.merchantList = res
this.merchantId = this.merchantList[0].merchantId
this.merchantName = this.merchantList[0].merchantName
this.merchantId = this.merchantList && this.merchantList[0].merchantId
this.merchantName = this.merchantList && this.merchantList[0].merchantName
})
},
changeType(val) {
......@@ -220,6 +232,13 @@ export default {
// }
},
handlebattleConfirm() {
if (this.userList.length == 0) {
this.$message({
message: '请先选择专员',
type: 'error'
})
return
}
let staffRequestList = []
let batchstaffRequestList = []
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!