ลงเวลาพิเศษ

This commit is contained in:
setthawutttty 2023-12-12 12:35:01 +07:00
parent 5ab256807a
commit 885bf3a3ca
3 changed files with 16 additions and 65 deletions

View file

@ -35,6 +35,8 @@ const formData = reactive<dataRowRound>({
note: "", note: "",
checkInStatus: "", checkInStatus: "",
checkOutStatus: "", checkOutStatus: "",
checkInEdit:false,
checkOutEdit:false
}); });
const objectRound: MyObjectRoundRef = { const objectRound: MyObjectRoundRef = {
@ -58,7 +60,7 @@ function validateForm() {
} }
if (hasError.every((result) => result === true)) { if (hasError.every((result) => result === true)) {
onSubmit(); onSubmit();
console.log(hasError) console.log(hasError);
} else { } else {
console.log(hasError); console.log(hasError);
} }
@ -129,6 +131,8 @@ watch(
formData.checkIn = props.detailData.checkIn; formData.checkIn = props.detailData.checkIn;
formData.checkOut = props.detailData.checkOut; formData.checkOut = props.detailData.checkOut;
formData.note = props.detailData.note; formData.note = props.detailData.note;
formData.checkInEdit = props.detailData.checkInEdit;
formData.checkOutEdit = props.detailData.checkOutEdit;
} }
} }
} }
@ -197,76 +201,21 @@ watch(
</q-input> </q-input>
</template> </template>
</datepicker> </datepicker>
<div class="row justify-between q-my-sm items-start"> <div class="column">
<p class="q-ma-none mt">เวลาเขางาน</p> <q-checkbox readonly :model-value="formData.checkInEdit" label="ขอแก้ไขเวลาช่วงเช้า" />
<q-input <q-checkbox readonly :model-value="formData.checkOutEdit" label="ขอแก้ไขเวลาช่วงบ่าย" />
ref="checkInRef"
class="inputgreen"
dense
lazy-rules
borderless
outlined
v-model="formData.checkIn"
:rules="[
(val) => !!val || 'กรุณากรอกเวลาเข้างาน',
(val) => {
if (val && formData.checkOut) {
if (val > formData.checkOut) {
return 'ต้องน้อยกว่าเวลาออกงาน';
}
if (val === formData.checkOut) {
return 'เวลาเข้างานช่วงเช้าต้องไม่ซ้ำกับออกงานเช้า';
}
}
return true;
},
]"
hide-bottom-space
type="time"
style="width: 140px"
/>
</div>
<q-separator inset />
<div class="row items-start q-my-sm justify-between">
<p class="q-ma-none mt">เวลาออกงาน</p>
<q-input
ref="checkOutRef"
class="inputgreen"
dense
v-model="formData.checkOut"
lazy-rules
borderless
outlined
:rules="[
(val) => !!val || 'กรุณากรอกเวลาออกงาน',
(val) => {
if (val && formData.checkIn) {
if (val < formData.checkIn) {
return 'ต้องมากกว่าเวลาเข้างาน';
}
if (val === formData.checkIn) {
return 'เวลาออกงานช่วงเช้าต้องไม่ซ้ำกับเข้างานเช้า';
}
}
return true;
},
]"
hide-bottom-space
type="time"
style="width: 140px"
/>
</div> </div>
</div> </div>
<div <div
class="col q-ma-md q-pa-sm bg-white border-custom text-weight-medium" class="col q-ma-md q-pa-sm bg-white border-custom text-weight-medium"
> >
<p style="color: #06884d; font-size: 16px">สถานะเขางาน</p> <p style="color: #06884d; font-size: 16px">สถานะชวงเช</p>
<div class="justify-between q-my-sm items-start"> <div class="justify-between q-my-sm items-start">
<q-select <q-select
ref="checkInStatusRef" ref="checkInStatusRef"
for="checkInStatus" for="checkInStatus"
emit-value emit-value
:rules="[(val) => !!val || 'กรุณาเลือกสถานะเข้างาน']" :rules="[(val) => !!val || 'กรุณาเลือกสถานะช่วงเช้า']"
hide-bottom-space hide-bottom-space
map-options map-options
outlined outlined
@ -286,7 +235,7 @@ watch(
<div <div
class="col q-ma-md q-pa-sm bg-white border-custom text-weight-medium" class="col q-ma-md q-pa-sm bg-white border-custom text-weight-medium"
> >
<p style="color: #06884d; font-size: 16px">สถานะออกงาน</p> <p style="color: #06884d; font-size: 16px">สถานะวงบาย</p>
<div <div
class="justify-between q-my-sm items-start" class="justify-between q-my-sm items-start"
style="width: 100%" style="width: 100%"
@ -298,7 +247,7 @@ watch(
map-options map-options
outlined outlined
dense dense
:rules="[(val) => !!val || 'กรุณาเลือกสถานะออกงาน']" :rules="[(val) => !!val || 'กรุณาเลือกสถานะช่วงบ่าย']"
hide-bottom-space hide-bottom-space
full-width full-width
v-model="SpecialTimeStore.checkOutStatus" v-model="SpecialTimeStore.checkOutStatus"

View file

@ -13,6 +13,8 @@ interface dataRowRound {
checkInStatus: string; checkInStatus: string;
checkOutStatus: string; checkOutStatus: string;
note: string; note: string;
checkInEdit:boolean
checkOutEdit:boolean
} }
interface MyObjectRoundRef { interface MyObjectRoundRef {
checkIn: object | null; checkIn: object | null;

View file

@ -78,11 +78,11 @@ export const useSpecialTimeStore = defineStore("LeaveSpecialTime", () => {
timeMorning: timeMorning:
e.startTimeMorning == null e.startTimeMorning == null
? "-" ? "-"
: e.startTimeMorning + " - " + e.endTimeMorning, : e.checkInEdit == true ? e.startTimeMorning + " - " + e.endTimeMorning:'-',
timeAfternoon: timeAfternoon:
e.startTimeAfternoon == null e.startTimeAfternoon == null
? "-" ? "-"
: e.startTimeAfternoon + " - " + e.endTimeAfternoon, : e.checkOutEdit == true ? e.startTimeAfternoon + " - " + e.endTimeAfternoon:'-',
startTimeMorning: e.startTimeMorning, startTimeMorning: e.startTimeMorning,
endTimeMorning: e.endTimeMorning, endTimeMorning: e.endTimeMorning,
startTimeAfternoon: e.startTimeAfternoon, startTimeAfternoon: e.startTimeAfternoon,