From ec8ff4f6259404460a0b4437e29a40986c2c4b9d Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 12 十月 2026 18:31:43 +0800
Subject: [PATCH] feat(workflow): 集成自动化审批功能并优化多个业务模块
---
src/views/crm/customer/pool/index.vue | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 102 insertions(+), 5 deletions(-)
diff --git a/src/views/crm/customer/pool/index.vue b/src/views/crm/customer/pool/index.vue
index 6fa6410..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 '@vben/common-ui';
+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 });
}
@@ -62,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',
@@ -76,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