Merge branch 'develop' of github.com:Frappet/BMA-EHR-RECRUIT-EXAM-VUE3 into develop

This commit is contained in:
Kittapath 2023-10-13 00:05:33 +07:00
commit 5bdeeb0cce

View file

@ -1,14 +1,31 @@
<!-- tab ประวการทำงาน --> <!-- tab ประวการทำงาน -->
<template> <template>
<q-form ref="myForm"> <q-form ref="myForm">
<Table :rows="rows" :columns="columns" :filter="filter" :visible-columns="visibleColumns" <Table
v-model:inputfilter="filter" v-model:inputvisible="visibleColumns" v-model:editvisible="edit" :add="clickAdd" :rows="rows"
:edit="clickEdit" :addData="false" :bottom="true" :editData="status == 'register' || status == 'rejectRegister'" :columns="columns"
name="ประวัติการทำงาน (ตั้งแต่เริ่มปฏิบัติงานกับกรุงเทพมหานคร - ปัจจุบัน)" icon="mdi-briefcase"> :filter="filter"
:visible-columns="visibleColumns"
v-model:inputfilter="filter"
v-model:inputvisible="visibleColumns"
v-model:editvisible="edit"
:add="clickAdd"
:edit="clickEdit"
:addData="false"
:bottom="true"
:editData="status == 'register' || status == 'rejectRegister'"
name="ประวัติการทำงาน (ตั้งแต่เริ่มปฏิบัติงานกับกรุงเทพมหานคร - ปัจจุบัน)"
icon="mdi-briefcase"
>
<template #columns="props"> <template #columns="props">
<q-tr :props="props"> <q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.name" :props="props" @click="selectData(props)" <q-td
class="cursor-pointer"> v-for="col in props.cols"
:key="col.name"
:props="props"
@click="selectData(props)"
class="cursor-pointer"
>
<div v-if="col.name == 'startDate' || col.name == 'endDate'"> <div v-if="col.name == 'startDate' || col.name == 'endDate'">
{{ date2Thai(col.value) }} {{ date2Thai(col.value) }}
</div> </div>
@ -17,16 +34,27 @@
</div> </div>
</q-td> </q-td>
<q-td auto-width v-if="edit === true"> <q-td auto-width v-if="edit === true">
<q-btn color="red" flat dense round size="14px" icon="mdi-trash-can-outline" <q-btn
@click="checkDelete(props.row)" /> color="red"
flat
dense
round
size="14px"
icon="mdi-trash-can-outline"
@click="checkDelete(props.row)"
/>
</q-td> </q-td>
</q-tr> </q-tr>
</template> </template>
<template #bottom="props"> <template #bottom="props">
<div style="width:75% !important;" /> <div style="width: 63.5% !important" />
<div :props="props" style="width:25% !important;padding-left: 12px;">
<span class="text-weight-medium text-subtitle2 q-py-sm">รวมระยะเวลา : <span class="q-pl-sm">{{ total <div :props="props" class="row" style="width: 33% !important; padding-left: 20px">
}}</span></span> <div class="text-weight-medium text-subtitle2 q-py-sm row col-12 justify-between">
<div>รวมระยะเวลา :</div>
<div>{{ total }}</div>
</div>
</div> </div>
</template> </template>
</Table> </Table>
@ -34,22 +62,43 @@
<q-dialog v-model="modal" persistent> <q-dialog v-model="modal" persistent>
<q-card style="width: 600px"> <q-card style="width: 600px">
<q-form ref="myForm"> <q-form ref="myForm">
<DialogHeader tittle="ประวัติการทำงาน (ตั้งแต่เริ่มปฏิบัติงานกับกรุงเทพมหานคร - ปัจจุบัน)" <DialogHeader
:close="checkClose" /> tittle="ประวัติการทำงาน (ตั้งแต่เริ่มปฏิบัติงานกับกรุงเทพมหานคร - ปัจจุบัน)"
:close="checkClose"
/>
<q-separator /> <q-separator />
<q-card-section class="q-p-sm"> <q-card-section class="q-p-sm">
<div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs"> <div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-xs-12 col-sm-6 col-md-6"> <div class="col-xs-12 col-sm-6 col-md-6">
<q-input :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" <q-input
:borderless="!edit" v-model="position" :class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="position"
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่ง/ลักษณะงาน'}`]" :rules="[(val) => !!val || `${'กรุณากรอกตำแหน่ง/ลักษณะงาน'}`]"
:label="`${'ตำแหน่ง/ลักษณะงาน'}`" @update:modelValue="clickEditRow" hide-bottom-space /> :label="`${'ตำแหน่ง/ลักษณะงาน'}`"
@update:modelValue="clickEditRow"
hide-bottom-space
/>
</div> </div>
<div class="col-xs-12 col-sm-6 col-md-6"> <div class="col-xs-12 col-sm-6 col-md-6">
<q-select :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" <q-select
:borderless="!edit" v-model="type" :options="opType" :class="getClass(edit)"
:rules="[(val) => !!val || `${'กรุณาเลือกประเภท'}`]" :label="`${'ประเภท'}`" :outlined="edit"
@update:modelValue="clickEditRow" hide-bottom-space /> dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="type"
:options="opType"
:rules="[(val) => !!val || `${'กรุณาเลือกประเภท'}`]"
:label="`${'ประเภท'}`"
@update:modelValue="clickEditRow"
hide-bottom-space
/>
</div> </div>
<!-- <!--
<div class="col-xs-12 col-sm-6 col-md-6"> <div class="col-xs-12 col-sm-6 col-md-6">
@ -84,8 +133,16 @@
</div> --> </div> -->
<div class="col-xs-12 col-sm-6 col-md-6"> <div class="col-xs-12 col-sm-6 col-md-6">
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<datepicker menu-class-name="modalfix" :readonly="!edit" v-model="startDate" :locale="'th'" <datepicker
autoApply :enableTimePicker="false" @update:modelValue="clickEditRow" week-start="0"> menu-class-name="modalfix"
:readonly="!edit"
v-model="startDate"
:locale="'th'"
autoApply
:enableTimePicker="false"
@update:modelValue="clickEditRow"
week-start="0"
>
<template #year="{ year }"> <template #year="{ year }">
{{ year + 543 }} {{ year + 543 }}
</template> </template>
@ -93,13 +150,23 @@
{{ parseInt(value + 543) }} {{ parseInt(value + 543) }}
</template> </template>
<template #trigger> <template #trigger>
<q-input :class="getClass(edit)" :outlined="edit" dense lazy-rules <q-input
:borderless="!edit" :model-value="date2Thai(startDate)" :class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:borderless="!edit"
:model-value="date2Thai(startDate)"
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่เริ่ม'}`, endDateValidation]" :rules="[(val) => !!val || `${'กรุณาเลือกวันที่เริ่ม'}`, endDateValidation]"
hide-bottom-space :label="`${'วันที่เริ่ม'}`"> hide-bottom-space
:label="`${'วันที่เริ่ม'}`"
>
<template v-slot:prepend> <template v-slot:prepend>
<q-icon name="event" class="cursor-pointer" <q-icon
:style="edit ? 'color: var(--q-primary)' : 'color: var(--q-grey)'"> name="event"
class="cursor-pointer"
:style="edit ? 'color: var(--q-primary)' : 'color: var(--q-grey)'"
>
</q-icon> </q-icon>
</template> </template>
</q-input> </q-input>
@ -108,8 +175,16 @@
</div> </div>
</div> </div>
<div class="col-xs-12 col-sm-6 col-md-6"> <div class="col-xs-12 col-sm-6 col-md-6">
<datepicker menu-class-name="modalfix" :readonly="!edit" v-model="endDate" :locale="'th'" <datepicker
autoApply :enableTimePicker="false" @update:modelValue="clickEditRow" week-start="0"> menu-class-name="modalfix"
:readonly="!edit"
v-model="endDate"
:locale="'th'"
autoApply
:enableTimePicker="false"
@update:modelValue="clickEditRow"
week-start="0"
>
<template #year="{ year }"> <template #year="{ year }">
{{ year + 543 }} {{ year + 543 }}
</template> </template>
@ -117,13 +192,23 @@
{{ parseInt(value + 543) }} {{ parseInt(value + 543) }}
</template> </template>
<template #trigger> <template #trigger>
<q-input :class="getClass(edit)" :outlined="edit" dense lazy-rules :borderless="!edit" <q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:borderless="!edit"
:model-value="date2Thai(endDate)" :model-value="date2Thai(endDate)"
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่สิ้นสุด'}`, endDateValidation]" :rules="[(val) => !!val || `${'กรุณาเลือกวันที่สิ้นสุด'}`, endDateValidation]"
hide-bottom-space :label="`${'วันที่สิ้นสุด'}`"> hide-bottom-space
:label="`${'วันที่สิ้นสุด'}`"
>
<template v-slot:prepend> <template v-slot:prepend>
<q-icon name="event" class="cursor-pointer" <q-icon
:style="edit ? 'color: var(--q-primary)' : 'color: var(--q-grey)'"> name="event"
class="cursor-pointer"
:style="edit ? 'color: var(--q-primary)' : 'color: var(--q-grey)'"
>
</q-icon> </q-icon>
</template> </template>
</q-input> </q-input>
@ -131,17 +216,34 @@
</datepicker> </datepicker>
</div> </div>
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<q-input :class="getClass(false)" :outlined="false" dense lazy-rules :readonly="!false" <q-input
:borderless="!false" v-model="rangeDate" :label="`${'ระยะเวลา'}`" :class="getClass(false)"
@update:modelValue="clickEditRow" hide-bottom-space /> :outlined="false"
dense
lazy-rules
:readonly="!false"
:borderless="!false"
v-model="rangeDate"
:label="`${'ระยะเวลา'}`"
@update:modelValue="clickEditRow"
hide-bottom-space
/>
</div> </div>
</div> </div>
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
<DialogFooter :edit="clickEdit" :save="clickSave" :validate="validateData" :clickNext="clickNext" <DialogFooter
:clickPrevious="clickPrevious" :editData="status == 'register' || status == 'rejectRegister'" :edit="clickEdit"
v-model:editvisible="edit" v-model:next="next" v-model:previous="previous" :save="clickSave"
v-model:modalEdit="modalEdit" /> :validate="validateData"
:clickNext="clickNext"
:clickPrevious="clickPrevious"
:editData="status == 'register' || status == 'rejectRegister'"
v-model:editvisible="edit"
v-model:next="next"
v-model:previous="previous"
v-model:modalEdit="modalEdit"
/>
</q-form> </q-form>
</q-card> </q-card>
</q-dialog> </q-dialog>
@ -230,7 +332,7 @@ const columns = ref<any>([
sortable: true, sortable: true,
field: 'position', field: 'position',
headerStyle: 'font-size: 14px', headerStyle: 'font-size: 14px',
style: "font-size: 14px; width:25%;", style: 'font-size: 14px; width:25%;',
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' }) a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' })
}, },
@ -241,7 +343,7 @@ const columns = ref<any>([
sortable: true, sortable: true,
field: 'type', field: 'type',
headerStyle: 'font-size: 14px', headerStyle: 'font-size: 14px',
style: "font-size: 14px; width:20%;", style: 'font-size: 14px; width:20%;',
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' }) a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' })
}, },
@ -270,34 +372,34 @@ const columns = ref<any>([
}, */ }, */
{ {
name: 'startDate', name: 'startDate',
align: 'left', align: 'center',
label: 'เริ่ม', label: 'เริ่ม',
sortable: true, sortable: true,
field: 'startDate', field: 'startDate',
headerStyle: 'font-size: 14px', headerStyle: 'font-size: 14px',
style: "font-size: 14px; width:15%;", style: 'font-size: 14px; width:15%;',
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' }) a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' })
}, },
{ {
name: 'endDate', name: 'endDate',
align: 'left', align: 'center',
label: 'สิ้นสุด', label: 'สิ้นสุด',
sortable: true, sortable: true,
field: 'endDate', field: 'endDate',
headerStyle: 'font-size: 14px', headerStyle: 'font-size: 14px',
style: "font-size: 14px; width:15%;", style: 'font-size: 14px; width:15%;',
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' }) a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' })
}, },
{ {
name: 'rangeDate', name: 'rangeDate',
align: 'left', align: 'right',
label: 'ระยะเวลา', label: 'ระยะเวลา',
sortable: true, sortable: true,
field: 'rangeDate', field: 'rangeDate',
headerStyle: 'font-size: 14px', headerStyle: 'font-size: 14px',
style: "font-size: 14px; width:20%;", style: 'font-size: 14px; width:20%;',
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' }) a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' })
} }
@ -348,7 +450,8 @@ const calDate = async () => {
} }
dayDiff += daysInMonth[_startDate.getMonth()] dayDiff += daysInMonth[_startDate.getMonth()]
} }
rangeDate.value = `${yearDiff > 0 ? yearDiff + ' ปี ' : ''}${monthDiff > 0 ? monthDiff + ' เดือน ' : '' rangeDate.value = `${yearDiff > 0 ? yearDiff + ' ปี ' : ''}${
monthDiff > 0 ? monthDiff + ' เดือน ' : ''
}${dayDiff > 0 ? dayDiff + ' วัน ' : ''}` }${dayDiff > 0 ? dayDiff + ' วัน ' : ''}`
} }
@ -418,7 +521,8 @@ const fetchData = async () => {
yearDiff = yearDiff + parseInt((monthDiff / 12).toString()) yearDiff = yearDiff + parseInt((monthDiff / 12).toString())
monthDiff = monthDiff % 12 monthDiff = monthDiff % 12
} }
total.value = `${yearDiff > 0 ? yearDiff + ' ปี ' : ''}${monthDiff > 0 ? monthDiff + ' เดือน ' : '' total.value = `${yearDiff > 0 ? yearDiff + ' ปี ' : ''}${
monthDiff > 0 ? monthDiff + ' เดือน ' : ''
}${dayDiff > 0 ? dayDiff + ' วัน ' : ''}` }${dayDiff > 0 ? dayDiff + ' วัน ' : ''}`
}) })
}) })
@ -484,10 +588,10 @@ const checkRowPage = () => {
const endDateValidation = (value: Date) => { const endDateValidation = (value: Date) => {
if (startDate.value < endDate.value) { if (startDate.value < endDate.value) {
return true; return true
} }
return false; return false
}; }
/** /**
* กดปมแกไขใน dialog * กดปมแกไขใน dialog