feat(staff): action buttons → filtered customer/group list
Adds groups.user_id filter; viewCustomers/viewGroups push owner_account_id query; CustomerList/GroupList read it. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,10 @@ const departmentId = computed<string | null>(() =>
|
||||
route.query.department_id ? String(route.query.department_id) : null,
|
||||
)
|
||||
|
||||
const ownerId = computed<string | null>(() =>
|
||||
route.query.owner_account_id ? String(route.query.owner_account_id) : null,
|
||||
)
|
||||
|
||||
const departmentName = computed(() => {
|
||||
if (!departmentId.value) return null
|
||||
return org.findNode(departmentId.value)?.label ?? departmentId.value
|
||||
@@ -96,6 +100,7 @@ async function load(): Promise<void> {
|
||||
page: page.value,
|
||||
page_size: pageSize.value,
|
||||
department_id: departmentId.value ?? undefined,
|
||||
owner_account_id: ownerId.value ?? undefined,
|
||||
})
|
||||
customers.value = res.items
|
||||
total.value = res.total
|
||||
@@ -118,9 +123,16 @@ function handlePageSizeChange(s: number): void {
|
||||
load()
|
||||
}
|
||||
|
||||
// React to top-bar channel + dept tree selection.
|
||||
/** Drop the ``owner_account_id`` query param while preserving any others. */
|
||||
function clearOwnerFilter(): void {
|
||||
const { owner_account_id: _drop, ...rest } = route.query
|
||||
void _drop
|
||||
router.replace({ query: rest })
|
||||
}
|
||||
|
||||
// React to top-bar channel + dept tree selection + owner_account_id query.
|
||||
watch(
|
||||
() => [channelStore.channel, departmentId.value] as const,
|
||||
() => [channelStore.channel, departmentId.value, ownerId.value] as const,
|
||||
() => {
|
||||
page.value = 1
|
||||
load()
|
||||
@@ -174,6 +186,7 @@ onMounted(load)
|
||||
<span class="yk-customers__sub">
|
||||
共 {{ total }} 条
|
||||
<template v-if="departmentName"> · 部门:{{ departmentName }}</template>
|
||||
<template v-if="ownerId"> · 员工账号:{{ ownerId }}</template>
|
||||
· 渠道:{{ channelLabelCurrent }}
|
||||
</span>
|
||||
</div>
|
||||
@@ -200,6 +213,15 @@ onMounted(load)
|
||||
>
|
||||
清除部门筛选
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="ownerId"
|
||||
size="small"
|
||||
type="info"
|
||||
plain
|
||||
@click="clearOwnerFilter"
|
||||
>
|
||||
清除员工筛选
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user