Browse Source

editer:fix>版本号联动

YaolongHan 4 years ago
parent
commit
5184d7912d
2 changed files with 10 additions and 2 deletions
  1. 6 2
      src/components/editview/baseTopoEditer.vue
  2. 4 0
      src/store/index.ts

+ 6 - 2
src/components/editview/baseTopoEditer.vue

@@ -60,6 +60,7 @@ export default {
       "isPub",
       "categoryId",
       "projectId",
+      "version",
     ]),
   },
   mounted() {
@@ -96,6 +97,7 @@ export default {
       "SETISPUB",
       "ADDEQUIPITEM",
       "EDITEQUIPITEM",
+      "SETVERSION",
     ]),
     // 恢复命令状态
     clearCmdStatus() {
@@ -262,7 +264,7 @@ export default {
             startAnc.isConnected = true;
             startAnc.parent?.connect("changePos", t, t.changePos);
             t.startAnchor = startAnc || null;
-            console.log('startAnc',startAnc)
+            console.log("startAnc", startAnc);
           }
         }
         if (t.anchor12d) {
@@ -288,6 +290,8 @@ export default {
       const uuid = uuidv1();
       return Promise.all([this.generateSnap(uuid), this.saveDraft(uuid)]).then(
         (vals) => {
+          // 重设版本号
+          this.SETVERSION(vals[1].version);
           this.$message.success(`保存成功${vals[1].version}`);
         }
       );
@@ -346,6 +350,7 @@ export default {
         pic: `${uuid}.png`,
         graphId: this.graphId,
         id: this.id,
+        version: this.version,
       };
       return new Promise((resolve, reject) => {
         saveGroup(obj).then((res) => {
@@ -374,7 +379,6 @@ export default {
     },
     // 自动保存
     autoSaveTopo() {
-      console.log(this.scene.undoStack.isChange);
       if (this.scene && this.scene.undoStack.isChange) {
         this.saveTopoDraft().then(() => {
           this.scene.undoStack.isChange = false;

+ 4 - 0
src/store/index.ts

@@ -42,6 +42,10 @@ export default new Vuex.Store({
       state.tupoName = val.name;  //拓扑图名称
       state.version = val.version; //版本号
     },
+    SETVERSION(state, val){
+      console.log('asdfasfas',val)
+      state.version = val; //版本号
+    },
     // 增加设备实例 item
     ADDEQUIPITEM(state, item): void {
       state.equipmentItemList.push(item);