feat: crm customer pool
							parent
							
								
									5424775317
								
							
						
					
					
						commit
						b4855beb1f
					
				|  | @ -0,0 +1,155 @@ | ||||||
|  | import type { VbenFormSchema } from '#/adapter/form'; | ||||||
|  | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; | ||||||
|  | 
 | ||||||
|  | import { DICT_TYPE, getDictOptions } from '#/utils/dict'; | ||||||
|  | 
 | ||||||
|  | /** 列表的搜索表单 */ | ||||||
|  | export function useGridFormSchema(): VbenFormSchema[] { | ||||||
|  |   return [ | ||||||
|  |     { | ||||||
|  |       fieldName: 'name', | ||||||
|  |       label: '客户名称', | ||||||
|  |       component: 'Input', | ||||||
|  |       componentProps: { | ||||||
|  |         placeholder: '请输入客户名称', | ||||||
|  |       }, | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       fieldName: 'mobile', | ||||||
|  |       label: '手机', | ||||||
|  |       component: 'Input', | ||||||
|  |       componentProps: { | ||||||
|  |         placeholder: '请输入手机', | ||||||
|  |       }, | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       fieldName: 'industryId', | ||||||
|  |       label: '所属行业', | ||||||
|  |       component: 'Select', | ||||||
|  |       componentProps: { | ||||||
|  |         options: getDictOptions(DICT_TYPE.CRM_CUSTOMER_INDUSTRY, 'number'), | ||||||
|  |         placeholder: '请选择所属行业', | ||||||
|  |       }, | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       fieldName: 'level', | ||||||
|  |       label: '客户级别', | ||||||
|  |       component: 'Select', | ||||||
|  |       componentProps: { | ||||||
|  |         options: getDictOptions(DICT_TYPE.CRM_CUSTOMER_LEVEL, 'number'), | ||||||
|  |         placeholder: '请选择客户级别', | ||||||
|  |       }, | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       fieldName: 'source', | ||||||
|  |       label: '客户来源', | ||||||
|  |       component: 'Select', | ||||||
|  |       componentProps: { | ||||||
|  |         options: getDictOptions(DICT_TYPE.CRM_CUSTOMER_SOURCE, 'number'), | ||||||
|  |         placeholder: '请选择客户来源', | ||||||
|  |       }, | ||||||
|  |     }, | ||||||
|  |   ]; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | export function useGridColumns(): VxeTableGridOptions['columns'] { | ||||||
|  |   return [ | ||||||
|  |     { | ||||||
|  |       title: '客户名称', | ||||||
|  |       field: 'name', | ||||||
|  |       width: 160, | ||||||
|  |       fixed: 'left', | ||||||
|  |       slots: { default: 'name' }, | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       title: '客户来源', | ||||||
|  |       field: 'source', | ||||||
|  |       width: 100, | ||||||
|  |       cellRender: { | ||||||
|  |         name: 'CellDict', | ||||||
|  |         props: { type: DICT_TYPE.CRM_CUSTOMER_SOURCE }, | ||||||
|  |       }, | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       title: '手机', | ||||||
|  |       field: 'mobile', | ||||||
|  |       width: 120, | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       title: '电话', | ||||||
|  |       field: 'telephone', | ||||||
|  |       width: 120, | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       title: '邮箱', | ||||||
|  |       field: 'email', | ||||||
|  |       width: 140, | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       title: '客户级别', | ||||||
|  |       field: 'level', | ||||||
|  |       width: 135, | ||||||
|  |       cellRender: { | ||||||
|  |         name: 'CellDict', | ||||||
|  |         props: { type: DICT_TYPE.CRM_CUSTOMER_LEVEL }, | ||||||
|  |       }, | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       title: '客户行业', | ||||||
|  |       field: 'industryId', | ||||||
|  |       width: 100, | ||||||
|  |       cellRender: { | ||||||
|  |         name: 'CellDict', | ||||||
|  |         props: { type: DICT_TYPE.CRM_CUSTOMER_INDUSTRY }, | ||||||
|  |       }, | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       title: '下次联系时间', | ||||||
|  |       field: 'contactNextTime', | ||||||
|  |       width: 180, | ||||||
|  |       formatter: 'formatDateTime', | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       title: '备注', | ||||||
|  |       field: 'remark', | ||||||
|  |       width: 200, | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       title: '成交状态', | ||||||
|  |       field: 'dealStatus', | ||||||
|  |       width: 80, | ||||||
|  |       cellRender: { | ||||||
|  |         name: 'CellDict', | ||||||
|  |         props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING }, | ||||||
|  |       }, | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       title: '最后跟进时间', | ||||||
|  |       field: 'contactLastTime', | ||||||
|  |       width: 180, | ||||||
|  |       formatter: 'formatDateTime', | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       title: '最后跟进记录', | ||||||
|  |       field: 'contactLastContent', | ||||||
|  |       width: 200, | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       title: '更新时间', | ||||||
|  |       field: 'updateTime', | ||||||
|  |       width: 180, | ||||||
|  |       formatter: 'formatDateTime', | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       title: '创建时间', | ||||||
|  |       field: 'createTime', | ||||||
|  |       width: 180, | ||||||
|  |       formatter: 'formatDateTime', | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       title: '创建人', | ||||||
|  |       field: 'creatorName', | ||||||
|  |       width: 100, | ||||||
|  |     }, | ||||||
|  |   ]; | ||||||
|  | } | ||||||
|  | @ -1,13 +1,68 @@ | ||||||
| <script lang="ts" setup> | <script lang="ts" setup> | ||||||
|  | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; | ||||||
|  | import type { CrmCustomerApi } from '#/api/crm/customer'; | ||||||
|  | 
 | ||||||
