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);