From c9303f5f4ff471081bdeb6ed2c15448a77adfb22 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期三, 03 四月 2024 11:08:05 +0800
Subject: [PATCH] 调整在线编制报告页面

---
 src/components/tool/word.vue                  |   11 +-
 src/components/view/b1-report-preparation.vue |   25 +++++
 package-lock.json                             |   96 +++++++++++++++++++++++
 src/main.js                                   |    2 
 src/util/file.js                              |   47 +++++++++++
 static/img/no-full.svg                        |    1 
 package.json                                  |    1 
 7 files changed, 172 insertions(+), 11 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index afa2cbe..03199f3 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -471,6 +471,11 @@
       "resolved": "https://registry.npmjs.org/@wangeditor/video-module/-/video-module-1.1.4.tgz",
       "integrity": "sha512-ZdodDPqKQrgx3IwWu4ZiQmXI8EXZ3hm2/fM6E3t5dB8tCaIGWQZhmqd6P5knfkRAd3z2+YRSRbxOGfoRSp/rLg=="
     },
+    "@xmldom/xmldom": {
+      "version": "0.8.10",
+      "resolved": "https://registry.npmmirror.com/@xmldom/xmldom/-/xmldom-0.8.10.tgz",
+      "integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw=="
+    },
     "JSV": {
       "version": "4.0.2",
       "resolved": "https://registry.npmjs.org/JSV/-/JSV-4.0.2.tgz",
@@ -691,7 +696,6 @@
       "version": "1.0.10",
       "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
       "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
-      "dev": true,
       "requires": {
         "sprintf-js": "~1.0.2"
       }
@@ -3577,6 +3581,11 @@
         }
       }
     },
+    "dingbat-to-unicode": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmmirror.com/dingbat-to-unicode/-/dingbat-to-unicode-1.0.1.tgz",
+      "integrity": "sha512-98l0sW87ZT58pU4i61wa2OHwxbiYSbuxsCBozaVnYX2iCnr3bLM3fIes1/ej7h1YdOKuKt/MLs706TVnALA65w=="
+    },
     "dir-glob": {
       "version": "2.2.2",
       "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.2.2.tgz",
@@ -3684,6 +3693,21 @@
       "requires": {
         "contra": "1.9.4",
         "crossvent": "1.5.5"
+      }
+    },
+    "duck": {
+      "version": "0.1.12",
+      "resolved": "https://registry.npmmirror.com/duck/-/duck-0.1.12.tgz",
+      "integrity": "sha512-wkctla1O6VfP89gQ+J/yDesM0S7B7XLXjKGzXxMDVFg7uEn706niAtyYovKbyq1oT9YwDcly721/iUWoc8MVRg==",
+      "requires": {
+        "underscore": "^1.13.1"
+      },
+      "dependencies": {
+        "underscore": {
+          "version": "1.13.6",
+          "resolved": "https://registry.npmmirror.com/underscore/-/underscore-1.13.6.tgz",
+          "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A=="
+        }
       }
     },
     "duplexer": {
@@ -6266,6 +6290,23 @@
         "js-tokens": "^3.0.0 || ^4.0.0"
       }
     },
