From 05c8f765dae996fd555240580376c23eab3131cc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com>
Date: Sat, 11 Jul 2026 19:02:29 +0800
Subject: [PATCH] =?UTF-8?q?refactor(user):=20=E4=BC=98=E5=8C=96=E7=94=A8?=
=?UTF-8?q?=E6=88=B7=E7=AE=A1=E7=90=86=E6=A8=A1=E5=9D=97=E6=8F=90=E5=8D=87?=
=?UTF-8?q?=E4=BD=93=E9=AA=8C=E4=B8=8E=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 删除系统用户管理模块中重复且冗余的 Extra 组件及相关引用
- 修复用户列表数据请求时搜索条件被覆盖的问题,保留默认筛选参数
- 清理未使用的 userType 和 handleTabs 相关代码,减少死代码
- 修改密码重置操作的明文展示方式,改为使用弹窗提示,提升安全性
- 在用户及管理员列表中新增状态列,显示用户状态(正常/冻结)
- 修改表格行点击事件为打开用户详情界面,移除无提示双击编辑操作
- 在用户列表页面新增高级筛选条件(角色、注册来源、类型)
- 添加搜索和重置按钮,绑定高级筛选参数,提高筛选灵活性
---
.workbuddy/memory/2026-07-11.md | 32 ++++++
src/views/system/admin/index.vue | 56 +++++-----
src/views/system/organization/index.vue | 4 -
src/views/system/user/components/Extra.vue | 54 ----------
src/views/system/user/index.vue | 114 +++++++++++++++------
src/views/system/userVerify2/index.vue | 4 -
6 files changed, 143 insertions(+), 121 deletions(-)
create mode 100644 .workbuddy/memory/2026-07-11.md
delete mode 100644 src/views/system/user/components/Extra.vue
diff --git a/.workbuddy/memory/2026-07-11.md b/.workbuddy/memory/2026-07-11.md
new file mode 100644
index 0000000..92ef9e8
--- /dev/null
+++ b/.workbuddy/memory/2026-07-11.md
@@ -0,0 +1,32 @@
+# 2026-07-11 工作日志
+
+## 用户管理模块 UX 优化(guilixu-admin 前端)
+
+按用户确认的方案,对 `src/views/system/` 下用户管理模块做了一轮优化:
+
+### 1. 隐藏右上角三个导航按钮
+- 原 `src/views/system/user/components/Extra.vue` 定义了「人员管理 / 实名认证 / 管理员列表」三个按钮,被 4 个页面复用:`user/index.vue`、`admin/index.vue`、`userVerify2/index.vue`、`organization/index.vue`。
+- 已移除这 4 个页面里对 `` 的引用与 import,并删除孤儿组件 `Extra.vue`。
+
+### 2. 修复搜索条件被覆盖的 bug
+- `user/index.vue` 与 `admin/index.vue` 的 `datasource` 中 `where = {}` 会清空传入条件(导致 `defaultWhere` 失效)。改为 `const params = { ...where, ... }` 合并后传给 `pageUsers`。
+
+### 3. 清理死代码
+- 删除 `userType`、`handleTabs`(user/index.vue、admin/index.vue 均未使用)。
+
+### 4. 修复重置密码明文安全问题
+- `resetPsw` 原先把明文新密码直接显示在 `message.success` 中;改为 `Modal.success` 弹窗展示,避免明文暴露。
+
+### 5. 增加用户状态列 + 行点击查看详情
+- user/admin 列表新增「状态」列(正常/冻结,读取 `record.status`)。
+- 表格行 `onClick` 改为打开用户详情抽屉(`openInfo`),移除原无提示的双击编辑。
+
+### 6. 新增高级筛选(仅 user/index.vue)
+- 在页头加入角色 / 注册来源(platform) / 类型(isAdmin) 三个筛选条件 + 搜索/重置按钮,绑定 `searchWhere` reactive,datasource 读取后传给 `pageUsers`。
+
+### 验证
+- 已用 `vue-tsc --noEmit` 跑类型检查(后台进行中),待结果确认无编译错误。
+
+### 备注
+- 方案中的「Batch 3 长期维护项」(admin/user 组件合并、导入模板配置化、search.vue 重命名)本次未执行,属可选重构,风险较高,留待后续。
+- Grep 工具在当前环境因 pcre2 动态库缺失报错,改用 bash grep 替代。
diff --git a/src/views/system/admin/index.vue b/src/views/system/admin/index.vue
index 5f6c7e5..d2d5501 100644
--- a/src/views/system/admin/index.vue
+++ b/src/views/system/admin/index.vue
@@ -1,8 +1,5 @@
$router.go(-1)">
-
-
-
+
+ 正常
+ 冻结
+ -
+
@@ -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();
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);
}
};
};
diff --git a/src/views/system/organization/index.vue b/src/views/system/organization/index.vue
index ebf61a8..4d26c28 100644
--- a/src/views/system/organization/index.vue
+++ b/src/views/system/organization/index.vue
@@ -1,8 +1,5 @@
$router.go(-1)">
-
-
-
-
-
- 人员管理
-
- 实名认证
-
- 管理员列表
-
-
-
-
-
diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index 61032fe..dfe3b85 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -1,8 +1,50 @@
$router.go(-1)">
-
-
-
+
+
+
+
+ {{ item.text }}
+
+
+
+
+ 微信小程序
+ H5
+ Web
+
+
+
+
+ 管理员
+ 普通用户
+
+
+
+ 搜索
+ 重置
+
+
+
+ 正常
+ 冻结
+ -
+
@@ -191,7 +238,6 @@
import { Organization } from '@/api/system/organization/model';
import { hasRole } from '@/utils/permission';
import { getPageTitle } from '@/utils/common';
- import Extra from './components/Extra.vue';
import { useUserStore } from '@/store/modules/user';
// 加载状态
@@ -212,8 +258,19 @@
const showInfo = ref(false);
// 是否显示用户导入弹窗
const showImport = ref(false);
- const userType = ref();
const searchText = ref('');
+ // 高级筛选条件
+ const searchWhere = reactive({
+ roleId: undefined,
+ platform: undefined,
+ isAdmin: undefined
+ });
+ const resetSearch = () => {
+ searchWhere.roleId = undefined;
+ searchWhere.platform = undefined;
+ searchWhere.isAdmin = undefined;
+ reload();
+ };
const userStore = useUserStore();
// 当前用户信息
const loginUser = computed(() => userStore.info ?? {});
@@ -393,6 +450,13 @@
key: 'roles',
align: 'center'
},
+ {
+ title: '状态',
+ dataIndex: 'status',
+ key: 'status',
+ align: 'center',
+ width: 90
+ },
{
title: '管理员',
key: 'isAdmin',
@@ -426,17 +490,15 @@
});
// 表格数据源
- const datasource: DatasourceFunction = ({
- page,
- limit,
- where,
- orders,
- filters
- }) => {
- where = {};
- where.roleId = filters.roles;
- where.keywords = searchText.value;
- return pageUsers({ page, limit, ...where, ...orders });
+ const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
+ const params = {
+ ...where,
+ keywords: searchText.value,
+ roleId: searchWhere.roleId,
+ platform: searchWhere.platform,
+ isAdmin: searchWhere.isAdmin || undefined
+ };
+ return pageUsers({ page, limit, ...params, ...orders });
};
/* 搜索 */
@@ -462,11 +524,6 @@
showImport.value = true;
};
- const handleTabs = (e) => {
- userType.value = Number(e.target.value);
- reload();
- };
-
/* 删除单个 */
const remove = (row: User) => {
const hide = messageLoading('请求中..', 0);
@@ -520,9 +577,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();
@@ -647,13 +707,9 @@
/* 自定义行属性 */
const customRow = (record: User) => {
return {
- // 行点击事件
+ // 行点击查看用户详情
onClick: () => {
- // console.log(record);
- },
- // 行双击事件
- onDblclick: () => {
- openEdit(record);
+ openInfo(record);
}
};
};
diff --git a/src/views/system/userVerify2/index.vue b/src/views/system/userVerify2/index.vue
index 4e18abb..2fd88cb 100644
--- a/src/views/system/userVerify2/index.vue
+++ b/src/views/system/userVerify2/index.vue
@@ -1,8 +1,5 @@
$router.go(-1)">
-
-
-
| null>(null);