perf: optimization workflow interactive

This commit is contained in:
wangdan-fit2cloud 2025-03-04 15:17:44 +08:00 committed by GitHub
parent d413287ebc
commit 1bfc005203
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 46 additions and 36 deletions

View File

@ -174,8 +174,10 @@ const isSave = ref(false)
const showHistory = ref(false) const showHistory = ref(false)
const disablePublic = ref(false) const disablePublic = ref(false)
const currentVersion = ref<any>({}) const currentVersion = ref<any>({})
const cloneWorkFlow = ref(null)
function back() { function back() {
if (JSON.stringify(cloneWorkFlow.value) !== JSON.stringify(getGraphData())) {
MsgConfirm(t('common.tip'), t('views.applicationWorkflow.tip.saveMessage'), { MsgConfirm(t('common.tip'), t('views.applicationWorkflow.tip.saveMessage'), {
confirmButtonText: t('views.applicationWorkflow.setting.exitSave'), confirmButtonText: t('views.applicationWorkflow.setting.exitSave'),
cancelButtonText: t('views.applicationWorkflow.setting.exit'), cancelButtonText: t('views.applicationWorkflow.setting.exit'),
@ -188,6 +190,9 @@ function back() {
.catch((action: Action) => { .catch((action: Action) => {
action === 'cancel' && router.push({ path: `/application/${id}/WORK_FLOW/overview` }) action === 'cancel' && router.push({ path: `/application/${id}/WORK_FLOW/overview` })
}) })
} else {
router.push({ path: `/application/${id}/WORK_FLOW/overview` })
}
} }
function clickoutsideHistory() { function clickoutsideHistory() {
if (!disablePublic.value) { if (!disablePublic.value) {
@ -357,6 +362,7 @@ function getDetail() {
workflowRef.value?.clearGraphData() workflowRef.value?.clearGraphData()
nextTick(() => { nextTick(() => {
workflowRef.value?.render(detail.value.work_flow) workflowRef.value?.render(detail.value.work_flow)
cloneWorkFlow.value = getGraphData()
}) })
}) })
} }
@ -366,7 +372,9 @@ function saveApplication(bool?: boolean, back?: boolean) {
work_flow: getGraphData() work_flow: getGraphData()
} }
loading.value = back || false loading.value = back || false
application.asyncPutApplication(id, obj).then((res) => { application
.asyncPutApplication(id, obj)
.then((res) => {
saveTime.value = new Date() saveTime.value = new Date()
if (bool) { if (bool) {
MsgSuccess(t('common.saveSuccess')) MsgSuccess(t('common.saveSuccess'))
@ -375,6 +383,9 @@ function saveApplication(bool?: boolean, back?: boolean) {
} }
} }
}) })
.catch(() => {
loading.value = false
})
} }
/** /**

View File

@ -17,17 +17,14 @@ export const startNode = {
} }
], ],
globalFields: [ globalFields: [
{ label: t('views.applicationWorkflow.nodes.startNode.currentTime'), value: 'time' },
{ {
value: 'time', label: t('views.application.applicationForm.form.historyRecord.label'),
label: t('views.applicationWorkflow.nodes.startNode.currentTime') value: 'history_context'
}, },
{ {
value: 'history_context', label: t('chat.chatId'),
label: t('views.application.applicationForm.form.historyRecord.label') value: 'chat_id'
},
{
value: 'chat_id',
label: t('chat.chatId')
} }
] ]
}, },

View File

@ -9,6 +9,7 @@
ref="replyNodeFormRef" ref="replyNodeFormRef"
hide-required-asterisk hide-required-asterisk
> >
<el-scrollbar max-height="750" @wheel="wheel">
<template v-for="(item, index) in form_data.variable_list" :key="item.id"> <template v-for="(item, index) in form_data.variable_list" :key="item.id">
<el-card shadow="never" class="card-never mb-8" style="--el-card-padding: 12px"> <el-card shadow="never" class="card-never mb-8" style="--el-card-padding: 12px">
<el-form-item :label="$t('views.applicationWorkflow.variable.label')"> <el-form-item :label="$t('views.applicationWorkflow.variable.label')">
@ -127,17 +128,18 @@
/> />
</el-form-item> </el-form-item>
</div> </div>
<el-form-item v-else>
<NodeCascader <NodeCascader
v-else
ref="nodeCascaderRef2" ref="nodeCascaderRef2"
:nodeModel="nodeModel" :nodeModel="nodeModel"
class="w-full" class="w-full"
:placeholder="$t('views.applicationWorkflow.variable.placeholder')" :placeholder="$t('views.applicationWorkflow.variable.placeholder')"
v-model="item.reference" v-model="item.reference"
/> />
</el-form-item>
</el-card> </el-card>
</template> </template>
</el-scrollbar>
<el-button link type="primary" @click="addVariable"> <el-button link type="primary" @click="addVariable">
<el-icon class="mr-4"> <el-icon class="mr-4">
<Plus /> <Plus />