diff --git a/src/views/extend/processFlowView/components/ProcessDetail.vue b/src/views/extend/processFlowView/components/ProcessDetail.vue
index 3430a02d..479d5ba4 100644
--- a/src/views/extend/processFlowView/components/ProcessDetail.vue
+++ b/src/views/extend/processFlowView/components/ProcessDetail.vue
@@ -17,7 +17,8 @@
下一步
- 刷新布局
+
+ 刷新布局
新建工序
@@ -97,11 +98,16 @@ export default {
},
],
],
- updateUrl: '/extend/process-flow-det/update',
- addUrl: '/extend/process-flow-det/create',
+ updateUrl: '/extend/process-flow-view/update',
+ addUrl: '/extend/process-flow-view/create',
// pageUrl: '/extend/process-flow-det/get',
- infoUrl: '/extend/process-flow-det/get',
- jsonData: '',
+ infoUrl: '/extend/process-flow-view/get',
+ layout: {
+ id: null,
+ flowId: null,
+ content: '',
+ createTime: null
+ },
};
},
@@ -121,85 +127,9 @@ export default {
immediate: false,
},
},
- mounted() {
- const fakeJson = {
- "cells": [
- {
- "position": {
- "x": 20,
- "y": 30
- },
- "size": {
- "width": 240,
- "height": 100
- },
- "shape": "process-node",
- "id": "4783abf7-9a4a-47f7-aaed-37e906e789c0",
- "tools": {
- "items": [
- {
- "name": "button-remove"
- }
- ]
- },
- "attrs": {
- "detName": {
- "text": "klj"
- },
- "sectionName": {
- "text": "default"
- },
- "detId": {
- "text": "1716703957541310466"
- },
- "processId": {
- "text": "1715253265454723073"
- }
- },
- "zIndex": 2
- },
- {
- "position": {
- "x": 290,
- "y": 30
- },
- "size": {
- "width": 240,
- "height": 100
- },
- "shape": "process-node",
- "id": "3a5c79f6-0f85-403e-b249-843d92488c29",
- "tools": {
- "items": [
- {
- "name": "button-remove"
- }
- ]
- },
- "attrs": {
- "detName": {
- "text": "jkljkl"
- },
- "detDesc": {
- "text": "hallo ich bin Maria"
- },
- "sectionName": {
- "text": "default"
- },
- "detId": {
- "text": "1716704220322844673"
- },
- "processId": {
- "text": "1715253265454723073"
- }
- },
- "zIndex": 3
- }
- ]
- }
-
+ activated() {
this.loadLayout().then(json => {
- this.initGraph(fakeJson)
+ this.initGraph(json)
})
// const pn1 = graph.addNode({
@@ -389,8 +319,28 @@ export default {
this.graph = graph;
},
- loadLayout() {
- return Promise.resolve()
+ resetLayout() {
+ this.layout = {
+ id: null,
+ flowId: null,
+ content: '',
+ createTime: null
+ }
+ },
+
+ async loadLayout() {
+ const flowId = this.$route.params.id;
+ if (!flowId) return { cells: [] }
+ const { code, data } = await this.info({ id: flowId });
+ if (code == 0) {
+ if (data) {
+ this.layout = data;
+ return JSON.parse(data?.content) || { cells: [] };
+ }
+ return { cells: [] };
+ }
+ this.resetLayout();
+ return Promise.reject(this.infoUrl + ' 接口出错!');
},
handleToJson() { },
@@ -403,8 +353,20 @@ export default {
}
},
- handleUpdateLayout() {
+ async handleUpdateLayout() {
+ this.layout.content = JSON.stringify(this.graph.toJSON());
+ let code, data;
// 手动刷新布局
+ if (this.layout.id) {
+ ({ code, data } = await this.put(this.layout));
+ } else {
+ this.layout.flowId = this.$route.params.id;
+ ({ code, data } = await this.post(this.layout));
+ }
+
+ if (code == 0) {
+ this.$modal.msgSuccess('布局已刷新!')
+ }
},
reset() {
diff --git a/src/views/extend/processFlowView/components/ProcessInfo.vue b/src/views/extend/processFlowView/components/ProcessInfo.vue
index aafc2f7a..705fefba 100644
--- a/src/views/extend/processFlowView/components/ProcessInfo.vue
+++ b/src/views/extend/processFlowView/components/ProcessInfo.vue
@@ -11,37 +11,34 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/src/views/extend/processFlowView/components/ProcessNode.js b/src/views/extend/processFlowView/components/ProcessNode.js
index b45a866d..7813f7ec 100644
--- a/src/views/extend/processFlowView/components/ProcessNode.js
+++ b/src/views/extend/processFlowView/components/ProcessNode.js
@@ -111,4 +111,6 @@ export async function createProcessNode({ flowId, id, name, sectionId, remark })
detId: id, // 工序ID
tools: [{ name: 'button-remove' }],
};
-}
\ No newline at end of file
+}
+
+export async function createEdge(src, dest) { }
\ No newline at end of file