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 RemarkExpansion from '../expansion/RemarkExpansion.vue';
|
||||||
import InfoMessengerExpansion from '../expansion/receive/InfoMessengerExpansion.vue';
|
import InfoMessengerExpansion from '../expansion/receive/InfoMessengerExpansion.vue';
|
||||||
import TableEmployee from '../TableEmployee.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 FormGroupHead from 'src/pages/08_request-list/FormGroupHead.vue';
|
||||||
import FailRemarkDialog from '../receive_view/FailRemarkDialog.vue';
|
import FailRemarkDialog from '../receive_view/FailRemarkDialog.vue';
|
||||||
|
|
||||||
|
|
@ -412,6 +417,26 @@ function openProductDialog() {
|
||||||
pageState.productDialog = true;
|
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 () => {
|
onMounted(async () => {
|
||||||
initTheme();
|
initTheme();
|
||||||
initLang();
|
initLang();
|
||||||
|
|
@ -1124,13 +1149,18 @@ watch([currentFormData.value.taskStatus], () => {
|
||||||
{{ $t('general.view', { msg: $t('general.example') }) }}
|
{{ $t('general.view', { msg: $t('general.example') }) }}
|
||||||
</MainButton>
|
</MainButton>
|
||||||
<div class="row" style="gap: var(--size-2)">
|
<div class="row" style="gap: var(--size-2)">
|
||||||
<template v-if="state.mode === 'create'">
|
<template
|
||||||
<!-- <UndoButton outlined @click="undo()" v-if="state.mode === 'edit'" />
|
v-if="
|
||||||
|
fullTaskOrder?.taskOrderStatus === TaskOrderStatus.Pending ||
|
||||||
|
state.mode === 'create'
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<UndoButton outlined @click="undo()" v-if="state.mode === 'edit'" />
|
||||||
<CancelButton
|
<CancelButton
|
||||||
@click="closeTab()"
|
@click="closeTab()"
|
||||||
v-if="state.mode === 'info'"
|
v-if="state.mode === 'info'"
|
||||||
outlined
|
outlined
|
||||||
/> -->
|
/>
|
||||||
<SaveButton
|
<SaveButton
|
||||||
v-if="state.mode && ['create', 'edit'].includes(state.mode)"
|
v-if="state.mode && ['create', 'edit'].includes(state.mode)"
|
||||||
@click="() => formDocument.submit()"
|
@click="() => formDocument.submit()"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue