Commit df356030 by 匡雅琴

Merge branch 'huy_dev_v2.3.0' of http://192.168.3.233:8090/saas/scrm-micro-setti…

…ngs into huy_dev_v2.3.0
2 parents a1da1263 95d23b6c
...@@ -124,4 +124,26 @@ const updateStatusApi = params => { ...@@ -124,4 +124,26 @@ const updateStatusApi = params => {
}) })
} }
export default { getListApi, getAllMerchantListApi, getRoleListApi, getAllDictApi, getMerchantTreeApi, getDetailInfoApi, getDetailLogApi, addEmployeeApi, updateEmployeeApi, deleteEmployeeApi, exportEmployeeApi, updateStatusApi } // 批量更新员工角色
const addStaffRoleBatch = params => {
params.method = `${defaultPath}staff.addStaffRoleBatch`
return http({
url: 'rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
// 批量更新员工状态
const updateStatusBatch = params => {
params.method = `${defaultPath}staff.updateStatusBatch`
return http({
url: 'rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
export default { getListApi, getAllMerchantListApi, getRoleListApi, getAllDictApi, getMerchantTreeApi, getDetailInfoApi, getDetailLogApi, addEmployeeApi, updateEmployeeApi, deleteEmployeeApi, exportEmployeeApi, updateStatusApi, addStaffRoleBatch, updateStatusBatch }
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
<div class="table-btn"> <div class="table-btn">
<el-button @click="handleExport" :size="size" type="primary" plain mode="el-button">导出</el-button> <el-button @click="handleExport" :size="size" type="primary" plain mode="el-button">导出</el-button>
<GLButton @click="handleExport" fn="导出" :size="size" type="primary" plain mode="el-button">导出</GLButton> <GLButton @click="handleExport" fn="导出" :size="size" type="primary" plain mode="el-button">导出</GLButton>
<el-button :size="size" plain @click="batch(1)">批量分配角色</el-button> <el-button v-if="userInfo.accountLevel == 4" :size="size" plain @click="batch(1)">批量分配角色</el-button>
<el-button :size="size" plain @click="batch(2)">批量启用</el-button> <el-button v-if="userInfo.accountLevel == 4" :size="size" plain @click="batch(2)">批量启用</el-button>
</div> </div>
</div> </div>
<!-- 表格区域 开始 --> <!-- 表格区域 开始 -->
<GLTable ref="employeeRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun" @paginationlisteners="paginationlisteners"> <GLTable ref="employeeRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="$globalState.session.accountLevel == 4 ? tableParams1 : tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun" @paginationlisteners="paginationlisteners">
<div slot="optionBtns" slot-scope="scope"> <div slot="optionBtns" slot-scope="scope">
<GLTableButton :buttonList="buttonList" :buttonItem="scope.scope"></GLTableButton> <GLTableButton :buttonList="buttonList" :buttonItem="scope.scope"></GLTableButton>
<!-- <el-button type="text" @click="handleDetail(scope.scope)">查看</el-button> <!-- <el-button type="text" @click="handleDetail(scope.scope)">查看</el-button>
...@@ -44,8 +44,8 @@ ...@@ -44,8 +44,8 @@
</div> </div>
<GLDialog :visible="roleVisible" :width="'720px'" @close="handleClose" title="批量分配账号角色" :showClose="true"> <GLDialog :visible="roleVisible" :width="'720px'" @close="handleClose" title="批量分配账号角色" :showClose="true">
<el-form :model="roleForm" :rules="roleFormRules" ref="roleForm" label-width="200px"> <el-form :model="roleForm" :rules="roleFormRules" ref="roleForm" label-width="200px">
<el-form-item label="角色权限:" prop="roleAuth"> <el-form-item label="角色权限:" prop="roleId">
<el-select style="width: 415px;" :size="size" v-model="roleForm.roleAuth" placeholder="请选择角色权限"> <el-select style="width: 415px;" :size="size" v-model="roleForm.roleId" placeholder="请选择角色权限">
<el-option v-for="item in baseData.roleList" :key="item.id" :label="item.roleName" :value="item.id"></el-option> <el-option v-for="item in baseData.roleList" :key="item.id" :label="item.roleName" :value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -145,6 +145,83 @@ export default { ...@@ -145,6 +145,83 @@ export default {
tableParams: { tableParams: {
listName: 'data', listName: 'data',
tableOption: false, tableOption: false,
// mutiSelectName: 'employeeList',
// mutiSelectUniqueKey: 'id',
otherOptions: {
label: '启用开关'
},
tableColumns: [
{
label: '员工姓名',
prop: 'staffName',
width: '200',
line: 1
},
{
label: '员工企微号',
prop: 'entmicroName',
line: 1,
width: '200',
formatter: cellValue => {
return cellValue.entmicroName || '-'
}
},
{
label: '角色',
prop: 'roleName',
width: '200',
line: 1,
formatter: cellValue => {
return cellValue.roleName || '-'
}
},
{
label: '登录手机号',
prop: 'staffPhone',
width: '200'
},
{
label: '所属门店',
prop: 'merchantName',
width: '350',
line: 1
},
{
label: '所属企微',
prop: 'belongingEntmicroName',
width: '200',
line: 1
},
// {
// label: '状态',
// prop: 'statusName',
// width: '80px'
// },
{
label: '更新时间',
prop: 'updatedTime',
line: 1,
minWidth: '200'
},
{
label: '启用开关',
prop: 'otherOptions',
width: '120',
addHtml: 'otherOptions',
fixed: 'right'
},
{
label: '操作',
prop: 'optionBtns',
width: '150',
addHtml: 'optionBtns',
fixed: 'right'
}
]
},
tableParams1: {
listName: 'data',
tableOption: false,
mutiSelectName: 'employeeList', mutiSelectName: 'employeeList',
mutiSelectUniqueKey: 'id', mutiSelectUniqueKey: 'id',
otherOptions: { otherOptions: {
...@@ -275,16 +352,14 @@ export default { ...@@ -275,16 +352,14 @@ export default {
roleVisible: false, roleVisible: false,
roleForm: {}, roleForm: {},
roleFormRules: { roleFormRules: {
roleAuth: [{required: true, message: '请选择角色权限', trigger: 'change'}] roleId: [{ required: true, message: '请选择角色权限', trigger: 'change' }]
} }
} }
}, },
mounted() { mounted() {
console.log(this.$refs.employeeRef)
this.userInfo = this.$globalState.session this.userInfo = this.$globalState.session
// 门店 // 门店
if (this.userInfo.accountLevel == 4) { if (this.userInfo.accountLevel == 4) {
// this.searchFormData.splice(0, 1)
var idx = this.tableParams.tableColumns.findIndex(item => item.prop == 'merchantName') var idx = this.tableParams.tableColumns.findIndex(item => item.prop == 'merchantName')
this.tableParams.tableColumns.splice(idx, 1) this.tableParams.tableColumns.splice(idx, 1)
this.searchFormData[0].isHide = true this.searchFormData[0].isHide = true
...@@ -455,9 +530,8 @@ export default { ...@@ -455,9 +530,8 @@ export default {
}) })
}, },
batch(type) { batch(type) {
console.log(handleObj[type]);
const name = handleObj[type] const name = handleObj[type]
const selectArr = this.$refs.employeeRef.mutiSelectArr[this.tableParams.mutiSelectName] const selectArr = this.$refs.employeeRef.mutiSelectArr[this.tableParams1.mutiSelectName]
if (!selectArr.length) { if (!selectArr.length) {
return this.$message.error('您未选中需要批量操作的员工。') return this.$message.error('您未选中需要批量操作的员工。')
} }
...@@ -473,34 +547,75 @@ export default { ...@@ -473,34 +547,75 @@ export default {
this.roleVisible = true this.roleVisible = true
} }
} else if (name == '启用') { } else if (name == '启用') {
const hasNoRole = selectArr.some(item => !item.roleName)
if (hasNoRole) {
this.$message.error('您选中的员工中包含未设置“角色”账号,请去除选中未设置“角色”员工账号。')
} else {
this.$confirm(`是否将选中的账号批量进行启用?`, '', { this.$confirm(`是否将选中的账号批量进行启用?`, '', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
console.log('点击了确定') const list = selectArr.map(item => {
return {
staffId: item.id,
status: 0
}
})
const param = {
list
}
this.$apis.employee.updateStatusBatch(param).then(res => {
if(res) {
this.$message.success('操作成功')
this.$refs.employeeRef.refreshTable(false) this.$refs.employeeRef.refreshTable(false)
} else {
this.$message.error('操作失败')
}
})
}).catch(() => { }).catch(() => {
console.log('点击了取消') console.log('点击了取消')
}) })
} }
}
}, },
// 批量分配角色,确定按钮 // 批量分配角色,确定按钮
handleAssign() { handleAssign() {
console.log(this.roleForm)
this.$refs.roleForm.validate((valid) => { this.$refs.roleForm.validate((valid) => {
if (valid) { if (valid) {
const { roleId } = this.roleForm
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 = {
roleId,
staffIds
}
console.log(param)
this.$apis.employee.addStaffRoleBatch(param).then(res => {
console.log(res)
if (res) {
this.$message.success('操作成功')
this.roleVisible = false this.roleVisible = false
setTimeout(() => {
this.roleForm = {} this.roleForm = {}
this.$refs.employeeRef.refreshTable(false) this.$refs.employeeRef.refreshTable(false)
} else {
this.$message.error('操作失败')
}
}) })
} }
}) })
}, },
handleClose() { handleClose() {
this.roleVisible = false this.roleVisible = false
this.roleForm = {}
this.$refs.roleForm.resetFields()
}, },
// 表格分页穿透事件 // 表格分页穿透事件
paginationlisteners(val) { paginationlisteners(val) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!