+    "lop": {
+      "version": "0.4.1",
+      "resolved": "https://registry.npmmirror.com/lop/-/lop-0.4.1.tgz",
+      "integrity": "sha512-9xyho9why2A2tzm5aIcMWKvzqKsnxrf9B5I+8O30olh6lQU8PH978LqZoI4++37RBgS1Em5i54v1TFs/3wnmXQ==",
+      "requires": {
+        "duck": "^0.1.12",
+        "option": "~0.2.1",
+        "underscore": "^1.13.1"
+      },
+      "dependencies": {
+        "underscore": {
+          "version": "1.13.6",
+          "resolved": "https://registry.npmmirror.com/underscore/-/underscore-1.13.6.tgz",
+          "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A=="
+        }
+      }
+    },
     "loud-rejection": {
       "version": "1.6.0",
       "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz",
@@ -6340,6 +6381,46 @@
       "dev": true,
       "requires": {
         "pify": "^3.0.0"
+      }
+    },
+    "mammoth": {
+      "version": "1.7.1",
+      "resolved": "https://registry.npmmirror.com/mammoth/-/mammoth-1.7.1.tgz",
+      "integrity": "sha512-ckxfvNH5sUaJh+SbYbxpvB7urZTGS02jA91rFCNiL928CgE9FXXMyXxcJBY0n+CpmKE/eWh7qaV0+v+Dbwun3Q==",
+      "requires": {
+        "@xmldom/xmldom": "^0.8.6",
+        "argparse": "~1.0.3",
+        "base64-js": "^1.5.1",
+        "bluebird": "~3.4.0",
+        "dingbat-to-unicode": "^1.0.1",
+        "jszip": "^3.7.1",
+        "lop": "^0.4.1",
+        "path-is-absolute": "^1.0.0",
+        "underscore": "^1.13.1",
+        "xmlbuilder": "^10.0.0"
+      },
+      "dependencies": {
+        "bluebird": {
+          "version": "3.4.7",
+          "resolved": "https://registry.npmmirror.com/bluebird/-/bluebird-3.4.7.tgz",
+          "integrity": "sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA=="
+        },
+        "jszip": {
+          "version": "3.10.1",
+          "resolved": "https://registry.npmmirror.com/jszip/-/jszip-3.10.1.tgz",
+          "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==",
+          "requires": {
+            "lie": "~3.3.0",
+            "pako": "~1.0.2",
+            "readable-stream": "~2.3.6",
+            "setimmediate": "^1.0.5"
+          }
+        },
+        "underscore": {
+          "version": "1.13.6",
+          "resolved": "https://registry.npmmirror.com/underscore/-/underscore-1.13.6.tgz",
+          "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A=="
+        }
       }
     },
     "map-cache": {
@@ -7810,6 +7891,11 @@
           }
         }
       }
+    },
+    "option": {
+      "version": "0.2.4",
+      "resolved": "https://registry.npmmirror.com/option/-/option-0.2.4.tgz",
+      "integrity": "sha512-pkEqbDyl8ou5cpq+VsnQbe/WlEy5qS7xPzMS1U55OCG9KPvwFD46zDbxQIj3egJSFc3D+XhYOPUzz49zQAVy7A=="
     },
     "ora": {
       "version": "1.4.0",
@@ -11631,8 +11717,7 @@
     "sprintf-js": {
       "version": "1.0.3",
       "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
-      "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
-      "dev": true
+      "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
     },
     "ssf": {
       "version": "0.10.3",
@@ -13742,6 +13827,11 @@
         }
       }
     },
