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 = [ const statusOptions = [
{ label: '全部流程', value: 1 }, { label: '已发布流程', value: 1 },
{ label: '未发布流程', value: 0 }, { label: '未发布流程', value: 0 },
]; ];
const currentStatus = ref(1); const currentStatus = ref(1);
@ -246,11 +246,20 @@ function handleDeploy() {
deployModalApi.open(); deployModalApi.open();
} }
// json
async function handleDeploySuccess() { async function handleDeploySuccess() {
// //
currentStatus.value = 0; currentStatus.value = 0;
await tableApi.reload(); await tableApi.reload();
} }
//
async function handleReload(type: 'add' | 'update') {
if (type === 'add') {
currentStatus.value = 0;
}
await tableApi.reload();
}
</script> </script>
<template> <template>
@ -358,7 +367,7 @@ async function handleDeploySuccess() {
</template> </template>
</BasicTable> </BasicTable>
</div> </div>
<ProcessDefinitionModal @reload="() => tableApi.reload()" /> <ProcessDefinitionModal @reload="handleReload" />
<ProcessDefinitionDeployModal @reload="handleDeploySuccess" /> <ProcessDefinitionDeployModal @reload="handleDeploySuccess" />
</Page> </Page>
</template> </template>

View File

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