Commit 01f92adfbb52fa39e29185d8f1f49e96a0629b6e

Authored by zhongnanhuang
1 parent 1206ec5f

feat: update 与发票核销功能分支合并

src/pages/Invoice/components/BankImportModal.tsx
@@ -83,6 +83,7 @@ export default ({ setVisible, onClose }) => { @@ -83,6 +83,7 @@ export default ({ setVisible, onClose }) => {
83 blobToJson(data).then((dataJson) => { 83 blobToJson(data).then((dataJson) => {
84 if (dataJson?.result === RESPONSE_CODE.SUCCESS) { 84 if (dataJson?.result === RESPONSE_CODE.SUCCESS) {
85 message.success(dataJson?.message); 85 message.success(dataJson?.message);
  86 + onClose();
86 } else { 87 } else {
87 message.error(dataJson?.message); 88 message.error(dataJson?.message);
88 } 89 }
@@ -99,7 +100,6 @@ export default ({ setVisible, onClose }) => { @@ -99,7 +100,6 @@ export default ({ setVisible, onClose }) => {
99 a.click(); // 模拟点击操作来下载文件 100 a.click(); // 模拟点击操作来下载文件
100 URL.revokeObjectURL(downloadUrl); // 释放掉 blob 对象所占用的内存 101 URL.revokeObjectURL(downloadUrl); // 释放掉 blob 对象所占用的内存
101 document.body.removeChild(a); 102 document.body.removeChild(a);
102 - onClose();  
103 } 103 }
104 }) 104 })
105 .catch((error) => { 105 .catch((error) => {
@@ -149,7 +149,6 @@ export default ({ setVisible, onClose }) => { @@ -149,7 +149,6 @@ export default ({ setVisible, onClose }) => {
149 }} 149 }}
150 onFinish={async () => { 150 onFinish={async () => {
151 handleUpload(); 151 handleUpload();
152 - onClose();  
153 }} 152 }}
154 onOpenChange={setVisible} 153 onOpenChange={setVisible}
155 > 154 >
src/pages/Invoice/index.tsx
@@ -474,6 +474,7 @@ const InvoicePage = () => { @@ -474,6 +474,7 @@ const InvoicePage = () => {
474 <BankImportModal 474 <BankImportModal
475 setVisible={setBankImportModalVisible} 475 setVisible={setBankImportModalVisible}
476 onClose={() => { 476 onClose={() => {
  477 + setBankImportModalVisible(false);
477 invoiceActionRef.current?.reload(); 478 invoiceActionRef.current?.reload();
478 bankActionRef.current?.reload(); 479 bankActionRef.current?.reload();
479 }} 480 }}
src/pages/Order/index.tsx
@@ -1075,26 +1075,6 @@ const OrderPage = () =&gt; { @@ -1075,26 +1075,6 @@ const OrderPage = () =&gt; {
1075 '' 1075 ''
1076 )} 1076 )}
1077 1077
1078 - {optRecord.subPath?.includes('afterSalesCompletion') ? (  
1079 - <ButtonConfirm  
1080 - className="p-0"  
1081 - title="是否完成售后?"  
1082 - text="完成售后"  
1083 - onConfirm={async () => {  
1084 - let res = await postServiceOrderAfterSalesCompletion({  
1085 - data: { ids: [optRecord.id] },  
1086 - });  
1087 - if (res.result === RESPONSE_CODE.SUCCESS) {  
1088 - message.success(res.message);  
1089 - refreshTable();  
1090 - return true;  
1091 - }  
1092 - }}  
1093 - />  
1094 - ) : (  
1095 - ''  
1096 - )}  
1097 -  
1098 {optRecord.subPath?.includes('procureOrder') ? ( 1078 {optRecord.subPath?.includes('procureOrder') ? (
1099 <ButtonConfirm 1079 <ButtonConfirm
1100 className="p-0" 1080 className="p-0"
@@ -1413,7 +1393,7 @@ const OrderPage = () =&gt; { @@ -1413,7 +1393,7 @@ const OrderPage = () =&gt; {
1413 <Flex justify="flex-end"> 1393 <Flex justify="flex-end">
1414 <Space.Compact direction="vertical" align="end"> 1394 <Space.Compact direction="vertical" align="end">
1415 <Space> 1395 <Space>
1416 - {record.mainPath?.includes('updateHirePurchase') ? ( 1396 + {false ? (
1417 <Button 1397 <Button
1418 className="p-0" 1398 className="p-0"
1419 type="link" 1399 type="link"
src/utils/index.ts
@@ -296,6 +296,31 @@ function FloatDiv(arg1: any, arg2: any) { @@ -296,6 +296,31 @@ function FloatDiv(arg1: any, arg2: any) {
296 } 296 }
297 } 297 }
298 298
  299 +async function blobToJson(blob: any) {
  300 + return new Promise((resolve, reject) => {
  301 + const reader = new FileReader();
  302 +
  303 + // 设置读取完成的事件处理程序
  304 + reader.onload = function (event) {
  305 + try {
  306 + const jsonString = event?.target?.result;
  307 + const jsonObject = JSON.parse(jsonString);
  308 + resolve(jsonObject);
  309 + } catch (error) {
  310 + reject(error);
  311 + }
  312 + };
  313 +
  314 + // 设置读取出错的事件处理程序
  315 + reader.onerror = function (error) {
  316 + reject(error);
  317 + };
  318 +
  319 + // 开始读取Blob对象
  320 + reader.readAsText(blob, 'UTF-8');
  321 + });
  322 +}
  323 +
299 export { 324 export {
300 FloatAdd, 325 FloatAdd,
301 FloatDiv, 326 FloatDiv,
@@ -303,6 +328,7 @@ export { @@ -303,6 +328,7 @@ export {
303 FloatSub, 328 FloatSub,
304 appendFormData, 329 appendFormData,
305 blobToFile, 330 blobToFile,
  331 + blobToJson,
306 copyToClipboard, 332 copyToClipboard,
307 customMessage, 333 customMessage,
308 dataURItoBlob, 334 dataURItoBlob,