Browse Source

拓扑图修改

haojianlong 4 years ago
parent
commit
d97e2b63ef

+ 1 - 1
package.json

@@ -23,7 +23,7 @@
     "@saga-web/cad-engine": "2.0.560",
     "@saga-web/draw": "2.1.75",
     "@saga-web/graphy": "2.1.47",
-    "@saga-web/topology": "1.0.77",
+    "@saga-web/topology": "1.0.78",
     "axios": "^0.18.0",
     "echarts": "^4.1.0",
     "el-cascader-multi": "^1.1.8",

+ 2 - 2
src/api/topo/index.js

@@ -9,6 +9,6 @@ export function topoCreate(param, success) {
 
 // 查询拓扑图
 export function topoQuery(param, success) {
-  let url = `${baseUrl}/datacenter/topo/query`;
-  httputils.postJson(url, param, success)
+  let url = `${baseUrl}/datacenter/topo/query?type=${param.type}`;
+  httputils.postJson(url, param.data||{}, success)
 }

BIN
src/views/business_space/dataUtil/2.jpg


+ 14 - 8
src/views/business_space/dataUtil/topology.vue

@@ -3,7 +3,7 @@
   <el-container>
     <el-aside width="200px" class="el-scrollbar">
       <div title="查询">
-        <el-button size="mini" @click="queryGraphy" icon="el-icon-notebook-2">查询</el-button>
+        <el-button size="mini" @click="queryGraphy" icon="el-icon-search">查询</el-button>
       </div>
       <div title="保存">
         <el-button size="mini" @click="saveGraphy" icon="el-icon-notebook-2">保存</el-button>
@@ -75,14 +75,14 @@ export default {
         {
           Id: this.uuid(),
           Size: {
-            Width: 100,
-            Height: 100
+            Width: 145,
+            Height: 89
           },
           Pos: {},
           img: require('./2.jpg'),
           ImgSource: this.img2,
           Name: '测试2',
-          AnchorList: [{ Pos: { X: 0, Y: -50 }, Id: this.uuid() }, { Pos: { X: -50, Y: 0 }, Id: this.uuid() }, { Pos: { X: 50, Y: 0 }, Id: this.uuid() }]
+          AnchorList: [{ Pos: { X: 0, Y: -44 }, Id: this.uuid() }, { Pos: { X: -72, Y: 0 }, Id: this.uuid() }, { Pos: { X: 72, Y: 0 }, Id: this.uuid() }]
         },
         {
           Id: this.uuid(),
@@ -140,6 +140,7 @@ export default {
       this.clearGraphy();
       this.scene = new TopoScene()
       this.view.scene = this.scene;
+      this.scene.callback = this.equipClick
     },
     // 清除canvas
     clearGraphy() {
@@ -155,11 +156,10 @@ export default {
     },
     additem(i) {
       let equipdata = this.equipList[i]
-      let curEquip = this.scene.createItem(equipdata);
-      this.scene.click(curEquip, this.equipClick)
+      this.scene.createItem(equipdata);
     },
     drawline() {
-      this.scene.isLining = true;
+      this.scene.isLining = !this.scene.isLining;
     },
     // 清除默认左右键事件
     disableRightButton() {
@@ -298,8 +298,14 @@ export default {
     },
     //查询
     queryGraphy() {
+      console.log(this.scene)
       topoQuery({ type: 'eq2sp_for' }, res => {
-        console.log(res);
+        console.log(res.Content[0])
+        // this.scene.loadData({
+          // equipList: res.Content[0].NodeList,
+          // relationList: res.Content[0].RelationList,
+        // })
+        // this.view.fitSceneToView()
       })
     }
   },