Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
liangzhen
/
framework-tools-web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 30523c49
authored
Dec 14, 2023
by
liuyong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改左侧菜单加载
1 parent
f1104ee5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
33 deletions
public/drawio/js/diagramly/App.js
public/drawio/js/grapheditor/Format.js
public/drawio/js/diagramly/App.js
View file @
30523c4
...
@@ -207,80 +207,138 @@ App = function(editor, container, lightbox)
...
@@ -207,80 +207,138 @@ App = function(editor, container, lightbox)
// w: 360
// 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
({
$
.
ajax
({
method
:
"post"
,
method
:
"post"
,
url
:
'http://
43.143.211.42:7003/ynMol/gtArcAllL
ist'
,
url
:
'http://
192.168.43.93:7003/ynMol/archi-l
ist'
,
data
:
JSON
.
stringify
({
data
:
JSON
.
stringify
({
metaModelId
:
urlParams
[
'id'
]
metaModelId
:
urlParams
[
'id'
]
}),
}),
contentType
:
"application/json"
,
contentType
:
"application/json"
,
success
:
result
=>
{
success
:
result
=>
{
const
yeWuLiuCheng
=
result
.
data
.
filter
(
item
=>
item
.
elementName
==
'业务流程'
);
const
shuJuJiaGou
=
result
.
data
.
find
(
item
=>
item
.
arciBelongName
==
'数据架构'
).
eleDtos
;
const
yeWuZhiNeng
=
result
.
data
.
filter
(
item
=>
item
.
elementName
==
'业务职能'
);
const
jiShuJiaGou
=
result
.
data
.
find
(
item
=>
item
.
arciBelongName
==
'技术架构'
).
eleDtos
;
const
yeWuYu
=
result
.
data
.
filter
(
item
=>
item
.
elementName
==
'业务域'
);
const
yingYongJiaGou
=
result
.
data
.
find
(
item
=>
item
.
arciBelongName
==
"应用架构"
).
eleDtos
;
const
yeWuYu1
=
result
.
data
.
filter
(
item
=>
item
.
elementName
==
'业务域1'
);
const
anQuanJiaGou
=
result
.
data
.
find
(
item
=>
item
.
arciBelongName
==
"安全架构"
).
eleDtos
;
const
yeWuJiaGou
=
result
.
data
.
find
(
item
=>
item
.
arciBelongName
==
'业务架构'
).
eleDtos
;
let
images_yeWuLiuCheng
=
[];
let
images_yeWuZhiNeng
=
[];
let
images_shuJuJiaGou
=
[];
let
images_yeWuYu
=
[];
let
images_jiShuJiaGou
=
[];
let
images_yeWuYu1
=
[];
let
images_yingYongJiaGou
=
[];
let
images_anQuanJiaGou
=
[];
yeWuLiuCheng
.
forEach
(
item
=>
{
let
images_yeWuJiaGou
=
[];
if
(
shuJuJiaGou
.
length
>
0
)
{
shuJuJiaGou
.
forEach
(
item
=>
{
if
(
item
.
icon
)
{
if
(
item
.
icon
)
{
if
(
item
.
icon
.
includes
(
'data'
))
{
if
(
item
.
icon
.
includes
(
'data'
))
{
images_yeWuLiuCheng
.
push
({
images_shuJuJiaGou
.
push
({
aspect
:
"fixed"
,
aspect
:
"fixed"
,
data
:
item
.
icon
,
data
:
setIcon
(
item
.
icon
,
item
.
dicys
,
item
.
color
)
,
h
:
256
,
h
:
256
,
title
:
item
.
iconRel
,
title
:
item
.
eleName
,
w
:
256
w
:
256
})
})
}
}
}
}
})
})
yeWuZhiNeng
.
forEach
(
item
=>
{
}
if
(
jiShuJiaGou
.
length
>
0
)
{
jiShuJiaGou
.
forEach
(
item
=>
{
if
(
item
.
icon
)
{
if
(
item
.
icon
)
{
if
(
item
.
icon
.
includes
(
'data'
))
{
if
(
item
.
icon
.
includes
(
'data'
))
{
images_yeWuZhiNeng
.
push
({
images_jiShuJiaGou
.
push
({
aspect
:
"fixed"
,
aspect
:
"fixed"
,
data
:
item
.
icon
,
data
:
setIcon
(
item
.
icon
,
item
.
dicys
,
item
.
color
)
,
h
:
256
,
h
:
256
,
title
:
item
.
iconRel
,
title
:
item
.
eleName
,
w
:
256
w
:
256
})
})
}
}
}
}
})
})
yeWuYu
.
forEach
(
item
=>
{
}
if
(
yingYongJiaGou
.
length
>
0
)
{
yingYongJiaGou
.
forEach
(
item
=>
{
if
(
item
.
icon
)
{
if
(
item
.
icon
)
{
if
(
item
.
icon
.
includes
(
'data'
))
{
if
(
item
.
icon
.
includes
(
'data'
))
{
images_yeWuY
u
.
push
({
images_yingYongJiaGo
u
.
push
({
aspect
:
"fixed"
,
aspect
:
"fixed"
,
data
:
item
.
icon
,
data
:
setIcon
(
item
.
icon
,
item
.
dicys
,
item
.
color
)
,
h
:
256
,
h
:
256
,
title
:
item
.
iconRel
,
title
:
item
.
eleName
,
w
:
256
w
:
256
})
})
}
}
}
}
})
})
yeWuYu1
.
forEach
(
item
=>
{
}
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
,
})
}
}
})
}
if
(
yeWuJiaGou
.
length
>
0
)
{
yeWuJiaGou
.
forEach
(
item
=>
{
if
(
item
.
icon
)
{
if
(
item
.
icon
)
{
if
(
item
.
icon
.
includes
(
'data'
))
{
if
(
item
.
icon
.
includes
(
'data'
))
{
images_yeWuYu1
.
push
({
images_yeWuJiaGou
.
push
({
aspect
:
"fixed"
,
aspect
:
"fixed"
,
data
:
item
.
icon
,
data
:
setIcon
(
item
.
icon
,
item
.
dicys
,
item
.
color
)
,
h
:
256
,
h
:
256
,
title
:
item
.
iconRel
,
title
:
item
.
eleName
,
w
:
256
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
(
'数据架构'
,
images_shuJuJiaGou
,
null
,
'ajax'
,
undefined
,
undefined
,
undefined
);
this
.
saveLibrary
(
'业务域1'
,
images_yeWuYu1
,
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
=>
{
error
:
error
=>
{
...
...
public/drawio/js/grapheditor/Format.js
View file @
30523c4
...
@@ -1551,12 +1551,26 @@ AttributePanel.prototype.init = function()//二次开发,属性面板内容
...
@@ -1551,12 +1551,26 @@ AttributePanel.prototype.init = function()//二次开发,属性面板内容
{
{
var
graph
=
this
.
editorUi
.
editor
.
graph
;
var
graph
=
this
.
editorUi
.
editor
.
graph
;
const
cell
=
graph
.
getSelectionCell
();
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();
// var ss = this.editorUi.getSelectionState();
const
objectTag
=
cell
.
value
;
const
objectTag
=
cell
.
value
;
console
.
log
(
objectTag
);
//元素名称--------------------------------------------------------------------------
//元素名称--------------------------------------------------------------------------
const
labelName
=
graph
.
getLabel
(
graph
.
getSelectionCell
());
//获取节点名称
const
labelName
=
graph
.
getLabel
(
graph
.
getSelectionCell
());
//获取节点名称
const
nodeName
=
labelName
.
replace
(
/<
[^
>
]
+>/g
,
''
);
const
nodeName
=
labelName
.
replace
(
/<
[^
>
]
+>/g
,
''
);
...
@@ -1602,7 +1616,7 @@ AttributePanel.prototype.init = function()//二次开发,属性面板内容
...
@@ -1602,7 +1616,7 @@ AttributePanel.prototype.init = function()//二次开发,属性面板内容
currentNode
=
obj
;
//文字节点转化为 object标签,属性label值为文字
currentNode
=
obj
;
//文字节点转化为 object标签,属性label值为文字
}
}
var
clone_currentNode
=
currentNode
.
cloneNode
(
false
);
var
clone_currentNode
=
currentNode
.
cloneNode
(
false
);
console
.
log
(
currentNode
)
//
console.log(currentNode)
const
attr_name_array
=
Array
.
from
(
$
(
".attrName"
));
const
attr_name_array
=
Array
.
from
(
$
(
".attrName"
));
const
attr_value_array
=
Array
.
from
(
$
(
".attrValue"
));
const
attr_value_array
=
Array
.
from
(
$
(
".attrValue"
));
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment