qsh 4 days ago
parent beb12193b3
commit c01fea9c5b
  1. 11
      src/api/system/user/index.ts
  2. 22
      src/views/Basic/User/index.vue

@ -12,7 +12,7 @@ export interface UserVO {
avatar: string avatar: string
loginIp: string loginIp: string
status: number status: number
inUse: number hireStatus: number
remark: string remark: string
loginDate: Date loginDate: Date
createTime: Date createTime: Date
@ -64,12 +64,17 @@ export const resetUserPwd = (id: number, password: string) => {
} }
// 用户状态修改 // 用户状态修改
export const updateUserStatus = (id: number, status: number, retireDate: string, inUse: number) => { export const updateUserStatus = (
id: number,
status: number,
retireDate: string,
hireStatus: number
) => {
const data = { const data = {
id, id,
status, status,
retireDate, retireDate,
inUse hireStatus
} }
return request.put({ url: '/admin-api/system/user/update-status', data: data }) return request.put({ url: '/admin-api/system/user/update-status', data: data })
} }

@ -51,10 +51,10 @@
<el-table-column label="部门" key="deptName" prop="deptName" width="100" /> <el-table-column label="部门" key="deptName" prop="deptName" width="100" />
<el-table-column label="手机号码" prop="mobile" width="120" /> <el-table-column label="手机号码" prop="mobile" width="120" />
<el-table-column label="微信号" prop="wxAlias" min-width="80" /> <el-table-column label="微信号" prop="wxAlias" min-width="80" />
<el-table-column label="在职状态" key="status" width="120"> <el-table-column label="在职状态" key="hireStatus" width="120">
<template #default="scope"> <template #default="scope">
<el-switch <el-switch
v-model="scope.row.status" v-model="scope.row.hireStatus"
:active-value="0" :active-value="0"
:inactive-value="1" :inactive-value="1"
active-text="在职" active-text="在职"
@ -65,16 +65,16 @@
/> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="启用状态" key="inUse" width="120"> <el-table-column label="启用状态" key="status" width="120">
<template #default="scope"> <template #default="scope">
<el-switch <el-switch
v-model="scope.row.inUse" v-model="scope.row.status"
:active-value="0" :active-value="0"
:inactive-value="1" :inactive-value="1"
active-text="启用" active-text="启用"
inactive-text="禁用" inactive-text="禁用"
size="small" size="small"
:disabled="scope.row.status == 1" :disabled="scope.row.hireStatus == 1"
v-hasPermi="['basic:employee:update']" v-hasPermi="['basic:employee:update']"
@change="handleUseChange(scope.row)" @change="handleUseChange(scope.row)"
/> />
@ -195,7 +195,7 @@ const openForm = (type: string, id?: number) => {
const handleStatusChange = async (row: UserApi.UserVO) => { const handleStatusChange = async (row: UserApi.UserVO) => {
try { try {
// //
const text = row.status === CommonStatusEnum.ENABLE ? '入职' : '离职' const text = row.hireStatus === CommonStatusEnum.ENABLE ? '入职' : '离职'
let result = { value: '' } let result = { value: '' }
if (text == '入职') { if (text == '入职') {
await message.confirm('确认要"' + text + '""' + row.nickname + '"吗?') await message.confirm('确认要"' + text + '""' + row.nickname + '"吗?')
@ -212,14 +212,16 @@ const handleStatusChange = async (row: UserApi.UserVO) => {
} }
} }
// //
await UserApi.updateUserStatus(row.id, row.status, result.value, row.inUse) await UserApi.updateUserStatus(row.id, row.status, result.value, row.hireStatus)
message.success('修改成功') message.success('修改成功')
// //
await getList() await getList()
} catch { } catch {
// //
row.status = row.hireStatus =
row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE : CommonStatusEnum.ENABLE row.hireStatus === CommonStatusEnum.ENABLE
? CommonStatusEnum.DISABLE
: CommonStatusEnum.ENABLE
} }
} }
@ -230,7 +232,7 @@ const handleUseChange = async (row: UserApi.UserVO) => {
const text = row.status === CommonStatusEnum.ENABLE ? '启用' : '禁用' const text = row.status === CommonStatusEnum.ENABLE ? '启用' : '禁用'
await message.confirm('确认要"' + text + '""' + row.nickname + '"吗?') await message.confirm('确认要"' + text + '""' + row.nickname + '"吗?')
// //
await UserApi.updateUserStatus(row.id, row.status, row.retireDate, row.inUse) await UserApi.updateUserStatus(row.id, row.status, row.retireDate, row.hireStatus)
message.success('修改成功') message.success('修改成功')
// //
await getList() await getList()

Loading…
Cancel
Save