Commit c4b33265 by liuyong

修改三个架构资产

1 parent 2f07808d
......@@ -50,7 +50,6 @@ const initAttributePanel = function(that) {
if(cell.style.includes('attr=')) {//属性列表
let haveAttrString = cell.style.match(/attr=\[[^\]]*\]/);
let stringAttr = haveAttrString[0].split('attr=')[1];
propertyList = JSON.parse(stringAttr);
}
......@@ -83,7 +82,7 @@ const initAttributePanel = function(that) {
if(propertyList.length > 0) {
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) {
// }
// }
}
const addListPanel = function(that, originAttr, attrName_, attrValue_) {
const addListPanel = function(that, originAttr, attrName_, attrValue_, controlType) {
const add_item_container = document.createElement('div');
add_item_container.style.cssText = 'display: flex;justify-content: space-between;padding: 4px;';
add_item_container.className = 'add_item_container';
......@@ -162,6 +161,59 @@ const addListPanel = function(that, originAttr, attrName_, attrValue_) {
const res = originAttr.find(item => item.name == attrName_);
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');
// removeAttr.style.margin = '0px 8px 0 8px';
// removeAttr.style.width = '9px';
......@@ -178,7 +230,7 @@ const addListPanel = function(that, originAttr, attrName_, attrValue_) {
// }
// item_right_container.appendChild(item_right_span);
item_right_container.appendChild(item_right_input);
// item_right_container.appendChild(removeAttr);
......
......@@ -45,19 +45,20 @@
commonGraph.forEach(item => {
let fns = [];
item.eleDtos.forEach(item2 => {
if(item2.icon) {
if(item2.icon.includes('data')) {
let attr_ = [];
if(item2.dicys && item2.dicys.length > 0) {
item2.dicys.forEach(res => {
if(res.fieldName) {
attr_.push(
{
name: res.fieldName,
value: res.propertyValue,
id: res.propertyId
id: res.propertyId,
controlType: 2
}
)
}
......
......@@ -2190,7 +2190,7 @@ Sidebar.prototype.createTitle = function(label)
elt.setAttribute('title', mxResources.get('sidebarTooltip'));
elt.className = 'geTitle';
console.log(label)
// console.log(label)
//二次开发,设置样式--------------------开始
if(label == '架构元素关系') {
// elt.style.borderTop = '2px solid #ccc';
......
......@@ -27,11 +27,11 @@ axios.interceptors.request.use(config => {
// config.headers.token = JSON.parse(localStorage.getItem('token')).token;
if(config.method == "post"){
let encryptString = encryptStringBySM4_CBC(JSON.stringify(config.data));
config.data = encryptString;
console.log(config.data);
}
// if(config.method == "post"){
// let encryptString = encryptStringBySM4_CBC(JSON.stringify(config.data));
// config.data = encryptString;
// console.log(config.data);
// }
return config;
},
error => {
......
<template>
<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>
</template>
<script>
import { MessageBox, Message } from 'element-ui';
export default {
name: 'JsmindDemo',
data() {
return {
jm: null
}
},
mounted(){
......@@ -24,13 +32,13 @@ export default {
"format":"node_tree",
/* 数据内容 */
"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":"easy2","topic":"Easy to edit"},
{"id":"easy3","topic":"Easy to store"},
{"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":"open2","topic":"BSD License"}
]},
......@@ -47,16 +55,63 @@ export default {
};
var options = {
container:'jsmind_container',
editable:true,
editable: true,
theme:'greensea'
};
var jm = new jsMind(options);
jm.show(mind);
console.log(jm.get_data())
this.jm = new jsMind(options);
this.jm.show(mind);
console.log(this.jm.get_data())
},
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>
......@@ -68,6 +123,11 @@ export default {
}
#jsmind_container{
width: 100%;
height: 100%;
height: calc(100% - 50px);
}
.menu_container{
background-color: #eee;
padding: 10px 0 10px 0;
text-align: right;
}
</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!