Commit 70ada0e3a1f0d87ff66c50532b68a247a0118357

Authored by 曾国涛
1 parent 0f671707

feat: 客户管理模块开发

src/pages/Client/Components/ClientDrawer.tsx
... ... @@ -18,12 +18,11 @@ import {
18 18 import { Button, Form, message } from 'antd';
19 19 import { useState } from 'react';
20 20  
21   -export default ({ optType, record }) => {
22   - const [form] = Form.useForm<{ name: string; company: string }>();
  21 +export default ({ optType, record, onFinish }) => {
  22 + const [form] = Form.useForm();
23 23 //省市区
24 24 const [province, setProvince] = useState('');
25 25 const [city, setCity] = useState('');
26   - const [setDistrict] = useState('');
27 26 const optTypeEnum = {
28 27 add: {
29 28 text: '新增',
... ... @@ -36,6 +35,7 @@ export default ({ optType, record }) =&gt; {
36 35 if (res.result === RESPONSE_CODE.SUCCESS) {
37 36 message.success('新增成功');
38 37 // 不返回不会关闭弹框
  38 + onFinish();
39 39 return true;
40 40 }
41 41 },
... ... @@ -51,6 +51,7 @@ export default ({ optType, record }) =&gt; {
51 51 if (res.result === RESPONSE_CODE.SUCCESS) {
52 52 message.success('编辑成功');
53 53 // 不返回不会关闭弹框
  54 + onFinish();
54 55 return true;
55 56 }
56 57 },
... ... @@ -214,7 +215,7 @@ export default ({ optType, record }) =&gt; {
214 215 allowClear={false}
215 216 onChange={(value) => {
216 217 if (value !== undefined || value !== null) {
217   - setDistrict(value);
  218 + /*setDistrict(value);*/
218 219 }
219 220 }}
220 221 disabled={city === ''}
... ...
src/pages/Client/index.tsx
... ... @@ -34,7 +34,7 @@ const columns = [
34 34 {
35 35 title: '单位地址',
36 36 width: 250,
37   - dataIndex: 'companyName',
  37 + dataIndex: 'companyAddressText',
38 38 hideInSearch: true,
39 39 },
40 40 {
... ... @@ -177,7 +177,7 @@ const columns = [
177 177 valueType: 'option',
178 178 key: 'option',
179 179 width: 150,
180   - render: (text, record) => {
  180 + render: (text, record, index, action) => {
181 181 console.log(JSON.stringify(record));
182 182 return [
183 183 <CommunicationHistoryModal
... ... @@ -188,11 +188,17 @@ const columns = [
188 188 key={'detail'}
189 189 record={record}
190 190 optType={'detail'}
  191 + onFinish={() => {
  192 + action.reload();
  193 + }}
191 194 ></ClientDrawer>,
192 195 <ClientDrawer
193 196 key={'edit'}
194 197 record={record}
195 198 optType={'edit'}
  199 + onFinish={() => {
  200 + action.reload();
  201 + }}
196 202 ></ClientDrawer>,
197 203 ];
198 204 },
... ... @@ -286,7 +292,13 @@ export default () =&gt; {
286 292 dateFormatter="string"
287 293 headerTitle="高级表格"
288 294 toolBarRender={() => [
289   - <ClientDrawer optType={'add'} key="button"></ClientDrawer>,
  295 + <ClientDrawer
  296 + optType={'add'}
  297 + key="button"
  298 + onFinish={() => {
  299 + actionRef.current.reload();
  300 + }}
  301 + ></ClientDrawer>,
290 302 <ClientImportModal key="import" />,
291 303 ]}
292 304 />
... ...