+    "xmlbuilder": {
+      "version": "10.1.1",
+      "resolved": "https://registry.npmmirror.com/xmlbuilder/-/xmlbuilder-10.1.1.tgz",
+      "integrity": "sha512-OyzrcFLL/nb6fMGHbiRDuPup9ljBycsdCypwuyg5AAHvyWzGfChJpCXMG88AGTIMFhGZ9RccFN1e6lhg3hkwKg=="
+    },
     "xmlchars": {
       "version": "2.2.0",
       "resolved": "https://registry.npmmirror.com/xmlchars/-/xmlchars-2.2.0.tgz",
diff --git a/package.json b/package.json
index fb17cee..5e1b7c1 100644
--- a/package.json
+++ b/package.json
@@ -31,6 +31,7 @@
     "layui": "^2.6.8",
     "luckyexcel": "^1.0.1",
     "luckysheet": "^2.1.13",
+    "mammoth": "^1.7.1",
     "muse-ui": "^3.0.2",
     "node-emoji": "^1.11.0",
     "popper.js": "^1.16.1",
diff --git a/src/components/tool/word.vue b/src/components/tool/word.vue
index 749a06c..1a4dce5 100644
--- a/src/components/tool/word.vue
+++ b/src/components/tool/word.vue
@@ -1,5 +1,5 @@
 <template>
-  <div class="tinymce-box">
+  <div class="tinymce-box" style="height: 100%">
     <editor
       v-model="myValue"
       :init="init"
@@ -49,7 +49,7 @@
     },
     plugins: {
       type: [String, Array],
-      default: 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template code codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount imagetools textpattern emoticons autosave bdmap indent2em autoresize formatpainter axupimgs'
+      default: 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template code codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount imagetools textpattern help emoticons autosave bdmap indent2em autoresize formatpainter axupimgs',
     },
     toolbar: {
       type: [String, Array],
@@ -67,6 +67,7 @@
         language: 'zh_CN',
         skin_url: `/static/tinymce/skins/ui/oxide`,
         convert_urls: false,
+        fullscreen_native: false,
         height: 500,
         // content_css锛堜负缂栬緫鍖烘寚瀹歝ss鏂囦欢锛�,鍔犱笂灏变笉鏄剧ず瀛楁暟缁熻浜�
         content_css: `/static/tinymce/skins/content/default/content.css`,
@@ -123,6 +124,8 @@
 }
 
 </script>
-<style scoped>
-
+<style>
+div.tox.tox-tinymce.tox-tinymce--toolbar-sticky-off{
+  height: 100% !important;
+}
 </style>
diff --git a/src/components/view/b1-report-preparation.vue b/src/components/view/b1-report-preparation.vue
index 4579292..c407f7b 100644
--- a/src/components/view/b1-report-preparation.vue
+++ b/src/components/view/b1-report-preparation.vue
@@ -38,6 +38,12 @@
 	.el-form-item {
 		margin-bottom: 16px;
 	}
+
+  .full-screen{
+    position: absolute;
+    right: 52px;
+    top: 22px;
+  }
 </style>
 
 <template>
@@ -77,8 +83,12 @@
 					:key="upIndex" @handleWeave="handleWeave"/>
 			</div>
 		</div>
-    <el-dialog title="鍦ㄧ嚎缂栧埗" :visible.sync="claimVisible" width="80%" :modal-append-to-body="false">
-      <Word style="height:70vh" v-if="claimVisible" ref="Word"/>
+    <el-dialog title="鍦ㄧ嚎缂栧埗" :visible.sync="claimVisible" width="25cm" :modal-append-to-body="false" :fullscreen="fullscreen">
+      <div class="full-screen">
+        <i class="el-icon-full-screen" style="cursor: pointer;font-size: 18px" @click="fullscreen=true;" v-if="!fullscreen"></i>
+        <img src="../../../static/img/no-full.svg" alt="" v-else style="cursor: pointer;" @click="fullscreen=false;" >
+      </div>
+      <Word :style="fullscreen?'height:83vh':'height:70vh'" v-if="claimVisible" ref="Word" :value="value"/>
 			<span slot="footer" class="dialog-footer">
 				<el-button @click="claimVisible = false">鍙� 娑�</el-button>
 				<el-button type="primary" @click="confirmClaim">纭� 瀹�</el-button>
@@ -90,6 +100,7 @@
 <script>
 	import ValueTable from '../tool/value-table.vue'
   import Word from '../tool/word.vue'
+  // import convertFileToHtml from '../../util/file';
 	export default {
 		components: {
 			ValueTable,
@@ -188,14 +199,22 @@
 				entityCopy: {},
 				upIndex: 0,
         statusList:[],
-        claimVisible:false
+        claimVisible:false,
+        fullscreen:false,
+        value:''
 			}
 		},
