sc
This commit is contained in:
@@ -12,9 +12,11 @@ export interface UserVO {
|
|||||||
avatar: string
|
avatar: string
|
||||||
loginIp: string
|
loginIp: string
|
||||||
status: number
|
status: number
|
||||||
|
inUse: number
|
||||||
remark: string
|
remark: string
|
||||||
loginDate: Date
|
loginDate: Date
|
||||||
createTime: Date
|
createTime: Date
|
||||||
|
retireDate: string
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询用户管理列表
|
// 查询用户管理列表
|
||||||
@@ -62,11 +64,12 @@ export const resetUserPwd = (id: number, password: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 用户状态修改
|
// 用户状态修改
|
||||||
export const updateUserStatus = (id: number, status: number, retireDate: string) => {
|
export const updateUserStatus = (id: number, status: number, retireDate: string, inUse: number) => {
|
||||||
const data = {
|
const data = {
|
||||||
id,
|
id,
|
||||||
status,
|
status,
|
||||||
retireDate
|
retireDate,
|
||||||
|
inUse
|
||||||
}
|
}
|
||||||
return request.put({ url: '/admin-api/system/user/update-status', data: data })
|
return request.put({ url: '/admin-api/system/user/update-status', data: data })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,13 +45,13 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-table v-loading="loading" :data="list">
|
<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="username" />
|
||||||
<el-table-column label="用户姓名" prop="nickname" />
|
<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="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="180">
|
<el-table-column label="在职状态" key="status" width="120">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="scope.row.status"
|
v-model="scope.row.status"
|
||||||
@@ -59,14 +59,30 @@
|
|||||||
:inactive-value="1"
|
:inactive-value="1"
|
||||||
active-text="在职"
|
active-text="在职"
|
||||||
inactive-text="离职"
|
inactive-text="离职"
|
||||||
|
size="small"
|
||||||
v-hasPermi="['basic:employee:update']"
|
v-hasPermi="['basic:employee:update']"
|
||||||
@change="handleStatusChange(scope.row)"
|
@change="handleStatusChange(scope.row)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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="hireDate" width="120" :formatter="dateFormatter" />
|
||||||
<el-table-column label="离职日期" prop="" 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">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
@@ -175,18 +191,18 @@ const openForm = (type: string, id?: number) => {
|
|||||||
formRef.value.open(type, id)
|
formRef.value.open(type, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 修改用户状态 */
|
/** 修改在职状态 */
|
||||||
const handleStatusChange = async (row: UserApi.UserVO) => {
|
const handleStatusChange = async (row: UserApi.UserVO) => {
|
||||||
try {
|
try {
|
||||||
// 修改状态的二次确认
|
// 修改状态的二次确认
|
||||||
const text = row.status === CommonStatusEnum.ENABLE ? '启用' : '停用'
|
const text = row.status === CommonStatusEnum.ENABLE ? '入职' : '离职'
|
||||||
let result = { value: '' }
|
let result = { value: '' }
|
||||||
if (text == '启用') {
|
if (text == '入职') {
|
||||||
await message.confirm('确认要"' + text + '""' + row.username + '"用户吗?')
|
await message.confirm('确认要"' + text + '""' + row.nickname + '"吗?')
|
||||||
} else {
|
} else {
|
||||||
result = await message.prompt(
|
result = await message.prompt(
|
||||||
'请输入年月日,如2024-01-01',
|
'请输入年月日,如2024-01-01',
|
||||||
'确认要"' + text + '""' + row.username + '"用户吗?'
|
'确认要"' + text + '""' + row.nickname + '"用户吗?'
|
||||||
)
|
)
|
||||||
const regex = /^\d{4}-\d{2}-\d{2}$/
|
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('修改成功')
|
message.success('修改成功')
|
||||||
// 刷新列表
|
// 刷新列表
|
||||||
await getList()
|
await getList()
|
||||||
|
|||||||
Reference in New Issue
Block a user