Skip to content

Commit 1bfc005

Browse files
perf: optimization workflow interactive
1 parent d413287 commit 1bfc005

File tree

3 files changed

+46
-36
lines changed

3 files changed

+46
-36
lines changed

ui/src/views/application-workflow/index.vue

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -174,20 +174,25 @@ const isSave = ref(false)
174174
const showHistory = ref(false)
175175
const disablePublic = ref(false)
176176
const currentVersion = ref<any>({})
177+
const cloneWorkFlow = ref(null)
177178
178179
function 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
}
192197
function 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
/**

ui/src/workflow/common/data.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,14 @@ export const startNode = {
1717
}
1818
],
1919
globalFields: [
20+
{ label: t('views.applicationWorkflow.nodes.startNode.currentTime'), value: 'time' },
2021
{
21-
value: 'time',
22-
label: t('views.applicationWorkflow.nodes.startNode.currentTime')
22+
label: t('views.application.applicationForm.form.historyRecord.label'),
23+
value: 'history_context'
2324
},
2425
{
25-
value: 'history_context',
26-
label: t('views.application.applicationForm.form.historyRecord.label')
27-
},
28-
{
29-
value: 'chat_id',
30-
label: t('chat.chatId')
26+
label: t('chat.chatId'),
27+
value: 'chat_id'
3128
}
3229
]
3330
},

ui/src/workflow/nodes/variable-assign-node/index.vue

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
ref="replyNodeFormRef"
1010
hide-required-asterisk
1111
>
12+
<el-scrollbar max-height="750" @wheel="wheel">
1213
<template v-for="(item, index) in form_data.variable_list" :key="item.id">
1314
<el-card shadow="never" class="card-never mb-8" style="--el-card-padding: 12px">
1415
<el-form-item :label="$t('views.applicationWorkflow.variable.label')">
@@ -127,17 +128,18 @@
127128
/>
128129
</el-form-item>
129130
</div>
130-
131-
<NodeCascader
132-
v-else
133-
ref="nodeCascaderRef2"
134-
:nodeModel="nodeModel"
135-
class="w-full"
136-
:placeholder="$t('views.applicationWorkflow.variable.placeholder')"
137-
v-model="item.reference"
138-
/>
131+
<el-form-item v-else>
132+
<NodeCascader
133+
ref="nodeCascaderRef2"
134+
:nodeModel="nodeModel"
135+
class="w-full"
136+
:placeholder="$t('views.applicationWorkflow.variable.placeholder')"
137+
v-model="item.reference"
138+
/>
139+
</el-form-item>
139140
</el-card>
140141
</template>
142+
</el-scrollbar>
141143
<el-button link type="primary" @click="addVariable">
142144
<el-icon class="mr-4">
143145
<Plus />

0 commit comments

Comments
 (0)