|  | import { useRouter } from 'vue-router'; | ||||||
|  | 
 | ||||||
| import { Page } from '@vben/common-ui'; | import { Page } from '@vben/common-ui'; | ||||||
|  | import { downloadFileFromBlobPart } from '@vben/utils'; | ||||||
| 
 | 
 | ||||||
| import { Button } from 'ant-design-vue'; | import { Button } from 'ant-design-vue'; | ||||||
| 
 | 
 | ||||||
|  | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; | ||||||
|  | import { exportCustomer, getCustomerPage } from '#/api/crm/customer'; | ||||||
| import { DocAlert } from '#/components/doc-alert'; | import { DocAlert } from '#/components/doc-alert'; | ||||||
|  | import { $t } from '#/locales'; | ||||||
|  | 
 | ||||||
|  | import { useGridColumns, useGridFormSchema } from './data'; | ||||||
|  | 
 | ||||||
|  | const { push } = useRouter(); | ||||||
|  | 
 | ||||||
|  | /** 导出表格 */ | ||||||
|  | async function handleExport() { | ||||||
|  |   const data = await exportCustomer(await gridApi.formApi.getValues()); | ||||||
|  |   downloadFileFromBlobPart({ fileName: '客户公海.xls', source: data }); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /** 查看客户详情 */ | ||||||
|  | function handleDetail(row: CrmCustomerApi.Customer) { | ||||||
|  |   push({ name: 'CrmCustomerDetail', params: { id: row.id } }); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const [Grid, gridApi] = useVbenVxeGrid({ | ||||||
|  |   formOptions: { | ||||||
|  |     schema: useGridFormSchema(), | ||||||
|  |   }, | ||||||
|  |   gridOptions: { | ||||||
|  |     columns: useGridColumns(), | ||||||
|  |     height: 'auto', | ||||||
|  |     keepSource: true, | ||||||
|  |     proxyConfig: { | ||||||
|  |       ajax: { | ||||||
|  |         query: async ({ page }, formValues) => { | ||||||
|  |           return await getCustomerPage({ | ||||||
|  |             page: page.currentPage, | ||||||
|  |             pageSize: page.pageSize, | ||||||
|  |             pool: true, | ||||||
|  |             ...formValues, | ||||||
|  |           }); | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |     }, | ||||||
|  |     rowConfig: { | ||||||
|  |       keyField: 'id', | ||||||
|  |     }, | ||||||
|  |     toolbarConfig: { | ||||||
|  |       refresh: { code: 'query' }, | ||||||
|  |       search: true, | ||||||
|  |     }, | ||||||
|  |   } as VxeTableGridOptions<CrmCustomerApi.Customer>, | ||||||
|  | }); | ||||||
| </script> | </script> | ||||||
| 
 | 
 | ||||||
| <template> | <template> | ||||||
|   <Page> |   <Page auto-content-height> | ||||||
|  |     <template #doc> | ||||||
|       <DocAlert |       <DocAlert | ||||||
|         title="【客户】客户管理、公海客户" |         title="【客户】客户管理、公海客户" | ||||||
|         url="https://doc.iocoder.cn/crm/customer/" |         url="https://doc.iocoder.cn/crm/customer/" | ||||||
|  | @ -16,23 +71,27 @@ import { DocAlert } from '#/components/doc-alert'; | ||||||
|         title="【通用】数据权限" |         title="【通用】数据权限" | ||||||
|         url="https://doc.iocoder.cn/crm/permission/" |         url="https://doc.iocoder.cn/crm/permission/" | ||||||
|       /> |       /> | ||||||
|     <Button |     </template> | ||||||
|       danger | 
 | ||||||
|       type="link" |     <Grid> | ||||||
|       target="_blank" |       <template #toolbar-tools> | ||||||
|       href="https://github.com/yudaocode/yudao-ui-admin-vue3" |         <TableAction | ||||||
|     > |           :actions="[ | ||||||
|       该功能支持 Vue3 + element-plus 版本! |             { | ||||||
|     </Button> |               label: $t('ui.actionTitle.export'), | ||||||
|     <br /> |               type: 'primary', | ||||||
|     <Button |               icon: ACTION_ICON.DOWNLOAD, | ||||||
|       type="link" |               auth: ['crm:customer:export'], | ||||||
|       target="_blank" |               onClick: handleExport, | ||||||
|       href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/customer/pool/index" |             }, | ||||||
|     > |           ]" | ||||||
|       可参考 |         /> | ||||||
|       https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/crm/customer/pool/index |       </template> | ||||||
|       代码,pull request 贡献给我们! |       <template #name="{ row }"> | ||||||
|  |         <Button type="link" @click="handleDetail(row)"> | ||||||
|  |           {{ row.name }} | ||||||
|         </Button> |         </Button> | ||||||
|  |       </template> | ||||||
|  |     </Grid> | ||||||
|   </Page> |   </Page> | ||||||
| </template> | </template> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 xingyu4j
						xingyu4j