Pārlūkot izejas kodu

1.一些奇怪的修改

zhangym 2 gadi atpakaļ
vecāks
revīzija
1324c39831

+ 13 - 58
src/views/energyOperationSupport/components/securitys/pic2.vue

@@ -123,7 +123,7 @@ import moment from "moment";
 import { Message } from "element-ui";
 import G6 from "@antv/g6";
 import insertCss from "insert-css";
-
+import axios from 'axios'
 
 const { Util, TreeGraph, registerNode, Menu, Tooltip, Minimap } = G6;
 let graph = {};
@@ -296,6 +296,10 @@ export default {
         console.log('casdasd', node)
         if (node.tlevel === 1) {
           this.crumbNavs = null;
+          this.$router.replace({
+            path: '/securitys/supplierAllBack',
+            name: 'supplierAllBack'
+          })
         }
         graph.changeData(node);
         //graph.changeData(JSON.parse(JSON.stringify(node)));
@@ -434,9 +438,11 @@ export default {
                 y: -size[1] / 2,
                 width: size[0],
                 height: size[1],
-                fill: nodeType2Color[itemtype],
+                fill: nodeType2Color[itemtype]
+
               },
               name: "rect",
+
             });
             // text time
             group.addShape("text", {
@@ -521,7 +527,7 @@ export default {
         },
         // 节点类型及样式
         defaultNode: {
-          size: [100, 30],
+          size: [150, 30],
           type: "rNode",
           style: {
             // 节点阴影颜色和宽度
@@ -838,30 +844,6 @@ export default {
       graph.translate(0, -200);
       this.findNodesByModels([item]);
     },
-    initTree(data) {
-      // 文本超出隐藏 (字段, 最大长度, 字体大小)
-      const fittingString = (str, maxWidth, fontSize) => {
-        const ellipsis = '...';
-        const ellipsisLength = G6.Util.getTextSize(ellipsis, fontSize)[0];
-        let currentWidth = 0;
-        let res = str;
-        const pattern = new RegExp('[\u4E00-\u9FA5]+'); // distinguish the Chinese charactors and letters
-        str.split('').forEach((letter, i) => {
-          if (currentWidth > maxWidth - ellipsisLength) return;
-          if (pattern.test(letter)) {
-            // Chinese charactors
-            currentWidth += fontSize;
-          } else {
-            // get the width of single letter according to the fontSize
-            currentWidth += G6.Util.getLetterWidth(letter, fontSize);
-          }
-          if (currentWidth > maxWidth - ellipsisLength) {
-            res = `${str.substr(0, i)}${ellipsis}`;
-          }
-        });
-        return res;
-      };
-    },
     findNodesByModels(arr) {
       // 查询是否有被选中节点,并清除样式
       if (this.lastSelectedNodeArr) {
@@ -1179,10 +1161,10 @@ export default {
           that.uploadloading = false;
           that.$refs.upload1.clearFiles();
           //that.getGxNameData3();
-          
-         // graph.changeData(that.treeData)
-         // graph.fitView([230, 240, 390, 390]);
-        location.reload()
+
+          // graph.changeData(that.treeData)
+          // graph.fitView([230, 240, 390, 390]);
+          location.reload()
         }
         else {
           that.$message.error(res.message);
@@ -1270,13 +1252,11 @@ export default {
           });
       }
     },
-
     //预览文件
     preview(data) {
       let that = this;
       that.loading = true;
       that.chart.fileData = data;
-      console.log(data)
       let SubmitData = {
         fileName: data.filename,
         fileUrl: data.filepath
@@ -1295,7 +1275,6 @@ export default {
           params: SubmitData,
           responseType: responseType
         }).then(function (res) {
-          console.log('111');
           let urlObject = window.URL || window.webkitURL || window;
           // 将二进制流转为blob
           let blob = new Blob([res], {
@@ -1306,39 +1285,15 @@ export default {
               type: type
             });
           }
-          // if (typeof window.navigator.msSaveBlob !== 'undefined') {
-          //   // 兼容IE,window.navigator.msSaveBlob:以本地方式保存文件
-          //   window.navigator.msSaveBlob(blob, decodeURI(fileName))
-          // } else {
-          // 创建新的URL并指向File对象或者Blob对象的地址
           let blobURL = urlObject.createObjectURL(blob);
           that.dialogVisible = true;
           that.previewUrl = blobURL;
           that.tableLoading = false;
           that.loading = false;
-          // 'https://file.keking.cn/onlinePreview?url=' + encodeURIComponent(blobURL)
-          // http://view.officeapps.live.com/op/view.aspx?src' + blobURL;
-          // 创建a标签,用于跳转至下载链接
-          // let tempLink = document.createElement('a')
-          // tempLink.style.display = 'none'
-          // tempLink.href = blobURL;
-          // tempLink.setAttribute('download', decodeURI(fileName))
-          // 兼容:某些浏览器不支持HTML5的download属性
-          // if (typeof tempLink.download === 'undefined') {
-          //   tempLink.setAttribute('target', '_blank')
-          // }
-          // // 挂载a标签
-          // document.body.appendChild(tempLink)
-          // tempLink.click()
-          // // 销毁a标签
-          // document.body.removeChild(tempLink)
-          // 释放blob URL地址
-          // urlObject.revokeObjectURL(blobURL);
           setTimeout(() => {
             urlObject.revokeObjectURL(blobURL);
           }, 1000)
         }).catch(function () {
-          //that.tableLoading = false;
           that.$message.error('预览失败');
           that.loading = true;
         })