Commit 434eb2b7 by cwq0219

员工

1 parent 671c1a94
......@@ -114,4 +114,14 @@ const exportEmployeeApi = params => {
})
}
export default { getListApi, getAllMerchantListApi, getRoleListApi, getAllDictApi, getMerchantTreeApi, getDetailInfoApi, getDetailLogApi, addEmployeeApi, updateEmployeeApi, deleteEmployeeApi, exportEmployeeApi }
const updateStatusApi = params => {
params.method = `${defaultPath}staff.updateStatus`
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 }
......@@ -19,11 +19,19 @@
<!-- 表格区域 开始 -->
<GLTable ref="employeeRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<div class="table-btns" slot="auth-button" slot-scope="scope">
<div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button type="text" @click="handleDetail(scope.scope)">查看</el-button>
<el-button type="text" @click="handleEdit(2, scope.scope)">修改</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
</div>
<template slot="otherOptions" slot-scope="scope">
<el-popover placement="left" width="260" trigger="hover">
<p>启用前,你可先为该员工创建角色,配置其所需的功能权限。如下所示:</p>
<p>1. 角色管理-创建角色;</p>
<p>2. 选择员工账户-修改角色</p>
<el-switch slot="reference" v-model="scope.scope.statusName" active-value="启用" inactive-value="禁用" @change="e => handleSwitchChange(e, scope.scope)"></el-switch>
</el-popover>
</template>
</GLTable>
<!-- 表格区域 end -->
</div>
......@@ -33,6 +41,7 @@
<script>
import { utils } from 'glsx-common'
import glsxCombiForm from './glsx-combi-form'
// import glsxTable from '@/components/glsx-table'
import selectPage from './components/selectPage'
export default {
name: 'index',
......@@ -110,7 +119,10 @@ export default {
getListApi: this.$apis.employee.getListApi,
tableParams: {
listName: 'data',
tableOption: true,
tableOption: false,
otherOptions: {
label: '启用开关'
},
tableColumns: [
{
label: '员工姓名',
......@@ -150,6 +162,18 @@ export default {
label: '更新时间',
prop: 'updatedTime',
line: 2
},
{
label: '操作',
prop: 'optionBtns',
width: '200px',
addHtml: 'optionBtns'
},
{
label: '启用开关',
prop: 'otherOptions',
width: '100px',
addHtml: 'otherOptions'
}
]
},
......@@ -165,6 +189,7 @@ export default {
components: {
glsxCombiForm,
selectPage
// glsxTable
},
mounted() {
......@@ -257,6 +282,20 @@ export default {
this.$router.push('/employee/editEmployee/' + addOrEdit + '/' + id)
},
handleSwitchChange(val, row) {
if (!row.roleName) {
this.$message({
message: '您还未给该员工设置“角色”!设置角色:员工账户管理-修改-角色权限',
type: 'error'
})
this.handleSearch()
return false
}
this.$apis.employee.updateStatusApi({ id: row.id, status: val == '启用' ? 0 : 2 }).then(res => {
this.handleSearch()
})
},
handleDelete(row) {
this.$confirm('是否确认删除该员工?', '删除', {
confirmButtonText: '确定',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!