refactor: submit quotation
This commit is contained in:
parent
eb944bfafa
commit
a9d1425f8d
1 changed files with 46 additions and 2 deletions
|
|
@ -77,7 +77,10 @@ const ocrStore = useOcrStore();
|
||||||
const { locale } = useI18n();
|
const { locale } = useI18n();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
||||||
const { currentFormData: quotationFormData } = storeToRefs(quotationForm);
|
const {
|
||||||
|
currentFormData: quotationFormData,
|
||||||
|
currentFormState: quotationFormState,
|
||||||
|
} = storeToRefs(quotationForm);
|
||||||
|
|
||||||
const refSelectZoneEmployee = ref<InstanceType<typeof SelectZone>>();
|
const refSelectZoneEmployee = ref<InstanceType<typeof SelectZone>>();
|
||||||
const selectedBranchIssuer = ref('');
|
const selectedBranchIssuer = ref('');
|
||||||
|
|
@ -157,6 +160,35 @@ const productServiceList = ref<
|
||||||
Required<QuotationPayload['productServiceList'][number]>[]
|
Required<QuotationPayload['productServiceList'][number]>[]
|
||||||
>([]);
|
>([]);
|
||||||
|
|
||||||
|
function convertDataToFormSubmit() {
|
||||||
|
quotationFormData.value.productServiceList = JSON.parse(
|
||||||
|
JSON.stringify(
|
||||||
|
productServiceList.value.map((v, i) => ({
|
||||||
|
workerIndex: [0, 1],
|
||||||
|
discount: 1,
|
||||||
|
amount: 1,
|
||||||
|
product: v.product,
|
||||||
|
work: v.work,
|
||||||
|
service: v.service,
|
||||||
|
})),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
quotationFormData.value.worker = JSON.parse(
|
||||||
|
JSON.stringify(
|
||||||
|
selectedWorker.value.map((v, i) => {
|
||||||
|
if (v.id === undefined) {
|
||||||
|
return v;
|
||||||
|
} else {
|
||||||
|
return v.id;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
quotationForm.submitQuotation();
|
||||||
|
}
|
||||||
|
|
||||||
async function getAllProduct(
|
async function getAllProduct(
|
||||||
groupId: string,
|
groupId: string,
|
||||||
opts?: { force?: false; page?: number; pageSize?: number },
|
opts?: { force?: false; page?: number; pageSize?: number },
|
||||||
|
|
@ -311,6 +343,11 @@ onMounted(async () => {
|
||||||
quotationFormData.value.customerBranchId =
|
quotationFormData.value.customerBranchId =
|
||||||
urlParams.get('customerBranchId') || '';
|
urlParams.get('customerBranchId') || '';
|
||||||
|
|
||||||
|
quotationFormState.value.mode = urlParams.get('statusDialog') as
|
||||||
|
| 'info'
|
||||||
|
| 'edit'
|
||||||
|
| 'create';
|
||||||
|
|
||||||
// fetch option
|
// fetch option
|
||||||
const resultOption = await fetch('/option/option.json');
|
const resultOption = await fetch('/option/option.json');
|
||||||
const rawOption = await resultOption.json();
|
const rawOption = await resultOption.json();
|
||||||
|
|
@ -587,7 +624,14 @@ watch(
|
||||||
<q-icon name="mdi-play-box-outline" size="xs" class="q-mr-xs" />
|
<q-icon name="mdi-play-box-outline" size="xs" class="q-mr-xs" />
|
||||||
{{ $t('general.view', { msg: $t('general.example') }) }}
|
{{ $t('general.view', { msg: $t('general.example') }) }}
|
||||||
</q-btn>
|
</q-btn>
|
||||||
<SaveButton solid />
|
<SaveButton
|
||||||
|
@click="
|
||||||
|
() => {
|
||||||
|
convertDataToFormSubmit();
|
||||||
|
}
|
||||||
|
"
|
||||||
|
solid
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue