refactor: flow

This commit is contained in:
puriphatt 2024-10-25 16:06:13 +07:00
parent b0cb6061af
commit 1fe2c3a96c
4 changed files with 348 additions and 30 deletions

View file

@ -5,6 +5,7 @@ import FormFlow from 'src/components/04_flow-management/FormFlow.vue';
import { WorkflowTemplatePayload } from 'src/stores/workflow-template/types';
import { nextTick } from 'vue';
const registerBranchId = defineModel('registerBranchId', { default: '' });
const model = defineModel<boolean>({ required: true, default: false });
const flowData = defineModel<WorkflowTemplatePayload>('flowData', {
required: true,
@ -21,10 +22,15 @@ withDefaults(
{ readonly: false },
);
defineEmits<{
(e: 'submit'): void;
(e: 'close'): void;
}>();
async function addStep() {
flowData.value.step.push({
responsiblePersonId: [''],
value: [''],
responsiblePersonId: [],
value: [],
name: '',
});
@ -37,7 +43,12 @@ async function addStep() {
}
</script>
<template>
<DialogForm :title="$t('flow.title')" v-model:modal="model">
<DialogForm
:title="$t('flow.title')"
v-model:modal="model"
:submit="() => $emit('submit')"
:close="() => $emit('close')"
>
<div
class="col surface-1 rounded bordered scroll row relative-position"
:class="{
@ -97,7 +108,10 @@ async function addStep() {
style="height: 100%; max-height: 100%; overflow-y: auto"
id="flow-form"
>
<FormFlow v-model:flow-data="flowData" />
<FormFlow
v-model:flow-data="flowData"
v-model:register-branch-id="registerBranchId"
/>
</section>
</div>
</DialogForm>