fix: request list => form expansion add individual cost

This commit is contained in:
puriphatt 2024-11-26 16:33:09 +07:00
parent df3413ad13
commit f87547d1bc
4 changed files with 22 additions and 10 deletions

View file

@ -2,10 +2,16 @@
const duty = defineModel<boolean>('duty', { required: true }); const duty = defineModel<boolean>('duty', { required: true });
const dutyCost = defineModel<number>('dutyCost', { required: false }); const dutyCost = defineModel<number>('dutyCost', { required: false });
defineProps<{ withDefaults(
readonly?: boolean; defineProps<{
cost?: boolean; options?: number[];
}>(); readonly?: boolean;
cost?: boolean;
}>(),
{
options: () => [30],
},
);
</script> </script>
<template> <template>
<div class="row items-center q-px-md q-py-xs"> <div class="row items-center q-px-md q-py-xs">
@ -24,7 +30,7 @@ defineProps<{
class="col" class="col"
/> />
<q-select <q-select
:options="[30]" :options
:disable="!duty" :disable="!duty"
:label="$t('duty.cost')" :label="$t('duty.cost')"
:readonly :readonly

View file

@ -15,14 +15,14 @@ defineProps<{
<q-radio <q-radio
v-model="localEmployee" v-model="localEmployee"
:val="true" :val="true"
:label="$t('requestList.nonLocalEmployee')" :label="$t('requestList.localEmployee')"
:disable="readonly" :disable="readonly"
class="col" class="col"
/> />
<q-radio <q-radio
v-model="localEmployee" v-model="localEmployee"
:val="false" :val="false"
:label="$t('requestList.localEmployee')" :label="$t('requestList.nonLocalEmployee')"
:disable="readonly" :disable="readonly"
class="col" class="col"
/> />

View file

@ -24,9 +24,10 @@ const defaultForm = {
customerDutyCost: 30, customerDutyCost: 30,
companyDuty: false, companyDuty: false,
companyDutyCost: 30, companyDutyCost: 30,
individualDuty: false,
localEmployee: true, localEmployee: true,
employeeId: '', employeeId: '',
individualDuty: false,
individualDutyCost: 10,
}; };
const attributesForm = defineModel<AttributesForm>('attributesForm', { const attributesForm = defineModel<AttributesForm>('attributesForm', {
@ -35,9 +36,10 @@ const attributesForm = defineModel<AttributesForm>('attributesForm', {
customerDutyCost: 30, customerDutyCost: 30,
companyDuty: false, companyDuty: false,
companyDutyCost: 30, companyDutyCost: 30,
individualDuty: false,
localEmployee: true, localEmployee: true,
employeeId: '', employeeId: '',
individualDuty: false,
individualDutyCost: 10,
}, },
}); });
@ -155,9 +157,12 @@ function assignToForm() {
{{ $t('duty.text', { subject: $t('general.individual') }) }} {{ $t('duty.text', { subject: $t('general.individual') }) }}
</FormGroupHead> </FormGroupHead>
<FormDuty <FormDuty
:options="[10]"
:readonly="!state.isEdit" :readonly="!state.isEdit"
class="surface-1" class="surface-1"
v-model:duty="formData.individualDuty" v-model:duty="formData.individualDuty"
v-model:duty-cost="formData.individualDutyCost"
cost
/> />
</section> </section>
</main> </main>

View file

@ -76,9 +76,10 @@ export type AttributesForm = {
customerDutyCost?: number; customerDutyCost?: number;
companyDuty: boolean; companyDuty: boolean;
companyDutyCost?: number; companyDutyCost?: number;
individualDuty: boolean;
localEmployee: boolean; localEmployee: boolean;
employeeId?: string; employeeId?: string;
individualDuty: boolean;
individualDutyCost?: number;
}; };
export type Step = { export type Step = {