Commit 48c794cd7f3c8ad53a26b7fa649e1989ec9e29b4

Authored by boyang
1 parent 2144d84d

fix: 修改类型按钮

src/pages/Client/Client/Components/ClientImportModal.tsx
@@ -6,7 +6,7 @@ import { Button, Form, message } from 'antd'; @@ -6,7 +6,7 @@ import { Button, Form, message } from 'antd';
6 import { RcFile } from 'antd/es/upload'; 6 import { RcFile } from 'antd/es/upload';
7 import axios from 'axios'; 7 import axios from 'axios';
8 8
9 -export default () => { 9 +export default ({ reloadTable }) => {
10 const [form] = Form.useForm(); 10 const [form] = Form.useForm();
11 const [messageApi, contextHolder] = message.useMessage(); 11 const [messageApi, contextHolder] = message.useMessage();
12 const downloadImportTemplate = () => { 12 const downloadImportTemplate = () => {
@@ -59,6 +59,7 @@ export default () => { @@ -59,6 +59,7 @@ export default () => {
59 blobToJson(data).then((dataJson) => { 59 blobToJson(data).then((dataJson) => {
60 if (dataJson?.result === RESPONSE_CODE.SUCCESS) { 60 if (dataJson?.result === RESPONSE_CODE.SUCCESS) {
61 message.success(dataJson?.message); 61 message.success(dataJson?.message);
  62 + reloadTable();
62 } else { 63 } else {
63 message.error(dataJson?.message); 64 message.error(dataJson?.message);
64 } 65 }
src/pages/Client/Client/Components/ClientModal.tsx
@@ -24,6 +24,7 @@ export default ({ data, type, reloadTable }) => { @@ -24,6 +24,7 @@ export default ({ data, type, reloadTable }) => {
24 const res = await postAdminClientAddOrModifyClientComunicationInfo({ 24 const res = await postAdminClientAddOrModifyClientComunicationInfo({
25 data: { 25 data: {
26 ...values, 26 ...values,
  27 + id: '',
27 clientId: data.id, 28 clientId: data.id,
28 }, 29 },
29 }); 30 });
src/pages/Client/Client/Components/CommunicationHistoryModal.tsx
@@ -31,20 +31,14 @@ export default ({ record }) => { @@ -31,20 +31,14 @@ export default ({ record }) => {
31 title: '跟进人', 31 title: '跟进人',
32 width: 50, 32 width: 50,
33 rules: [{ required: true, message: '请输入跟进人' }], 33 rules: [{ required: true, message: '请输入跟进人' }],
34 - dataIndex: 'createByName', 34 + dataIndex: 'updateByName',
35 }, 35 },
36 - // {  
37 - // title: '跟进类型',  
38 - // width: 150,  
39 - // ellipsis: true,  
40 - // dataIndex: 'wayText',  
41 - // hideInSearch: true,  
42 - // },  
43 { 36 {
44 - title: '跟进类型', 37 + title: '跟进方式',
45 width: 50, 38 width: 50,
46 dataIndex: 'way', 39 dataIndex: 'way',
47 rules: [{ required: true, message: '请选择方式' }], 40 rules: [{ required: true, message: '请选择方式' }],
  41 + render: (text, record) => record.wayText, // 显示 wayText
48 request: async () => { 42 request: async () => {
49 const res = await postServiceConstClientWay(); 43 const res = await postServiceConstClientWay();
50 return enumToSelect(res.data); 44 return enumToSelect(res.data);
src/pages/Client/Client/index.tsx
@@ -449,7 +449,12 @@ export default () => { @@ -449,7 +449,12 @@ export default () => {
449 actionRef.current.reload(); 449 actionRef.current.reload();
450 }} 450 }}
451 ></ClientDrawer>, 451 ></ClientDrawer>,
452 - <ClientImportModal key="import" />, 452 + <ClientImportModal
  453 + key="import"
  454 + reloadTable={() => {
  455 + actionRef.current.reload();
  456 + }}
  457 + />,
453 ]} 458 ]}
454 /> 459 />
455 </Space> 460 </Space>
src/pages/Client/FollowRecord/Components/ClientModal.tsx
@@ -25,11 +25,12 @@ export default ({ data, type, reloadTable }) =&gt; { @@ -25,11 +25,12 @@ export default ({ data, type, reloadTable }) =&gt; {
25 }, 25 },
26 }); 26 });
27 const matchingItem = resSearchId.data.data.find( 27 const matchingItem = resSearchId.data.data.find(
28 - (item) => item.name === values.name, 28 + (item) => item.id === values.name,
29 ); 29 );
30 let matchedId; 30 let matchedId;
31 if (matchingItem) { 31 if (matchingItem) {
32 matchedId = matchingItem.id; // 匹配成功,取出 id 32 matchedId = matchingItem.id; // 匹配成功,取出 id
  33 + values.name = matchingItem.name;
33 } else { 34 } else {
34 matchedId = null; // 如果没有匹配项,可以设置为 null 或其他值 35 matchedId = null; // 如果没有匹配项,可以设置为 null 或其他值
35 } 36 }
@@ -114,13 +115,22 @@ export default ({ data, type, reloadTable }) =&gt; { @@ -114,13 +115,22 @@ export default ({ data, type, reloadTable }) =&gt; {
114 }, 115 },
115 }); 116 });
116 console.log(data, '5656data?.nameedit'); 117 console.log(data, '5656data?.nameedit');
117 - const namesArray = res.data.data.map((item) => item.name);  
118 - const formattedObject = namesArray.reduce((acc, name) => {  
119 - acc[name] = name; // 将名称作为键和值 118 + // const namesArray = res.data.data.map((item) => item.name);
  119 + // const formattedObject = res.data.data.reduce((acc, name) => {
  120 + // acc[name] = name; // 将名称作为键和值
  121 + // return acc;
  122 + // }, {});
  123 + // console.log(namesArray, '5656namesArray');
  124 + // const formattedObject = res.data.data.reduce((acc, item) => {
  125 + // acc[item.name] = item.name; // 使用 name 作为键,id 作为值
  126 + // return acc;
  127 + // }, {});
  128 + // return enumToSelect(formattedObject);
  129 + const options = res.data.data.reduce((acc, item) => {
  130 + acc.push({ label: item.name, value: item.id }); // 使用 name 作为 label,id 作为 value
120 return acc; 131 return acc;
121 - }, {});  
122 - console.log(namesArray, '5656namesArray');  
123 - return enumToSelect(formattedObject); 132 + }, []);
  133 + return options;
124 }} 134 }}
125 rules={[ 135 rules={[
126 { 136 {
src/pages/Client/FollowRecord/index.tsx
@@ -4,7 +4,6 @@ import CommunicationHistoryModal from &#39;@/pages/Client/FollowRecord/Components/Co @@ -4,7 +4,6 @@ import CommunicationHistoryModal from &#39;@/pages/Client/FollowRecord/Components/Co
4 import { 4 import {
5 postAdminClientQueryClientComunicationInfo, 5 postAdminClientQueryClientComunicationInfo,
6 postAdminClientRemoveClientComunicationInfo, 6 postAdminClientRemoveClientComunicationInfo,
7 - // postServiceConstClientGroupFilters,  
8 postServiceConstClientWay, 7 postServiceConstClientWay,
9 postServiceConstTradeStatus, 8 postServiceConstTradeStatus,
10 } from '@/services'; 9 } from '@/services';
@@ -64,7 +63,7 @@ export default () =&gt; { @@ -64,7 +63,7 @@ export default () =&gt; {
64 }, 63 },
65 { 64 {
66 title: '跟进人员', 65 title: '跟进人员',
67 - dataIndex: 'createByName', 66 + dataIndex: 'updateByName',
68 width: 100, 67 width: 100,
69 ellipsis: true, 68 ellipsis: true,
70 hideInSearch: false, 69 hideInSearch: false,