refactor: workflow
This commit is contained in:
parent
249f7d59f5
commit
3395995f68
4 changed files with 562 additions and 165 deletions
|
|
@ -1,119 +0,0 @@
|
|||
<script lang="ts" setup>
|
||||
import DialogForm from 'src/components/DialogForm.vue';
|
||||
import SideMenu from 'src/components/SideMenu.vue';
|
||||
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,
|
||||
default: {
|
||||
name: '',
|
||||
step: [],
|
||||
},
|
||||
});
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
readonly?: boolean;
|
||||
}>(),
|
||||
{ readonly: false },
|
||||
);
|
||||
|
||||
defineEmits<{
|
||||
(e: 'submit'): void;
|
||||
(e: 'close'): void;
|
||||
}>();
|
||||
|
||||
async function addStep() {
|
||||
flowData.value.step.push({
|
||||
responsiblePersonId: [],
|
||||
value: [],
|
||||
name: '',
|
||||
});
|
||||
|
||||
await nextTick();
|
||||
const scrollTarget = document.getElementById(
|
||||
`input-flow-step-name-${flowData.value.step.length - 1}`,
|
||||
);
|
||||
if (scrollTarget)
|
||||
scrollTarget.scrollIntoView({ behavior: 'instant', inline: 'center' });
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<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="{
|
||||
'q-mx-lg q-my-md': $q.screen.gt.sm,
|
||||
'q-mx-md q-my-sm': !$q.screen.gt.sm,
|
||||
}"
|
||||
>
|
||||
<section
|
||||
class="col"
|
||||
style="height: 100%; max-height: 100; overflow-y: auto"
|
||||
v-if="$q.screen.gt.sm"
|
||||
>
|
||||
<div class="q-py-md q-pl-md q-pr-sm">
|
||||
<SideMenu
|
||||
:menu="[
|
||||
{
|
||||
name: $t('general.name', { msg: $t('flow.template') }),
|
||||
anchor: 'form-flow-template',
|
||||
},
|
||||
{
|
||||
name: $t('flow.processStep'),
|
||||
anchor: 'form-flow-step',
|
||||
useBtn: true,
|
||||
},
|
||||
]"
|
||||
background="transparent"
|
||||
:active="{
|
||||
background: 'hsla(var(--blue-6-hsl) / .2)',
|
||||
foreground: 'var(--blue-6)',
|
||||
}"
|
||||
scroll-element="#flow-form"
|
||||
>
|
||||
<template v-slot:btn-form-flow-step>
|
||||
<q-btn
|
||||
dense
|
||||
flat
|
||||
icon="mdi-plus"
|
||||
size="sm"
|
||||
rounded
|
||||
id="btn-add-step"
|
||||
padding="0px 0px"
|
||||
style="color: var(--stone-9)"
|
||||
@click.stop="addStep"
|
||||
:disabled="readonly"
|
||||
/>
|
||||
</template>
|
||||
</SideMenu>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section
|
||||
class="col-12 col-md-10"
|
||||
:class="{
|
||||
'q-py-md q-pr-md ': $q.screen.gt.sm,
|
||||
'q-py-md q-px-lg': !$q.screen.gt.sm,
|
||||
}"
|
||||
style="height: 100%; max-height: 100%; overflow-y: auto"
|
||||
id="flow-form"
|
||||
>
|
||||
<FormFlow
|
||||
v-model:flow-data="flowData"
|
||||
v-model:register-branch-id="registerBranchId"
|
||||
/>
|
||||
</section>
|
||||
</div>
|
||||
</DialogForm>
|
||||
</template>
|
||||
<style scoped></style>
|
||||
Loading…
Add table
Add a link
Reference in a new issue