|
@@ -124,26 +124,26 @@ export default {
|
|
coolName.value = newVal
|
|
coolName.value = newVal
|
|
})
|
|
})
|
|
watch(() => props.coolObj, (newVal) => {
|
|
watch(() => props.coolObj, (newVal) => {
|
|
- setTimeout(() => {
|
|
|
|
- loading.value = true
|
|
|
|
- copyObj.value = newVal
|
|
|
|
- modelId.value = copyObj.value.id
|
|
|
|
- cid.getModelInfo({ id: copyObj.value.id, pageno: 1, pagesize: 20 }).then(res => {
|
|
|
|
- if (res.data[0].relation_json == null || res.data[0].relation_json == '') return;
|
|
|
|
- const origiondata = JSON.parse(res.data[0].relation_json)
|
|
|
|
- lf.value.render(origiondata);
|
|
|
|
- loading.value = false
|
|
|
|
- console.log('watchRender');
|
|
|
|
- for (let index = 0; index < origiondata.edges.length; index++) {
|
|
|
|
- const element = origiondata.edges[index];
|
|
|
|
- if (element.properties != null && element.properties["issv"] === 'SV') {
|
|
|
|
- let lineStyle = lf.value.getEdgeModelById(element.id)//.getEdgeStyle();
|
|
|
|
- // console.log(lineStyle)
|
|
|
|
- lineStyle.setProperties({ svEdge: { stroke: 'orange' } })
|
|
|
|
- }
|
|
|
|
|
|
+ // setTimeout(() => {
|
|
|
|
+ loading.value = true
|
|
|
|
+ copyObj.value = newVal
|
|
|
|
+ modelId.value = copyObj.value.id
|
|
|
|
+ cid.getModelInfo({ id: copyObj.value.id, pageno: 1, pagesize: 20 }).then(res => {
|
|
|
|
+ if (res.data[0].relation_json == null || res.data[0].relation_json == '') return;
|
|
|
|
+ const origiondata = JSON.parse(res.data[0].relation_json)
|
|
|
|
+ lf.value.render(origiondata);
|
|
|
|
+ loading.value = false
|
|
|
|
+ console.log('调用了coolobg的watch');
|
|
|
|
+ for (let index = 0; index < origiondata.edges.length; index++) {
|
|
|
|
+ const element = origiondata.edges[index];
|
|
|
|
+ if (element.properties != null && element.properties["issv"] === 'SV') {
|
|
|
|
+ let lineStyle = lf.value.getEdgeModelById(element.id)//.getEdgeStyle();
|
|
|
|
+ // console.log(lineStyle)
|
|
|
|
+ lineStyle.setProperties({ svEdge: { stroke: 'orange' } })
|
|
}
|
|
}
|
|
- }, { immediate: true })
|
|
|
|
- }, 3000);
|
|
|
|
|
|
+ }
|
|
|
|
+ }, { immediate: true })
|
|
|
|
+ // }, 3000);
|
|
})
|
|
})
|
|
watch(() => props.svOrGoose, (newVal) => {
|
|
watch(() => props.svOrGoose, (newVal) => {
|
|
numCase.value = newVal
|
|
numCase.value = newVal
|
|
@@ -177,25 +177,47 @@ export default {
|
|
console.log(JSON.stringify(lf.value.getGraphData()))
|
|
console.log(JSON.stringify(lf.value.getGraphData()))
|
|
const xml = lfJson2Xml(lf.value.getGraphData());
|
|
const xml = lfJson2Xml(lf.value.getGraphData());
|
|
const data = JSON.stringify(lf.value.getGraphData())
|
|
const data = JSON.stringify(lf.value.getGraphData())
|
|
- cid.saveMap(
|
|
|
|
- {
|
|
|
|
- id: copyObj.value.id - 0 || modelId.value - 0,
|
|
|
|
- //model_name: coolName.value,
|
|
|
|
- //vol_id: coolObj.value.id - 0,
|
|
|
|
- //line_link_style: coolId.value - 0,
|
|
|
|
- relation_json: data,
|
|
|
|
- //area_type: "116329",
|
|
|
|
- }
|
|
|
|
- ).then(res => {
|
|
|
|
- if (res.code == 0) {
|
|
|
|
- ElMessage({
|
|
|
|
- type: "success",
|
|
|
|
- message: "保存成功!",
|
|
|
|
- duration: 2000,
|
|
|
|
- })
|
|
|
|
- // window.location.reload()
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ if (modelId.value != undefined && modelId.value != null && modelId.value != '') {
|
|
|
|
+ cid.saveMap(
|
|
|
|
+ {
|
|
|
|
+ id: modelId.value - 0,
|
|
|
|
+ relation_json: data,
|
|
|
|
+ }
|
|
|
|
+ ).then(res => {
|
|
|
|
+ if (res.code == 0) {
|
|
|
|
+ ElMessage({
|
|
|
|
+ type: "success",
|
|
|
|
+ message: "保存成功!",
|
|
|
|
+ duration: 2000,
|
|
|
|
+ })
|
|
|
|
+ }else{
|
|
|
|
+ ElMessage({
|
|
|
|
+ message:res.msg,
|
|
|
|
+ type:"error"
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ cid.saveMap(
|
|
|
|
+ {
|
|
|
|
+ id: copyObj.value.id - 0,
|
|
|
|
+ relation_json: data,
|
|
|
|
+ }
|
|
|
|
+ ).then(res => {
|
|
|
|
+ if (res.code == 0) {
|
|
|
|
+ ElMessage({
|
|
|
|
+ type: "success",
|
|
|
|
+ message: "保存成功!",
|
|
|
|
+ duration: 2000,
|
|
|
|
+ })
|
|
|
|
+ }else{
|
|
|
|
+ ElMessage({
|
|
|
|
+ message:res.msg,
|
|
|
|
+ type:"error"
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
function cleanMap() {
|
|
function cleanMap() {
|
|
lf.value.clearData()
|
|
lf.value.clearData()
|
|
@@ -225,7 +247,6 @@ export default {
|
|
function lastRender() {
|
|
function lastRender() {
|
|
loading.value = true
|
|
loading.value = true
|
|
modelId.value = route.query.modelid
|
|
modelId.value = route.query.modelid
|
|
- console.log(modelId.value, 'modelid')
|
|
|
|
cid.getModelInfo({ id: modelId.value - 0, pageno: 1, pagesize: 20 }).then(res => {
|
|
cid.getModelInfo({ id: modelId.value - 0, pageno: 1, pagesize: 20 }).then(res => {
|
|
if (res.data[0].relation_json == null || res.data[0].relation_json == '') return;
|
|
if (res.data[0].relation_json == null || res.data[0].relation_json == '') return;
|
|
const origiondata = JSON.parse(res.data[0].relation_json)
|
|
const origiondata = JSON.parse(res.data[0].relation_json)
|
|
@@ -235,7 +256,7 @@ export default {
|
|
const element = origiondata.edges[index];
|
|
const element = origiondata.edges[index];
|
|
if (element.properties != null && element.properties["issv"] === 'SV') {
|
|
if (element.properties != null && element.properties["issv"] === 'SV') {
|
|
let lineStyle = lf.value.getEdgeModelById(element.id)//.getEdgeStyle();
|
|
let lineStyle = lf.value.getEdgeModelById(element.id)//.getEdgeStyle();
|
|
- console.log(lineStyle)
|
|
|
|
|
|
+ // console.log(lineStyle)
|
|
lineStyle.setProperties({ svEdge: { stroke: 'orange' } })
|
|
lineStyle.setProperties({ svEdge: { stroke: 'orange' } })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -362,7 +383,7 @@ export default {
|
|
},//节点内文字样式
|
|
},//节点内文字样式
|
|
});
|
|
});
|
|
lf.value.on("edge:click", function (data, e, position) {
|
|
lf.value.on("edge:click", function (data, e, position) {
|
|
- console.log(data,'data1');
|
|
|
|
|
|
+ console.log(data, 'data1');
|
|
delId.value = data.data.id
|
|
delId.value = data.data.id
|
|
if (copyColor.value == '#255CE7') {
|
|
if (copyColor.value == '#255CE7') {
|
|
lf.value.graphModel.updateText(data.data.id, "GOOSE");
|
|
lf.value.graphModel.updateText(data.data.id, "GOOSE");
|
|
@@ -383,7 +404,7 @@ export default {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
lf.value.on('node:click', function (data, e, position) {//传送坐标轴参数到父组件
|
|
lf.value.on('node:click', function (data, e, position) {//传送坐标轴参数到父组件
|
|
- console.log(data,'data3');
|
|
|
|
|
|
+ console.log(data, 'data3');
|
|
copyId.value = data.data.id
|
|
copyId.value = data.data.id
|
|
nodeId.value = data.data.id
|
|
nodeId.value = data.data.id
|
|
setX.value = data.data.x
|
|
setX.value = data.data.x
|
|
@@ -426,7 +447,7 @@ export default {
|
|
})
|
|
})
|
|
// console.log(lf.value.graphModel,'sss');
|
|
// console.log(lf.value.graphModel,'sss');
|
|
lf.value.on('edge:click', function (data, e, position) {//解决点击连接线问题
|
|
lf.value.on('edge:click', function (data, e, position) {//解决点击连接线问题
|
|
- console.log(data,'data2');
|
|
|
|
|
|
+ console.log(data, 'data2');
|
|
if (copyColor.value == '#255CE7') {
|
|
if (copyColor.value == '#255CE7') {
|
|
blue()
|
|
blue()
|
|
lf.value.changeEdgeType(data.data.id, "baseEdge")
|
|
lf.value.changeEdgeType(data.data.id, "baseEdge")
|
|
@@ -441,7 +462,11 @@ export default {
|
|
// lf.value.register(logicFlows)
|
|
// lf.value.register(logicFlows)
|
|
lf.value.extension.dndPanel.setPatternItems(needMap.value);
|
|
lf.value.extension.dndPanel.setPatternItems(needMap.value);
|
|
lf.value.render();
|
|
lf.value.render();
|
|
- lastRender()
|
|
|
|
|
|
+ console.log(route.query.modelid, '498651');
|
|
|
|
+ if (route.query.modelid != '' && route.query.modelid != null && route.query.modelid != undefined) {
|
|
|
|
+ console.log(456789);
|
|
|
|
+ lastRender()
|
|
|
|
+ }
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
loading.value = false
|
|
loading.value = false
|
|
}, 10000)
|
|
}, 10000)
|
|
@@ -456,6 +481,7 @@ export default {
|
|
onBeforeUnmount(() => {
|
|
onBeforeUnmount(() => {
|
|
// lf.value.remove()
|
|
// lf.value.remove()
|
|
coolObj.value = {}
|
|
coolObj.value = {}
|
|
|
|
+ router.push("/home/setting")
|
|
})
|
|
})
|
|
return {
|
|
return {
|
|
container,
|
|
container,
|