瀏覽代碼

沙盘新增跳转编辑页的一些问题

cxmo 1 年之前
父節點
當前提交
e005ffb21f
共有 1 個文件被更改,包括 15 次插入13 次删除
  1. 15 13
      src/views/sandbox_manage/sandFlow/index.vue

+ 15 - 13
src/views/sandbox_manage/sandFlow/index.vue

@@ -119,9 +119,10 @@ export default {
 		},
 
 		/* 获取画布内容 */
-		getGraphData() {
+		getGraphData(SandboxVersionCode,modifyType) {
 			const { id,type } = this.$route.query;
-
+			const sandbox_versioncode = id||SandboxVersionCode
+			const modify_type = type||modifyType
 			// type === 'edit' && sandInterface.sandData({
 			// 	SandboxId: id
 			// }).then(res => {
@@ -137,9 +138,9 @@ export default {
 			// 	// 轮询
 			// 	this.$route.query.type === 'edit' && this.autoSave();
 			// })
-
+			if(!sandbox_versioncode) return
 			sandInterface.versionData({
-				SandboxVersionCode: id
+				SandboxVersionCode: id||SandboxVersionCode
 			}).then(res => {
 				if(res.Ret !== 200) return
 
@@ -149,14 +150,14 @@ export default {
 					classify: ChartPermissionId
 				}
 				this.initData = JSON.parse(Content);
-                this.$nextTick(()=>{
-                    this.graph.centerContent()
-                })
-				if(type === 'edit') {
+				this.$nextTick(()=>{
+					this.graph.centerContent()
+				})
+				if(modify_type === 'edit') {
 					this.sandInfo = res.Data;
 					// 轮询
 					this.autoSave();
-                    //this.graph.centerContent();
+					//this.graph.centerContent();
 				}
 			})
 		},
@@ -182,9 +183,9 @@ export default {
 				const params = new FormData();
 				params.append('Img',dataUri)
 				const { Data } = await dataBaseInterface.uploadImgSvg(params);
-				let SandboxVersionCode = (this.sand_id && classify === this.sandInfo.ChartPermissionId)  ? this.sand_id : '';
-				
-				const { Ret , Data : sandData} =	await sandInterface.sandSave({
+				//let SandboxVersionCode = (this.sand_id && classify === this.sandInfo.ChartPermissionId)  ? this.sand_id : '';
+				let SandboxVersionCode = this.sand_id
+				const { Ret , Data : sandData} = await sandInterface.sandSave({
 					SandboxVersionCode,
 					Name: name,
 					ChartPermissionId: Number(classify),
@@ -207,7 +208,8 @@ export default {
 						type:'edit',
 						},
 					});
-					this.getGraphData();
+					this.getGraphData(sandData.VersionCode,'edit');
+					return
 				}
 				
 				callback && callback();