Commit c4b33265 by liuyong

修改三个架构资产

1 parent 2f07808d
...@@ -50,7 +50,6 @@ const initAttributePanel = function(that) { ...@@ -50,7 +50,6 @@ const initAttributePanel = function(that) {
if(cell.style.includes('attr=')) {//属性列表 if(cell.style.includes('attr=')) {//属性列表
let haveAttrString = cell.style.match(/attr=\[[^\]]*\]/); let haveAttrString = cell.style.match(/attr=\[[^\]]*\]/);
let stringAttr = haveAttrString[0].split('attr=')[1]; let stringAttr = haveAttrString[0].split('attr=')[1];
propertyList = JSON.parse(stringAttr); propertyList = JSON.parse(stringAttr);
} }
...@@ -83,7 +82,7 @@ const initAttributePanel = function(that) { ...@@ -83,7 +82,7 @@ const initAttributePanel = function(that) {
if(propertyList.length > 0) { if(propertyList.length > 0) {
propertyList.forEach(item => { propertyList.forEach(item => {
addListPanel(that, propertyList, item.name, item.value); addListPanel(that, propertyList, item.name, item.value, item.controlType);
}) })
} }
...@@ -118,7 +117,7 @@ const initAttributePanel = function(that) { ...@@ -118,7 +117,7 @@ const initAttributePanel = function(that) {
// } // }
// } // }
} }
const addListPanel = function(that, originAttr, attrName_, attrValue_) { const addListPanel = function(that, originAttr, attrName_, attrValue_, controlType) {
const add_item_container = document.createElement('div'); const add_item_container = document.createElement('div');
add_item_container.style.cssText = 'display: flex;justify-content: space-between;padding: 4px;'; add_item_container.style.cssText = 'display: flex;justify-content: space-between;padding: 4px;';
add_item_container.className = 'add_item_container'; add_item_container.className = 'add_item_container';
...@@ -162,6 +161,59 @@ const addListPanel = function(that, originAttr, attrName_, attrValue_) { ...@@ -162,6 +161,59 @@ const addListPanel = function(that, originAttr, attrName_, attrValue_) {
const res = originAttr.find(item => item.name == attrName_); const res = originAttr.find(item => item.name == attrName_);
res.value = e.data; res.value = e.data;
} }
item_right_container.appendChild(item_right_input);
// switch(controlType){
// case 0:
// const item_right_input = document.createElement('input');
// item_right_input.type = "text";
// item_right_input.value = attrValue_;
// item_right_input.style.cssText = 'width: 100%;';
// item_right_input.className = 'attrValue';
// item_right_input.oninput = function (e) {
// const res = originAttr.find(item => item.name == attrName_);
// res.value = e.data;
// }
// item_right_container.appendChild(item_right_input);
// break;
// case 1:
// const item_right_textarea = document.createElement('textarea');
// item_right_textarea.rows = "2"; // 设置显示的行数为2行
// item_right_textarea.cols = "4";
// item_right_textarea.value = attrValue_;
// item_right_textarea.style.cssText = 'width: 100%;';
// item_right_textarea.className = 'attrValue';
// item_right_textarea.onchange = function (e) {
// const res = originAttr.find(item => item.name == attrName_);
// res.value = e.data;
// }
// item_right_container.appendChild(item_right_textarea);
// break;
// case 2:
// const item_right_select = document.createElement('select');
// var option = document.createElement("option");
// option.value = null;
// option.text = "请选择";
// item_right_select.add(option); // 设置显示的行数为2行
// var option2 = document.createElement("option");
// option2.value = '1';
// option2.text = "数据1";
// item_right_select.add(option2);
// item_right_select.value = attrValue_;
// item_right_select.style.cssText = 'width: 100%;';
// item_right_select.className = 'attrValue';
// item_right_select.onchange = function (e) {
// const res = originAttr.find(item => item.name == attrName_);
// res.value = e.data;
// }
// item_right_container.appendChild(item_right_select);
// break;
// }
// var removeAttr = document.createElement('a'); // var removeAttr = document.createElement('a');
// removeAttr.style.margin = '0px 8px 0 8px'; // removeAttr.style.margin = '0px 8px 0 8px';
// removeAttr.style.width = '9px'; // removeAttr.style.width = '9px';
...@@ -178,7 +230,7 @@ const addListPanel = function(that, originAttr, attrName_, attrValue_) { ...@@ -178,7 +230,7 @@ const addListPanel = function(that, originAttr, attrName_, attrValue_) {
// } // }
// item_right_container.appendChild(item_right_span); // item_right_container.appendChild(item_right_span);
item_right_container.appendChild(item_right_input);
// item_right_container.appendChild(removeAttr); // item_right_container.appendChild(removeAttr);
......
...@@ -45,19 +45,20 @@ ...@@ -45,19 +45,20 @@
commonGraph.forEach(item => { commonGraph.forEach(item => {
let fns = []; let fns = [];
item.eleDtos.forEach(item2 => { item.eleDtos.forEach(item2 => {
if(item2.icon) { if(item2.icon) {
if(item2.icon.includes('data')) { if(item2.icon.includes('data')) {
let attr_ = []; let attr_ = [];
if(item2.dicys && item2.dicys.length > 0) { if(item2.dicys && item2.dicys.length > 0) {
item2.dicys.forEach(res => { item2.dicys.forEach(res => {
if(res.fieldName) { if(res.fieldName) {
attr_.push( attr_.push(
{ {
name: res.fieldName, name: res.fieldName,
value: res.propertyValue, value: res.propertyValue,
id: res.propertyId id: res.propertyId,
controlType: 2
} }
) )
} }
......
...@@ -2190,7 +2190,7 @@ Sidebar.prototype.createTitle = function(label) ...@@ -2190,7 +2190,7 @@ Sidebar.prototype.createTitle = function(label)
elt.setAttribute('title', mxResources.get('sidebarTooltip')); elt.setAttribute('title', mxResources.get('sidebarTooltip'));
elt.className = 'geTitle'; elt.className = 'geTitle';
console.log(label) // console.log(label)
//二次开发,设置样式--------------------开始 //二次开发,设置样式--------------------开始
if(label == '架构元素关系') { if(label == '架构元素关系') {
// elt.style.borderTop = '2px solid #ccc'; // elt.style.borderTop = '2px solid #ccc';
......
...@@ -27,11 +27,11 @@ axios.interceptors.request.use(config => { ...@@ -27,11 +27,11 @@ axios.interceptors.request.use(config => {
// config.headers.token = JSON.parse(localStorage.getItem('token')).token; // config.headers.token = JSON.parse(localStorage.getItem('token')).token;
if(config.method == "post"){ // if(config.method == "post"){
let encryptString = encryptStringBySM4_CBC(JSON.stringify(config.data)); // let encryptString = encryptStringBySM4_CBC(JSON.stringify(config.data));
config.data = encryptString; // config.data = encryptString;
console.log(config.data); // console.log(config.data);
} // }
return config; return config;
}, },
error => { error => {
......
<template> <template>
<div class="jsmindDemo"> <div class="jsmindDemo">
<div class="menu_container">
<el-button size="mini" @click="addNode">添加节点</el-button>
<!-- <el-button size="mini" @click="editNode">编辑节点</el-button> -->
<el-button size="mini" @click="deleteNode">删除节点</el-button>
<el-button size="mini" @click="saveJsMind">保存</el-button>
</div>
<div id="jsmind_container"></div> <div id="jsmind_container"></div>
</div> </div>
</template> </template>
<script> <script>
import { MessageBox, Message } from 'element-ui';
export default { export default {
name: 'JsmindDemo', name: 'JsmindDemo',
data() { data() {
return { return {
jm: null
} }
}, },
mounted(){ mounted(){
...@@ -24,13 +32,13 @@ export default { ...@@ -24,13 +32,13 @@ export default {
"format":"node_tree", "format":"node_tree",
/* 数据内容 */ /* 数据内容 */
"data":{"id":"root","topic":"jsMind","children":[ "data":{"id":"root","topic":"jsMind","children":[
{"id":"easy","topic":"Easy","direction":"left","expanded":false,"children":[ {"id":"easy","topic":"Easy","direction":"left","expanded":true,"children":[
{"id":"easy1","topic":"Easy to show"}, {"id":"easy1","topic":"Easy to show"},
{"id":"easy2","topic":"Easy to edit"}, {"id":"easy2","topic":"Easy to edit"},
{"id":"easy3","topic":"Easy to store"}, {"id":"easy3","topic":"Easy to store"},
{"id":"easy4","topic":"Easy to embed"} {"id":"easy4","topic":"Easy to embed"}
]}, ]},
{"id":"open","topic":"Open Source","direction":"right","expanded":true,"children":[ {"id":"open","topic":"Open Source","direction":"right","expanded":false,"children":[
{"id":"open1","topic":"on GitHub"}, {"id":"open1","topic":"on GitHub"},
{"id":"open2","topic":"BSD License"} {"id":"open2","topic":"BSD License"}
]}, ]},
...@@ -47,16 +55,63 @@ export default { ...@@ -47,16 +55,63 @@ export default {
}; };
var options = { var options = {
container:'jsmind_container', container:'jsmind_container',
editable:true, editable: true,
theme:'greensea' theme:'greensea'
}; };
var jm = new jsMind(options); this.jm = new jsMind(options);
jm.show(mind); this.jm.show(mind);
console.log(jm.get_data()) console.log(this.jm.get_data())
}, },
methods: { methods: {
saveJsMind() {
this.jm.shoot();
},
addNode() {
let selectedNode = this.jm.get_selected_node() // as parent of new node
if(!selectedNode) {
Message({
type: 'error',
message: '请先选择一个节点!'
});
return;
}
let nodeid = 'newId' + Date.parse(new Date());
let topic = '新节点';
this.jm.add_node(selectedNode, nodeid, topic);
},
editNode() {
let selectedId = this.get_selected_nodeid();
if(!selectedId) {
Message({
type: 'error',
message: '请先选择一个节点!'
});
return;
}
let nodeObj = this.jm.get_node(selectedId);
this.nodeOption.content = nodeObj.topic;
},
deleteNode() {
let selectedId = this.get_selected_nodeid();
if(!selectedId) {
Message({
type: 'error',
message: '请先选择一个节点!'
});
return;
}
this.jm.remove_node(selectedId);
},
// 获取选中标签的 ID
get_selected_nodeid() {
let selectedNode = this.jm.get_selected_node();
if(selectedNode) {
return selectedNode.id;
} else {
return null;
}
},
} }
} }
</script> </script>
...@@ -68,6 +123,11 @@ export default { ...@@ -68,6 +123,11 @@ export default {
} }
#jsmind_container{ #jsmind_container{
width: 100%; width: 100%;
height: 100%; height: calc(100% - 50px);
}
.menu_container{
background-color: #eee;
padding: 10px 0 10px 0;
text-align: right;
} }
</style> </style>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!