Commit cba8c9eacf0a91533138ce7d0322057884c9fc48
1 parent
978db6d6
fix: 跟进记录根据状态禁止工单编辑
Showing
6 changed files
with
21 additions
and
579 deletions
.umirc.ts
@@ -14,8 +14,8 @@ export default defineConfig({ | @@ -14,8 +14,8 @@ export default defineConfig({ | ||
14 | }, | 14 | }, |
15 | proxy: { | 15 | proxy: { |
16 | '/api/': { | 16 | '/api/': { |
17 | - // target: 'http://localhost:8085/', | ||
18 | - target: 'http://192.168.1.6:8085/', | 17 | + target: 'http://localhost:8085/', |
18 | + // target: 'http://192.168.1.6:8085/', | ||
19 | // target: 'http://39.108.227.113:8085/', | 19 | // target: 'http://39.108.227.113:8085/', |
20 | changeOrigin: true, | 20 | changeOrigin: true, |
21 | pathRewrite: { '^/api': '' }, | 21 | pathRewrite: { '^/api': '' }, |
src/pages/Client/FollowRecord/Components/ClientImportModal.tsx deleted
100644 → 0
1 | -import { RESPONSE_CODE } from '@/constants/enum'; | ||
2 | -import { downloadFile } from '@/services/order'; | ||
3 | -import { blobToJson } from '@/utils'; | ||
4 | -import { ModalForm, ProFormUploadDragger } from '@ant-design/pro-components'; | ||
5 | -import { Button, Form, message } from 'antd'; | ||
6 | -import { RcFile } from 'antd/es/upload'; | ||
7 | -import axios from 'axios'; | ||
8 | - | ||
9 | -export default () => { | ||
10 | - const [form] = Form.useForm(); | ||
11 | - const [messageApi, contextHolder] = message.useMessage(); | ||
12 | - const downloadImportTemplate = () => { | ||
13 | - messageApi.open({ | ||
14 | - type: 'loading', | ||
15 | - content: '正在导入...', | ||
16 | - duration: 0, | ||
17 | - }); | ||
18 | - downloadFile( | ||
19 | - '/api/admin/client/downloadImportTemplate', | ||
20 | - '客户导入模板.xlsx', | ||
21 | - 'post', | ||
22 | - {}, | ||
23 | - () => { | ||
24 | - messageApi.destroy(); | ||
25 | - }, | ||
26 | - ); | ||
27 | - }; | ||
28 | - | ||
29 | - return ( | ||
30 | - <ModalForm | ||
31 | - title="导入客户信息" | ||
32 | - trigger={<Button type="primary">导入客户信息</Button>} | ||
33 | - form={form} | ||
34 | - autoFocusFirstInput | ||
35 | - modalProps={{ | ||
36 | - destroyOnClose: true, | ||
37 | - onCancel: () => console.log('run'), | ||
38 | - }} | ||
39 | - submitTimeout={2000} | ||
40 | - onFinish={async (values) => { | ||
41 | - const formData = new FormData(); | ||
42 | - values.file.forEach((file) => { | ||
43 | - formData.append('file', file.originFileObj as RcFile); | ||
44 | - }); | ||
45 | - axios({ | ||
46 | - url: '/api/admin/client/importClient', | ||
47 | - method: 'post', | ||
48 | - responseType: 'blob', | ||
49 | - headers: { | ||
50 | - Authorization: localStorage.getItem('token'), | ||
51 | - 'Content-Type': | ||
52 | - 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq', | ||
53 | - }, | ||
54 | - data: formData, | ||
55 | - }) | ||
56 | - .then((response) => { | ||
57 | - let data = response.data; | ||
58 | - if (data.type === 'application/json') { | ||
59 | - blobToJson(data).then((dataJson) => { | ||
60 | - if (dataJson?.result === RESPONSE_CODE.SUCCESS) { | ||
61 | - message.success(dataJson?.message); | ||
62 | - } else { | ||
63 | - message.error(dataJson?.message); | ||
64 | - } | ||
65 | - }); | ||
66 | - } else { | ||
67 | - message.error('上传失败,已下载错误信息表格'); | ||
68 | - // 创建一个新的 Blob 对象,它包含了服务器响应的数据(即你的 Excel 文件) | ||
69 | - const blob = new Blob([response.data]); // Excel 的 MIME 类型 | ||
70 | - const downloadUrl = window.URL.createObjectURL(blob); | ||
71 | - const a = document.createElement('a'); | ||
72 | - a.href = downloadUrl; | ||
73 | - a.download = '银行流水导入模板.xlsx'; // 你可以为文件命名 | ||
74 | - document.body.appendChild(a); | ||
75 | - a.click(); // 模拟点击操作来下载文件 | ||
76 | - URL.revokeObjectURL(downloadUrl); // 释放掉 blob 对象所占用的内存 | ||
77 | - document.body.removeChild(a); | ||
78 | - } | ||
79 | - }) | ||
80 | - .catch((error) => { | ||
81 | - // 处理错误 | ||
82 | - message.error('系统出现异常了,请联系管理员', error); | ||
83 | - }) | ||
84 | - .finally(() => {}); | ||
85 | - return true; | ||
86 | - }} | ||
87 | - > | ||
88 | - <ProFormUploadDragger max={1} label="上传" name="file" /> | ||
89 | - <Button type="link" onClick={downloadImportTemplate}> | ||
90 | - 下载导入模板 | ||
91 | - </Button> | ||
92 | - {contextHolder} | ||
93 | - </ModalForm> | ||
94 | - ); | ||
95 | -}; |
src/pages/Client/FollowRecord/Components/ClientModal.tsx
@@ -19,8 +19,10 @@ import { | @@ -19,8 +19,10 @@ import { | ||
19 | } from '@ant-design/pro-components'; | 19 | } from '@ant-design/pro-components'; |
20 | import { Button, Col, Form, Row, message } from 'antd'; | 20 | import { Button, Col, Form, Row, message } from 'antd'; |
21 | import { RcFile } from 'antd/es/upload'; | 21 | import { RcFile } from 'antd/es/upload'; |
22 | +import { useEffect } from 'react'; | ||
22 | import './style.css'; | 23 | import './style.css'; |
23 | export default ({ data, type, reloadTable }) => { | 24 | export default ({ data, type, reloadTable }) => { |
25 | + useEffect(() => {}); | ||
24 | const [form] = Form.useForm(); | 26 | const [form] = Form.useForm(); |
25 | const onfinish = async (values) => { | 27 | const onfinish = async (values) => { |
26 | const resSearchId = await postAdminClientQueryClientPage({ | 28 | const resSearchId = await postAdminClientQueryClientPage({ |
@@ -325,6 +327,7 @@ export default ({ data, type, reloadTable }) => { | @@ -325,6 +327,7 @@ export default ({ data, type, reloadTable }) => { | ||
325 | readonly={optType[type].readOnly} | 327 | readonly={optType[type].readOnly} |
326 | fieldProps={{ | 328 | fieldProps={{ |
327 | labelInValue: false, | 329 | labelInValue: false, |
330 | + disabled: data?.ticketsStatus === 'SOLVED', | ||
328 | }} | 331 | }} |
329 | initialValue={data?.ticketsType ? data?.ticketsType + '' : null} | 332 | initialValue={data?.ticketsType ? data?.ticketsType + '' : null} |
330 | request={async () => { | 333 | request={async () => { |
@@ -339,6 +342,10 @@ export default ({ data, type, reloadTable }) => { | @@ -339,6 +342,10 @@ export default ({ data, type, reloadTable }) => { | ||
339 | name="ticketsDetail" | 342 | name="ticketsDetail" |
340 | label="工单详情" | 343 | label="工单详情" |
341 | placeholder="请输入工单详情" | 344 | placeholder="请输入工单详情" |
345 | + fieldProps={{ | ||
346 | + labelInValue: false, | ||
347 | + disabled: data?.ticketsStatus === 'SOLVED', | ||
348 | + }} | ||
342 | initialValue={data?.ticketsDetail ? data?.ticketsDetail + '' : null} | 349 | initialValue={data?.ticketsDetail ? data?.ticketsDetail + '' : null} |
343 | readonly={optType[type].readOnly} | 350 | readonly={optType[type].readOnly} |
344 | ></ProFormTextArea> | 351 | ></ProFormTextArea> |
@@ -374,6 +381,10 @@ export default ({ data, type, reloadTable }) => { | @@ -374,6 +381,10 @@ export default ({ data, type, reloadTable }) => { | ||
374 | <Col span={4}>附件:</Col> | 381 | <Col span={4}>附件:</Col> |
375 | <Col span={20}> | 382 | <Col span={20}> |
376 | <UploadC | 383 | <UploadC |
384 | + fieldProps={{ | ||
385 | + labelInValue: false, | ||
386 | + disabled: data?.ticketsStatus === 'SOLVED', | ||
387 | + }} | ||
377 | onFilesChange={async (newFileList) => { | 388 | onFilesChange={async (newFileList) => { |
378 | if (newFileList.length > 0) { | 389 | if (newFileList.length > 0) { |
379 | const urls = []; // 创建一个数组来存储所有的 URL | 390 | const urls = []; // 创建一个数组来存储所有的 URL |
@@ -414,6 +425,7 @@ export default ({ data, type, reloadTable }) => { | @@ -414,6 +425,7 @@ export default ({ data, type, reloadTable }) => { | ||
414 | readonly={optType[type].readOnly} | 425 | readonly={optType[type].readOnly} |
415 | fieldProps={{ | 426 | fieldProps={{ |
416 | labelInValue: false, | 427 | labelInValue: false, |
428 | + disabled: data?.ticketsStatus === 'SOLVED', | ||
417 | }} | 429 | }} |
418 | initialValue={data?.assignPeople ? data?.assignPeople + '' : null} | 430 | initialValue={data?.assignPeople ? data?.assignPeople + '' : null} |
419 | label="指派人员" | 431 | label="指派人员" |
src/pages/Client/FollowRecord/Components/ClientModal2.tsx deleted
100644 → 0
1 | -import { RESPONSE_CODE } from '@/constants/enum'; | ||
2 | -import UploadC from '@/pages/Invoice/waitProcessRecord/components/UploadSingleImg'; | ||
3 | -import { | ||
4 | - postAdminClientAddOrModifyClientComunicationInfo, | ||
5 | - postAdminClientQueryClientPage, | ||
6 | - postOrderErpOrderStagesUpload, | ||
7 | - postOrderErpUsersListByPage, | ||
8 | - postServiceConstClientWay, | ||
9 | - postServiceConstTradeStatus, | ||
10 | -} from '@/services'; | ||
11 | -import { enumToSelect } from '@/utils'; | ||
12 | -import { | ||
13 | - ModalForm, | ||
14 | - ProFormDateTimePicker, | ||
15 | - ProFormSelect, | ||
16 | - ProFormText, | ||
17 | - ProFormTextArea, | ||
18 | - ProFormUploadDragger, | ||
19 | -} from '@ant-design/pro-components'; | ||
20 | -import { Button, Col, Form, Row, message } from 'antd'; | ||
21 | -import { RcFile } from 'antd/es/upload'; | ||
22 | -import './style.css'; | ||
23 | -export default ({ data, type, reloadTable }) => { | ||
24 | - const [form] = Form.useForm(); | ||
25 | - const onfinish = async (values) => { | ||
26 | - const resSearchId = await postAdminClientQueryClientPage({ | ||
27 | - data: { | ||
28 | - groupFilter: 'all', | ||
29 | - }, | ||
30 | - }); | ||
31 | - const matchingItem = resSearchId.data.data.find( | ||
32 | - (item) => item.id === values.name, | ||
33 | - ); | ||
34 | - let matchedId; | ||
35 | - if (matchingItem) { | ||
36 | - matchedId = matchingItem.id; // 匹配成功,取出 id | ||
37 | - values.name = matchingItem.name; | ||
38 | - } else { | ||
39 | - matchedId = null; // 如果没有匹配项,可以设置为 null 或其他值 | ||
40 | - } | ||
41 | - const res = await postAdminClientAddOrModifyClientComunicationInfo({ | ||
42 | - data: { | ||
43 | - ...values, | ||
44 | - ticketsAttachments: form.getFieldValue('ticketsAttachments'), | ||
45 | - clientId: matchedId, | ||
46 | - }, | ||
47 | - }); | ||
48 | - if (res.result === RESPONSE_CODE.SUCCESS) { | ||
49 | - message.success('新增成功'); | ||
50 | - reloadTable(); | ||
51 | - return true; | ||
52 | - } | ||
53 | - // 不返回不会关闭弹框 | ||
54 | - }; | ||
55 | - | ||
56 | - const editOnfinish = async (values) => { | ||
57 | - // setEditClientId(data.clientId); | ||
58 | - values.clientId = data.clientId; | ||
59 | - | ||
60 | - // const resSearchId = await postAdminClientQueryClientPage({ | ||
61 | - // data: { | ||
62 | - // groupFilter: 'all', | ||
63 | - // }, | ||
64 | - // }); | ||
65 | - // const matchingItem = resSearchId.data.data.find( | ||
66 | - // (item) => item.id === values.name, | ||
67 | - // ); | ||
68 | - const res = await postAdminClientAddOrModifyClientComunicationInfo({ | ||
69 | - data: { | ||
70 | - ...values, | ||
71 | - // ticketsAttachments: form.getFieldValue("ticketsAttachments"), | ||
72 | - ticketsAttachments: | ||
73 | - form.getFieldValue('ticketsAttachments') !== undefined | ||
74 | - ? form.getFieldValue('ticketsAttachments') | ||
75 | - : data?.ticketsAttachments, | ||
76 | - url: | ||
77 | - form.getFieldValue('url') !== undefined | ||
78 | - ? form.getFieldValue('url') | ||
79 | - : data?.url, | ||
80 | - // ticketsAttachments: data?.annexUrl, | ||
81 | - }, | ||
82 | - }); | ||
83 | - if (res.result === RESPONSE_CODE.SUCCESS) { | ||
84 | - message.success('新增成功'); | ||
85 | - reloadTable(); | ||
86 | - return true; | ||
87 | - } | ||
88 | - // 不返回不会关闭弹框 | ||
89 | - }; | ||
90 | - const optType = { | ||
91 | - add: { | ||
92 | - readOnly: false, | ||
93 | - title: '新增跟进记录', | ||
94 | - button: ( | ||
95 | - <Button size={'middle'} type="primary"> | ||
96 | - 新增 | ||
97 | - </Button> | ||
98 | - ), | ||
99 | - onFinish: onfinish, | ||
100 | - }, | ||
101 | - modify: { | ||
102 | - readOnly: false, | ||
103 | - title: '修改跟进记录', | ||
104 | - button: ( | ||
105 | - <Button size={'middle'} type="primary"> | ||
106 | - 编辑 | ||
107 | - </Button> | ||
108 | - ), | ||
109 | - onFinish: editOnfinish, | ||
110 | - }, | ||
111 | - detail: { | ||
112 | - readOnly: true, | ||
113 | - title: '查看跟进记录', | ||
114 | - button: ( | ||
115 | - <Button size={'middle'} type="primary" color="red"> | ||
116 | - 查看 | ||
117 | - </Button> | ||
118 | - ), | ||
119 | - onFinish: () => {}, | ||
120 | - }, | ||
121 | - }; | ||
122 | - return ( | ||
123 | - <ModalForm | ||
124 | - title={optType[type].title} | ||
125 | - resize={{ | ||
126 | - onResize() { | ||
127 | - console.log('resize!'); | ||
128 | - }, | ||
129 | - maxWidth: window.innerWidth * 0.8, | ||
130 | - minWidth: 400, | ||
131 | - }} | ||
132 | - form={form} | ||
133 | - trigger={optType[type].button} | ||
134 | - autoFocusFirstInput | ||
135 | - drawerProps={{ | ||
136 | - destroyOnClose: true, | ||
137 | - }} | ||
138 | - submitTimeout={2000} | ||
139 | - onFinish={optType[type].onFinish} | ||
140 | - > | ||
141 | - <ProFormSelect | ||
142 | - name="name" | ||
143 | - readonly={optType[type].readOnly} | ||
144 | - fieldProps={{ | ||
145 | - labelInValue: false, | ||
146 | - disabled: type === 'modify', | ||
147 | - }} | ||
148 | - initialValue={data ? data?.clientName + '' : null} | ||
149 | - label="客户" | ||
150 | - width="sm" | ||
151 | - request={async () => { | ||
152 | - const res = await postAdminClientQueryClientPage({ | ||
153 | - data: { | ||
154 | - groupFilter: 'all', | ||
155 | - }, | ||
156 | - }); | ||
157 | - // const namesArray = res.data.data.map((item) => item.name); | ||
158 | - // const formattedObject = res.data.data.reduce((acc, name) => { | ||
159 | - // acc[name] = name; // 将名称作为键和值 | ||
160 | - // return acc; | ||
161 | - // }, {}); | ||
162 | - // console.log(namesArray, '5656namesArray'); | ||
163 | - // const formattedObject = res.data.data.reduce((acc, item) => { | ||
164 | - // acc[item.name] = item.name; // 使用 name 作为键,id 作为值 | ||
165 | - // return acc; | ||
166 | - // }, {}); | ||
167 | - // return enumToSelect(formattedObject); | ||
168 | - const options = res.data.data.reduce((acc, item) => { | ||
169 | - acc.push({ label: item.name, value: item.id }); // 使用 name 作为 label,id 作为 value | ||
170 | - return acc; | ||
171 | - }, []); | ||
172 | - return options; | ||
173 | - }} | ||
174 | - rules={[ | ||
175 | - { | ||
176 | - required: true, | ||
177 | - message: '请选择客户', | ||
178 | - }, | ||
179 | - ]} | ||
180 | - ></ProFormSelect> | ||
181 | - <ProFormText | ||
182 | - name="contact" | ||
183 | - label="联系人" | ||
184 | - width="sm" | ||
185 | - placeholder="请输入联系人" | ||
186 | - initialValue={data?.content} | ||
187 | - readonly={optType[type].readOnly} | ||
188 | - rules={[ | ||
189 | - { | ||
190 | - required: true, | ||
191 | - message: '请输入联系人', | ||
192 | - }, | ||
193 | - ]} | ||
194 | - ></ProFormText> | ||
195 | - <ProFormText | ||
196 | - name="contactPhone" | ||
197 | - label="联系电话" | ||
198 | - width="sm" | ||
199 | - placeholder="请输入联系电话" | ||
200 | - initialValue={data?.content} | ||
201 | - readonly={optType[type].readOnly} | ||
202 | - rules={[ | ||
203 | - { | ||
204 | - required: true, | ||
205 | - message: '请输入联系电话', | ||
206 | - }, | ||
207 | - ]} | ||
208 | - ></ProFormText> | ||
209 | - <ProFormDateTimePicker | ||
210 | - name="datetime" | ||
211 | - label="跟进日期" | ||
212 | - initialValue={data ? data?.datetime + '' : null} | ||
213 | - placeholder="请选择跟进时间" | ||
214 | - width="sm" | ||
215 | - rules={[ | ||
216 | - { | ||
217 | - required: true, | ||
218 | - message: '请选择跟进日期', | ||
219 | - }, | ||
220 | - ]} | ||
221 | - /> | ||
222 | - <ProFormSelect | ||
223 | - name="tradeStatus" | ||
224 | - label="跟进状态" | ||
225 | - width="sm" | ||
226 | - placeholder="请输入跟进状态" | ||
227 | - readonly={optType[type].readOnly} | ||
228 | - fieldProps={{ | ||
229 | - labelInValue: false, | ||
230 | - }} | ||
231 | - initialValue={data?.tradeStatus ? data?.tradeStatus + '' : null} | ||
232 | - rules={[ | ||
233 | - { | ||
234 | - required: true, | ||
235 | - message: '请输入跟进状态', | ||
236 | - }, | ||
237 | - ]} | ||
238 | - request={async () => { | ||
239 | - const res = await postServiceConstTradeStatus(); | ||
240 | - return enumToSelect(res.data); | ||
241 | - }} | ||
242 | - /> | ||
243 | - <ProFormSelect | ||
244 | - name="way" | ||
245 | - width="sm" | ||
246 | - readonly={optType[type].readOnly} | ||
247 | - fieldProps={{ | ||
248 | - labelInValue: false, | ||
249 | - }} | ||
250 | - initialValue={data?.way ? data?.way + '' : null} | ||
251 | - label="跟进方式" | ||
252 | - request={async () => { | ||
253 | - const res = await postServiceConstClientWay(); | ||
254 | - return enumToSelect(res.data); | ||
255 | - }} | ||
256 | - rules={[ | ||
257 | - { | ||
258 | - required: true, | ||
259 | - message: '请选择跟进方式', | ||
260 | - }, | ||
261 | - ]} | ||
262 | - ></ProFormSelect> | ||
263 | - <ProFormTextArea | ||
264 | - name="content" | ||
265 | - label="跟进详情" | ||
266 | - placeholder="请输入跟进详情" | ||
267 | - initialValue={data?.content} | ||
268 | - readonly={optType[type].readOnly} | ||
269 | - rules={[ | ||
270 | - { | ||
271 | - required: true, | ||
272 | - message: '请输入跟进详情', | ||
273 | - }, | ||
274 | - ]} | ||
275 | - ></ProFormTextArea> | ||
276 | - <ProFormUploadDragger | ||
277 | - label="附件" | ||
278 | - name="attachment" | ||
279 | - action="upload.do" | ||
280 | - hidden={optType[type].readOnly} | ||
281 | - onChange={(info) => { | ||
282 | - const uploadFile = async ({ fileList: newFileList }) => { | ||
283 | - if (newFileList.length > 0) { | ||
284 | - const formData = new FormData(); | ||
285 | - formData.append('file', newFileList[0].originFileObj as RcFile); | ||
286 | - const res = await postOrderErpOrderStagesUpload({ | ||
287 | - data: formData, | ||
288 | - headers: { | ||
289 | - 'Content-Type': | ||
290 | - 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq', | ||
291 | - }, | ||
292 | - }); | ||
293 | - const url = res.data; | ||
294 | - console.log('attachments' + JSON.stringify(url)); | ||
295 | - form.setFieldValue('attachments', url); | ||
296 | - } else { | ||
297 | - form.setFieldValue('attachments', null); | ||
298 | - } | ||
299 | - }; | ||
300 | - uploadFile(info); | ||
301 | - }} | ||
302 | - max={1} | ||
303 | - /> | ||
304 | - <a hidden={!optType[type].readOnly} href={data?.attachments} download> | ||
305 | - 下载附件 | ||
306 | - </a> | ||
307 | - <ProFormTextArea | ||
308 | - name="comment" | ||
309 | - label="客户评价" | ||
310 | - placeholder="请输入客户评价" | ||
311 | - initialValue={data?.comment} | ||
312 | - readonly={optType[type].readOnly} | ||
313 | - ></ProFormTextArea> | ||
314 | - <ProFormText | ||
315 | - initialValue={data?.attachments} | ||
316 | - name="attachments" | ||
317 | - hidden | ||
318 | - ></ProFormText> | ||
319 | - <ProFormText initialValue={data?.id} name="id" hidden></ProFormText> | ||
320 | - <div className="styled-text"> | ||
321 | - <div className="vertical-line"></div> | ||
322 | - <span className="text">工单指派</span> | ||
323 | - </div> | ||
324 | - <ProFormSelect | ||
325 | - name="ticketsType" | ||
326 | - label="工单类型" | ||
327 | - width="sm" | ||
328 | - placeholder="请输入工单类型" | ||
329 | - readonly={optType[type].readOnly} | ||
330 | - fieldProps={{ | ||
331 | - labelInValue: false, | ||
332 | - }} | ||
333 | - initialValue={data?.ticketsType ? data?.ticketsType + '' : null} | ||
334 | - request={async () => { | ||
335 | - return [ | ||
336 | - { label: '问题', value: 'QUESTION' }, | ||
337 | - { label: '需求', value: 'DEMAND' }, | ||
338 | - { label: '建议', value: 'ADVICE' }, | ||
339 | - ]; | ||
340 | - }} | ||
341 | - /> | ||
342 | - <ProFormTextArea | ||
343 | - name="ticketsDetail" | ||
344 | - label="工单详情" | ||
345 | - placeholder="请输入工单详情" | ||
346 | - initialValue={data?.ticketsDetail ? data?.ticketsDetail + '' : null} | ||
347 | - readonly={optType[type].readOnly} | ||
348 | - ></ProFormTextArea> | ||
349 | - {/* <ProFormUploadDragger | ||
350 | - label="工单附件" | ||
351 | - name="ticketsAttachment" | ||
352 | - action="upload.do" | ||
353 | - hidden={optType[type].readOnly} | ||
354 | - onChange={(info) => { | ||
355 | - const uploadFile = async ({ fileList: newFileList }) => { | ||
356 | - if (newFileList.length > 0) { | ||
357 | - const formData = new FormData(); | ||
358 | - formData.append('file', newFileList[0].originFileObj as RcFile); | ||
359 | - const res = await postOrderErpOrderStagesUpload({ | ||
360 | - data: formData, | ||
361 | - headers: { | ||
362 | - 'Content-Type': | ||
363 | - 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq', | ||
364 | - }, | ||
365 | - }); | ||
366 | - const url = res.data; | ||
367 | - console.log('ticketsAttachments' + JSON.stringify(url)); | ||
368 | - form.setFieldValue('ticketsAttachments', url); | ||
369 | - } else { | ||
370 | - form.setFieldValue('ticketsAttachments', null); | ||
371 | - } | ||
372 | - }; | ||
373 | - uploadFile(info); | ||
374 | - }} | ||
375 | - max={1} | ||
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> | ||
411 | - <a hidden={!optType[type].readOnly} href={data?.orderAttachment} download> | ||
412 | - {/* <a href={data?.annexUrl} download> */} | ||
413 | - 下载附件 | ||
414 | - </a> | ||
415 | - <ProFormSelect | ||
416 | - name="assignPeople" | ||
417 | - width="sm" | ||
418 | - readonly={optType[type].readOnly} | ||
419 | - fieldProps={{ | ||
420 | - labelInValue: false, | ||
421 | - }} | ||
422 | - initialValue={data?.assignPeople ? data?.assignPeople + '' : null} | ||
423 | - label="指派人员" | ||
424 | - request={async () => { | ||
425 | - const res = await postOrderErpUsersListByPage({ | ||
426 | - data: { | ||
427 | - pageSize: 10000, | ||
428 | - }, | ||
429 | - }); | ||
430 | - const userOptions = res.data.records | ||
431 | - ? res.data.records.map((user) => ({ | ||
432 | - label: user.userName, // 或者使用其他需要的属性 | ||
433 | - value: user.userName, // 作为value的字段 | ||
434 | - })) | ||
435 | - : []; | ||
436 | - return userOptions; | ||
437 | - }} | ||
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> */} | ||
473 | - </ModalForm> | ||
474 | - ); | ||
475 | -}; |
src/pages/Client/FollowRecord/Components/CommunicationHistoryModal.tsx
@@ -33,6 +33,7 @@ export default ({ data, reloadTable }) => { | @@ -33,6 +33,7 @@ export default ({ data, reloadTable }) => { | ||
33 | const [assignPeople, setAssignPeople] = useState(''); // 附件名称 | 33 | const [assignPeople, setAssignPeople] = useState(''); // 附件名称 |
34 | useEffect(() => { | 34 | useEffect(() => { |
35 | const request = async () => { | 35 | const request = async () => { |
36 | + console.log(data, '5656datatatatata'); | ||
36 | const res = await postAdminClientQueryClientComunicationInfo({ | 37 | const res = await postAdminClientQueryClientComunicationInfo({ |
37 | data: { | 38 | data: { |
38 | id: data.id, | 39 | id: data.id, |
@@ -48,8 +49,8 @@ export default ({ data, reloadTable }) => { | @@ -48,8 +49,8 @@ export default ({ data, reloadTable }) => { | ||
48 | // data.annexUrl = resTicket.data.annexUrl; | 49 | // data.annexUrl = resTicket.data.annexUrl; |
49 | // data.assignPeople = resTicket.data.assignPeople; | 50 | // data.assignPeople = resTicket.data.assignPeople; |
50 | // console.log(resTicket, '5656resTicket'); | 51 | // console.log(resTicket, '5656resTicket'); |
52 | + // const dataSearch = res.data.data[0]; | ||
51 | const dataSearch = res.data.data[0]; | 53 | const dataSearch = res.data.data[0]; |
52 | - console.log(dataSearch, '5656dataSearch'); | ||
53 | if (dataSearch) { | 54 | if (dataSearch) { |
54 | // data.type = resTicket.data.type; | 55 | // data.type = resTicket.data.type; |
55 | // data.detailText = resTicket.data.detailText; | 56 | // data.detailText = resTicket.data.detailText; |
@@ -199,9 +200,7 @@ export default ({ data, reloadTable }) => { | @@ -199,9 +200,7 @@ export default ({ data, reloadTable }) => { | ||
199 | <ClientModal | 200 | <ClientModal |
200 | key={'modify'} | 201 | key={'modify'} |
201 | // data={data} // 将表单数据传递给 ClientModal | 202 | // data={data} // 将表单数据传递给 ClientModal |
202 | - data={{ | ||
203 | - data, | ||
204 | - }} // 传递修改后的 data | 203 | + data={data} // 传递修改后的 data |
205 | reloadTable={() => { | 204 | reloadTable={() => { |
206 | actionRef?.current?.reload(); // 重新加载表格数据 | 205 | actionRef?.current?.reload(); // 重新加载表格数据 |
207 | props.submit(); | 206 | props.submit(); |
src/pages/Client/FollowRecord/index.tsx
@@ -12,7 +12,6 @@ import type { ActionType } from '@ant-design/pro-components'; | @@ -12,7 +12,6 @@ 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, Popconfirm, 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'; | ||
16 | 15 | ||
17 | export default () => { | 16 | export default () => { |
18 | const actionRef = useRef<ActionType>(); | 17 | const actionRef = useRef<ActionType>(); |
@@ -23,6 +22,7 @@ export default () => { | @@ -23,6 +22,7 @@ export default () => { | ||
23 | 22 | ||
24 | // 更新 refreshKey,强制刷新 CommunicationHistoryModal | 23 | // 更新 refreshKey,强制刷新 CommunicationHistoryModal |
25 | setRefreshKey((prevKey) => prevKey + 1); | 24 | setRefreshKey((prevKey) => prevKey + 1); |
25 | + console.log('5656refresh'); | ||
26 | }; | 26 | }; |
27 | //biaoji | 27 | //biaoji |
28 | const columns = [ | 28 | const columns = [ |
@@ -241,7 +241,8 @@ export default () => { | @@ -241,7 +241,8 @@ export default () => { | ||
241 | return [ | 241 | return [ |
242 | <CommunicationHistoryModal | 242 | <CommunicationHistoryModal |
243 | // key={'communicationHistory'} | 243 | // key={'communicationHistory'} |
244 | - key={`communicationHistory-${refreshKey}`} // 使用 refreshKey 来强制更新组件 | 244 | + // key={'communicationHistory'} |
245 | + key={`${refreshKey}`} // 使用 refreshKey 来强制更新组件 | ||
245 | data={record} | 246 | data={record} |
246 | // reloadTable={() => { | 247 | // reloadTable={() => { |
247 | // actionRef.current.reload(); | 248 | // actionRef.current.reload(); |
@@ -249,7 +250,7 @@ export default () => { | @@ -249,7 +250,7 @@ export default () => { | ||
249 | // }} | 250 | // }} |
250 | reloadTable={reload} | 251 | reloadTable={reload} |
251 | />, | 252 | />, |
252 | - <ClientModal2 | 253 | + <ClientModal |
253 | key={'modify'} | 254 | key={'modify'} |
254 | // data={data} // 将表单数据传递给 ClientModal | 255 | // data={data} // 将表单数据传递给 ClientModal |
255 | data={record} // 传递修改后的 data | 256 | data={record} // 传递修改后的 data |