refactor: assign after submit
This commit is contained in:
parent
c5aa7e94a1
commit
226da5ccfe
1 changed files with 9 additions and 2 deletions
|
|
@ -143,10 +143,12 @@ export const useQuotationForm = defineStore('form-quotation', () => {
|
|||
}
|
||||
|
||||
async function submitQuotation() {
|
||||
let status = false;
|
||||
if (currentFormState.value.mode === 'create') {
|
||||
const res = await quotationStore.createQuotation(currentFormData.value);
|
||||
|
||||
if (res !== null) {
|
||||
currentFormData.value.id = res.id;
|
||||
fileItemNewWorker.value.forEach(async (v) => {
|
||||
if (v.group === undefined) return;
|
||||
await employeeStore.postMeta({
|
||||
|
|
@ -156,7 +158,7 @@ export const useQuotationForm = defineStore('form-quotation', () => {
|
|||
file: v.file,
|
||||
});
|
||||
});
|
||||
return true;
|
||||
status = true;
|
||||
}
|
||||
}
|
||||
if (currentFormState.value.mode === 'edit' && currentFormData.value.id) {
|
||||
|
|
@ -169,11 +171,16 @@ export const useQuotationForm = defineStore('form-quotation', () => {
|
|||
id: currentFormData.value.id,
|
||||
});
|
||||
|
||||
if (res) return true;
|
||||
if (res) status = true;
|
||||
}
|
||||
|
||||
currentFormState.value.mode = 'info';
|
||||
|
||||
if (currentFormData.value.id !== undefined) {
|
||||
assignFormData(currentFormData.value.id, 'info');
|
||||
}
|
||||
currentFormState.value.createdBy = (_) => getName() || '';
|
||||
return status;
|
||||
}
|
||||
|
||||
function injectNewEmployee(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue