From a241b66efcc41e973290a6722fb7a4d79b833ea1 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期二, 13 十月 2026 09:54:32 +0800
Subject: [PATCH] feat(bi): 为图表配置接口添加名称字段
---
src/views/crm/customer/pool/index.vue | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 104 insertions(+), 6 deletions(-)
diff --git a/src/views/crm/customer/pool/index.vue b/src/views/crm/customer/pool/index.vue
index ce4a1a6..1e68a0e 100644
--- a/src/views/crm/customer/pool/index.vue
+++ b/src/views/crm/customer/pool/index.vue
@@ -2,24 +2,86 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { CrmCustomerApi } from '#/api/crm/customer';
+import { ref } from 'vue';
import { useRouter } from 'vue-router';
-import { Page } from '../../../../packages/effects/common-ui/src';
-import { downloadFileFromBlobPart } from '../../../../packages/utils/src';
+import { confirm, Page, useVbenModal } from '@vben/common-ui';
+import { downloadFileFromBlobPart } from '@vben/utils';
-import { Button } from 'ant-design-vue';
+import { Button, message } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
-import { exportCustomer, getCustomerPage } from '#/api/crm/customer';
+import {
+ exportCustomer,
+ getCustomerPage,
+ receiveCustomer,
+} from '#/api/crm/customer';
import { $t } from '#/locales';
+import DistributeForm from '../detail/modules/distribute-form.vue';
import { useGridColumns, useGridFormSchema } from './data';
const { push } = useRouter();
+const receiving = ref(false);
+const [DistributeModal, distributeModalApi] = useVbenModal({
+ connectedComponent: DistributeForm,
+ destroyOnClose: true,
+});
+
+function handleRefresh() {
+ gridApi.grid.clearCheckboxRow();
+ gridApi.query();
+}
+
+function getCustomerIds(row?: CrmCustomerApi.Customer): number[] {
+ const records: CrmCustomerApi.Customer[] = row
+ ? [row]
+ : gridApi.grid.getCheckboxRecords();
+ const ids = records.map((item) => item.id!);
+ if (ids.length === 0) {
+ message.warning('璇峰厛鍕鹃�夊鎴�');
+ }
+ return ids;
+}
+
+/** 棰嗗彇鍗曟潯鎴栧嬀閫夌殑鍏捣瀹㈡埛 */
+async function handleReceive(row?: CrmCustomerApi.Customer) {
+ if (receiving.value) return;
+ const ids = getCustomerIds(row);
+ if (ids.length === 0) return;
+ receiving.value = true;
+ try {
+ try {
+ await confirm(
+ row
+ ? `纭畾棰嗗彇瀹㈡埛銆�${row.name}銆戝悧锛焋
+ : `纭畾棰嗗彇閫変腑鐨� ${ids.length} 涓鎴峰悧锛焋,
+ );
+ } catch {
+ return;
+ }
+ await receiveCustomer(ids);
+ message.success('棰嗗彇瀹㈡埛鎴愬姛');
+ handleRefresh();
+ } finally {
+ receiving.value = false;
+ }
+}
+
+/** 鍒嗛厤鍗曟潯鎴栧嬀閫夌殑鍏捣瀹㈡埛 */
+function handleDistribute(row?: CrmCustomerApi.Customer) {
+ const ids = getCustomerIds(row);
+ if (ids.length === 0) return;
+ distributeModalApi.setData({ ids }).open();
+}
/** 瀵煎嚭琛ㄦ牸 */
async function handleExport() {
- const data = await exportCustomer(await gridApi.formApi.getValues());
+ const data = await exportCustomer({
+ ...(await gridApi.formApi.getValues()),
+ pool: true,
+ sceneType: 4,
+ });
downloadFileFromBlobPart({ fileName: '瀹㈡埛鍏捣.xls', source: data });
}
@@ -43,6 +105,7 @@
pageNo: page.currentPage,
pageSize: page.pageSize,
pool: true,
+ sceneType: 4,
...formValues,
});
},
@@ -61,10 +124,25 @@
</script>
<template>
- <Page auto-content-height><Grid>
+ <Page auto-content-height>
+ <DistributeModal @success="handleRefresh" />
+ <Grid>
<template #toolbar-tools>
<TableAction
:actions="[
+ {
+ label: '棰嗗彇瀹㈡埛',
+ type: 'primary',
+ auth: ['crm:customer:receive'],
+ disabled: receiving,
+ onClick: () => handleReceive(),
+ },
+ {
+ label: '鍒嗛厤瀹㈡埛',
+ auth: ['crm:customer:distribute'],
+ disabled: receiving,
+ onClick: () => handleDistribute(),
+ },
{
label: $t('ui.actionTitle.export'),
type: 'primary',
@@ -75,6 +153,26 @@
]"
/>
</template>
+ <template #actions="{ row }">
+ <TableAction
+ :actions="[
+ {
+ label: '棰嗗彇',
+ type: 'link',
+ auth: ['crm:customer:receive'],
+ disabled: receiving,
+ onClick: () => handleReceive(row),
+ },
+ {
+ label: '鍒嗛厤',
+ type: 'link',
+ auth: ['crm:customer:distribute'],
+ disabled: receiving,
+ onClick: () => handleDistribute(row),
+ },
+ ]"
+ />
+ </template>
<template #name="{ row }">
<Button type="link" @click="handleDetail(row)">
{{ row.name }}
--
Gitblit v1.9.3