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,20 +174,25 @@ 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() {
MsgConfirm(t('common.tip'), t('views.applicationWorkflow.tip.saveMessage'), { if (JSON.stringify(cloneWorkFlow.value) !== JSON.stringify(getGraphData())) {
confirmButtonText: t('views.applicationWorkflow.setting.exitSave'), MsgConfirm(t('common.tip'), t('views.applicationWorkflow.tip.saveMessage'), {
cancelButtonText: t('views.applicationWorkflow.setting.exit'), confirmButtonText: t('views.applicationWorkflow.setting.exitSave'),
type: 'warning', cancelButtonText: t('views.applicationWorkflow.setting.exit'),
distinguishCancelAndClose: true type: 'warning',
}) distinguishCancelAndClose: true
.then(() => {
saveApplication(true, true)
})
.catch((action: Action) => {
action === 'cancel' && router.push({ path: `/application/${id}/WORK_FLOW/overview` })
}) })
.then(() => {
saveApplication(true, true)
})
.catch((action: Action) => {
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,15 +372,20 @@ 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
saveTime.value = new Date() .asyncPutApplication(id, obj)
if (bool) { .then((res) => {
MsgSuccess(t('common.saveSuccess')) saveTime.value = new Date()
if (back) { if (bool) {
router.push({ path: `/application/${id}/WORK_FLOW/overview` }) MsgSuccess(t('common.saveSuccess'))
if (back) {
router.push({ path: `/application/${id}/WORK_FLOW/overview` })
}
} }
} })
}) .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 />