|
|
|
@ -45,13 +45,13 @@ |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
<el-table v-loading="loading" :data="list"> |
|
|
|
|
<el-table-column label="用户编号" key="id" prop="id" /> |
|
|
|
|
<el-table-column label="用户编号" key="id" prop="id" width="100" /> |
|
|
|
|
<el-table-column label="登录账号" prop="username" /> |
|
|
|
|
<el-table-column label="用户姓名" prop="nickname" /> |
|
|
|
|
<el-table-column label="部门" key="deptName" prop="deptName" /> |
|
|
|
|
<el-table-column label="部门" key="deptName" prop="deptName" width="100" /> |
|
|
|
|
<el-table-column label="手机号码" prop="mobile" width="120" /> |
|
|
|
|
<el-table-column label="微信号" prop="wxAlias" min-width="80" /> |
|
|
|
|
<el-table-column label="状态" key="status" width="180"> |
|
|
|
|
<el-table-column label="在职状态" key="status" width="120"> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<el-switch |
|
|
|
|
v-model="scope.row.status" |
|
|
|
@ -59,14 +59,30 @@ |
|
|
|
|
:inactive-value="1" |
|
|
|
|
active-text="在职" |
|
|
|
|
inactive-text="离职" |
|
|
|
|
size="small" |
|
|
|
|
v-hasPermi="['basic:employee:update']" |
|
|
|
|
@change="handleStatusChange(scope.row)" |
|
|
|
|
/> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="启用状态" key="inUse" width="120"> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<el-switch |
|
|
|
|
v-model="scope.row.inUse" |
|
|
|
|
:active-value="0" |
|
|
|
|
:inactive-value="1" |
|
|
|
|
active-text="启用" |
|
|
|
|
inactive-text="禁用" |
|
|
|
|
size="small" |
|
|
|
|
:disabled="scope.row.status == 1" |
|
|
|
|
v-hasPermi="['basic:employee:update']" |
|
|
|
|
@change="handleUseChange(scope.row)" |
|
|
|
|
/> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="入职日期" prop="hireDate" width="120" :formatter="dateFormatter" /> |
|
|
|
|
<el-table-column label="离职日期" prop="" width="120" :formatter="dateFormatter" /> |
|
|
|
|
<el-table-column label="操作" width="200"> |
|
|
|
|
<el-table-column label="操作" width="180"> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<el-button |
|
|
|
|
type="primary" |
|
|
|
@ -175,18 +191,18 @@ const openForm = (type: string, id?: number) => { |
|
|
|
|
formRef.value.open(type, id) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** 修改用户状态 */ |
|
|
|
|
/** 修改在职状态 */ |
|
|
|
|
const handleStatusChange = async (row: UserApi.UserVO) => { |
|
|
|
|
try { |
|
|
|
|
// 修改状态的二次确认 |
|
|
|
|
const text = row.status === CommonStatusEnum.ENABLE ? '启用' : '停用' |
|
|
|
|
const text = row.status === CommonStatusEnum.ENABLE ? '入职' : '离职' |
|
|
|
|
let result = { value: '' } |
|
|
|
|
if (text == '启用') { |
|
|
|
|
await message.confirm('确认要"' + text + '""' + row.username + '"用户吗?') |
|
|
|
|
if (text == '入职') { |
|
|
|
|
await message.confirm('确认要"' + text + '""' + row.nickname + '"吗?') |
|
|
|
|
} else { |
|
|
|
|
result = await message.prompt( |
|
|
|
|
'请输入年月日,如2024-01-01', |
|
|
|
|
'确认要"' + text + '""' + row.username + '"用户吗?' |
|
|
|
|
'确认要"' + text + '""' + row.nickname + '"用户吗?' |
|
|
|
|
) |
|
|
|
|
const regex = /^\d{4}-\d{2}-\d{2}$/ |
|
|
|
|
|
|
|
|
@ -196,7 +212,25 @@ const handleStatusChange = async (row: UserApi.UserVO) => { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 发起修改状态 |
|
|
|
|
await UserApi.updateUserStatus(row.id, row.status, result.value) |
|
|
|
|
await UserApi.updateUserStatus(row.id, row.status, result.value, row.inUse) |
|
|
|
|
message.success('修改成功') |
|
|
|
|
// 刷新列表 |
|
|
|
|
await getList() |
|
|
|
|
} catch { |
|
|
|
|
// 取消后,进行恢复按钮 |
|
|
|
|
row.status = |
|
|
|
|
row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE : CommonStatusEnum.ENABLE |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 修改启用状态 |
|
|
|
|
const handleUseChange = async (row: UserApi.UserVO) => { |
|
|
|
|
try { |
|
|
|
|
// 修改状态的二次确认 |
|
|
|
|
const text = row.status === CommonStatusEnum.ENABLE ? '启用' : '禁用' |
|
|
|
|
await message.confirm('确认要"' + text + '""' + row.nickname + '"吗?') |
|
|
|
|
// 发起修改状态 |
|
|
|
|
await UserApi.updateUserStatus(row.id, row.status, row.retireDate, row.inUse) |
|
|
|
|
message.success('修改成功') |
|
|
|
|
// 刷新列表 |
|
|
|
|
await getList() |
|
|
|
|