@@ -174,20 +174,25 @@ const isSave = ref(false)
174174const showHistory = ref (false )
175175const disablePublic = ref (false )
176176const currentVersion = ref <any >({})
177+ const cloneWorkFlow = ref (null )
177178
178179function back() {
179- MsgConfirm (t (' common.tip' ), t (' views.applicationWorkflow.tip.saveMessage' ), {
180- confirmButtonText: t (' views.applicationWorkflow.setting.exitSave' ),
181- cancelButtonText: t (' views.applicationWorkflow.setting.exit' ),
182- type: ' warning' ,
183- distinguishCancelAndClose: true
184- })
185- .then (() => {
186- saveApplication (true , true )
187- })
188- .catch ((action : Action ) => {
189- action === ' cancel' && router .push ({ path: ` /application/${id }/WORK_FLOW/overview ` })
180+ if (JSON .stringify (cloneWorkFlow .value ) !== JSON .stringify (getGraphData ())) {
181+ MsgConfirm (t (' common.tip' ), t (' views.applicationWorkflow.tip.saveMessage' ), {
182+ confirmButtonText: t (' views.applicationWorkflow.setting.exitSave' ),
183+ cancelButtonText: t (' views.applicationWorkflow.setting.exit' ),
184+ type: ' warning' ,
185+ distinguishCancelAndClose: true
190186 })
187+ .then (() => {
188+ saveApplication (true , true )
189+ })
190+ .catch ((action : Action ) => {
191+ action === ' cancel' && router .push ({ path: ` /application/${id }/WORK_FLOW/overview ` })
192+ })
193+ } else {
194+ router .push ({ path: ` /application/${id }/WORK_FLOW/overview ` })
195+ }
191196}
192197function clickoutsideHistory() {
193198 if (! disablePublic .value ) {
@@ -357,6 +362,7 @@ function getDetail() {
357362 workflowRef .value ?.clearGraphData ()
358363 nextTick (() => {
359364 workflowRef .value ?.render (detail .value .work_flow )
365+ cloneWorkFlow .value = getGraphData ()
360366 })
361367 })
362368}
@@ -366,15 +372,20 @@ function saveApplication(bool?: boolean, back?: boolean) {
366372 work_flow: getGraphData ()
367373 }
368374 loading .value = back || false
369- application .asyncPutApplication (id , obj ).then ((res ) => {
370- saveTime .value = new Date ()
371- if (bool ) {
372- MsgSuccess (t (' common.saveSuccess' ))
373- if (back ) {
374- router .push ({ path: ` /application/${id }/WORK_FLOW/overview ` })
375+ application
376+ .asyncPutApplication (id , obj )
377+ .then ((res ) => {
378+ saveTime .value = new Date ()
379+ if (bool ) {
380+ MsgSuccess (t (' common.saveSuccess' ))
381+ if (back ) {
382+ router .push ({ path: ` /application/${id }/WORK_FLOW/overview ` })
383+ }
375384 }
376- }
377- })
385+ })
386+ .catch (() => {
387+ loading .value = false
388+ })
378389}
379390
380391/**
0 commit comments