ソースを参照

同屏对比添加文件上传接口,首页自然资源分布Card显示异常BUG修复。

DESKTOP-6LTVLN7\Liumouren 2 年 前
コミット
be6763427c

+ 3 - 1
src/api/url.js

@@ -38,5 +38,7 @@ export default {
   // group的请求DMS数据列表(搜索条件联动)
   auditSelectContentList: "/audit/audit/selectContentList",
   // 动态查询条件
-  getContentInfoWhere: "/audit/audit/getContentInfoWhere"
+  getContentInfoWhere: "/audit/audit/getContentInfoWhere",
+  // 文件上传
+  proxyDmsFileUploadFile: "/dms/file/uploadFile"
 };

+ 60 - 1
src/components/common/BottomForm/SameScreenComparison.vue

@@ -168,7 +168,9 @@ export default {
       // 底部文本域
       textarea1: "",
       // 地图底图列表
-      mapList: []
+      mapList: [],
+      // 导出图片blob数据暂存
+      imgBlob: []
     };
   },
   created() {
@@ -275,9 +277,23 @@ export default {
         this.cutDiv();
       }
     },
+    // base64转file对象
+    base64ToFile(base64, fileName) {
+      let arr = base64.split(",");
+      let mime = arr[0].match(/:(.*?);/)[1];
+      let bstr = atob(arr[1]);
+      let n = bstr.length;
+      let u8arr = new Uint8Array(n);
+      while (n--) {
+        u8arr[n] = bstr.charCodeAt(n);
+      }
+      // image/png
+      return new File([u8arr], fileName, { type: mime });
+    },
     // div转图片
     cutDiv() {
       try {
+        this.imgBlob = [];
         this.doPrintLoading = true;
         var container = document.getElementById("doPrint").innerHTML;
         const _width = container.offsetWidth;
@@ -326,6 +342,7 @@ export default {
         html2canvas(this.$refs.doPrint, ops).then(
           canvas => {
             document.getElementById("imgOut").setAttribute("src", canvas.toDataURL("image/png"));
+            this.imgBlob = canvas;
             setTimeout(() => {
               if (that.doPrintLoading) {
                 that.doPrint(parentNodeList, svgElemNodeList, canvasList);
@@ -373,6 +390,48 @@ export default {
       document.body.appendChild(new_iframe);
       doc = new_iframe.contentWindow.document;
       var obj = document.getElementById("imgBox");
+
+      try {
+        let fileParams = {
+          columnId: "776",
+          paraName: "print.png",
+          type: "3",
+          file: base64ToFile(this.imgBlob, "print.png")
+        };
+        this.$Post(this.urlsCollection.proxyDmsFileUploadFile, fileParams).then(res => {
+          if (res.code === 200) {
+            let filePath = res.content;
+            // 开始提交
+            let createTaskForm = {
+              c_print_user_id: localStorage.getItem("USER_ID"),
+              print_file: filePath,
+              c_print_time: parseInt(new Date().getTime() / 1000) * 1000
+            };
+            let params = new FormData();
+            params.append("columnId", "1405");
+            params.append("modelId", "776");
+            params.append("content", JSON.stringify(createTaskForm));
+            this.$Post(this.urlsCollection.addContent, params).then(
+              res => {
+                if (res.code === 200) {
+                  this.$message.success(res.message);
+                } else {
+                  this.$message.error(res.message);
+                }
+              },
+              error => {
+                this.submitLoading = false;
+                this.$message.error(error);
+              }
+            );
+          } else {
+            this.$message.error(res.message);
+          }
+        });
+      } catch (e) {
+        this.$message.error("文件上传失败:" + e);
+      }
+
       doc.write(obj.innerHTML);
       doc.close();
       this.showMapSvgAndRemoveMapCanvas(parentNodeList, svgElemNodeList, canvasList);

+ 1 - 1
src/views/HomeView.vue

@@ -72,7 +72,7 @@
         @selectEvent="homeSelect"
         v-if="$ifMenu('1', '')"
       />
-      <div id="mainMenus_topRight" v-if="menus.main[0]">
+      <div id="mainMenus_topRight" v-if="menus.main[0]" v-show="$ifMenu('1', '')">
         <MenuCard :menuData="menus.main[0]">
           <div class="bar-btn">
             <div