Commit 5213ab602dd34ad95754dc85b5782431a1f46ee7

Authored by boyang
1 parent 0a62353d

fix: 修改附件组件

src/pages/Client/Client/Components/ClientInformationModal.tsx
1 import { RESPONSE_CODE } from '@/constants/enum'; 1 import { RESPONSE_CODE } from '@/constants/enum';
  2 +import UploadC from '@/pages/Invoice/waitProcessRecord/components/UploadSingleImg';
2 import { 3 import {
3 postAdminClientAddOrModifyClientComunicationInfo, 4 postAdminClientAddOrModifyClientComunicationInfo,
4 postAdminClientQueryClientPage, 5 postAdminClientQueryClientPage,
@@ -16,7 +17,7 @@ import { @@ -16,7 +17,7 @@ import {
16 ProFormTextArea, 17 ProFormTextArea,
17 ProFormUploadDragger, 18 ProFormUploadDragger,
18 } from '@ant-design/pro-components'; 19 } from '@ant-design/pro-components';
19 -import { Button, Form, message } from 'antd'; 20 +import { Button, Col, Form, Row, message } from 'antd';
20 import { RcFile } from 'antd/es/upload'; 21 import { RcFile } from 'antd/es/upload';
21 import './style.css'; 22 import './style.css';
22 export default ({ data, type, reloadTable }) => { 23 export default ({ data, type, reloadTable }) => {
@@ -342,7 +343,7 @@ export default ({ data, type, reloadTable }) => { @@ -342,7 +343,7 @@ export default ({ data, type, reloadTable }) => {
342 initialValue={data?.ticketsDetail ? data?.ticketsDetail + '' : null} 343 initialValue={data?.ticketsDetail ? data?.ticketsDetail + '' : null}
343 readonly={optType[type].readOnly} 344 readonly={optType[type].readOnly}
344 ></ProFormTextArea> 345 ></ProFormTextArea>
345 - <ProFormUploadDragger 346 + {/* <ProFormUploadDragger
346 label="工单附件" 347 label="工单附件"
347 name="ticketsAttachment" 348 name="ticketsAttachment"
348 action="upload.do" 349 action="upload.do"
@@ -369,7 +370,41 @@ export default ({ data, type, reloadTable }) =&gt; { @@ -369,7 +370,41 @@ export default ({ data, type, reloadTable }) =&gt; {
369 uploadFile(info); 370 uploadFile(info);
370 }} 371 }}
371 max={1} 372 max={1}
372 - /> 373 + /> */}
  374 + <Row>
  375 + <Col span={4}>上传发票:</Col>
  376 + <Col span={20}>
  377 + <UploadC
  378 + onFilesChange={async (newFileList) => {
  379 + if (newFileList.length > 0) {
  380 + const urls = []; // 创建一个数组来存储所有的 URL
  381 +
  382 + for (const file of newFileList) {
  383 + const formData = new FormData();
  384 + formData.append('file', file.originFileObj as RcFile);
  385 +
  386 + const res = await postOrderErpOrderStagesUpload({
  387 + data: formData,
  388 + headers: {
  389 + 'Content-Type':
  390 + 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq',
  391 + },
  392 + });
  393 +
  394 + const url = res.data; // 获取响应中的 URL
  395 + urls.push(url); // 将每个 URL 追加到数组中
  396 + }
  397 +
  398 + // 将所有 URL 使用 ',' 进行拼接
  399 + const combinedUrl = urls.join(',');
  400 + form.setFieldValue('ticketsAttachments', combinedUrl); // 设置表单字段值为拼接后的 URL
  401 + } else {
  402 + form.setFieldValue('ticketsAttachments', null); // 如果没有文件,则清空 URL
  403 + }
  404 + }}
  405 + ></UploadC>
  406 + </Col>
  407 + </Row>
373 <a hidden={!optType[type].readOnly} href={data?.orderAttachment} download> 408 <a hidden={!optType[type].readOnly} href={data?.orderAttachment} download>
374 下载附件 409 下载附件
375 </a> 410 </a>
src/pages/Client/Client/Components/ClientModal.tsx
1 import { RESPONSE_CODE } from '@/constants/enum'; 1 import { RESPONSE_CODE } from '@/constants/enum';
  2 +import UploadC from '@/pages/Invoice/waitProcessRecord/components/UploadSingleImg';
2 import { 3 import {
3 postAdminClientAddOrModifyClientComunicationInfo, 4 postAdminClientAddOrModifyClientComunicationInfo,
4 postAdminClientQueryClientPage, 5 postAdminClientQueryClientPage,
@@ -16,7 +17,7 @@ import { @@ -16,7 +17,7 @@ import {
16 ProFormTextArea, 17 ProFormTextArea,
17 ProFormUploadDragger, 18 ProFormUploadDragger,
18 } from '@ant-design/pro-components'; 19 } from '@ant-design/pro-components';
19 -import { Button, Form, message } from 'antd'; 20 +import { Button, Col, Form, Row, message } from 'antd';
20 import { RcFile } from 'antd/es/upload'; 21 import { RcFile } from 'antd/es/upload';
21 import './style.css'; 22 import './style.css';
22 export default ({ data, type, reloadTable }) => { 23 export default ({ data, type, reloadTable }) => {
@@ -291,7 +292,41 @@ export default ({ data, type, reloadTable }) =&gt; { @@ -291,7 +292,41 @@ export default ({ data, type, reloadTable }) =&gt; {
291 initialValue={data?.detailText ? data?.detailText + '' : null} 292 initialValue={data?.detailText ? data?.detailText + '' : null}
292 readonly={optType[type].readOnly} 293 readonly={optType[type].readOnly}
293 ></ProFormTextArea> 294 ></ProFormTextArea>
294 - <ProFormUploadDragger 295 + <Row>
  296 + <Col span={4}>上传发票:</Col>
  297 + <Col span={20}>
  298 + <UploadC
  299 + onFilesChange={async (newFileList) => {
  300 + if (newFileList.length > 0) {
  301 + const urls = []; // 创建一个数组来存储所有的 URL
  302 +
  303 + for (const file of newFileList) {
  304 + const formData = new FormData();
  305 + formData.append('file', file.originFileObj as RcFile);
  306 +
  307 + const res = await postOrderErpOrderStagesUpload({
  308 + data: formData,
  309 + headers: {
  310 + 'Content-Type':
  311 + 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq',
  312 + },
  313 + });
  314 +
  315 + const url = res.data; // 获取响应中的 URL
  316 + urls.push(url); // 将每个 URL 追加到数组中
  317 + }
  318 +
  319 + // 将所有 URL 使用 ',' 进行拼接
  320 + const combinedUrl = urls.join(',');
  321 + form.setFieldValue('ticketsAttachments', combinedUrl); // 设置表单字段值为拼接后的 URL
  322 + } else {
  323 + form.setFieldValue('ticketsAttachments', null); // 如果没有文件,则清空 URL
  324 + }
  325 + }}
  326 + ></UploadC>
  327 + </Col>
  328 + </Row>
  329 + {/* <ProFormUploadDragger
295 label="工单附件" 330 label="工单附件"
296 name="ticketsAttachment" 331 name="ticketsAttachment"
297 action="upload.do" 332 action="upload.do"
@@ -318,7 +353,7 @@ export default ({ data, type, reloadTable }) =&gt; { @@ -318,7 +353,7 @@ export default ({ data, type, reloadTable }) =&gt; {
318 uploadFile(info); 353 uploadFile(info);
319 }} 354 }}
320 max={1} 355 max={1}
321 - /> 356 + /> */}
322 <a hidden={!optType[type].readOnly} href={data?.orderAttachment} download> 357 <a hidden={!optType[type].readOnly} href={data?.orderAttachment} download>
323 下载附件 358 下载附件
324 </a> 359 </a>
src/pages/Client/Client/Components/InformationHistoryModal.tsx
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 import ClientInformationModal from '@/pages/Client/Client/Components/ClientInformationModal'; 2 import ClientInformationModal from '@/pages/Client/Client/Components/ClientInformationModal';
3 3
4 import { 4 import {
5 - getOrderErpTicketsGetTicketsByClientId,  
6 postAdminClientQueryClientComunicationInfo, 5 postAdminClientQueryClientComunicationInfo,
7 postAdminClientRemoveClientComunicationInfo, 6 postAdminClientRemoveClientComunicationInfo,
8 } from '@/services/request'; 7 } from '@/services/request';
@@ -31,6 +30,7 @@ export default ({ data, reloadTable }) =&gt; { @@ -31,6 +30,7 @@ export default ({ data, reloadTable }) =&gt; {
31 const [ticketsDetail, setTicketsDetail] = useState(''); // 附件名称 30 const [ticketsDetail, setTicketsDetail] = useState(''); // 附件名称
32 const [ticketsAttachment, setTicketsAttachment] = useState(''); // 附件名称 31 const [ticketsAttachment, setTicketsAttachment] = useState(''); // 附件名称
33 const [assignPeople, setAssignPeople] = useState(''); // 附件名称 32 const [assignPeople, setAssignPeople] = useState(''); // 附件名称
  33 + const [comment, setComment] = useState(''); // 客户评价
34 34
35 useEffect(() => { 35 useEffect(() => {
36 const request = async () => { 36 const request = async () => {
@@ -39,18 +39,9 @@ export default ({ data, reloadTable }) =&gt; { @@ -39,18 +39,9 @@ export default ({ data, reloadTable }) =&gt; {
39 id: data.id, 39 id: data.id,
40 }, 40 },
41 }); 41 });
42 - const resTicket = await getOrderErpTicketsGetTicketsByClientId({  
43 - query: {  
44 - id: data.id,  
45 - },  
46 - });  
47 const dataSearch = res.data.data[0]; 42 const dataSearch = res.data.data[0];
48 43
49 if (dataSearch) { 44 if (dataSearch) {
50 - data.type = resTicket.data.type;  
51 - data.detailText = resTicket.data.detailText;  
52 - data.annexUrl = resTicket.data.annexUrl;  
53 - data.assignPeople = resTicket.data.assignPeople;  
54 if (dataSearch.attachments) { 45 if (dataSearch.attachments) {
55 const url = dataSearch.attachments; 46 const url = dataSearch.attachments;
56 const match = url.match(/aliyuncs\.com\/(.*?)\?/); 47 const match = url.match(/aliyuncs\.com\/(.*?)\?/);
@@ -63,11 +54,11 @@ export default ({ data, reloadTable }) =&gt; { @@ -63,11 +54,11 @@ export default ({ data, reloadTable }) =&gt; {
63 setAttachmentsName(decodedStr); // 设置跟进日期 54 setAttachmentsName(decodedStr); // 设置跟进日期
64 } 55 }
65 } 56 }
66 - 57 + setComment(dataSearch.comment);
67 setTicketsType(dataSearch.ticketsTypeText); 58 setTicketsType(dataSearch.ticketsTypeText);
68 - setTicketsDetail(resTicket.data.detailText);  
69 - setTicketsAttachment(resTicket.data.annexUrl);  
70 - setAssignPeople(resTicket.data.assignPeople); 59 + setTicketsDetail(dataSearch.ticketsDetail);
  60 + setTicketsAttachment(dataSearch.ticketsAttachments);
  61 + setAssignPeople(dataSearch.assignPeople);
71 setDatetime(dataSearch.datetime); // 设置跟进日期 62 setDatetime(dataSearch.datetime); // 设置跟进日期
72 // setDateRange(data.dateRange || []); // 设置跟进时间范围 63 // setDateRange(data.dateRange || []); // 设置跟进时间范围
73 setCreateByName(dataSearch.createByName); // 设置跟进人员 64 setCreateByName(dataSearch.createByName); // 设置跟进人员
@@ -141,6 +132,11 @@ export default ({ data, reloadTable }) =&gt; { @@ -141,6 +132,11 @@ export default ({ data, reloadTable }) =&gt; {
141 label: '指派人员', 132 label: '指派人员',
142 children: assignPeople, // 跟进状态 133 children: assignPeople, // 跟进状态
143 }, 134 },
  135 + {
  136 + key: '11',
  137 + label: '客户评价',
  138 + children: comment, // 跟进状态
  139 + },
144 ]; 140 ];
145 const handleDelete = async () => { 141 const handleDelete = async () => {
146 // 调用删除接口 142 // 调用删除接口
@@ -250,10 +246,10 @@ export default ({ data, reloadTable }) =&gt; { @@ -250,10 +246,10 @@ export default ({ data, reloadTable }) =&gt; {
250 工单附件:{ticketsAttachment} 246 工单附件:{ticketsAttachment}
251 </a> 247 </a>
252 )} */} 248 )} */}
253 - {ticketsAttachment && ( 249 + {/* {ticketsAttachment && (
254 <div> 250 <div>
255 {ticketsAttachment.includes('jpg') || 251 {ticketsAttachment.includes('jpg') ||
256 - ticketsAttachment.includes('png') ? ( 252 + ticketsAttachment.includes('png') ? (
257 <> 253 <>
258 <img 254 <img
259 src={ticketsAttachment} 255 src={ticketsAttachment}
@@ -271,6 +267,28 @@ export default ({ data, reloadTable }) =&gt; { @@ -271,6 +267,28 @@ export default ({ data, reloadTable }) =&gt; {
271 </a> 267 </a>
272 )} 268 )}
273 </div> 269 </div>
  270 + )} */}
  271 + {ticketsAttachment && (
  272 + <div>
  273 + {ticketsAttachment.split(',').map((ticketsAttachment, index) => (
  274 + <div key={index}>
  275 + {ticketsAttachment.includes('jpg') ||
  276 + ticketsAttachment.includes('png') ? (
  277 + <>
  278 + <img
  279 + src={ticketsAttachment}
  280 + alt={`附件 ${index + 1}`}
  281 + style={{ maxWidth: '300px', height: 'auto' }}
  282 + />
  283 + <div></div>
  284 + </>
  285 + ) : null}
  286 + <a href={ticketsAttachment} download>
  287 + 工单附件:{ticketsAttachment}
  288 + </a>
  289 + </div>
  290 + ))}
  291 + </div>
274 )} 292 )}
275 </ModalForm> 293 </ModalForm>
276 </Space> 294 </Space>
src/pages/Client/Client/index.tsx
@@ -166,6 +166,13 @@ const columns = [ @@ -166,6 +166,13 @@ const columns = [
166 // return enumToSelect(res.data); 166 // return enumToSelect(res.data);
167 // }, 167 // },
168 // }, 168 // },
  169 + // {
  170 + // title: '创建人',
  171 + // width: 150,
  172 + // ellipsis: true,
  173 + // dataIndex: 'createByName',
  174 + // hideInSearch: true,
  175 + // },
169 { 176 {
170 title: '客户等级', 177 title: '客户等级',
171 width: 150, 178 width: 150,
src/pages/Client/FollowRecord/Components/ClientModal.tsx
1 import { RESPONSE_CODE } from '@/constants/enum'; 1 import { RESPONSE_CODE } from '@/constants/enum';
  2 +import UploadC from '@/pages/Invoice/waitProcessRecord/components/UploadSingleImg';
2 import { 3 import {
3 postAdminClientAddOrModifyClientComunicationInfo, 4 postAdminClientAddOrModifyClientComunicationInfo,
4 postAdminClientQueryClientPage, 5 postAdminClientQueryClientPage,
@@ -16,7 +17,7 @@ import { @@ -16,7 +17,7 @@ import {
16 ProFormTextArea, 17 ProFormTextArea,
17 ProFormUploadDragger, 18 ProFormUploadDragger,
18 } from '@ant-design/pro-components'; 19 } from '@ant-design/pro-components';
19 -import { Button, Form, message } from 'antd'; 20 +import { Button, Col, Form, Row, message } from 'antd';
20 import { RcFile } from 'antd/es/upload'; 21 import { RcFile } from 'antd/es/upload';
21 import './style.css'; 22 import './style.css';
22 export default ({ data, type, reloadTable }) => { 23 export default ({ data, type, reloadTable }) => {
@@ -341,7 +342,7 @@ export default ({ data, type, reloadTable }) =&gt; { @@ -341,7 +342,7 @@ export default ({ data, type, reloadTable }) =&gt; {
341 initialValue={data?.ticketsDetail ? data?.ticketsDetail + '' : null} 342 initialValue={data?.ticketsDetail ? data?.ticketsDetail + '' : null}
342 readonly={optType[type].readOnly} 343 readonly={optType[type].readOnly}
343 ></ProFormTextArea> 344 ></ProFormTextArea>
344 - <ProFormUploadDragger 345 + {/* <ProFormUploadDragger
345 label="工单附件" 346 label="工单附件"
346 name="ticketsAttachment" 347 name="ticketsAttachment"
347 action="upload.do" 348 action="upload.do"
@@ -368,7 +369,41 @@ export default ({ data, type, reloadTable }) =&gt; { @@ -368,7 +369,41 @@ export default ({ data, type, reloadTable }) =&gt; {
368 uploadFile(info); 369 uploadFile(info);
369 }} 370 }}
370 max={1} 371 max={1}
371 - /> 372 + /> */}
  373 + <Row>
  374 + <Col span={4}>上传发票:</Col>
  375 + <Col span={20}>
  376 + <UploadC
  377 + onFilesChange={async (newFileList) => {
  378 + if (newFileList.length > 0) {
  379 + const urls = []; // 创建一个数组来存储所有的 URL
  380 +
  381 + for (const file of newFileList) {
  382 + const formData = new FormData();
  383 + formData.append('file', file.originFileObj as RcFile);
  384 +
  385 + const res = await postOrderErpOrderStagesUpload({
  386 + data: formData,
  387 + headers: {
  388 + 'Content-Type':
  389 + 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq',
  390 + },
  391 + });
  392 +
  393 + const url = res.data; // 获取响应中的 URL
  394 + urls.push(url); // 将每个 URL 追加到数组中
  395 + }
  396 +
  397 + // 将所有 URL 使用 ',' 进行拼接
  398 + const combinedUrl = urls.join(',');
  399 + form.setFieldValue('ticketsAttachments', combinedUrl); // 设置表单字段值为拼接后的 URL
  400 + } else {
  401 + form.setFieldValue('ticketsAttachments', null); // 如果没有文件,则清空 URL
  402 + }
  403 + }}
  404 + ></UploadC>
  405 + </Col>
  406 + </Row>
372 <a hidden={!optType[type].readOnly} href={data?.orderAttachment} download> 407 <a hidden={!optType[type].readOnly} href={data?.orderAttachment} download>
373 {/* <a href={data?.annexUrl} download> */} 408 {/* <a href={data?.annexUrl} download> */}
374 下载附件 409 下载附件
src/pages/Client/FollowRecord/Components/ClientModal2.tsx
1 import { RESPONSE_CODE } from '@/constants/enum'; 1 import { RESPONSE_CODE } from '@/constants/enum';
  2 +import UploadC from '@/pages/Invoice/waitProcessRecord/components/UploadSingleImg';
2 import { 3 import {
3 postAdminClientAddOrModifyClientComunicationInfo, 4 postAdminClientAddOrModifyClientComunicationInfo,
4 postAdminClientQueryClientPage, 5 postAdminClientQueryClientPage,
@@ -16,7 +17,7 @@ import { @@ -16,7 +17,7 @@ import {
16 ProFormTextArea, 17 ProFormTextArea,
17 ProFormUploadDragger, 18 ProFormUploadDragger,
18 } from '@ant-design/pro-components'; 19 } from '@ant-design/pro-components';
19 -import { Button, Form, message } from 'antd'; 20 +import { Button, Col, Form, Row, message } from 'antd';
20 import { RcFile } from 'antd/es/upload'; 21 import { RcFile } from 'antd/es/upload';
21 import './style.css'; 22 import './style.css';
22 export default ({ data, type, reloadTable }) => { 23 export default ({ data, type, reloadTable }) => {
@@ -72,6 +73,10 @@ export default ({ data, type, reloadTable }) =&gt; { @@ -72,6 +73,10 @@ export default ({ data, type, reloadTable }) =&gt; {
72 form.getFieldValue('ticketsAttachments') !== undefined 73 form.getFieldValue('ticketsAttachments') !== undefined
73 ? form.getFieldValue('ticketsAttachments') 74 ? form.getFieldValue('ticketsAttachments')
74 : data?.ticketsAttachments, 75 : data?.ticketsAttachments,
  76 + url:
  77 + form.getFieldValue('url') !== undefined
  78 + ? form.getFieldValue('url')
  79 + : data?.url,
75 // ticketsAttachments: data?.annexUrl, 80 // ticketsAttachments: data?.annexUrl,
76 }, 81 },
77 }); 82 });
@@ -341,7 +346,7 @@ export default ({ data, type, reloadTable }) =&gt; { @@ -341,7 +346,7 @@ export default ({ data, type, reloadTable }) =&gt; {
341 initialValue={data?.ticketsDetail ? data?.ticketsDetail + '' : null} 346 initialValue={data?.ticketsDetail ? data?.ticketsDetail + '' : null}
342 readonly={optType[type].readOnly} 347 readonly={optType[type].readOnly}
343 ></ProFormTextArea> 348 ></ProFormTextArea>
344 - <ProFormUploadDragger 349 + {/* <ProFormUploadDragger
345 label="工单附件" 350 label="工单附件"
346 name="ticketsAttachment" 351 name="ticketsAttachment"
347 action="upload.do" 352 action="upload.do"
@@ -368,7 +373,41 @@ export default ({ data, type, reloadTable }) =&gt; { @@ -368,7 +373,41 @@ export default ({ data, type, reloadTable }) =&gt; {
368 uploadFile(info); 373 uploadFile(info);
369 }} 374 }}
370 max={1} 375 max={1}
371 - /> 376 + /> */}
  377 + <Row>
  378 + <Col span={4}>上传发票:</Col>
  379 + <Col span={20}>
  380 + <UploadC
  381 + onFilesChange={async (newFileList) => {
  382 + if (newFileList.length > 0) {
  383 + const urls = []; // 创建一个数组来存储所有的 URL
  384 +
  385 + for (const file of newFileList) {
  386 + const formData = new FormData();
  387 + formData.append('file', file.originFileObj as RcFile);
  388 +
  389 + const res = await postOrderErpOrderStagesUpload({
  390 + data: formData,
  391 + headers: {
  392 + 'Content-Type':
  393 + 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq',
  394 + },
  395 + });
  396 +
  397 + const url = res.data; // 获取响应中的 URL
  398 + urls.push(url); // 将每个 URL 追加到数组中
  399 + }
  400 +
  401 + // 将所有 URL 使用 ',' 进行拼接
  402 + const combinedUrl = urls.join(',');
  403 + form.setFieldValue('ticketsAttachments', combinedUrl); // 设置表单字段值为拼接后的 URL
  404 + } else {
  405 + form.setFieldValue('ticketsAttachments', null); // 如果没有文件,则清空 URL
  406 + }
  407 + }}
  408 + ></UploadC>
  409 + </Col>
  410 + </Row>
372 <a hidden={!optType[type].readOnly} href={data?.orderAttachment} download> 411 <a hidden={!optType[type].readOnly} href={data?.orderAttachment} download>
373 {/* <a href={data?.annexUrl} download> */} 412 {/* <a href={data?.annexUrl} download> */}
374 下载附件 413 下载附件
@@ -397,6 +436,40 @@ export default ({ data, type, reloadTable }) =&gt; { @@ -397,6 +436,40 @@ export default ({ data, type, reloadTable }) =&gt; {
397 return userOptions; 436 return userOptions;
398 }} 437 }}
399 ></ProFormSelect> 438 ></ProFormSelect>
  439 + {/* <Row>
  440 + <Col span={4}>上传发票:</Col>
  441 + <Col span={20}>
  442 + <UploadC
  443 + onFilesChange={async (newFileList) => {
  444 + if (newFileList.length > 0) {
  445 + const urls = []; // 创建一个数组来存储所有的 URL
  446 +
  447 + for (const file of newFileList) {
  448 + const formData = new FormData();
  449 + formData.append('file', file.originFileObj as RcFile);
  450 +
  451 + const res = await postOrderErpOrderStagesUpload({
  452 + data: formData,
  453 + headers: {
  454 + 'Content-Type':
  455 + 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq',
  456 + },
  457 + });
  458 +
  459 + const url = res.data; // 获取响应中的 URL
  460 + urls.push(url); // 将每个 URL 追加到数组中
  461 + }
  462 +
  463 + // 将所有 URL 使用 ',' 进行拼接
  464 + const combinedUrl = urls.join(',');
  465 + form.setFieldValue('url', combinedUrl); // 设置表单字段值为拼接后的 URL
  466 + } else {
  467 + form.setFieldValue('url', null); // 如果没有文件,则清空 URL
  468 + }
  469 + }}
  470 + ></UploadC>
  471 + </Col>
  472 + </Row> */}
400 </ModalForm> 473 </ModalForm>
401 ); 474 );
402 }; 475 };
src/pages/Client/FollowRecord/Components/CommunicationHistoryModal.tsx
1 import ClientModal from '@/pages/Client/FollowRecord/Components/ClientModal'; 1 import ClientModal from '@/pages/Client/FollowRecord/Components/ClientModal';
2 import { 2 import {
3 - getOrderErpTicketsGetTicketsByClientId,  
4 postAdminClientQueryClientComunicationInfo, 3 postAdminClientQueryClientComunicationInfo,
5 postAdminClientRemoveClientComunicationInfo, 4 postAdminClientRemoveClientComunicationInfo,
6 } from '@/services/request'; 5 } from '@/services/request';
@@ -28,8 +27,9 @@ export default ({ data, reloadTable }) =&gt; { @@ -28,8 +27,9 @@ export default ({ data, reloadTable }) =&gt; {
28 const [attachmentsName, setAttachmentsName] = useState(''); // 附件名称 27 const [attachmentsName, setAttachmentsName] = useState(''); // 附件名称
29 const [ticketsType, setTicketsType] = useState(''); // 附件名称 28 const [ticketsType, setTicketsType] = useState(''); // 附件名称
30 const [ticketsDetail, setTicketsDetail] = useState(''); // 附件名称 29 const [ticketsDetail, setTicketsDetail] = useState(''); // 附件名称
31 - const [ticketsAttachment, setTicketsAttachment] = useState(''); // 附件名称 30 + const [ticketsAttachment, setTicketsAttachment] = useState(); // 附件名称
32 // const [ticketsAttachmentName, setTicketsAttachmentName] = useState(''); // 附件名称 31 // const [ticketsAttachmentName, setTicketsAttachmentName] = useState(''); // 附件名称
  32 + const [comment, setComment] = useState(''); // 客户评价
33 const [assignPeople, setAssignPeople] = useState(''); // 附件名称 33 const [assignPeople, setAssignPeople] = useState(''); // 附件名称
34 useEffect(() => { 34 useEffect(() => {
35 const request = async () => { 35 const request = async () => {
@@ -38,22 +38,23 @@ export default ({ data, reloadTable }) =&gt; { @@ -38,22 +38,23 @@ export default ({ data, reloadTable }) =&gt; {
38 id: data.id, 38 id: data.id,
39 }, 39 },
40 }); 40 });
41 - const resTicket = await getOrderErpTicketsGetTicketsByClientId({  
42 - query: {  
43 - id: data.id,  
44 - },  
45 - }); 41 + // const resTicket = await getOrderErpTicketsGetTicketsByClientId({
  42 + // query: {
  43 + // id: data.id,
  44 + // },
  45 + // });
46 // data.type = resTicket.data.type; 46 // data.type = resTicket.data.type;
47 // data.detailText = resTicket.data.detailText; 47 // data.detailText = resTicket.data.detailText;
48 // data.annexUrl = resTicket.data.annexUrl; 48 // data.annexUrl = resTicket.data.annexUrl;
49 // data.assignPeople = resTicket.data.assignPeople; 49 // data.assignPeople = resTicket.data.assignPeople;
50 // console.log(resTicket, '5656resTicket'); 50 // console.log(resTicket, '5656resTicket');
51 const dataSearch = res.data.data[0]; 51 const dataSearch = res.data.data[0];
  52 + console.log(dataSearch, '5656dataSearch');
52 if (dataSearch) { 53 if (dataSearch) {
53 - data.type = resTicket.data.type;  
54 - data.detailText = resTicket.data.detailText;  
55 - data.annexUrl = resTicket.data.annexUrl;  
56 - data.assignPeople = resTicket.data.assignPeople; 54 + // data.type = resTicket.data.type;
  55 + // data.detailText = resTicket.data.detailText;
  56 + // data.annexUrl = resTicket.data.annexUrl;
  57 + // data.assignPeople = resTicket.data.assignPeople;
57 if (dataSearch.attachments) { 58 if (dataSearch.attachments) {
58 const url = dataSearch.attachments; 59 const url = dataSearch.attachments;
59 const match = url.match(/aliyuncs\.com\/(.*?)\?/); 60 const match = url.match(/aliyuncs\.com\/(.*?)\?/);
@@ -78,10 +79,12 @@ export default ({ data, reloadTable }) =&gt; { @@ -78,10 +79,12 @@ export default ({ data, reloadTable }) =&gt; {
78 // setTicketsAttachmentName(decodedStr); // 设置跟进日期 79 // setTicketsAttachmentName(decodedStr); // 设置跟进日期
79 // } 80 // }
80 // } 81 // }
  82 + setComment(dataSearch.comment);
81 setTicketsType(dataSearch.ticketsTypeText); 83 setTicketsType(dataSearch.ticketsTypeText);
82 - setTicketsDetail(resTicket.data.detailText);  
83 - setTicketsAttachment(resTicket.data.annexUrl);  
84 - setAssignPeople(resTicket.data.assignPeople); 84 + setTicketsDetail(dataSearch.ticketsDetail);
  85 + setTicketsAttachment(dataSearch.ticketsAttachments);
  86 + setAssignPeople(dataSearch.assignPeople);
  87 + setComment(dataSearch.comment);
85 setDatetime(dataSearch.datetime); // 设置跟进日期 88 setDatetime(dataSearch.datetime); // 设置跟进日期
86 // setDateRange(data.dateRange || []); // 设置跟进时间范围 89 // setDateRange(data.dateRange || []); // 设置跟进时间范围
87 setCreateByName(dataSearch.createByName); // 设置跟进人员 90 setCreateByName(dataSearch.createByName); // 设置跟进人员
@@ -146,7 +149,7 @@ export default ({ data, reloadTable }) =&gt; { @@ -146,7 +149,7 @@ export default ({ data, reloadTable }) =&gt; {
146 children: ticketsDetail, // 跟进状态 149 children: ticketsDetail, // 跟进状态
147 }, 150 },
148 // { 151 // {
149 - // key: '10', 152 + // key: '12',
150 // label: '工单附件', 153 // label: '工单附件',
151 // children: ticketsAttachment, // 跟进状态 154 // children: ticketsAttachment, // 跟进状态
152 // }, 155 // },
@@ -155,6 +158,11 @@ export default ({ data, reloadTable }) =&gt; { @@ -155,6 +158,11 @@ export default ({ data, reloadTable }) =&gt; {
155 label: '指派人员', 158 label: '指派人员',
156 children: assignPeople, // 跟进状态 159 children: assignPeople, // 跟进状态
157 }, 160 },
  161 + {
  162 + key: '11',
  163 + label: '客户评价',
  164 + children: comment, // 跟进状态
  165 + },
158 ]; 166 ];
159 const handleDelete = async () => { 167 const handleDelete = async () => {
160 // 调用删除接口 168 // 调用删除接口
@@ -192,11 +200,7 @@ export default ({ data, reloadTable }) =&gt; { @@ -192,11 +200,7 @@ export default ({ data, reloadTable }) =&gt; {
192 key={'modify'} 200 key={'modify'}
193 // data={data} // 将表单数据传递给 ClientModal 201 // data={data} // 将表单数据传递给 ClientModal
194 data={{ 202 data={{
195 - ...data,  
196 - type: data.type,  
197 - detailText: data.detailText,  
198 - annexUrl: data.annexUrl,  
199 - assignPeople: data.assignPeople, 203 + data,
200 }} // 传递修改后的 data 204 }} // 传递修改后的 data
201 reloadTable={() => { 205 reloadTable={() => {
202 actionRef?.current?.reload(); // 重新加载表格数据 206 actionRef?.current?.reload(); // 重新加载表格数据
@@ -277,10 +281,10 @@ export default ({ data, reloadTable }) =&gt; { @@ -277,10 +281,10 @@ export default ({ data, reloadTable }) =&gt; {
277 工单附件:{ticketsAttachment} 281 工单附件:{ticketsAttachment}
278 </a> 282 </a>
279 )} */} 283 )} */}
280 - {ticketsAttachment && ( 284 + {/* {ticketsAttachment && (
281 <div> 285 <div>
282 {ticketsAttachment.includes('jpg') || 286 {ticketsAttachment.includes('jpg') ||
283 - ticketsAttachment.includes('png') ? ( 287 + ticketsAttachment.includes('png') ? (
284 <> 288 <>
285 <img 289 <img
286 src={ticketsAttachment} 290 src={ticketsAttachment}
@@ -298,6 +302,28 @@ export default ({ data, reloadTable }) =&gt; { @@ -298,6 +302,28 @@ export default ({ data, reloadTable }) =&gt; {
298 </a> 302 </a>
299 )} 303 )}
300 </div> 304 </div>
  305 + )} */}
  306 + {ticketsAttachment && (
  307 + <div>
  308 + {ticketsAttachment.split(',').map((ticketsAttachment, index) => (
  309 + <div key={index}>
  310 + {ticketsAttachment.includes('jpg') ||
  311 + ticketsAttachment.includes('png') ? (
  312 + <>
  313 + <img
  314 + src={ticketsAttachment}
  315 + alt={`附件 ${index + 1}`}
  316 + style={{ maxWidth: '300px', height: 'auto' }}
  317 + />
  318 + <div></div>
  319 + </>
  320 + ) : null}
  321 + <a href={ticketsAttachment} download>
  322 + 工单附件:{ticketsAttachment}
  323 + </a>
  324 + </div>
  325 + ))}
  326 + </div>
301 )} 327 )}
302 </ModalForm> 328 </ModalForm>
303 </Space> 329 </Space>
src/pages/Client/FollowRecord/index.tsx
@@ -10,7 +10,7 @@ import { @@ -10,7 +10,7 @@ import {
10 import { enumToSelect } from '@/utils'; 10 import { enumToSelect } from '@/utils';
11 import type { ActionType } from '@ant-design/pro-components'; 11 import type { ActionType } from '@ant-design/pro-components';
12 import { ProTable } from '@ant-design/pro-components'; 12 import { ProTable } from '@ant-design/pro-components';
13 -import { Button, Space, message } from 'antd'; 13 +import { Button, Popconfirm, Space, message } from 'antd';
14 import { useRef, useState } from 'react'; 14 import { useRef, useState } from 'react';
15 import ClientModal2 from './Components/ClientModal2'; 15 import ClientModal2 from './Components/ClientModal2';
16 16
@@ -264,7 +264,7 @@ export default () =&gt; { @@ -264,7 +264,7 @@ export default () =&gt; {
264 style={{ marginRight: '10px' }} 264 style={{ marginRight: '10px' }}
265 />, 265 />,
266 <> 266 <>
267 - <Button 267 + {/* <Button
268 key={'delete'} 268 key={'delete'}
269 onClick={() => { 269 onClick={() => {
270 handleDelete(); 270 handleDelete();
@@ -276,13 +276,39 @@ export default () =&gt; { @@ -276,13 +276,39 @@ export default () =&gt; {
276 type="primary" 276 type="primary"
277 size="middle" 277 size="middle"
278 danger 278 danger
279 - // 使用 danger 属性来将按钮颜色设置为红色  
280 - // onFinish={() => {  
281 - // actionRef.current.reload();  
282 - // }} 279 + // 使用 danger 属性来将按钮颜色设置为红色
  280 + // onFinish={() => {
  281 + // actionRef.current.reload();
  282 + // }}
283 > 283 >
284 删除 284 删除
285 </Button> 285 </Button>
  286 + <ButtonConfirm
  287 + key={'delete'}
  288 + className="p-0"
  289 + title={'是否确认删除'}
  290 + text="删除"
  291 + type="primary"
  292 + size="middle"
  293 + danger
  294 + onConfirm={async () => {
  295 + handleDelete();
  296 + actionRef.current.reload();
  297 + }}
  298 + /> */}
  299 + <Popconfirm
  300 + title={'是否确认删除'}
  301 + onConfirm={async () => {
  302 + handleDelete();
  303 + actionRef.current.reload();
  304 + }}
  305 + okText="确认"
  306 + cancelText="取消"
  307 + >
  308 + <Button key={'delete'} type="primary" size="middle" danger>
  309 + 删除
  310 + </Button>
  311 + </Popconfirm>
286 </>, 312 </>,
287 ]; 313 ];
288 }, 314 },