Browse Source

系统图相关功能开发

niuheng 3 years ago
parent
commit
4bd9b8bf97

+ 1 - 1
src/components/systemGraph/addGraph.vue

@@ -62,7 +62,7 @@
 </template>
 <script>
 import { mapState } from "vuex";
-import { sysGraphController } from "@/controller/sysGraphController";
+import { sysGraphController } from "@/controller/systemGraph/sysGraphController";
 import { logicConfig } from "@/logicConfig";
 import { Message } from "element-ui";
 

+ 7 - 3
src/components/systemGraph/edit.vue

@@ -262,7 +262,8 @@
   </div>
 </template>
 <script>
-import { sysGraphController } from "@/controller/sysGraphController";
+import { graphStateEnum } from "@/controller/systemGraph/graphStateEnum";
+import { sysGraphController } from "@/controller/systemGraph/sysGraphController";
 import addGraph from "./addGraph.vue";
 import graph from "./graph.vue";
 import { logicConfig } from "@/logicConfig";
@@ -456,7 +457,7 @@ export default {
       this.fullscreenLoading = false;
       switch (resultObj.result) {
         case logicConfig.resultObj.success:
-          // this.graphInfo.
+          this.graphInfo.extraProps.state = graphStateEnum.Publish;
           return Message.success("上架成功");
         case logicConfig.resultObj.failure:
           return Message.success("上架失败,原因:" + (resultObj.reason || ""));
@@ -469,6 +470,7 @@ export default {
       this.fullscreenLoading = false;
       switch (resultObj.result) {
         case logicConfig.resultObj.success:
+          this.graphInfo.extraProps.state = graphStateEnum.Draft;
           return Message.success("下架成功");
         case logicConfig.resultObj.failure:
           return Message.success("下架失败,原因:" + (resultObj.reason || ""));
@@ -483,7 +485,9 @@ export default {
         case logicConfig.resultObj.success:
           return Message.success("删除图纸成功");
         case logicConfig.resultObj.failure:
-          return Message.success("删除图纸失败,原因:" + (resultObj.reason || ""));
+          return Message.success(
+            "删除图纸失败,原因:" + (resultObj.reason || "")
+          );
       }
     },
   },

+ 1 - 1
src/components/systemGraph/index.vue

@@ -62,7 +62,7 @@
 import { mapState } from "vuex";
 import { logicConfig } from "@/logicConfig";
 import packageConfig from "../../../package.json";
-import { sysGraphController } from "@/controller/sysGraphController";
+import { sysGraphController } from "@/controller/systemGraph/sysGraphController";
 
 export default {
   props: [],

+ 15 - 0
src/controller/systemGraph/graphStateEnum.ts

@@ -0,0 +1,15 @@
+/**
+ * 系统图状态枚举
+ */
+export enum graphStateEnum {
+    //未发布
+    Draft = "Draft",
+    //待审核
+    WaitCheck = "WaitCheck",
+    //审核完成
+    Checked = "Checked",
+    //回收站
+    Recyle = "Recyle",
+    //发布
+    Publish = "Publish",
+}

+ 7 - 19
src/controller/systemGraph/sysGraphController.ts

@@ -1,3 +1,4 @@
+import { graphStateEnum } from "./graphStateEnum";
 import { sysGraphHttpUtils } from "@/utils/http/sysGraphHttpUtils";
 import { logicConfig } from "@/logicConfig";
 import moment, { Moment } from 'moment';
@@ -36,9 +37,9 @@ export class sysGraphController {
             let _c = dataArr[i];
             let extraProps = _c.extraProps;
             //图状态(Draft: 未发布, WaitCheck: 待审核, Checked: 审核完成, Recyle: 回收站, Publish: 发布)
-            let stateName = extraProps.state == graphState.Draft ? '草稿' :
-                extraProps.state == graphState.Publish ? '上架' :
-                    extraProps.state == graphState.Recyle ? '下架' : '';
+            let stateName = extraProps.state == graphStateEnum.Draft ? '草稿' :
+                extraProps.state == graphStateEnum.Publish ? '上架' :
+                    extraProps.state == graphStateEnum.Recyle ? '下架' : '';
 
             //获取系统类型名称
             let systemTypeName = (_tempSystemTypeObj[_c.system] || {}).aliasName;
@@ -10357,7 +10358,7 @@ export class sysGraphController {
     * @param id 系统图ID
     */
     static async delSysGraph(id: string) {
-        var resultObj = await this.updateSysGraphState({ id: id, state: graphState.Recyle });
+        var resultObj = await this.updateSysGraphState({ id: id, state: graphStateEnum.Recyle });
         return resultObj;
     }
 
@@ -10366,7 +10367,7 @@ export class sysGraphController {
     * @param id 系统图ID
     */
     static async publishSysGraph(id: string) {
-        var resultObj = await this.updateSysGraphState({ id: id, state: graphState.Publish });
+        var resultObj = await this.updateSysGraphState({ id: id, state: graphStateEnum.Publish });
         return resultObj;
     }
 
@@ -10375,21 +10376,8 @@ export class sysGraphController {
     * @param id 系统图ID
     */
     static async draftGraph(id: string) {
-        var resultObj = await this.updateSysGraphState({ id: id, state: graphState.Draft });
+        var resultObj = await this.updateSysGraphState({ id: id, state: graphStateEnum.Draft });
         return resultObj;
     }
 
-}
-
-enum graphState {
-    //未发布
-    Draft = "Drafta",
-    //待审核
-    WaitCheck = "WaitCheck",
-    //审核完成
-    Checked = "Checked",
-    //回收站
-    Recyle = "Recyle",
-    //发布
-    Publish = "Publish",
 }