refactor: 新增后跳转到未发布流程

This commit is contained in:
dap
2025-01-16 16:57:17 +08:00
parent 1877888846
commit cd6d413f08
2 changed files with 19 additions and 7 deletions

View File

@@ -107,7 +107,7 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
// 左边的切换
const statusOptions = [
{ label: '全部流程', value: 1 },
{ label: '已发布流程', value: 1 },
{ label: '未发布流程', value: 0 },
];
const currentStatus = ref(1);
@@ -246,11 +246,20 @@ function handleDeploy() {
deployModalApi.open();
}
// 部署流程json
async function handleDeploySuccess() {
// 跳转到未发布
currentStatus.value = 0;
await tableApi.reload();
}
// 新增完成需要跳转到未发布
async function handleReload(type: 'add' | 'update') {
if (type === 'add') {
currentStatus.value = 0;
}
await tableApi.reload();
}
</script>
<template>
@@ -358,7 +367,7 @@ async function handleDeploySuccess() {
</template>
</BasicTable>
</div>
<ProcessDefinitionModal @reload="() => tableApi.reload()" />
<ProcessDefinitionModal @reload="handleReload" />
<ProcessDefinitionDeployModal @reload="handleDeploySuccess" />
</Page>
</template>

View File

@@ -15,7 +15,7 @@ import {
import { modalSchema } from './data';
const emit = defineEmits<{ reload: [] }>();
const emit = defineEmits<{ reload: [type: 'add' | 'update'] }>();
const isUpdate = ref(false);
const title = computed(() => {
@@ -96,10 +96,13 @@ async function handleConfirm() {
return;
}
const data = cloneDeep(await formApi.getValues());
await (isUpdate.value
? workflowDefinitionUpdate(data)
: workflowDefinitionAdd(data));
emit('reload');
if (isUpdate.value) {
await workflowDefinitionUpdate(data);
emit('reload', 'update');
} else {
await workflowDefinitionAdd(data);
emit('reload', 'add');
}
await handleCancel();
} catch (error) {
console.error(error);