134134 </div >
135135</template >
136136<script setup lang="ts">
137- import { ref , onMounted , onBeforeUnmount , computed } from ' vue'
137+ import { ref , onMounted , onBeforeUnmount , computed , nextTick } from ' vue'
138138import { useRouter , useRoute } from ' vue-router'
139139import Workflow from ' @/workflow/index.vue'
140140import DropdownMenu from ' @/views/application-workflow/component/DropdownMenu.vue'
141141import PublishHistory from ' @/views/application-workflow/component/PublishHistory.vue'
142142import applicationApi from ' @/api/application'
143143import { isAppIcon } from ' @/utils/application'
144- import { MsgSuccess , MsgConfirm , MsgError } from ' @/utils/message'
144+ import { MsgSuccess , MsgError } from ' @/utils/message'
145145import { datetimeFormat } from ' @/utils/time'
146146import useStore from ' @/stores'
147147import { WorkFlowInstance } from ' @/workflow/common/validate'
@@ -182,34 +182,31 @@ function clickoutsideHistory() {
182182
183183function refreshVersion(item ? : any ) {
184184 if (item ) {
185- getHistortyDetail (item . id )
185+ renderGraphData (item )
186186 }
187187 if (hasPermission (` APPLICATION:MANAGE:${id } ` , ' AND' ) && isSave .value ) {
188188 initInterval ()
189189 }
190190 showHistory .value = false
191191 disablePublic .value = false
192192}
193+
193194function checkVersion(item : any ) {
194195 disablePublic .value = true
195- getHistortyDetail (item .id )
196196 currentVersion .value = item
197+ renderGraphData (item )
197198 closeInterval ()
198199}
199200
200- function getHistortyDetail(versionId : string ) {
201- applicationApi .getWorkFlowVersionDetail (id , versionId , loading ).then ((res : any ) => {
202- res .data ?.work_flow [' nodes' ].map ((v : any ) => {
203- v [' properties' ][' noRender' ] = true
204- })
205- detail .value .work_flow = res .data .work_flow
206- detail .value .stt_model_id = res .data .stt_model
207- detail .value .tts_model_id = res .data .tts_model
208- detail .value .tts_type = res .data .tts_type
209- saveTime .value = res .data ?.update_time
210- setTimeout (() => {
211- workflowRef .value ?.renderGraphData ()
212- }, 200 )
201+ function renderGraphData(item : any ) {
202+ item .work_flow [' nodes' ].map ((v : any ) => {
203+ v [' properties' ][' noRender' ] = true
204+ })
205+ detail .value .work_flow = item .work_flow
206+ saveTime .value = item ?.update_time
207+ workflowRef .value ?.clearGraphData ()
208+ nextTick (() => {
209+ workflowRef .value ?.render (item .work_flow )
213210 })
214211}
215212
@@ -259,7 +256,6 @@ function publicHandle() {
259256 return
260257 }
261258 applicationApi .putPublishApplication (id as String , obj , loading ).then (() => {
262- getDetail ()
263259 MsgSuccess (' 发布成功' )
264260 })
265261 })
@@ -317,7 +313,7 @@ function getGraphData() {
317313}
318314
319315function getDetail() {
320- application .asyncGetApplicationDetail (id , loading ).then ((res : any ) => {
316+ application .asyncGetApplicationDetail (id ).then ((res : any ) => {
321317 res .data ?.work_flow [' nodes' ].map ((v : any ) => {
322318 v [' properties' ][' noRender' ] = true
323319 })
@@ -326,9 +322,10 @@ function getDetail() {
326322 detail .value .tts_model_id = res .data .tts_model
327323 detail .value .tts_type = res .data .tts_type
328324 saveTime .value = res .data ?.update_time
329- setTimeout (() => {
330- workflowRef .value ?.renderGraphData ()
331- }, 200 )
325+ workflowRef .value ?.clearGraphData ()
326+ nextTick (() => {
327+ workflowRef .value ?.renderGraphData (detail .value .work_flow )
328+ })
332329 })
333330}
334331
0 commit comments