+    watch:{
+      claimVisible(val){
+        this.fullscreen = false;
+      }
+    },
 		mounted() {
 			this.entityCopy = this.HaveJson(this.componentData.entity)
 			this.getPower()
 		},
 		methods: {
+      // ...convertFileToHtml(),
 			refreshTable() {
 				this.$refs['ValueTable'].selectList()
 			},
diff --git a/src/main.js b/src/main.js
index def9d78..41bde4c 100644
--- a/src/main.js
+++ b/src/main.js
@@ -13,7 +13,7 @@
 
 //鏈湴
 Vue.prototype.LOCATIONVUE = "http://127.0.0.1:80";
-const javaApi = 'http://192.168.0.10:8001';//鏉�
+const javaApi = 'http://192.168.0.161:8001';//鏉�
 // const javaApi = 'http://114.132.189.42:9006';//娴嬭瘯鏈�
 //鑳滀簯鏈嶅姟鍣�
 // Vue.prototype.LOCATIONVUE = "http://syxt.shxiao2.cn";
diff --git a/src/util/file.js b/src/util/file.js
new file mode 100644
index 0000000..cca1216
--- /dev/null
+++ b/src/util/file.js
@@ -0,0 +1,47 @@
+import * as pdfjsLib from 'pdfjs-dist';
+import { convertToHtml } from 'mammoth';
+
+export default {
+  methods: {
+    convertFileToHtml(file) {
+      const fileType = file.type.split('/')[1];
+      const fileExtension = fileType === 'pdf' ? '.pdf' : '.docx';
+
+      // 灏嗘枃浠惰浆鎹负Blob瀵硅薄
+      const fileReader = new FileReader();
+      fileReader.onload = async (event) => {
+        const arrayBuffer = event.target.result;
+        const byteArray = new Uint8Array(arrayBuffer);
+        const blob = new Blob([byteArray], { type: fileType + fileExtension });
+
+        if (fileType === 'pdf') {
+          // 浣跨敤pdfjsLib灏哖DF杞崲涓篐TML
+          const pdfData = await pdfjsLib.getDocument(blob).promise;
+          const pageNumber = 1;
+          const scale = 1;
+          const viewport = pageNumber * scale;
+          const canvas = document.createElement('canvas');
+          const context = canvas.getContext('2d');
+          canvas.width = pdfData.internal.pageSize.getWidth() * scale;
+          canvas.height = pdfData.internal.pageSize.getHeight() * scale;
+          const renderContext = {
+            canvasContext: context,
+            viewport: viewport,
+          };
+          const renderTask = pdfData.getPage(pageNumber).render(renderContext);
+          await renderTask.promise;
+          const base64Image = canvas.toDataURL('image/png');
+
+          // 灏哹ase64Image杞崲涓篐TML
+          const htmlContent = `<img src="${base64Image}" />`;
+          return htmlContent;
+        } else if (fileType === 'docx') {
+          // 浣跨敤mammoth灏哤ord杞崲涓篐TML
+          const htmlContent = await convertToHtml(blob, { format: 'html' });
+          return htmlContent;
+        }
+      };
+      fileReader.readAsArrayBuffer(blob);
+    },
+  },
+};
diff --git a/static/img/no-full.svg b/static/img/no-full.svg
new file mode 100644
index 0000000..e78c651
--- /dev/null
+++ b/static/img/no-full.svg
@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1712111454775" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5950" width="18" height="18" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M354.133333 682.666667H256v-42.666667h170.666667v170.666667H384v-98.133334L243.2 853.333333l-29.866667-29.866666L354.133333 682.666667z m358.4 0l140.8 140.8-29.866666 29.866666-140.8-140.8V810.666667h-42.666667v-170.666667h170.666667v42.666667h-98.133334zM354.133333 384L213.333333 243.2l29.866667-29.866667L384 354.133333V256h42.666667v170.666667H256V384h98.133333z m358.4 0H810.666667v42.666667h-170.666667V256h42.666667v98.133333L823.466667 213.333333l29.866666 29.866667L712.533333 384z" fill="#606266" p-id="5951"></path></svg>
\ No newline at end of file

--
Gitblit v1.9.3