refactor: move var out
This commit is contained in:
parent
19825019bf
commit
c47bcc10cc
1 changed files with 22 additions and 21 deletions
|
|
@ -7,28 +7,29 @@ import { QuotationPayload, EmployeeWorker } from 'src/stores/quotations/types';
|
||||||
// NOTE: Import stores
|
// NOTE: Import stores
|
||||||
import { useQuotationStore } from 'stores/quotations';
|
import { useQuotationStore } from 'stores/quotations';
|
||||||
|
|
||||||
|
const DEFAULT_DATA: QuotationPayload = {
|
||||||
|
productServiceList: [],
|
||||||
|
urgent: false,
|
||||||
|
customerBranchId: '',
|
||||||
|
worker: [],
|
||||||
|
workerCount: 0,
|
||||||
|
payBillDate: new Date(),
|
||||||
|
paySplit: [],
|
||||||
|
paySplitCount: 0,
|
||||||
|
payCondition: 'Full',
|
||||||
|
dueDate: new Date(),
|
||||||
|
documentReceivePoint: '',
|
||||||
|
contactTel: '',
|
||||||
|
contactName: '',
|
||||||
|
workName: '',
|
||||||
|
actorName: '',
|
||||||
|
status: 'CREATED',
|
||||||
|
};
|
||||||
|
|
||||||
export const useQuotationForm = defineStore('form-quotation', () => {
|
export const useQuotationForm = defineStore('form-quotation', () => {
|
||||||
const quotationStore = useQuotationStore();
|
const quotationStore = useQuotationStore();
|
||||||
|
|
||||||
const defaultFormData: QuotationPayload = {
|
let resetFormData = structuredClone(DEFAULT_DATA);
|
||||||
productServiceList: [],
|
|
||||||
urgent: false,
|
|
||||||
customerBranchId: '',
|
|
||||||
worker: [],
|
|
||||||
workerCount: 0,
|
|
||||||
payBillDate: new Date(),
|
|
||||||
paySplit: [],
|
|
||||||
paySplitCount: 0,
|
|
||||||
payCondition: 'Full',
|
|
||||||
dueDate: new Date(),
|
|
||||||
documentReceivePoint: '',
|
|
||||||
contactTel: '',
|
|
||||||
contactName: '',
|
|
||||||
workName: '',
|
|
||||||
actorName: '',
|
|
||||||
status: 'CREATED',
|
|
||||||
};
|
|
||||||
let resetFormData = structuredClone(defaultFormData);
|
|
||||||
|
|
||||||
const currentFormData = ref<QuotationPayload>(structuredClone(resetFormData));
|
const currentFormData = ref<QuotationPayload>(structuredClone(resetFormData));
|
||||||
const currentFormState = ref<{
|
const currentFormState = ref<{
|
||||||
|
|
@ -46,8 +47,8 @@ export const useQuotationForm = defineStore('form-quotation', () => {
|
||||||
|
|
||||||
function resetForm(clean = false) {
|
function resetForm(clean = false) {
|
||||||
if (clean) {
|
if (clean) {
|
||||||
currentFormData.value = structuredClone(defaultFormData);
|
currentFormData.value = structuredClone(DEFAULT_DATA);
|
||||||
resetFormData = structuredClone(defaultFormData);
|
resetFormData = structuredClone(DEFAULT_DATA);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue