Commit 95d23b6c by 胡悦

修改批量员工接口

1 parent 68839c5e
......@@ -125,8 +125,8 @@ const updateStatusApi = params => {
}
// 批量更新员工角色
const updateStaffRoleBatch = params => {
params.method = `${defaultPath}staff.updateStaffRoleBatch`
const addStaffRoleBatch = params => {
params.method = `${defaultPath}staff.addStaffRoleBatch`
return http({
url: 'rop-merchants/router',
method: 'POST',
......@@ -146,4 +146,4 @@ const updateStatusBatch = params => {
})
}
export default { getListApi, getAllMerchantListApi, getRoleListApi, getAllDictApi, getMerchantTreeApi, getDetailInfoApi, getDetailLogApi, addEmployeeApi, updateEmployeeApi, deleteEmployeeApi, exportEmployeeApi, updateStatusApi, updateStaffRoleBatch, updateStatusBatch }
export default { getListApi, getAllMerchantListApi, getRoleListApi, getAllDictApi, getMerchantTreeApi, getDetailInfoApi, getDetailLogApi, addEmployeeApi, updateEmployeeApi, deleteEmployeeApi, exportEmployeeApi, updateStatusApi, addStaffRoleBatch, updateStatusBatch }
......@@ -530,7 +530,6 @@ export default {
})
},
batch(type) {
console.log(handleObj[type]);
const name = handleObj[type]
const selectArr = this.$refs.employeeRef.mutiSelectArr[this.tableParams1.mutiSelectName]
if (!selectArr.length) {
......@@ -548,12 +547,15 @@ export default {
this.roleVisible = true
}
} else if (name == '启用') {
this.$confirm(`是否将选中的账号批量进行启用?`, '', {
const hasNoRole = selectArr.some(item => !item.roleName)
if (hasNoRole) {
this.$message.error('您选中的员工中包含未设置“角色”账号,请去除选中未设置“角色”员工账号。')
} else {
this.$confirm(`是否将选中的账号批量进行启用?`, '', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
console.log('点击了确定')
const list = selectArr.map(item => {
return {
staffId: item.id,
......@@ -574,6 +576,7 @@ export default {
}).catch(() => {
console.log('点击了取消')
})
}
}
},
......@@ -582,18 +585,20 @@ export default {
this.$refs.roleForm.validate((valid) => {
if (valid) {
const { roleId } = this.roleForm
let list = this.$refs.employeeRef.mutiSelectArr[this.tableParams1.mutiSelectName]
list = list.map(item => {
return {
staffId: item.id,
roleId
}
})
let staffIds = this.$refs.employeeRef.mutiSelectArr[this.tableParams1.mutiSelectName]
staffIds = staffIds.map(item => item.id)
// list = list.map(item => {
// return {
// staffId: item.id
// roleId,
// }
// })
const param = {
list
roleId,
staffIds
}
console.log(param)
this.$apis.employee.updateStaffRoleBatch(param).then(res => {
this.$apis.employee.addStaffRoleBatch(param).then(res => {
console.log(res)
if (res) {
this.$message.success('操作成功')
......@@ -609,6 +614,8 @@ export default {
},
handleClose() {
this.roleVisible = false
this.roleForm = {}
this.$refs.roleForm.resetFields()
},
// 表格分页穿透事件
paginationlisteners(val) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!