Commit 0f6717078ff79a0f503ec27d83627a9e24ef5343
1 parent
1938a03b
feat: 客户管理模块开发
Showing
5 changed files
with
157 additions
and
28 deletions
src/pages/Client/Components/ClientDrawer.tsx
1 | import { RESPONSE_CODE } from '@/constants/enum'; | 1 | import { RESPONSE_CODE } from '@/constants/enum'; |
2 | import { | 2 | import { |
3 | postAdminClientAddAdminClient, | 3 | postAdminClientAddAdminClient, |
4 | + postAdminClientModifyClientInfo, | ||
4 | postDistrictSelectByLevel, | 5 | postDistrictSelectByLevel, |
5 | postDistrictSelectByNameAndLevel, | 6 | postDistrictSelectByNameAndLevel, |
6 | postDistrictSelOrderProvince, | 7 | postDistrictSelOrderProvince, |
@@ -17,15 +18,53 @@ import { | @@ -17,15 +18,53 @@ import { | ||
17 | import { Button, Form, message } from 'antd'; | 18 | import { Button, Form, message } from 'antd'; |
18 | import { useState } from 'react'; | 19 | import { useState } from 'react'; |
19 | 20 | ||
20 | -export default ({ record }) => { | 21 | +export default ({ optType, record }) => { |
21 | const [form] = Form.useForm<{ name: string; company: string }>(); | 22 | const [form] = Form.useForm<{ name: string; company: string }>(); |
22 | //省市区 | 23 | //省市区 |
23 | const [province, setProvince] = useState(''); | 24 | const [province, setProvince] = useState(''); |
24 | const [city, setCity] = useState(''); | 25 | const [city, setCity] = useState(''); |
25 | const [setDistrict] = useState(''); | 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 | return ( | 65 | return ( |
27 | <DrawerForm | 66 | <DrawerForm |
28 | - title={record ? '详情' : '编辑'} | 67 | + title={optTypeEnum[optType].text} |
29 | resize={{ | 68 | resize={{ |
30 | onResize() { | 69 | onResize() { |
31 | console.log('resize!'); | 70 | console.log('resize!'); |
@@ -35,31 +74,18 @@ export default ({ record }) => { | @@ -35,31 +74,18 @@ export default ({ record }) => { | ||
35 | }} | 74 | }} |
36 | initialValues={record} | 75 | initialValues={record} |
37 | form={form} | 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 | autoFocusFirstInput | 78 | autoFocusFirstInput |
46 | drawerProps={{ | 79 | drawerProps={{ |
47 | destroyOnClose: true, | 80 | destroyOnClose: true, |
48 | }} | 81 | }} |
49 | submitTimeout={2000} | 82 | submitTimeout={2000} |
50 | width={500} | 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 | <ProFormText | 89 | <ProFormText |
64 | name="name" | 90 | name="name" |
65 | label="客户名称" | 91 | label="客户名称" |
src/pages/Client/Components/CommunicationHistoryModal.tsx
@@ -33,7 +33,8 @@ export default ({ clientId }) => { | @@ -33,7 +33,8 @@ export default ({ clientId }) => { | ||
33 | }, | 33 | }, |
34 | { | 34 | { |
35 | title: '内容', | 35 | title: '内容', |
36 | - width: 50, | 36 | + width: 100, |
37 | + valueType: 'textarea', | ||
37 | rules: [{ required: true, message: '请输入内容' }], | 38 | rules: [{ required: true, message: '请输入内容' }], |
38 | dataIndex: 'content', | 39 | dataIndex: 'content', |
39 | }, | 40 | }, |
src/pages/Client/index.tsx
@@ -22,63 +22,75 @@ const columns = [ | @@ -22,63 +22,75 @@ const columns = [ | ||
22 | { | 22 | { |
23 | title: '客户名称', | 23 | title: '客户名称', |
24 | dataIndex: 'name', | 24 | dataIndex: 'name', |
25 | + width: 100, | ||
25 | hideInSearch: true, | 26 | hideInSearch: true, |
26 | }, | 27 | }, |
27 | { | 28 | { |
28 | title: '单位名称', | 29 | title: '单位名称', |
30 | + width: 150, | ||
29 | dataIndex: 'companyName', | 31 | dataIndex: 'companyName', |
30 | hideInSearch: true, | 32 | hideInSearch: true, |
31 | }, | 33 | }, |
32 | { | 34 | { |
33 | title: '单位地址', | 35 | title: '单位地址', |
36 | + width: 250, | ||
34 | dataIndex: 'companyName', | 37 | dataIndex: 'companyName', |
35 | hideInSearch: true, | 38 | hideInSearch: true, |
36 | }, | 39 | }, |
37 | { | 40 | { |
38 | title: '联系电话', | 41 | title: '联系电话', |
42 | + width: 150, | ||
39 | dataIndex: 'phoneNumber', | 43 | dataIndex: 'phoneNumber', |
40 | hideInSearch: true, | 44 | hideInSearch: true, |
41 | }, | 45 | }, |
42 | { | 46 | { |
43 | title: '客户来源', | 47 | title: '客户来源', |
48 | + width: 150, | ||
44 | dataIndex: 'source', | 49 | dataIndex: 'source', |
45 | hideInSearch: true, | 50 | hideInSearch: true, |
46 | }, | 51 | }, |
47 | { | 52 | { |
48 | title: '推荐人', | 53 | title: '推荐人', |
49 | dataIndex: 'referrers', | 54 | dataIndex: 'referrers', |
55 | + width: 150, | ||
50 | hideInSearch: true, | 56 | hideInSearch: true, |
51 | }, | 57 | }, |
52 | { | 58 | { |
53 | title: '客户需求', | 59 | title: '客户需求', |
54 | dataIndex: 'requirements', | 60 | dataIndex: 'requirements', |
61 | + width: 150, | ||
55 | hideInSearch: true, | 62 | hideInSearch: true, |
56 | }, | 63 | }, |
57 | { | 64 | { |
58 | title: '是否已报方案', | 65 | title: '是否已报方案', |
66 | + width: 150, | ||
59 | dataIndex: 'hasSchemeText', | 67 | dataIndex: 'hasSchemeText', |
60 | hideInSearch: true, | 68 | hideInSearch: true, |
61 | }, | 69 | }, |
62 | { | 70 | { |
63 | title: '报价时间', | 71 | title: '报价时间', |
64 | key: 'since', | 72 | key: 'since', |
73 | + width: 150, | ||
65 | dataIndex: 'quoteDatetime', | 74 | dataIndex: 'quoteDatetime', |
66 | valueType: 'dateTime', | 75 | valueType: 'dateTime', |
67 | hideInSearch: true, | 76 | hideInSearch: true, |
68 | }, | 77 | }, |
69 | { | 78 | { |
70 | title: '跟进状态', | 79 | title: '跟进状态', |
80 | + width: 150, | ||
71 | dataIndex: 'tradeStatusText', | 81 | dataIndex: 'tradeStatusText', |
72 | hideInSearch: true, | 82 | hideInSearch: true, |
73 | }, | 83 | }, |
74 | { | 84 | { |
75 | title: '客户等级', | 85 | title: '客户等级', |
86 | + width: 150, | ||
76 | dataIndex: 'levelText', | 87 | dataIndex: 'levelText', |
77 | hideInSearch: true, | 88 | hideInSearch: true, |
78 | }, | 89 | }, |
79 | { | 90 | { |
80 | title: '创建时间', | 91 | title: '创建时间', |
81 | key: 'since', | 92 | key: 'since', |
93 | + width: 150, | ||
82 | dataIndex: 'createTime', | 94 | dataIndex: 'createTime', |
83 | valueType: 'dateTime', | 95 | valueType: 'dateTime', |
84 | hideInSearch: true, | 96 | hideInSearch: true, |
@@ -86,6 +98,7 @@ const columns = [ | @@ -86,6 +98,7 @@ const columns = [ | ||
86 | { | 98 | { |
87 | title: '最新跟进时间', | 99 | title: '最新跟进时间', |
88 | key: 'since', | 100 | key: 'since', |
101 | + width: 150, | ||
89 | dataIndex: 'latestCommunicationTime', | 102 | dataIndex: 'latestCommunicationTime', |
90 | valueType: 'dateTime', | 103 | valueType: 'dateTime', |
91 | hideInSearch: true, | 104 | hideInSearch: true, |
@@ -147,7 +160,6 @@ const columns = [ | @@ -147,7 +160,6 @@ const columns = [ | ||
147 | { | 160 | { |
148 | title: '创建时间', | 161 | title: '创建时间', |
149 | valueType: 'dateRange', | 162 | valueType: 'dateRange', |
150 | - width: 200, | ||
151 | hideInTable: true, | 163 | hideInTable: true, |
152 | search: { | 164 | search: { |
153 | transform: (value) => { | 165 | transform: (value) => { |
@@ -164,6 +176,7 @@ const columns = [ | @@ -164,6 +176,7 @@ const columns = [ | ||
164 | title: '操作', | 176 | title: '操作', |
165 | valueType: 'option', | 177 | valueType: 'option', |
166 | key: 'option', | 178 | key: 'option', |
179 | + width: 150, | ||
167 | render: (text, record) => { | 180 | render: (text, record) => { |
168 | console.log(JSON.stringify(record)); | 181 | console.log(JSON.stringify(record)); |
169 | return [ | 182 | return [ |
@@ -171,7 +184,16 @@ const columns = [ | @@ -171,7 +184,16 @@ const columns = [ | ||
171 | key={'communicationHistory'} | 184 | key={'communicationHistory'} |
172 | clientId={record.id} | 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,6 +245,9 @@ export default () => { | ||
223 | </Button>, | 245 | </Button>, |
224 | ], | 246 | ], |
225 | }} | 247 | }} |
248 | + scroll={{ | ||
249 | + x: 1400, | ||
250 | + }} | ||
226 | editable={{ | 251 | editable={{ |
227 | type: 'multiple', | 252 | type: 'multiple', |
228 | }} | 253 | }} |
@@ -261,7 +286,7 @@ export default () => { | @@ -261,7 +286,7 @@ export default () => { | ||
261 | dateFormatter="string" | 286 | dateFormatter="string" |
262 | headerTitle="高级表格" | 287 | headerTitle="高级表格" |
263 | toolBarRender={() => [ | 288 | toolBarRender={() => [ |
264 | - <ClientDrawer key="button"></ClientDrawer>, | 289 | + <ClientDrawer optType={'add'} key="button"></ClientDrawer>, |
265 | <ClientImportModal key="import" />, | 290 | <ClientImportModal key="import" />, |
266 | ]} | 291 | ]} |
267 | /> | 292 | /> |
src/services/definition.ts
@@ -117,6 +117,8 @@ export interface AdminClientDto { | @@ -117,6 +117,8 @@ export interface AdminClientDto { | ||
117 | */ | 117 | */ |
118 | hasScheme?: boolean; | 118 | hasScheme?: boolean; |
119 | hasSchemeText?: string; | 119 | hasSchemeText?: string; |
120 | + /** @format int64 */ | ||
121 | + id?: number; | ||
120 | /** @format date-time */ | 122 | /** @format date-time */ |
121 | latestCommunicationTime?: string; | 123 | latestCommunicationTime?: string; |
122 | /** | 124 | /** |
@@ -1940,7 +1942,8 @@ export interface QueryClientDto { | @@ -1940,7 +1942,8 @@ export interface QueryClientDto { | ||
1940 | } | 1942 | } |
1941 | 1943 | ||
1942 | export interface QueryCommunicationInfoDto { | 1944 | export interface QueryCommunicationInfoDto { |
1943 | - clientId?: string; | 1945 | + /** @format int64 */ |
1946 | + clientId?: number; | ||
1944 | content?: string; | 1947 | content?: string; |
1945 | /** @format int32 */ | 1948 | /** @format int32 */ |
1946 | current?: number; | 1949 | current?: number; |
@@ -1948,7 +1951,8 @@ export interface QueryCommunicationInfoDto { | @@ -1948,7 +1951,8 @@ export interface QueryCommunicationInfoDto { | ||
1948 | datetime?: string; | 1951 | datetime?: string; |
1949 | /** @format int32 */ | 1952 | /** @format int32 */ |
1950 | end?: number; | 1953 | end?: number; |
1951 | - id?: string; | 1954 | + /** @format int64 */ |
1955 | + id?: number; | ||
1952 | /** @format int32 */ | 1956 | /** @format int32 */ |
1953 | pageSize?: number; | 1957 | pageSize?: number; |
1954 | /** @format int32 */ | 1958 | /** @format int32 */ |
@@ -2728,7 +2732,8 @@ export interface ApiOrderConfirmReceiveRequest { | @@ -2728,7 +2732,8 @@ export interface ApiOrderConfirmReceiveRequest { | ||
2728 | } | 2732 | } |
2729 | 2733 | ||
2730 | export interface ClientCommunicationInfo { | 2734 | export interface ClientCommunicationInfo { |
2731 | - clientId?: string; | 2735 | + /** @format int64 */ |
2736 | + clientId?: number; | ||
2732 | /** | 2737 | /** |
2733 | * @description | 2738 | * @description |
2734 | * 内容 | 2739 | * 内容 |
@@ -2743,7 +2748,8 @@ export interface ClientCommunicationInfo { | @@ -2743,7 +2748,8 @@ export interface ClientCommunicationInfo { | ||
2743 | * @format date-time | 2748 | * @format date-time |
2744 | */ | 2749 | */ |
2745 | datetime?: string; | 2750 | datetime?: string; |
2746 | - id?: string; | 2751 | + /** @format int64 */ |
2752 | + id?: number; | ||
2747 | logicDelete?: boolean; | 2753 | logicDelete?: boolean; |
2748 | updateByName?: string; | 2754 | updateByName?: string; |
2749 | /** @format date-time */ | 2755 | /** @format date-time */ |
src/services/request.ts
@@ -609,6 +609,77 @@ export const postAdminClientModifyClientComunicationInfo = | @@ -609,6 +609,77 @@ export const postAdminClientModifyClientComunicationInfo = | ||
609 | return request; | 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 | /** @description request parameter type for postAdminClientQueryClientComunicationInfo */ | 683 | /** @description request parameter type for postAdminClientQueryClientComunicationInfo */ |
613 | export interface PostAdminClientQueryClientComunicationInfoOption { | 684 | export interface PostAdminClientQueryClientComunicationInfoOption { |
614 | /** | 685 | /** |