From 11ec728cf48a0f8f75f0d52826ad994deb34e589 Mon Sep 17 00:00:00 2001 From: linmianxun <634841751@qq.com> Date: Mon, 14 Sep 2026 22:19:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E5=88=97=E8=A1=A8=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E5=88=86=E9=A1=B5=E7=BB=84=E4=BB=B6=EF=BC=8C=E5=B7=A5?= =?UTF-8?q?=E5=8D=95/=E4=BA=BA=E5=91=98/=E8=B4=A6=E5=8F=B7=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E6=9C=8D=E5=8A=A1=E7=AB=AF=E5=88=86=E9=A1=B5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- .../src/views/inquiry/account/index.vue | 85 ++++++--- .../inquiry/components/AdminPagination.vue | 172 ++++++++++++++++++ .../src/views/inquiry/staffRole/index.vue | 37 +++- .../views/inquiry/styles/admin-fidelity.css | 17 ++ .../src/views/inquiry/workOrder/index.vue | 30 ++- 5 files changed, 298 insertions(+), 43 deletions(-) create mode 100644 inquiry-backend/src/views/inquiry/components/AdminPagination.vue diff --git a/inquiry-backend/src/views/inquiry/account/index.vue b/inquiry-backend/src/views/inquiry/account/index.vue index 3cbc642..3f71393 100644 --- a/inquiry-backend/src/views/inquiry/account/index.vue +++ b/inquiry-backend/src/views/inquiry/account/index.vue @@ -18,9 +18,13 @@ import { } from "/@/views/inquiry/account/account.api"; import ProtoIcon from "/@/views/inquiry/components/ProtoIcon.vue"; import AdminModal from "/@/views/inquiry/components/AdminModal.vue"; +import AdminPagination from "/@/views/inquiry/components/AdminPagination.vue"; const rows = ref([]); const loading = ref(false); +const total = ref(0); +const pageNo = ref(1); +const pageSize = ref(10); const roleOptions = ref<{ value: string; label: string; tag: string }[]>([]); const filters = reactive({ keyword: "", status: "" as "" | "active" | "disabled" }); const modalOpen = ref(false); @@ -35,15 +39,6 @@ const form = reactive({ password: "", }); -const filtered = computed(() => - rows.value.filter((r) => { - const kw = filters.keyword.trim().toLowerCase(); - if (kw && !`${r.username}${r.name}${r.wecomUserId}${r.phoneMasked}`.toLowerCase().includes(kw)) return false; - if (filters.status && r.status !== filters.status) return false; - return true; - }), -); - const modalTitle = computed(() => (editing.value ? "编辑账号" : "新建账号")); const modalSub = computed(() => editing.value ? `正在编辑:${editing.value.username}` : "创建账号并绑定角色", @@ -67,8 +62,28 @@ async function loadList() { loading.value = true; try { if (!roleOptions.value.length) await loadRoles(); - const res: any = await listUsers({ pageNo: 1, pageSize: 200 }); - const records = res?.records || res?.result?.records || []; + const kw = filters.keyword.trim(); + // Jeecg QueryGenerator:字段值包 * 走 LIKE。多字段 AND 过严,按关键字形态选一个字段。 + const params: Record = { + pageNo: pageNo.value, + pageSize: pageSize.value, + }; + if (kw) { + if (/[\u4e00-\u9fff]/.test(kw)) { + params.realname = `*${kw}*`; + } else if (/^\d{5,}$/.test(kw)) { + params.phone = `*${kw}*`; + } else { + params.username = `*${kw}*`; + } + } + if (filters.status === "active") params.status = 1; + if (filters.status === "disabled") params.status = 2; + + const res: any = await listUsers(params); + const page = res?.records ? res : res?.result || {}; + const records = page.records || []; + total.value = Number(page.total || records.length || 0); const mapped: AccountRow[] = []; for (const u of records as any[]) { let roleId = ""; @@ -89,6 +104,11 @@ async function loadList() { mapped.push(mapUserToAccount(u, roleId, roleLabel, roleTag)); } rows.value = mapped; + const maxPage = Math.max(1, Math.ceil(total.value / pageSize.value) || 1); + if (pageNo.value > maxPage) { + pageNo.value = maxPage; + await loadList(); + } } catch (e: any) { message.error(e?.message || "加载账号失败"); } finally { @@ -96,6 +116,20 @@ async function loadList() { } } +let accountSearchTimer: ReturnType | null = null; +watch( + () => [filters.keyword, filters.status], + () => { + pageNo.value = 1; + if (accountSearchTimer) clearTimeout(accountSearchTimer); + accountSearchTimer = setTimeout(() => loadList(), 250); + }, +); + +function onPageChange() { + loadList(); +} + onMounted(() => loadList()); function openCreate() { @@ -225,13 +259,6 @@ function removeAccount(row: AccountRow) { }, }); } - -watch( - () => filters.keyword, - () => { - /* 本地过滤即可,账号量通常很小 */ - }, -);