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
loginIp: string
status: number
inUse: number
hireStatus: number
remark: string
loginDate: 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 = {
id,
status,
retireDate,
inUse
hireStatus
}
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="手机号码" prop="mobile" width="120" />
<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">
<el-switch
v-model="scope.row.status"
v-model="scope.row.hireStatus"
:active-value="0"
:inactive-value="1"
active-text="在职"
@ -65,16 +65,16 @@
/>
</template>
</el-table-column>
<el-table-column label="启用状态" key="inUse" width="120">
<el-table-column label="启用状态" key="status" width="120">
<template #default="scope">
<el-switch
v-model="scope.row.inUse"
v-model="scope.row.status"
:active-value="0"
:inactive-value="1"
active-text="启用"
inactive-text="禁用"
size="small"
:disabled="scope.row.status == 1"
:disabled="scope.row.hireStatus == 1"
v-hasPermi="['basic:employee:update']"
@change="handleUseChange(scope.row)"
/>
@ -195,7 +195,7 @@ const openForm = (type: string, id?: number) => {
const handleStatusChange = async (row: UserApi.UserVO) => {
try {
//
const text = row.status === CommonStatusEnum.ENABLE ? '入职' : '离职'
const text = row.hireStatus === CommonStatusEnum.ENABLE ? '入职' : '离职'
let result = { value: '' }
if (text == '入职') {
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('修改成功')
//
await getList()
} catch {
//
row.status =
row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE : CommonStatusEnum.ENABLE
row.hireStatus =
row.hireStatus === CommonStatusEnum.ENABLE
? CommonStatusEnum.DISABLE
: CommonStatusEnum.ENABLE
}
}
@ -230,7 +232,7 @@ const handleUseChange = async (row: UserApi.UserVO) => {
const text = row.status === CommonStatusEnum.ENABLE ? '启用' : '禁用'
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('修改成功')
//
await getList()

Loading…
Cancel
Save