|
@@ -123,7 +123,7 @@ import moment from "moment";
|
|
import { Message } from "element-ui";
|
|
import { Message } from "element-ui";
|
|
import G6 from "@antv/g6";
|
|
import G6 from "@antv/g6";
|
|
import insertCss from "insert-css";
|
|
import insertCss from "insert-css";
|
|
-
|
|
|
|
|
|
+import axios from 'axios'
|
|
|
|
|
|
const { Util, TreeGraph, registerNode, Menu, Tooltip, Minimap } = G6;
|
|
const { Util, TreeGraph, registerNode, Menu, Tooltip, Minimap } = G6;
|
|
let graph = {};
|
|
let graph = {};
|
|
@@ -296,6 +296,10 @@ export default {
|
|
console.log('casdasd', node)
|
|
console.log('casdasd', node)
|
|
if (node.tlevel === 1) {
|
|
if (node.tlevel === 1) {
|
|
this.crumbNavs = null;
|
|
this.crumbNavs = null;
|
|
|
|
+ this.$router.replace({
|
|
|
|
+ path: '/securitys/supplierAllBack',
|
|
|
|
+ name: 'supplierAllBack'
|
|
|
|
+ })
|
|
}
|
|
}
|
|
graph.changeData(node);
|
|
graph.changeData(node);
|
|
//graph.changeData(JSON.parse(JSON.stringify(node)));
|
|
//graph.changeData(JSON.parse(JSON.stringify(node)));
|
|
@@ -434,9 +438,11 @@ export default {
|
|
y: -size[1] / 2,
|
|
y: -size[1] / 2,
|
|
width: size[0],
|
|
width: size[0],
|
|
height: size[1],
|
|
height: size[1],
|
|
- fill: nodeType2Color[itemtype],
|
|
|
|
|
|
+ fill: nodeType2Color[itemtype]
|
|
|
|
+
|
|
},
|
|
},
|
|
name: "rect",
|
|
name: "rect",
|
|
|
|
+
|
|
});
|
|
});
|
|
// text time
|
|
// text time
|
|
group.addShape("text", {
|
|
group.addShape("text", {
|
|
@@ -521,7 +527,7 @@ export default {
|
|
},
|
|
},
|
|
// 节点类型及样式
|
|
// 节点类型及样式
|
|
defaultNode: {
|
|
defaultNode: {
|
|
- size: [100, 30],
|
|
|
|
|
|
+ size: [150, 30],
|
|
type: "rNode",
|
|
type: "rNode",
|
|
style: {
|
|
style: {
|
|
// 节点阴影颜色和宽度
|
|
// 节点阴影颜色和宽度
|
|
@@ -838,30 +844,6 @@ export default {
|
|
graph.translate(0, -200);
|
|
graph.translate(0, -200);
|
|
this.findNodesByModels([item]);
|
|
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) {
|
|
findNodesByModels(arr) {
|
|
// 查询是否有被选中节点,并清除样式
|
|
// 查询是否有被选中节点,并清除样式
|
|
if (this.lastSelectedNodeArr) {
|
|
if (this.lastSelectedNodeArr) {
|
|
@@ -1179,10 +1161,10 @@ export default {
|
|
that.uploadloading = false;
|
|
that.uploadloading = false;
|
|
that.$refs.upload1.clearFiles();
|
|
that.$refs.upload1.clearFiles();
|
|
//that.getGxNameData3();
|
|
//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 {
|
|
else {
|
|
that.$message.error(res.message);
|
|
that.$message.error(res.message);
|
|
@@ -1270,13 +1252,11 @@ export default {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
},
|
|
},
|
|
-
|
|
|
|
//预览文件
|
|
//预览文件
|
|
preview(data) {
|
|
preview(data) {
|
|
let that = this;
|
|
let that = this;
|
|
that.loading = true;
|
|
that.loading = true;
|
|
that.chart.fileData = data;
|
|
that.chart.fileData = data;
|
|
- console.log(data)
|
|
|
|
let SubmitData = {
|
|
let SubmitData = {
|
|
fileName: data.filename,
|
|
fileName: data.filename,
|
|
fileUrl: data.filepath
|
|
fileUrl: data.filepath
|
|
@@ -1295,7 +1275,6 @@ export default {
|
|
params: SubmitData,
|
|
params: SubmitData,
|
|
responseType: responseType
|
|
responseType: responseType
|
|
}).then(function (res) {
|
|
}).then(function (res) {
|
|
- console.log('111');
|
|
|
|
let urlObject = window.URL || window.webkitURL || window;
|
|
let urlObject = window.URL || window.webkitURL || window;
|
|
// 将二进制流转为blob
|
|
// 将二进制流转为blob
|
|
let blob = new Blob([res], {
|
|
let blob = new Blob([res], {
|
|
@@ -1306,39 +1285,15 @@ export default {
|
|
type: type
|
|
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);
|
|
let blobURL = urlObject.createObjectURL(blob);
|
|
that.dialogVisible = true;
|
|
that.dialogVisible = true;
|
|
that.previewUrl = blobURL;
|
|
that.previewUrl = blobURL;
|
|
that.tableLoading = false;
|
|
that.tableLoading = false;
|
|
that.loading = 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(() => {
|
|
setTimeout(() => {
|
|
urlObject.revokeObjectURL(blobURL);
|
|
urlObject.revokeObjectURL(blobURL);
|
|
}, 1000)
|
|
}, 1000)
|
|
}).catch(function () {
|
|
}).catch(function () {
|
|
- //that.tableLoading = false;
|
|
|
|
that.$message.error('预览失败');
|
|
that.$message.error('预览失败');
|
|
that.loading = true;
|
|
that.loading = true;
|
|
})
|
|
})
|