This commit is contained in:
qsh
2024-05-23 15:24:05 +08:00
parent 3050b9a2fe
commit 33be215c0a
11 changed files with 60 additions and 127 deletions

View File

@@ -35,7 +35,7 @@
<el-table-column label="用户编号" key="id" prop="id" />
<el-table-column label="用户名称" prop="username" />
<el-table-column label="用户昵称" prop="nickname" />
<el-table-column label="部门" key="deptName" prop="dept.name" />
<el-table-column label="部门" key="deptName" prop="deptName" />
<el-table-column label="手机号码" prop="mobile" width="120" />
<el-table-column label="状态" key="status">
<template #default="scope">
@@ -47,7 +47,12 @@
/>
</template>
</el-table-column>
<el-table-column label="创建时间" prop="createTime" width="180" />
<el-table-column
label="创建时间"
prop="createTime"
width="180"
:formatter="dateFormatter"
/>
<el-table-column label="操作" width="260">
<template #default="scope">
<el-button type="primary" link @click="openForm('update', scope.row.id)">
@@ -72,6 +77,7 @@
</template>
<script setup lang="ts" name="SystemUser">
import { CommonStatusEnum } from '@/utils/constants'
import { dateFormatter } from '@/utils/formatTime'
import * as UserApi from '@/api/system/user'
import UserForm from './UserForm.vue'
import DeptTree from './DeptTree.vue'
@@ -94,11 +100,7 @@ const queryFormRef = ref() // 搜索的表单
const getList = async () => {
loading.value = true
try {
// const data = await UserApi.getUserPage(queryParams)
const data = {
list: [{ username: '测试', status: 0 }],
total: 0
}
const data = await UserApi.getUserPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
@@ -137,7 +139,7 @@ const handleStatusChange = async (row: UserApi.UserVO) => {
const text = row.status === CommonStatusEnum.ENABLE ? '启用' : '停用'
await message.confirm('确认要"' + text + '""' + row.username + '"用户吗?')
// 发起修改状态
// await UserApi.updateUserStatus(row.id, row.status)
await UserApi.updateUserStatus(row.id, row.status)
// 刷新列表
await getList()
} catch {
@@ -150,12 +152,10 @@ const handleStatusChange = async (row: UserApi.UserVO) => {
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
console.log(id)
// 删除的二次确认
await message.delConfirm()
// 发起删除
// await UserApi.deleteUser(id)
await UserApi.deleteUser(id)
message.success(t('common.delSuccess'))
// 刷新列表
await getList()
@@ -172,7 +172,7 @@ const handleResetPwd = async (row: UserApi.UserVO) => {
)
const password = result.value
// 发起重置
// await UserApi.resetUserPwd(row.id, password)
await UserApi.resetUserPwd(row.id, password)
message.success('修改成功,新密码是:' + password)
} catch {}
}