Commit ccc0cd26 by 史敦盼

属性修改

1 parent ac1c0fdc
...@@ -28,7 +28,7 @@ const initAttributePanel = function(that) { ...@@ -28,7 +28,7 @@ const initAttributePanel = function(that) {
// var ss = that.editorUi.getSelectionState(); // var ss = that.editorUi.getSelectionState();
const objectTag = cell.value; const objectTag = cell.value;
let parentElementOptions = []; // 上级元素
//元素名称-------------------------------------------------------------------------- //元素名称--------------------------------------------------------------------------
// const labelName = graph.getLabel(graph.getSelectionCell());//获取节点名称 // const labelName = graph.getLabel(graph.getSelectionCell());//获取节点名称
// const nodeName = labelName.replace(/<[^>]+>/g, ''); // const nodeName = labelName.replace(/<[^>]+>/g, '');
...@@ -323,6 +323,10 @@ const initAttributePanel = function(that) { ...@@ -323,6 +323,10 @@ const initAttributePanel = function(that) {
case '上级元素': case '上级元素':
valueSelect2.style.cssText = baseEleStyle; valueSelect2.style.cssText = baseEleStyle;
valueSelect2.value = value valueSelect2.value = value
valueSelect2.onchange = function (e) {
parentElementChange(e.target.value)
}
infoItemContain.appendChild(valueSelect2); infoItemContain.appendChild(valueSelect2);
break break
case '上级资产': case '上级资产':
...@@ -352,10 +356,14 @@ const initAttributePanel = function(that) { ...@@ -352,10 +356,14 @@ const initAttributePanel = function(that) {
success: function (res) { success: function (res) {
if(res.code === 200) { if(res.code === 200) {
const archiData = res.data; const archiData = res.data;
archiData.forEach(v => { archiData.forEach((v, i) => {
var option1 = document.createElement("option"); var option1 = document.createElement("option");
option1.value = v.elementId; option1.value = v.elementId;
option1.text = v.elementName; option1.text = v.elementName;
if(v.elementName == c.value) {
c.text = v.elementName
c.options[i].selected = true
}
c.appendChild(option1); c.appendChild(option1);
}) })
} }
...@@ -433,7 +441,7 @@ const addListPanel = function(that, originAttr, attrName_, attrValue_, controlTy ...@@ -433,7 +441,7 @@ const addListPanel = function(that, originAttr, attrName_, attrValue_, controlTy
item_right_input.style.cssText = 'width: 100%;height:20px'; item_right_input.style.cssText = 'width: 100%;height:20px';
item_right_input.className = 'attrValue'; item_right_input.className = 'attrValue';
item_right_input.oninput = function (e) { item_right_input.oninput = function (e) {
const res = originAttr.find(item => item.cnName == attrName_); const res = originAttr.find(item => item.cnName || item.name == attrName_);
res.value_ = e.target.value; res.value_ = e.target.value;
} }
item_right_container.appendChild(item_right_input); item_right_container.appendChild(item_right_input);
...@@ -446,7 +454,7 @@ const addListPanel = function(that, originAttr, attrName_, attrValue_, controlTy ...@@ -446,7 +454,7 @@ const addListPanel = function(that, originAttr, attrName_, attrValue_, controlTy
item_right_textarea.style.cssText = 'width: 100%;background: #ffffff;'; item_right_textarea.style.cssText = 'width: 100%;background: #ffffff;';
// item_right_textarea.className = 'attrValue'; // item_right_textarea.className = 'attrValue';
item_right_textarea.oninput = function (e) { item_right_textarea.oninput = function (e) {
const res = originAttr.find(item => item.cnName == attrName_); const res = originAttr.find(item => item.cnName || item.name == attrName_);
res.value_ = e.target.value; res.value_ = e.target.value;
} }
item_right_container.appendChild(item_right_textarea); item_right_container.appendChild(item_right_textarea);
...@@ -515,9 +523,76 @@ const addListPanel = function(that, originAttr, attrName_, attrValue_, controlTy ...@@ -515,9 +523,76 @@ const addListPanel = function(that, originAttr, attrName_, attrValue_, controlTy
add_item_container.appendChild(item_right_container); add_item_container.appendChild(item_right_container);
that.container.appendChild(add_item_container); that.container.appendChild(add_item_container);
}
// 获取上级元素
function getParentElementOptions(item) {
$.ajax({
method: 'post',
url: `http://${ajaxUrl}/eadc-shared-ability/arc-ast-info/qyLastEle`,
data: JSON.stringify({eleName: item && item.elementName}),
contentType: 'application/json',
success: function (res) {
if(res.code === 200) {
parentElementOptions = res.data
if (!parentElementOptions.length) {
// 没有上级元素时,上级节点查对应所属元素下的所有上级节点
parentElementChange(item && item.elementName)
}
}
},
error: function (error) {
console.error(error)
},
})
}
// 上级元素change事件
function parentElementChange(eleName) {
//上级节点下拉框值
const params = {
archiType: getArchiType(),
archiAssetState: 2,
archiStage: 1,
eleName,
}
$.ajax({
method: 'post',
url: `http://${ajaxUrl}/eadc-shared-ability/arc-ast-info/qryByTree`,
data: JSON.stringify(params),
contentType: 'application/json',
success: function (res) {
if(res.code === 200) {
this.treeSelectData = res.data
}
},
error: function (error) {
console.error(error)
},
})
}
function getArchiType() {
const { info } = urlParams
let archiType = ''
switch (info) {
case '5':
archiType = 'ARCHI_SAFE'
break
case '4':
archiType = 'ARCHI_TECHNOLOGY'
break
case '3':
archiType = 'ARCHI_DATA'
break
case '2':
archiType = 'ARCHI_APPLICATION'
break
case '1':
archiType = 'ARCHI_BUSINESS'
break
}
return archiType
} }
//初始化右侧属性面板控件 //初始化右侧属性面板控件
// const attributeNode = function(that, label3, div, ui, addClickHandler, idx) { // const attributeNode = function(that, label3, div, ui, addClickHandler, idx) {
......
...@@ -105,8 +105,8 @@ function propertyTransferMenuAction(editorUi, graph) {//属性传递按钮点击 ...@@ -105,8 +105,8 @@ function propertyTransferMenuAction(editorUi, graph) {//属性传递按钮点击
{ {
if (!graph.isSelectionEmpty()) if (!graph.isSelectionEmpty())
{ {
var cells = graph.getSelectionCells(); var cell = graph.getSelectionCell();console.log('cell', cell)
window.parent.postMessage({ type: 'propertyConnect' } , '*'); window.parent.postMessage({ type: 'propertyConnect', data: {value: cell.value}} , '*');
// graph.setCellStyles('property', '属性', [cells[0]]);//设置style里面拼接属性 // graph.setCellStyles('property', '属性', [cells[0]]);//设置style里面拼接属性
......
...@@ -65,6 +65,10 @@ export default { ...@@ -65,6 +65,10 @@ export default {
type: String, type: String,
default: '', default: '',
}, },
assetName: {
type: String,
default: '',
}
}, },
data() { data() {
return { return {
...@@ -97,6 +101,7 @@ export default { ...@@ -97,6 +101,7 @@ export default {
{ {
label: '资产名称', // label文字 label: '资产名称', // label文字
prop: 'assetName', // 字段名 prop: 'assetName', // 字段名
initValue: this.assetName,
element: 'el-input', // 指定elementui组件 element: 'el-input', // 指定elementui组件
placeholder: '请填写资产名称', // elementui组件属性 placeholder: '请填写资产名称', // elementui组件属性
rules: [{ required: true, trigger: 'blur', message: '不能为空' }], rules: [{ required: true, trigger: 'blur', message: '不能为空' }],
...@@ -395,6 +400,9 @@ export default { ...@@ -395,6 +400,9 @@ export default {
}) })
}, },
handleOpen() { handleOpen() {
this.$nextTick(() => {
this.$refs['addForm'].addInitValue()
})
this.getArchiEleOptions() this.getArchiEleOptions()
}, },
handleClose() { handleClose() {
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
<el-button @click="closeGraphDialog">取消</el-button> <el-button @click="closeGraphDialog">取消</el-button>
</span> </span>
</el-dialog> --> </el-dialog> -->
<Add title="属性关联" :visible.sync="graph_dialog" /> <Add title="属性关联" :asset-name="assetName" :visible.sync="graph_dialog" />
</div> </div>
</template> </template>
...@@ -95,6 +95,7 @@ ...@@ -95,6 +95,7 @@
graphList: [], graphList: [],
eleLevel: null, eleLevel: null,
status: 1, status: 1,
assetName: ''
}; };
}, },
mounted(){ mounted(){
...@@ -151,7 +152,8 @@ ...@@ -151,7 +152,8 @@
} }
if(e.data.type == 'propertyConnect'){ if(e.data.type == 'propertyConnect'){
// console.log(JSON.parse(e.data.data)) // console.log(e.data.data)
this.assetName = e.data.data.value
this.graph_dialog = true; this.graph_dialog = true;
this.showCurrentGraph(this.search_select1[0].arciBelongName, 0); this.showCurrentGraph(this.search_select1[0].arciBelongName, 0);
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!