refactor: add mode edit
This commit is contained in:
parent
4596b3e4e5
commit
4d7e2b1645
1 changed files with 34 additions and 4 deletions
|
|
@ -15,7 +15,12 @@ import AdditionalFileExpansion from '../expansion/AdditionalFileExpansion.vue';
|
|||
import RemarkExpansion from '../expansion/RemarkExpansion.vue';
|
||||
import InfoMessengerExpansion from '../expansion/receive/InfoMessengerExpansion.vue';
|
||||
import TableEmployee from '../TableEmployee.vue';
|
||||
import { SaveButton, MainButton, EditButton } from 'src/components/button';
|
||||
import {
|
||||
SaveButton,
|
||||
MainButton,
|
||||
EditButton,
|
||||
UndoButton,
|
||||
} from 'src/components/button';
|
||||
import FormGroupHead from 'src/pages/08_request-list/FormGroupHead.vue';
|
||||
import FailRemarkDialog from '../receive_view/FailRemarkDialog.vue';
|
||||
|
||||
|
|
@ -412,6 +417,26 @@ function openProductDialog() {
|
|||
pageState.productDialog = true;
|
||||
}
|
||||
|
||||
async function closeTab() {
|
||||
if (state.value.mode === 'edit' && !!currentFormData.value.id) {
|
||||
taskOrderFormStore.resetForm();
|
||||
await taskOrderFormStore.assignFormData(currentFormData.value.id, 'edit');
|
||||
} else {
|
||||
dialogWarningClose(t, {
|
||||
message: t('dialog.message.close'),
|
||||
action: () => {
|
||||
window.close();
|
||||
},
|
||||
cancel: () => {},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function undo() {
|
||||
if (!currentFormData.value) return;
|
||||
taskOrderFormStore.assignFormData(currentFormData.value?.id || '', 'info');
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
initTheme();
|
||||
initLang();
|
||||
|
|
@ -1124,13 +1149,18 @@ watch([currentFormData.value.taskStatus], () => {
|
|||
{{ $t('general.view', { msg: $t('general.example') }) }}
|
||||
</MainButton>
|
||||
<div class="row" style="gap: var(--size-2)">
|
||||
<template v-if="state.mode === 'create'">
|
||||
<!-- <UndoButton outlined @click="undo()" v-if="state.mode === 'edit'" />
|
||||
<template
|
||||
v-if="
|
||||
fullTaskOrder?.taskOrderStatus === TaskOrderStatus.Pending ||
|
||||
state.mode === 'create'
|
||||
"
|
||||
>
|
||||
<UndoButton outlined @click="undo()" v-if="state.mode === 'edit'" />
|
||||
<CancelButton
|
||||
@click="closeTab()"
|
||||
v-if="state.mode === 'info'"
|
||||
outlined
|
||||
/> -->
|
||||
/>
|
||||
<SaveButton
|
||||
v-if="state.mode && ['create', 'edit'].includes(state.mode)"
|
||||
@click="() => formDocument.submit()"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue