perf: 优化应用编排历史版本
This commit is contained in:
parent
f9611c2c03
commit
c960123b41
@ -16,7 +16,9 @@ const install = (app: App) => {
|
|||||||
const commentName: string = key
|
const commentName: string = key
|
||||||
.substring(key.lastIndexOf('/') + 1, key.length)
|
.substring(key.lastIndexOf('/') + 1, key.length)
|
||||||
.replace('.vue', '')
|
.replace('.vue', '')
|
||||||
|
if (key !== '/src/components/dynamics-form/constructor/index.vue') {
|
||||||
app.component(commentName, components[key].default)
|
app.component(commentName, components[key].default)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
app.component('DynamicsForm', DynamicsForm)
|
app.component('DynamicsForm', DynamicsForm)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -134,14 +134,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, onBeforeUnmount, computed } from 'vue'
|
import { ref, onMounted, onBeforeUnmount, computed, nextTick } from 'vue'
|
||||||
import { useRouter, useRoute } from 'vue-router'
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
import Workflow from '@/workflow/index.vue'
|
import Workflow from '@/workflow/index.vue'
|
||||||
import DropdownMenu from '@/views/application-workflow/component/DropdownMenu.vue'
|
import DropdownMenu from '@/views/application-workflow/component/DropdownMenu.vue'
|
||||||
import PublishHistory from '@/views/application-workflow/component/PublishHistory.vue'
|
import PublishHistory from '@/views/application-workflow/component/PublishHistory.vue'
|
||||||
import applicationApi from '@/api/application'
|
import applicationApi from '@/api/application'
|
||||||
import { isAppIcon } from '@/utils/application'
|
import { isAppIcon } from '@/utils/application'
|
||||||
import { MsgSuccess, MsgConfirm, MsgError } from '@/utils/message'
|
import { MsgSuccess, MsgError } from '@/utils/message'
|
||||||
import { datetimeFormat } from '@/utils/time'
|
import { datetimeFormat } from '@/utils/time'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
import { WorkFlowInstance } from '@/workflow/common/validate'
|
import { WorkFlowInstance } from '@/workflow/common/validate'
|
||||||
@ -182,7 +182,7 @@ function clickoutsideHistory() {
|
|||||||
|
|
||||||
function refreshVersion(item?: any) {
|
function refreshVersion(item?: any) {
|
||||||
if (item) {
|
if (item) {
|
||||||
getHistortyDetail(item.id)
|
renderGraphData(item)
|
||||||
}
|
}
|
||||||
if (hasPermission(`APPLICATION:MANAGE:${id}`, 'AND') && isSave.value) {
|
if (hasPermission(`APPLICATION:MANAGE:${id}`, 'AND') && isSave.value) {
|
||||||
initInterval()
|
initInterval()
|
||||||
@ -190,26 +190,23 @@ function refreshVersion(item?: any) {
|
|||||||
showHistory.value = false
|
showHistory.value = false
|
||||||
disablePublic.value = false
|
disablePublic.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkVersion(item: any) {
|
function checkVersion(item: any) {
|
||||||
disablePublic.value = true
|
disablePublic.value = true
|
||||||
getHistortyDetail(item.id)
|
|
||||||
currentVersion.value = item
|
currentVersion.value = item
|
||||||
|
renderGraphData(item)
|
||||||
closeInterval()
|
closeInterval()
|
||||||
}
|
}
|
||||||
|
|
||||||
function getHistortyDetail(versionId: string) {
|
function renderGraphData(item: any) {
|
||||||
applicationApi.getWorkFlowVersionDetail(id, versionId, loading).then((res: any) => {
|
item.work_flow['nodes'].map((v: any) => {
|
||||||
res.data?.work_flow['nodes'].map((v: any) => {
|
|
||||||
v['properties']['noRender'] = true
|
v['properties']['noRender'] = true
|
||||||
})
|
})
|
||||||
detail.value.work_flow = res.data.work_flow
|
detail.value.work_flow = item.work_flow
|
||||||
detail.value.stt_model_id = res.data.stt_model
|
saveTime.value = item?.update_time
|
||||||
detail.value.tts_model_id = res.data.tts_model
|
workflowRef.value?.clearGraphData()
|
||||||
detail.value.tts_type = res.data.tts_type
|
nextTick(() => {
|
||||||
saveTime.value = res.data?.update_time
|
workflowRef.value?.render(item.work_flow)
|
||||||
setTimeout(() => {
|
|
||||||
workflowRef.value?.renderGraphData()
|
|
||||||
}, 200)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +256,6 @@ function publicHandle() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
applicationApi.putPublishApplication(id as String, obj, loading).then(() => {
|
applicationApi.putPublishApplication(id as String, obj, loading).then(() => {
|
||||||
getDetail()
|
|
||||||
MsgSuccess('发布成功')
|
MsgSuccess('发布成功')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -317,7 +313,7 @@ function getGraphData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getDetail() {
|
function getDetail() {
|
||||||
application.asyncGetApplicationDetail(id, loading).then((res: any) => {
|
application.asyncGetApplicationDetail(id).then((res: any) => {
|
||||||
res.data?.work_flow['nodes'].map((v: any) => {
|
res.data?.work_flow['nodes'].map((v: any) => {
|
||||||
v['properties']['noRender'] = true
|
v['properties']['noRender'] = true
|
||||||
})
|
})
|
||||||
@ -326,9 +322,10 @@ function getDetail() {
|
|||||||
detail.value.tts_model_id = res.data.tts_model
|
detail.value.tts_model_id = res.data.tts_model
|
||||||
detail.value.tts_type = res.data.tts_type
|
detail.value.tts_type = res.data.tts_type
|
||||||
saveTime.value = res.data?.update_time
|
saveTime.value = res.data?.update_time
|
||||||
setTimeout(() => {
|
workflowRef.value?.clearGraphData()
|
||||||
workflowRef.value?.renderGraphData()
|
nextTick(() => {
|
||||||
}, 200)
|
workflowRef.value?.renderGraphData(detail.value.work_flow)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -196,15 +196,15 @@ class AppNodeModel extends HtmlResize.model {
|
|||||||
|
|
||||||
setAttributes() {
|
setAttributes() {
|
||||||
this.width = this.get_width()
|
this.width = this.get_width()
|
||||||
const isLoop=(node_id:string,target_node_id:string)=>{
|
const isLoop = (node_id: string, target_node_id: string) => {
|
||||||
const up_node_list=this.graphModel.getNodeIncomingNode(node_id)
|
const up_node_list = this.graphModel.getNodeIncomingNode(node_id)
|
||||||
for (const index in up_node_list) {
|
for (const index in up_node_list) {
|
||||||
const item=up_node_list[index]
|
const item = up_node_list[index]
|
||||||
if(item.id===target_node_id){
|
if (item.id === target_node_id) {
|
||||||
return true
|
return true
|
||||||
}else{
|
} else {
|
||||||
const result= isLoop(item.id,target_node_id)
|
const result = isLoop(item.id, target_node_id)
|
||||||
if(result){
|
if (result) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ class AppNodeModel extends HtmlResize.model {
|
|||||||
this.sourceRules.push({
|
this.sourceRules.push({
|
||||||
message: '不可循环连线',
|
message: '不可循环连线',
|
||||||
validate: (sourceNode: any, targetNode: any, sourceAnchor: any, targetAnchor: any) => {
|
validate: (sourceNode: any, targetNode: any, sourceAnchor: any, targetAnchor: any) => {
|
||||||
return !isLoop(sourceNode.id,targetNode.id)
|
return !isLoop(sourceNode.id, targetNode.id)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -51,8 +51,13 @@ const lf = ref()
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
renderGraphData()
|
renderGraphData()
|
||||||
})
|
})
|
||||||
|
const render = (data: any) => {
|
||||||
const renderGraphData = () => {
|
lf.value.render(data)
|
||||||
|
}
|
||||||
|
const renderGraphData = (data?: any) => {
|
||||||
|
if (data) {
|
||||||
|
graphData.value = data
|
||||||
|
}
|
||||||
const container: any = document.querySelector('#container')
|
const container: any = document.querySelector('#container')
|
||||||
if (container) {
|
if (container) {
|
||||||
lf.value = new LogicFlow({
|
lf.value = new LogicFlow({
|
||||||
@ -133,7 +138,7 @@ const addNode = (shapeItem: ShapeItem) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const clearGraphData = () => {
|
const clearGraphData = () => {
|
||||||
return lf.value.graphModel.clearData()
|
return lf.value.clearData()
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
@ -142,7 +147,8 @@ defineExpose({
|
|||||||
getGraphData,
|
getGraphData,
|
||||||
addNode,
|
addNode,
|
||||||
clearGraphData,
|
clearGraphData,
|
||||||
renderGraphData
|
renderGraphData,
|
||||||
|
render
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user