From ccbe1710b9c52b0ca23150b0a9ca763da6e1223c Mon Sep 17 00:00:00 2001
From: dminyi <1301963064@qq.com>
Date: Thu, 12 Sep 2024 15:43:22 +0800
Subject: [PATCH] Merge branch 'master' of http://120.79.193.119:9090/r/gzzfw/frontEnd/gzDyh into master

---
 gz-customerSystem/src/views/register/matterDetail/FileUpLoad.jsx |   92 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 66 insertions(+), 26 deletions(-)

diff --git a/gz-customerSystem/src/views/register/matterDetail/FileUpLoad.jsx b/gz-customerSystem/src/views/register/matterDetail/FileUpLoad.jsx
index 5f48ce3..4afdef4 100644
--- a/gz-customerSystem/src/views/register/matterDetail/FileUpLoad.jsx
+++ b/gz-customerSystem/src/views/register/matterDetail/FileUpLoad.jsx
@@ -3,7 +3,7 @@
 import * as $$ from '@/utils/utility';
 import { Form, Input, Modal, Upload } from '@arco-design/web-react';
 import { IconLink } from '@arco-design/web-react/icon';
-
+import './index.less'
 
 const FormItem = Form.Item;
 const appUrl = $$.appUrl;
@@ -30,15 +30,61 @@
       ...currentFile,
       url: URL.createObjectURL(currentFile.originFile),
     });
-
-    setScanContent(fileView.response.data.ocrResult.wordsResult[0])
   };
 
-  console.log(fileView, 'fileView')
+  const handleScaned = () => {
+    setScaned(true)
+    const content = fileView.response.data.ocrResult.wordsResult.join('\n')
+    setTimeout(() => {
+      console.log(formRef.current, content);
+      formRef.current.setFieldValue('scanContent', content)
+    }, 0)
+    setScanContent(content)
+  }
+
+  const handleText = () => {
+    onConfirm(scanContent);
+    setScanFile(false);
+    setScanImage(false);
+    setScaned(false);
+  }
 
   return (
     <>
-      <Modal style={{ width: '1200px' }} visible={visible} onCancel={onCancel} title='识别上传材料' centered footer={null}>
+
+      <Modal
+        // style={{ width: '944px' }}
+        visible={scanImage}
+        onCancel={() => setScanImage(false)}
+        footer={null}
+        title='选择识别范围'
+        centered
+        unmountOnExit={true}
+        maskClosable={false}
+      >
+        <img
+          src={fileView?.url}
+          alt=""
+          style={{
+            display: 'block',
+            margin: 'auto',
+            maxWidth: '100%',
+            maxHeight: '100%',
+            objectFit: 'contain',
+          }}
+        />
+        <div><Button type="primary" onClick={() => handleScaned()} style={{ marginTop: '20px' }}>开始识别</Button></div>
+      </Modal>
+      <Modal
+        // style={{ width: '1200px' }}
+        visible={visible}
+        onCancel={onCancel}
+        title='识别上传材料'
+        centered
+        footer={null}
+        unmountOnExit={true}
+        maskClosable={false}
+      >
         <Form
           layout='vertical'
           requiredSymbol={false}
@@ -61,7 +107,6 @@
               }}
               tip='支持png、 jpg、pdf等格式文件上传,每次上传大小不超过10M'
               showUploadList={{
-                // Please dont remove this comment
                 fileIcon: <IconLink style={{ color: '#1D2129' }} />,
               }}
               // onChange={(info, currentFile) => {
@@ -84,29 +129,26 @@
 
         </Form>
 
-      </Modal>
-      <Modal style={{ width: '944px' }} visible={scanImage} onCancel={() => setScanImage(false)} footer={null} title='选择识别范围' centered>
-        <img
-          src={fileView?.url}
-          alt=""
-          style={{
-            display: 'block',
-            margin: 'auto',
-            maxWidth: '100%',
-            maxHeight: '100%',
-            objectFit: 'contain',
-          }}
-        />
-        <div><Button type="primary" onClick={() => setScaned(true)} style={{ marginTop: '20px' }}>开始识别</Button></div>
-      </Modal>
-      <Modal style={{ width: '1200px' }} visible={scaned} onCancel={() => setScaned(false)} footer={null} title='识别上传材料' centered>
+      </Modal >
+      <Modal
+        className='scan-modal'
+        // style={{ width: '1200px' }}
+        wrapStyle={{ zIndex: 1002 }}
+        visible={scaned}
+        onCancel={() => setScaned(false)}
+        footer={null}
+        title='识别上传材料'
+        centered
+        unmountOnExit={true}
+        maskClosable={false}
+        mountOnEnter={false}
+      >
         <Form
           ref={formRef}
           layout='vertical'
           requiredSymbol={false}
           scrollToFirstError={true}
           initialValues={{
-            scanContent: scanContent,
           }}//默认值
         >
           <FormItem
@@ -117,13 +159,11 @@
               showWordLimit
               rows={5}
               placeholder=''
-              defaultValue={scanContent}
               wrapperStyle={{ width: '100%' }}
               onChange={(v) => console.log(v, 'vvvvvv')}
             />
-            <div style={{ marginTop: '24px' }}><Button type="primary" onClick={() => { onConfirm(); setScanFile(false); setScanImage(false); setScaned(false); }}>使用文字</Button></div>
           </FormItem>
-
+          <div style={{ marginTop: '24px' }}><Button type="primary" onClick={() => { handleText() }}>使用文字</Button></div>
         </Form>
       </Modal>
 

--
Gitblit v1.8.0