Commit 30523c49 by liuyong

修改左侧菜单加载

1 parent f1104ee5
......@@ -207,80 +207,138 @@ App = function(editor, container, lightbox)
// w: 360
// }
// ];
const setIcon = function (itemIcon, dicys, color) {
const item_icon = itemIcon.split("base64,")[1];
const decode_item_icon = (window.atob) ? atob(item_icon) : Base64.decode(item_icon);//svg解码,为字符串
const svgDocument = new DOMParser().parseFromString(decode_item_icon, 'text/xml');//svg字符串转标签
const svgTag = svgDocument.getElementsByTagName('svg')[0];
const rectTag = svgDocument.getElementsByTagName('rect')[0];
const pathTag = svgDocument.getElementsByTagName('path')[0];
if(rectTag) {
rectTag.setAttribute('fill', color)
}
if(pathTag) {
pathTag.setAttribute('fill', color)
}
if(dicys.length > 0) {
dicys.forEach(item2 => {
svgTag.setAttribute(item2.fieldName, encodeURIComponent(item2.chineseName));
})
}
const svgToString = new XMLSerializer().serializeToString(svgDocument);//svg标签转化为字符串
const encode_item_icon = (window.btoa)? btoa(svgToString) : Base64.encode(svgToString);//base64编码
icon = 'data:image/svg+xml;base64,' + encode_item_icon;
return icon;
}
$.ajax({
method: "post",
url: 'http://43.143.211.42:7003/ynMol/gtArcAllList',
url: 'http://192.168.43.93:7003/ynMol/archi-list',
data: JSON.stringify({
metaModelId: urlParams['id']
}),
contentType: "application/json",
success: result => {
const yeWuLiuCheng = result.data.filter(item => item.elementName == '业务流程');
const yeWuZhiNeng = result.data.filter(item => item.elementName == '业务职能');
const yeWuYu = result.data.filter(item => item.elementName == '业务域');
const yeWuYu1 = result.data.filter(item => item.elementName == '业务域1');
let images_yeWuLiuCheng = [];
let images_yeWuZhiNeng = [];
let images_yeWuYu = [];
let images_yeWuYu1 = [];
yeWuLiuCheng.forEach(item => {
if(item.icon) {
if(item.icon.includes('data')) {
images_yeWuLiuCheng.push({
aspect: "fixed",
data: item.icon,
h: 256,
title: item.iconRel,
w: 256
})
const shuJuJiaGou = result.data.find(item => item.arciBelongName == '数据架构').eleDtos;
const jiShuJiaGou = result.data.find(item => item.arciBelongName == '技术架构').eleDtos;
const yingYongJiaGou = result.data.find(item => item.arciBelongName == "应用架构").eleDtos;
const anQuanJiaGou = result.data.find(item => item.arciBelongName == "安全架构").eleDtos;
const yeWuJiaGou = result.data.find(item => item.arciBelongName == '业务架构').eleDtos;
let images_shuJuJiaGou = [];
let images_jiShuJiaGou = [];
let images_yingYongJiaGou = [];
let images_anQuanJiaGou = [];
let images_yeWuJiaGou = [];
if(shuJuJiaGou.length > 0) {
shuJuJiaGou.forEach(item => {
if(item.icon) {
if(item.icon.includes('data')) {
images_shuJuJiaGou.push({
aspect: "fixed",
data: setIcon(item.icon, item.dicys, item.color),
h: 256,
title: item.eleName,
w: 256
})
}
}
}
})
yeWuZhiNeng.forEach(item => {
if(item.icon) {
if(item.icon.includes('data')) {
images_yeWuZhiNeng.push({
aspect: "fixed",
data: item.icon,
h: 256,
title: item.iconRel,
w: 256
})
})
}
if(jiShuJiaGou.length > 0) {
jiShuJiaGou.forEach(item => {
if(item.icon) {
if(item.icon.includes('data')) {
images_jiShuJiaGou.push({
aspect: "fixed",
data: setIcon(item.icon, item.dicys, item.color),
h: 256,
title: item.eleName,
w: 256
})
}
}
}
})
yeWuYu.forEach(item => {
if(item.icon) {
if(item.icon.includes('data')) {
images_yeWuYu.push({
aspect: "fixed",
data: item.icon,
h: 256,
title: item.iconRel,
w: 256
})
})
}
if(yingYongJiaGou.length > 0) {
yingYongJiaGou.forEach(item => {
if(item.icon) {
if(item.icon.includes('data')) {
images_yingYongJiaGou.push({
aspect: "fixed",
data: setIcon(item.icon, item.dicys, item.color),
h: 256,
title: item.eleName,
w: 256
})
}
}
}
})
yeWuYu1.forEach(item => {
if(item.icon) {
if(item.icon.includes('data')) {
images_yeWuYu1.push({
aspect: "fixed",
data: item.icon,
h: 256,
title: item.iconRel,
w: 256
})
})
}
if(anQuanJiaGou.length > 0) {
anQuanJiaGou.forEach(item => {
if(item.icon) {
if(item.icon.includes('data')) {
images_anQuanJiaGou.push({
aspect: "fixed",
data: setIcon(item.icon, item.dicys, item.color),
h: 256,
title: item.eleName,
w: 256,
})
}
}
}
})
this.saveLibrary('业务流程', images_yeWuLiuCheng, null, 'ajax', undefined, undefined, undefined);
this.saveLibrary('业务职能', images_yeWuZhiNeng, null, 'ajax', undefined, undefined, undefined);
this.saveLibrary('业务域', images_yeWuYu, null, 'ajax', undefined, undefined, undefined);
this.saveLibrary('业务域1', images_yeWuYu1, null, 'ajax', undefined, undefined, undefined);
})
}
if(yeWuJiaGou.length > 0) {
yeWuJiaGou.forEach(item => {
if(item.icon) {
if(item.icon.includes('data')) {
images_yeWuJiaGou.push({
aspect: "fixed",
data: setIcon(item.icon, item.dicys, item.color),
h: 256,
title: item.eleName,
w: 256
})
}
}
})
}
this.saveLibrary('数据架构', images_shuJuJiaGou, null, 'ajax', undefined, undefined, undefined);
this.saveLibrary('技术架构', images_jiShuJiaGou, null, 'ajax', undefined, undefined, undefined);
this.saveLibrary('应用架构', images_yingYongJiaGou, null, 'ajax', undefined, undefined, undefined);
this.saveLibrary('安全架构', images_anQuanJiaGou, null, 'ajax', undefined, undefined, undefined);
this.saveLibrary('业务架构', images_yeWuJiaGou, null, 'ajax', undefined, undefined, undefined);
},
error: error => {
......
......@@ -1551,12 +1551,26 @@ AttributePanel.prototype.init = function()//二次开发,属性面板内容
{
var graph = this.editorUi.editor.graph;
const cell = graph.getSelectionCell();
console.log(graph.getModel().getValue(cell));
if(cell.style.includes('svg+xml')) {//新增图库的图形
const decode_style = window.atob(cell.style.split("svg+xml,")[1]);//svg解码,为字符串
const svgDocument = new DOMParser().parseFromString(decode_style, 'text/xml');//svg字符串转标签
console.log(svgDocument);
// const attributeArr = Array.from(objectTag.attributes);
// attributeArr.forEach(item => {
// this.addListPanel(item.name, item.value);
// })
}
// var ss = this.editorUi.getSelectionState();
const objectTag = cell.value;
console.log(objectTag);
//元素名称--------------------------------------------------------------------------
const labelName = graph.getLabel(graph.getSelectionCell());//获取节点名称
const nodeName = labelName.replace(/<[^>]+>/g, '');
......@@ -1602,7 +1616,7 @@ AttributePanel.prototype.init = function()//二次开发,属性面板内容
currentNode = obj;//文字节点转化为 object标签,属性label值为文字
}
var clone_currentNode = currentNode.cloneNode(false);
console.log(currentNode)
// console.log(currentNode)
const attr_name_array = Array.from($(".attrName"));
const attr_value_array = Array.from($(".attrValue"));
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!