refactor(user): 优化用户管理模块提升体验与代码质量

- 删除系统用户管理模块中重复且冗余的 Extra 组件及相关引用
- 修复用户列表数据请求时搜索条件被覆盖的问题,保留默认筛选参数
- 清理未使用的 userType 和 handleTabs 相关代码,减少死代码
- 修改密码重置操作的明文展示方式,改为使用弹窗提示,提升安全性
- 在用户及管理员列表中新增状态列,显示用户状态(正常/冻结)
- 修改表格行点击事件为打开用户详情界面,移除无提示双击编辑操作
- 在用户列表页面新增高级筛选条件(角色、注册来源、类型)
- 添加搜索和重置按钮,绑定高级筛选参数,提高筛选灵活性
This commit is contained in:
2026-07-11 19:02:29 +08:00
parent 548a178a55
commit 05c8f765da
6 changed files with 143 additions and 121 deletions

View File

@@ -1,8 +1,5 @@
<template>
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
<template #extra>
<Extra />
</template>
<a-card :bordered="false">
<!-- 表格 -->
<ele-pro-table
@@ -56,6 +53,11 @@
{{ item.roleName }}
</a-tag>
</template>
<template v-if="column.key === 'status'">
<a-tag v-if="record.status === 0" color="green">正常</a-tag>
<a-tag v-else-if="record.status === 1" color="red">冻结</a-tag>
<span v-else>-</span>
</template>
<template v-if="column.key === 'platform'">
<WechatOutlined v-if="record.platform === 'MP-WEIXIN'" />
<Html5Outlined v-if="record.platform === 'H5'" />
@@ -144,7 +146,6 @@
import { Organization } from '@/api/system/organization/model';
import { hasRole } from '@/utils/permission';
import { getPageTitle } from '@/utils/common';
import Extra from '@/views/system/user/components/Extra.vue';
// 加载状态
const loading = ref(true);
@@ -164,7 +165,6 @@
const showInfo = ref(false);
// 是否显示用户导入弹窗
const showImport = ref(false);
const userType = ref<number>();
const searchText = ref('');
// 加载角色
@@ -255,6 +255,13 @@
key: 'roles',
align: 'center'
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
align: 'center',
width: 90
},
{
title: '注册时间',
dataIndex: 'createTime',
@@ -280,18 +287,13 @@
});
// 表格数据源
const datasource: DatasourceFunction = ({
page,
limit,
where,
orders,
filters
}) => {
where = {};
where.roleId = filters.roles;
where.keywords = searchText.value;
where.isAdmin = 1;
return pageUsers({ page, limit, ...where, ...orders });
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
const params = {
...where,
keywords: searchText.value,
isAdmin: 1
};
return pageUsers({ page, limit, ...params, ...orders });
};
/* 搜索 */
@@ -317,11 +319,6 @@
showImport.value = true;
};
const handleTabs = (e) => {
userType.value = Number(e.target.value);
reload();
};
/* 删除单个 */
const remove = (row: User) => {
const hide = messageLoading('请求中..', 0);
@@ -375,9 +372,12 @@
const hide = message.loading('请求中..', 0);
const password = uuid(8);
updateUserPassword(row.userId, password)
.then((msg) => {
.then(() => {
hide();
message.success(msg + ',新密码:' + password);
Modal.success({
title: '密码重置成功',
content: `新密码:${password}(请妥善保管并及时通知用户)`
});
})
.catch((e) => {
hide();
@@ -402,13 +402,9 @@
/* 自定义行属性 */
const customRow = (record: User) => {
return {
// 行点击事件
// 行点击查看用户详情
onClick: () => {
// console.log(record);
},
// 行双击事件
onDblclick: () => {
openEdit(record);
openInfo(record);
}
};
};