Commit 0f6717078ff79a0f503ec27d83627a9e24ef5343
1 parent
1938a03b
feat: 客户管理模块开发
Showing
5 changed files
with
157 additions
and
28 deletions
src/pages/Client/Components/ClientDrawer.tsx
1 | 1 | import { RESPONSE_CODE } from '@/constants/enum'; |
2 | 2 | import { |
3 | 3 | postAdminClientAddAdminClient, |
4 | + postAdminClientModifyClientInfo, | |
4 | 5 | postDistrictSelectByLevel, |
5 | 6 | postDistrictSelectByNameAndLevel, |
6 | 7 | postDistrictSelOrderProvince, |
... | ... | @@ -17,15 +18,53 @@ import { |
17 | 18 | import { Button, Form, message } from 'antd'; |
18 | 19 | import { useState } from 'react'; |
19 | 20 | |
20 | -export default ({ record }) => { | |
21 | +export default ({ optType, record }) => { | |
21 | 22 | const [form] = Form.useForm<{ name: string; company: string }>(); |
22 | 23 | //省市区 |
23 | 24 | const [province, setProvince] = useState(''); |
24 | 25 | const [city, setCity] = useState(''); |
25 | 26 | const [setDistrict] = useState(''); |
27 | + const optTypeEnum = { | |
28 | + add: { | |
29 | + text: '新增', | |
30 | + button: <Button type="primary">新增</Button>, | |
31 | + readonly: false, | |
32 | + onFinish: async (values) => { | |
33 | + const res = await postAdminClientAddAdminClient({ | |
34 | + data: values, | |
35 | + }); | |
36 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
37 | + message.success('新增成功'); | |
38 | + // 不返回不会关闭弹框 | |
39 | + return true; | |
40 | + } | |
41 | + }, | |
42 | + }, | |
43 | + edit: { | |
44 | + text: '编辑', | |
45 | + button: <a type="primary">编辑</a>, | |
46 | + readonly: false, | |
47 | + onFinish: async (values) => { | |
48 | + const res = await postAdminClientModifyClientInfo({ | |
49 | + data: values, | |
50 | + }); | |
51 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
52 | + message.success('编辑成功'); | |
53 | + // 不返回不会关闭弹框 | |
54 | + return true; | |
55 | + } | |
56 | + }, | |
57 | + }, | |
58 | + detail: { | |
59 | + text: '详情', | |
60 | + button: <a type="primary">详情</a>, | |
61 | + readonly: true, | |
62 | + }, | |
63 | + }; | |
64 | + | |
26 | 65 | return ( |
27 | 66 | <DrawerForm |
28 | - title={record ? '详情' : '编辑'} | |
67 | + title={optTypeEnum[optType].text} | |
29 | 68 | resize={{ |
30 | 69 | onResize() { |
31 | 70 | console.log('resize!'); |
... | ... | @@ -35,31 +74,18 @@ export default ({ record }) => { |
35 | 74 | }} |
36 | 75 | initialValues={record} |
37 | 76 | form={form} |
38 | - trigger={ | |
39 | - record ? ( | |
40 | - <a type="primary">详情</a> | |
41 | - ) : ( | |
42 | - <Button type="primary">新增</Button> | |
43 | - ) | |
44 | - } | |
77 | + trigger={optTypeEnum[optType].button} | |
45 | 78 | autoFocusFirstInput |
46 | 79 | drawerProps={{ |
47 | 80 | destroyOnClose: true, |
48 | 81 | }} |
49 | 82 | submitTimeout={2000} |
50 | 83 | width={500} |
51 | - readonly={!!record} | |
52 | - onFinish={async (values) => { | |
53 | - const res = await postAdminClientAddAdminClient({ | |
54 | - data: values, | |
55 | - }); | |
56 | - if (res.result === RESPONSE_CODE.SUCCESS) { | |
57 | - message.success('新增成功'); | |
58 | - // 不返回不会关闭弹框 | |
59 | - return true; | |
60 | - } | |
61 | - }} | |
84 | + readonly={optTypeEnum[optType].readonly} | |
85 | + onFinish={optTypeEnum[optType].onFinish} | |
62 | 86 | > |
87 | + <ProFormText name="id" label="id" hidden={true} /> | |
88 | + | |
63 | 89 | <ProFormText |
64 | 90 | name="name" |
65 | 91 | label="客户名称" | ... | ... |
src/pages/Client/Components/CommunicationHistoryModal.tsx
src/pages/Client/index.tsx
... | ... | @@ -22,63 +22,75 @@ const columns = [ |
22 | 22 | { |
23 | 23 | title: '客户名称', |
24 | 24 | dataIndex: 'name', |
25 | + width: 100, | |
25 | 26 | hideInSearch: true, |
26 | 27 | }, |
27 | 28 | { |
28 | 29 | title: '单位名称', |
30 | + width: 150, | |
29 | 31 | dataIndex: 'companyName', |
30 | 32 | hideInSearch: true, |
31 | 33 | }, |
32 | 34 | { |
33 | 35 | title: '单位地址', |
36 | + width: 250, | |
34 | 37 | dataIndex: 'companyName', |
35 | 38 | hideInSearch: true, |
36 | 39 | }, |
37 | 40 | { |
38 | 41 | title: '联系电话', |
42 | + width: 150, | |
39 | 43 | dataIndex: 'phoneNumber', |
40 | 44 | hideInSearch: true, |
41 | 45 | }, |
42 | 46 | { |
43 | 47 | title: '客户来源', |
48 | + width: 150, | |
44 | 49 | dataIndex: 'source', |
45 | 50 | hideInSearch: true, |
46 | 51 | }, |
47 | 52 | { |
48 | 53 | title: '推荐人', |
49 | 54 | dataIndex: 'referrers', |
55 | + width: 150, | |
50 | 56 | hideInSearch: true, |
51 | 57 | }, |
52 | 58 | { |
53 | 59 | title: '客户需求', |
54 | 60 | dataIndex: 'requirements', |
61 | + width: 150, | |
55 | 62 | hideInSearch: true, |
56 | 63 | }, |
57 | 64 | { |
58 | 65 | title: '是否已报方案', |
66 | + width: 150, | |
59 | 67 | dataIndex: 'hasSchemeText', |
60 | 68 | hideInSearch: true, |
61 | 69 | }, |
62 | 70 | { |
63 | 71 | title: '报价时间', |
64 | 72 | key: 'since', |
73 | + width: 150, | |
65 | 74 | dataIndex: 'quoteDatetime', |
66 | 75 | valueType: 'dateTime', |
67 | 76 | hideInSearch: true, |
68 | 77 | }, |
69 | 78 | { |
70 | 79 | title: '跟进状态', |
80 | + width: 150, | |
71 | 81 | dataIndex: 'tradeStatusText', |
72 | 82 | hideInSearch: true, |
73 | 83 | }, |
74 | 84 | { |
75 | 85 | title: '客户等级', |
86 | + width: 150, | |
76 | 87 | dataIndex: 'levelText', |
77 | 88 | hideInSearch: true, |
78 | 89 | }, |
79 | 90 | { |
80 | 91 | title: '创建时间', |
81 | 92 | key: 'since', |
93 | + width: 150, | |
82 | 94 | dataIndex: 'createTime', |
83 | 95 | valueType: 'dateTime', |
84 | 96 | hideInSearch: true, |
... | ... | @@ -86,6 +98,7 @@ const columns = [ |
86 | 98 | { |
87 | 99 | title: '最新跟进时间', |
88 | 100 | key: 'since', |
101 | + width: 150, | |
89 | 102 | dataIndex: 'latestCommunicationTime', |
90 | 103 | valueType: 'dateTime', |
91 | 104 | hideInSearch: true, |
... | ... | @@ -147,7 +160,6 @@ const columns = [ |
147 | 160 | { |
148 | 161 | title: '创建时间', |
149 | 162 | valueType: 'dateRange', |
150 | - width: 200, | |
151 | 163 | hideInTable: true, |
152 | 164 | search: { |
153 | 165 | transform: (value) => { |
... | ... | @@ -164,6 +176,7 @@ const columns = [ |
164 | 176 | title: '操作', |
165 | 177 | valueType: 'option', |
166 | 178 | key: 'option', |
179 | + width: 150, | |
167 | 180 | render: (text, record) => { |
168 | 181 | console.log(JSON.stringify(record)); |
169 | 182 | return [ |
... | ... | @@ -171,7 +184,16 @@ const columns = [ |
171 | 184 | key={'communicationHistory'} |
172 | 185 | clientId={record.id} |
173 | 186 | />, |
174 | - <ClientDrawer key={'detail'} record={record}></ClientDrawer>, | |
187 | + <ClientDrawer | |
188 | + key={'detail'} | |
189 | + record={record} | |
190 | + optType={'detail'} | |
191 | + ></ClientDrawer>, | |
192 | + <ClientDrawer | |
193 | + key={'edit'} | |
194 | + record={record} | |
195 | + optType={'edit'} | |
196 | + ></ClientDrawer>, | |
175 | 197 | ]; |
176 | 198 | }, |
177 | 199 | }, |
... | ... | @@ -223,6 +245,9 @@ export default () => { |
223 | 245 | </Button>, |
224 | 246 | ], |
225 | 247 | }} |
248 | + scroll={{ | |
249 | + x: 1400, | |
250 | + }} | |
226 | 251 | editable={{ |
227 | 252 | type: 'multiple', |
228 | 253 | }} |
... | ... | @@ -261,7 +286,7 @@ export default () => { |
261 | 286 | dateFormatter="string" |
262 | 287 | headerTitle="高级表格" |
263 | 288 | toolBarRender={() => [ |
264 | - <ClientDrawer key="button"></ClientDrawer>, | |
289 | + <ClientDrawer optType={'add'} key="button"></ClientDrawer>, | |
265 | 290 | <ClientImportModal key="import" />, |
266 | 291 | ]} |
267 | 292 | /> | ... | ... |
src/services/definition.ts
... | ... | @@ -117,6 +117,8 @@ export interface AdminClientDto { |
117 | 117 | */ |
118 | 118 | hasScheme?: boolean; |
119 | 119 | hasSchemeText?: string; |
120 | + /** @format int64 */ | |
121 | + id?: number; | |
120 | 122 | /** @format date-time */ |
121 | 123 | latestCommunicationTime?: string; |
122 | 124 | /** |
... | ... | @@ -1940,7 +1942,8 @@ export interface QueryClientDto { |
1940 | 1942 | } |
1941 | 1943 | |
1942 | 1944 | export interface QueryCommunicationInfoDto { |
1943 | - clientId?: string; | |
1945 | + /** @format int64 */ | |
1946 | + clientId?: number; | |
1944 | 1947 | content?: string; |
1945 | 1948 | /** @format int32 */ |
1946 | 1949 | current?: number; |
... | ... | @@ -1948,7 +1951,8 @@ export interface QueryCommunicationInfoDto { |
1948 | 1951 | datetime?: string; |
1949 | 1952 | /** @format int32 */ |
1950 | 1953 | end?: number; |
1951 | - id?: string; | |
1954 | + /** @format int64 */ | |
1955 | + id?: number; | |
1952 | 1956 | /** @format int32 */ |
1953 | 1957 | pageSize?: number; |
1954 | 1958 | /** @format int32 */ |
... | ... | @@ -2728,7 +2732,8 @@ export interface ApiOrderConfirmReceiveRequest { |
2728 | 2732 | } |
2729 | 2733 | |
2730 | 2734 | export interface ClientCommunicationInfo { |
2731 | - clientId?: string; | |
2735 | + /** @format int64 */ | |
2736 | + clientId?: number; | |
2732 | 2737 | /** |
2733 | 2738 | * @description |
2734 | 2739 | * 内容 |
... | ... | @@ -2743,7 +2748,8 @@ export interface ClientCommunicationInfo { |
2743 | 2748 | * @format date-time |
2744 | 2749 | */ |
2745 | 2750 | datetime?: string; |
2746 | - id?: string; | |
2751 | + /** @format int64 */ | |
2752 | + id?: number; | |
2747 | 2753 | logicDelete?: boolean; |
2748 | 2754 | updateByName?: string; |
2749 | 2755 | /** @format date-time */ | ... | ... |
src/services/request.ts
... | ... | @@ -609,6 +609,77 @@ export const postAdminClientModifyClientComunicationInfo = |
609 | 609 | return request; |
610 | 610 | })(); |
611 | 611 | |
612 | +/** @description request parameter type for postAdminClientModifyClientInfo */ | |
613 | +export interface PostAdminClientModifyClientInfoOption { | |
614 | + /** | |
615 | + * @description | |
616 | + * dto | |
617 | + */ | |
618 | + body: { | |
619 | + /** | |
620 | + @description | |
621 | + dto */ | |
622 | + dto: AdminClientDto; | |
623 | + }; | |
624 | +} | |
625 | + | |
626 | +/** @description response type for postAdminClientModifyClientInfo */ | |
627 | +export interface PostAdminClientModifyClientInfoResponse { | |
628 | + /** | |
629 | + * @description | |
630 | + * OK | |
631 | + */ | |
632 | + 200: ServerResult; | |
633 | + /** | |
634 | + * @description | |
635 | + * Created | |
636 | + */ | |
637 | + 201: any; | |
638 | + /** | |
639 | + * @description | |
640 | + * Unauthorized | |
641 | + */ | |
642 | + 401: any; | |
643 | + /** | |
644 | + * @description | |
645 | + * Forbidden | |
646 | + */ | |
647 | + 403: any; | |
648 | + /** | |
649 | + * @description | |
650 | + * Not Found | |
651 | + */ | |
652 | + 404: any; | |
653 | +} | |
654 | + | |
655 | +export type PostAdminClientModifyClientInfoResponseSuccess = | |
656 | + PostAdminClientModifyClientInfoResponse[200]; | |
657 | +/** | |
658 | + * @description | |
659 | + * 修改跟进信息 | |
660 | + * @tags 客户管理 | |
661 | + * @produces * | |
662 | + * @consumes application/json | |
663 | + */ | |
664 | +export const postAdminClientModifyClientInfo = /* #__PURE__ */ (() => { | |
665 | + const method = 'post'; | |
666 | + const url = '/admin/client/modifyClientInfo'; | |
667 | + function request( | |
668 | + option: PostAdminClientModifyClientInfoOption, | |
669 | + ): Promise<PostAdminClientModifyClientInfoResponseSuccess> { | |
670 | + return requester(request.url, { | |
671 | + method: request.method, | |
672 | + ...option, | |
673 | + }) as unknown as Promise<PostAdminClientModifyClientInfoResponseSuccess>; | |
674 | + } | |
675 | + | |
676 | + /** http method */ | |
677 | + request.method = method; | |
678 | + /** request url */ | |
679 | + request.url = url; | |
680 | + return request; | |
681 | +})(); | |
682 | + | |
612 | 683 | /** @description request parameter type for postAdminClientQueryClientComunicationInfo */ |
613 | 684 | export interface PostAdminClientQueryClientComunicationInfoOption { |
614 | 685 | /** | ... | ... |