ทะเบียนประวัติ: ปรับแท็บข้อมูลผลงาน

This commit is contained in:
oat_dev 2024-04-02 15:07:35 +07:00
parent f156956d7f
commit 07474e873d
5 changed files with 1644 additions and 1550 deletions

View file

@ -52,10 +52,15 @@ const insigniaForm = reactive<RequestItemsObject>({
note: "",
});
const currentPage = ref<number>(1);
const maxPageHistory = ref<number>(1);
const currentPageHistory = ref<number>(1);
const maxPage = ref<number>(1);
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const isEdit = ref<boolean>(false);
const modal = ref<boolean>(false);
const modeView = ref<string>("table");
@ -678,6 +683,7 @@ onMounted(async () => {
:paging="true"
:columns="columns"
:filter="filterSearch"
v-model:pagination="pagination"
:grid="modeView === 'card'"
:visible-columns="visibleColumns"
:rows-per-page-options="[20, 50, 100]"
@ -778,429 +784,437 @@ onMounted(async () => {
</q-card>
</div>
</template>
<template v-slot:pagination="scope">
<q-pagination
v-model="currentPage"
active-color="primary"
color="dark"
:max="Number(maxPage)"
size="sm"
boundary-links
direction-links
></q-pagination>
</template>
</d-table>
<q-dialog v-model="modal" persistent>
<q-card style="width: 600px">
<q-layout
view="lHh lpr lFf"
container
style="height: 80vh"
class="bg-white"
>
<q-form greedy @submit.prevent @validation-success="onSubmit">
<DialogHeader tittle="เครื่องราชอิสริยาภรณ์" :close="clickClose" />
<q-separator />
<q-card-section class="q-p-sm">
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
autoApply
year-picker
v-model="insigniaForm.year"
week-start="0"
menu-class-name="modalfix"
:locale="'th'"
:enableTimePicker="false"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
dense
outlined
hide-bottom-space
class="inputgreen"
:model-value="insigniaForm.year !== 0 ? (insigniaForm.year as number) + 543 : null"
:rules="[
<q-header>
<q-toolbar>
<DialogHeader
:tittle="
isEdit
? 'แก้ไขข้อมูลเครื่องราชอิสริยาภรณ์'
: 'เพิ่มข้อมูลเครื่องราชอิสริยาภรณ์'
"
:close="clickClose"
/>
</q-toolbar>
<q-separator color="grey-4" />
</q-header>
<q-page-container>
<q-page class="q-pa-md">
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
autoApply
year-picker
v-model="insigniaForm.year"
week-start="0"
menu-class-name="modalfix"
:locale="'th'"
:enableTimePicker="false"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
dense
outlined
hide-bottom-space
class="inputgreen"
:model-value="insigniaForm.year !== 0 ? (insigniaForm.year as number) + 543 : null"
:rules="[
(val:string) =>
!!val ||
`${'กรุณาเลือกปีที่ยื่นขอพระราชทานเครื่องราชฯ'}`,
]"
:label="`${'ปีที่ยื่นขอพระราชทานเครื่องราชฯ'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
color="primary"
/>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
autoApply
borderless
week-start="0"
menu-class-name="modalfix"
v-model="insigniaForm.receiveDate"
:locale="'th'"
:enableTimePicker="false"
>
<template #year="{ year }">
{{ year + 543 }}
</template>
<template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input
dense
outlined
hide-bottom-space
class="inputgreen"
for="inputDatereceive"
ref="dateReceivedRef"
:model-value="
:label="`${'ปีที่ยื่นขอพระราชทานเครื่องราชฯ'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
color="primary"
/>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
autoApply
borderless
week-start="0"
menu-class-name="modalfix"
v-model="insigniaForm.receiveDate"
:locale="'th'"
:enableTimePicker="false"
>
<template #year="{ year }">
{{ year + 543 }}
</template>
<template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input
dense
outlined
hide-bottom-space
class="inputgreen"
for="inputDatereceive"
ref="dateReceivedRef"
:model-value="
insigniaForm.receiveDate != null
? date2Thai(insigniaForm.receiveDate as Date)
: null
"
:label="`${'วันที่ได้รับ'}`"
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่ได้รับ'}`]"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
color="primary"
/>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<selector
dense
outlined
use-input
emit-value
lazy-rules
map-options
hide-bottom-space
option-value="id"
input-debounce="0"
option-label="name"
v-model="insigniaForm.insigniaId"
class="inputgreen"
:label="`${'ชื่อเครื่องราชฯ'}`"
:options="Ops.insigniaOptions"
:rules="[(val:string) => !!val || `${'กรุณาเลือกชื่อเครื่องราชฯ'}`]"
@filter="(inputValue:string,
:label="`${'วันที่ได้รับ'}`"
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่ได้รับ'}`]"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
color="primary"
/>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<selector
dense
outlined
use-input
emit-value
lazy-rules
map-options
hide-bottom-space
option-value="id"
input-debounce="0"
option-label="name"
v-model="insigniaForm.insigniaId"
class="inputgreen"
:label="`${'ชื่อเครื่องราชฯ'}`"
:options="Ops.insigniaOptions"
:rules="[(val:string) => !!val || `${'กรุณาเลือกชื่อเครื่องราชฯ'}`]"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'insigniaOptions'
) "
@update:modelValue="insigniaTypeSelection"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
readonly
outlined
lazy-rules
hide-bottom-space
v-model="insigniaType"
:label="`${'ลำดับชั้น'}`"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
v-model="insigniaForm.no"
class="inputgreen"
:label="`${'ลำดับที่'}`"
:rules="[(val:string) => !!val || `${'กรุณากรอกลำดับที่'}`]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
v-model="insigniaForm.issue"
class="inputgreen"
:label="`${'ราชกิจจาฯ ฉบับที่'}`"
:rules="[(val:string) => !!val || `${'กรุณากรอกราชกิจจาฯ ฉบับที่'}`]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
v-model="insigniaForm.volumeNo"
class="inputgreen"
:label="`${'เล่มที่'}`"
:rules="[(val:string) => !!val || `${'กรุณากรอกเล่มที่'}`]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
v-model="insigniaForm.volume"
class="inputgreen"
:label="`${'เล่ม'}`"
:rules="[(val:string) => !!val || `${'กรุณากรอกเล่ม'}`]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
v-model="insigniaForm.section"
class="inputgreen"
:label="`${'ตอน'}`"
:rules="[(val:string) => !!val || `${'กรุณากรอกตอน'}`]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
lazy-rules
outlined
hide-bottom-space
v-model="insigniaForm.page"
class="inputgreen"
:label="`${'หน้า'}`"
:rules="[(val:string) => !!val || `${'กรุณากรอกหน้า'}`]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
autoApply
week-start="0"
v-model="insigniaForm.dateAnnounce"
menu-class-name="modalfix"
:locale="'th'"
:enableTimePicker="false"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
dense
outlined
hide-bottom-space
class="inputgreen"
:model-value="date2Thai(insigniaForm.dateAnnounce as Date)"
:label="`${'วันที่ประกาศในราชกิจจาฯ'}`"
:rules="[
@update:modelValue="insigniaTypeSelection"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
readonly
outlined
lazy-rules
hide-bottom-space
v-model="insigniaType"
:label="`${'ลำดับชั้น'}`"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
v-model="insigniaForm.no"
class="inputgreen"
:label="`${'ลำดับที่'}`"
:rules="[(val:string) => !!val || `${'กรุณากรอกลำดับที่'}`]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
v-model="insigniaForm.issue"
class="inputgreen"
:label="`${'ราชกิจจาฯ ฉบับที่'}`"
:rules="[(val:string) => !!val || `${'กรุณากรอกราชกิจจาฯ ฉบับที่'}`]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
v-model="insigniaForm.volumeNo"
class="inputgreen"
:label="`${'เล่มที่'}`"
:rules="[(val:string) => !!val || `${'กรุณากรอกเล่มที่'}`]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
v-model="insigniaForm.volume"
class="inputgreen"
:label="`${'เล่ม'}`"
:rules="[(val:string) => !!val || `${'กรุณากรอกเล่ม'}`]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
v-model="insigniaForm.section"
class="inputgreen"
:label="`${'ตอน'}`"
:rules="[(val:string) => !!val || `${'กรุณากรอกตอน'}`]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
lazy-rules
outlined
hide-bottom-space
v-model="insigniaForm.page"
class="inputgreen"
:label="`${'หน้า'}`"
:rules="[(val:string) => !!val || `${'กรุณากรอกหน้า'}`]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
autoApply
week-start="0"
v-model="insigniaForm.dateAnnounce"
menu-class-name="modalfix"
:locale="'th'"
:enableTimePicker="false"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
dense
outlined
hide-bottom-space
class="inputgreen"
:model-value="date2Thai(insigniaForm.dateAnnounce as Date)"
:label="`${'วันที่ประกาศในราชกิจจาฯ'}`"
:rules="[
(val:string) =>
!!val || `${'กรุณาเลือกวันที่ประกาศในราชกิจจาฯ'}`,
]"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
color="primary"
/>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
v-model="insigniaForm.refCommandNo"
class="inputgreen"
:label="`${'เลขที่คำสั่ง'}`"
>
<template v-slot:append>
<q-icon name="mdi-file" class="cursor-pointer" />
</template>
</q-input>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
autoApply
week-start="0"
v-model="insigniaForm.refCommandDate"
menu-class-name="modalfix"
:locale="'th'"
:enableTimePicker="false"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
dense
outlined
clearable
hide-bottom-space
class="inputgreen"
:label="`${'เอกสารอ้างอิง (ลง วัน/เดือน/ปี)'}`"
:model-value="
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
color="primary"
/>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
lazy-rules
hide-bottom-space
v-model="insigniaForm.refCommandNo"
class="inputgreen"
:label="`${'เลขที่คำสั่ง'}`"
>
<template v-slot:append>
<q-icon name="mdi-file" class="cursor-pointer" />
</template>
</q-input>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
autoApply
week-start="0"
v-model="insigniaForm.refCommandDate"
menu-class-name="modalfix"
:locale="'th'"
:enableTimePicker="false"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
dense
outlined
clearable
hide-bottom-space
class="inputgreen"
:label="`${'เอกสารอ้างอิง (ลง วัน/เดือน/ปี)'}`"
:model-value="
date2Thai(insigniaForm.refCommandDate as Date)
"
@clear="insigniaForm.refCommandDate = null"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
color="primary"
/>
</template>
</q-input>
</template>
</datepicker>
@clear="insigniaForm.refCommandDate = null"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
color="primary"
/>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
hide-bottom-space
v-model="insigniaForm.note"
class="inputgreen"
label="หมายเหตุ"
/>
</div>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
dense
outlined
hide-bottom-space
v-model="insigniaForm.note"
class="inputgreen"
label="หมายเหตุ"
/>
</div>
</div>
</q-card-section>
<q-separator />
<div class="text-right q-pa-sm">
<q-btn
dense
unelevated
label="บันทึก"
id="onSubmit"
type="submit"
color="public"
class="q-px-md"
>
<q-tooltip>นทกขอม</q-tooltip>
</q-btn>
</div>
</q-page>
</q-page-container>
<q-footer>
<q-separator color="grey-4" />
<q-toolbar class="fit row wrap justify-end items-start content-start">
<q-btn
dense
unelevated
label="บันทึก"
id="onSubmit"
type="submit"
color="public"
class="q-px-md"
>
<q-tooltip>นทกขอม</q-tooltip>
</q-btn>
</q-toolbar>
</q-footer>
</q-form>
</q-card>
</q-layout>
</q-dialog>
<q-dialog v-model="modalHistory" persistent>
<q-card style="min-width: 80%">
<q-card-section class="flex justify-between" style="padding: 0">
<DialogHeader
tittle="ประวัติแก้ไขเครื่องราชอิสริยาภรณ์"
:close="() => (modalHistory = false)"
/>
</q-card-section>
<q-separator />
<q-card-section class="q-p-sm">
<div class="row q-gutter-sm q-mb-sm">
<q-space />
<q-input
standout
dense
v-model="filterHistory"
ref="filterRef"
outlined
placeholder="ค้นหา"
debounce="300"
>
<template v-slot:append>
<q-icon
v-if="filterHistory == ''"
name="search"
@click.stop.prevent="filterHistory = ''"
class="cursor-pointer"
/>
<q-icon
v-if="filterHistory"
name="cancel"
@click.stop.prevent="filterHistory = ''"
class="cursor-pointer"
/>
</template>
</q-input>
<q-select
v-model="visibleColumnsHistory"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columnsHistory"
option-value="name"
options-cover
style="min-width: 150px"
<q-layout
view="lHh lpr lFf"
container
style="height: 80vh; min-width: 80%"
class="bg-white"
>
<q-header>
<q-toolbar>
<DialogHeader
tittle="ประวัติแก้ไขเครื่องราชอิสริยาภรณ์"
:close="() => (modalHistory = false)"
/>
</div>
<d-table
ref="table"
flat
bordered
dense
:columns="columnsHistory"
:rows="rowsHistory"
:paging="true"
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumnsHistory"
:filter="filterHistory"
>
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.id">
<div>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</q-toolbar>
<q-separator color="grey-4" />
</q-header>
<template v-slot:pagination="scope">
<q-pagination
v-model="currentPageHistory"
active-color="primary"
color="dark"
:max="Number(maxPageHistory)"
size="sm"
boundary-links
direction-links
></q-pagination>
</template>
</d-table>
</q-card-section>
</q-card>
<q-page-container>
<q-page class="q-pa-md">
<div class="row q-gutter-sm q-mb-sm">
<q-space />
<q-input
standout
dense
v-model="filterHistory"
ref="filterRef"
outlined
placeholder="ค้นหา"
debounce="300"
>
<template v-slot:append>
<q-icon
v-if="filterHistory == ''"
name="search"
@click.stop.prevent="filterHistory = ''"
class="cursor-pointer"
/>
<q-icon
v-if="filterHistory"
name="cancel"
@click.stop.prevent="filterHistory = ''"
class="cursor-pointer"
/>
</template>
</q-input>
<q-select
v-model="visibleColumnsHistory"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columnsHistory"
option-value="name"
options-cover
style="min-width: 150px"
/>
</div>
<d-table
ref="table"
flat
bordered
v-model:pagination="historyPagination"
dense
:columns="columnsHistory"
:rows="rowsHistory"
:paging="true"
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumnsHistory"
:filter="filterHistory"
>
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.id">
<div>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</q-page>
</q-page-container>
</q-layout>
</q-dialog>
</template>