update
This commit is contained in:
parent
46533bbd62
commit
15d3ac574d
128 changed files with 347 additions and 322 deletions
|
|
@ -1,555 +0,0 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, watch } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
|
||||
/** importType*/
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { FormFilter } from "@/modules/04_registryNew/interface/request/Main";
|
||||
|
||||
/** importComponent*/
|
||||
import DialogAddData from "@/modules/04_registryNew/components/DialogAddData.vue";
|
||||
import DialogHistory from "@/modules/04_registryNew/components/DialogHistory.vue";
|
||||
|
||||
/** importStore*/
|
||||
import { useRegistryNewDataStore } from "@/modules/04_registryNew/store";
|
||||
|
||||
const store = useRegistryNewDataStore();
|
||||
const router = useRouter();
|
||||
|
||||
const formFilter = defineModel<FormFilter>("formFilter", { required: true });
|
||||
const maxPage = defineModel<Number>("maxPage", { required: true });
|
||||
const empType = defineModel<string>("empType", { required: true });
|
||||
const props = defineProps({
|
||||
rows: { type: Array },
|
||||
fetchData: { type: Function },
|
||||
fetchType: { type: Function },
|
||||
total: { type: Number },
|
||||
// empType: { type: String },
|
||||
});
|
||||
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "no",
|
||||
align: "left",
|
||||
label: "ลำดับ",
|
||||
sortable: true,
|
||||
field: "no",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "fullName",
|
||||
align: "left",
|
||||
label: "ชื่อ - นามสกุล",
|
||||
sortable: true,
|
||||
field: "fullName",
|
||||
headerStyle: "font-size: 14px; min-width: 200px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "posNo",
|
||||
align: "left",
|
||||
label: "ตำแหน่งเลขที่",
|
||||
sortable: true,
|
||||
field: "posNo",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "position",
|
||||
align: "left",
|
||||
label: "ตำแหน่งในสายงาน",
|
||||
sortable: true,
|
||||
field: "position",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "posPath",
|
||||
align: "left",
|
||||
label: "ตำแหน่งประเภท",
|
||||
sortable: true,
|
||||
field: "posType",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "posLevel",
|
||||
align: "left",
|
||||
label: "ระดับ",
|
||||
sortable: true,
|
||||
field: "posLevel",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
format(val, row) {
|
||||
return row.posTypeShortName
|
||||
? row.posTypeShortName + " " + row.posLevel
|
||||
: row.posLevel;
|
||||
},
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "org",
|
||||
align: "left",
|
||||
label: "สังกัด",
|
||||
sortable: true,
|
||||
field: "org",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
// {
|
||||
// name: "year",
|
||||
// align: "left",
|
||||
// label: "ปีงบประมาณ",
|
||||
// sortable: true,
|
||||
// field: "year",
|
||||
// headerStyle: "font-size: 14px",
|
||||
// style: "font-size: 14px",
|
||||
// sort: (a: string, b: string) =>
|
||||
// a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
// },
|
||||
// {
|
||||
// name: "salary",
|
||||
// align: "left",
|
||||
// label: "ค่าจ้าง",
|
||||
// sortable: true,
|
||||
// field: "salary",
|
||||
// headerStyle: "font-size: 14px",
|
||||
// style: "font-size: 14px",
|
||||
// sort: (a: string, b: string) =>
|
||||
// a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
// },
|
||||
]);
|
||||
|
||||
const visibleColumns = ref<string[]>([
|
||||
"no",
|
||||
"fullName",
|
||||
"posNo",
|
||||
"position",
|
||||
"posPath",
|
||||
"posType",
|
||||
"posLevel",
|
||||
"org",
|
||||
]);
|
||||
|
||||
function updatePagePagination() {
|
||||
props.fetchData?.();
|
||||
}
|
||||
|
||||
function updatePageSizePagination(newPagination: any) {
|
||||
formFilter.value.page = 1;
|
||||
formFilter.value.pageSize = newPagination.rowsPerPage;
|
||||
}
|
||||
|
||||
const pagination = ref({
|
||||
page: formFilter.value.page,
|
||||
rowsPerPage: formFilter.value.pageSize,
|
||||
});
|
||||
|
||||
const modalDialogAdd = ref<boolean>(false);
|
||||
const modalHistory = ref<boolean>(false);
|
||||
|
||||
function onClickAddData() {
|
||||
modalDialogAdd.value = !modalDialogAdd.value;
|
||||
}
|
||||
|
||||
function onClickHistory() {
|
||||
modalHistory.value = !modalHistory.value;
|
||||
}
|
||||
|
||||
function onClickViewDetail(id: string) {
|
||||
if (empType.value === "officer") {
|
||||
router.push(`/registry-new/${id}`);
|
||||
} else {
|
||||
router.push(`/registry-new-employee/${id}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function redirect ไปหน้ารายการคำร้องขอแก้ไขข้อมูล
|
||||
*/
|
||||
function redirectToPagePetition() {
|
||||
router.push(`/registry-new/request-edit`);
|
||||
}
|
||||
|
||||
watch(
|
||||
() => formFilter.value.pageSize,
|
||||
() => {
|
||||
props.fetchData?.();
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="col-12 row q-pb-sm q-col-gutter-sm items-center">
|
||||
<div class="row q-gutter-sm">
|
||||
<q-btn
|
||||
v-if="empType === 'officer'"
|
||||
color="primary"
|
||||
label="รายการคำร้องขอแก้ไข"
|
||||
@click="redirectToPagePetition()"
|
||||
>
|
||||
<q-tooltip>รายการคำร้องขอแก้ไข</q-tooltip></q-btn
|
||||
>
|
||||
<q-btn
|
||||
round
|
||||
flat
|
||||
dense
|
||||
color="blue"
|
||||
icon="mdi-history"
|
||||
@click="onClickHistory"
|
||||
>
|
||||
<q-tooltip>ประวัติถือครองตำแหน่ง</q-tooltip></q-btn
|
||||
>
|
||||
</div>
|
||||
<q-space />
|
||||
<q-select
|
||||
v-if="store.mode === 'table'"
|
||||
v-model="visibleColumns"
|
||||
multiple
|
||||
outlined
|
||||
dense
|
||||
options-dense
|
||||
:display-value="$q.lang.table.columns"
|
||||
emit-value
|
||||
map-options
|
||||
:options="columns"
|
||||
option-value="name"
|
||||
options-cover
|
||||
style="min-width: 150px"
|
||||
class="full-height"
|
||||
hide-bottom-space
|
||||
/>
|
||||
<div>
|
||||
<q-btn-toggle
|
||||
v-model="store.mode"
|
||||
dense
|
||||
class="my-custom-toggle no-shadow"
|
||||
toggle-color="grey-4"
|
||||
:options="[
|
||||
{ value: 'table', slot: 'table' },
|
||||
{ value: 'card', slot: 'card' },
|
||||
]"
|
||||
>
|
||||
<template v-slot:table>
|
||||
<q-icon
|
||||
name="format_list_bulleted"
|
||||
class="q-px-sm q-py-xs"
|
||||
size="22px"
|
||||
:style="{
|
||||
color: store.mode === 'table' ? '#787B7C' : '#C9D3DB',
|
||||
}"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template v-slot:card>
|
||||
<q-icon
|
||||
name="mdi-view-grid-outline"
|
||||
size="22px"
|
||||
class="q-px-sm q-py-xs"
|
||||
:style="{
|
||||
color: store.mode === 'card' ? '#787B7C' : '#C9D3DB',
|
||||
}"
|
||||
/>
|
||||
</template>
|
||||
</q-btn-toggle>
|
||||
</div>
|
||||
</div>
|
||||
<d-table
|
||||
ref="table"
|
||||
row-key="id"
|
||||
flat
|
||||
bordered
|
||||
dense
|
||||
:card-container-class="store.mode === 'card' ? 'q-col-gutter-md' : ''"
|
||||
:columns="columns"
|
||||
:rows="props.rows"
|
||||
:grid="store.mode === 'card'"
|
||||
:paging="true"
|
||||
v-model:pagination="pagination"
|
||||
:rows-per-page-options="[20, 50, 100]"
|
||||
:visible-columns="visibleColumns"
|
||||
@update:pagination="updatePageSizePagination"
|
||||
>
|
||||
>
|
||||
<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" v-if="col.name === 'posLevel'">{{
|
||||
empType === "officer" ? col.label : "ระดับชั้นงาน"
|
||||
}}</span>
|
||||
<span class="text-weight-medium" v-else-if="col.name === 'posPath'">{{
|
||||
empType === "officer" ? col.label : "กลุ่มงาน"
|
||||
}}</span>
|
||||
<span
|
||||
class="text-weight-medium"
|
||||
v-else-if="col.name === 'position'"
|
||||
>{{ empType === "officer" ? col.label : "ตำแหน่ง" }}</span
|
||||
>
|
||||
|
||||
<span class="text-weight-medium" v-else>{{ col.label }}</span>
|
||||
</q-th>
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:body="props" v-if="store.mode === 'table'">
|
||||
<q-tr :props="props">
|
||||
<q-td v-for="col in props.cols" :key="col.id">
|
||||
<div v-if="col.name === 'no'">
|
||||
{{
|
||||
(formFilter.page - 1) * formFilter.pageSize + props.rowIndex + 1
|
||||
}}
|
||||
</div>
|
||||
<div v-else-if="col.name == 'fullName'">
|
||||
<div class="row col-12 wrap items-center">
|
||||
<q-item>
|
||||
<q-item-section avatar>
|
||||
<q-avatar size="50px" class="bg-grey-2">
|
||||
<q-img :src="props.row.avatar" />
|
||||
</q-avatar>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<div
|
||||
class="text-weight-medium text-primary cursor-pointer"
|
||||
@click="onClickViewDetail(props.row.id)"
|
||||
>
|
||||
<q-tooltip>ดูทะเบียนประวัติ</q-tooltip>
|
||||
{{
|
||||
`${props.row.prefix ? props.row.prefix : ""}${
|
||||
props.row.firstName
|
||||
} ${props.row.lastName}`
|
||||
}}
|
||||
</div>
|
||||
<div class="text-weight-light">{{ props.row.citizenId }}</div>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="table_ellipsis">
|
||||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:item="props" v-else>
|
||||
<div class="col-xs-12 col-sm-4 col-md-3">
|
||||
<q-card flat bordered class="">
|
||||
<q-card-section class="text-center q-pb-none">
|
||||
<q-avatar size="80px" class="bg-grey-2">
|
||||
<q-img :src="props.row.avatar" />
|
||||
</q-avatar>
|
||||
|
||||
<div class="text-weight-medium q-mt-md">
|
||||
{{
|
||||
`${props.row.prefix ? props.row.prefix : ""}${
|
||||
props.row.firstName
|
||||
} ${props.row.lastName}`
|
||||
}}
|
||||
</div>
|
||||
<div class="text-weight-light full-width text-center">
|
||||
{{ props.row.citizenId }}
|
||||
</div>
|
||||
</q-card-section>
|
||||
|
||||
<q-card-section class="q-pa-sm">
|
||||
<q-card bordered class="bg-grey-13">
|
||||
<q-card-section>
|
||||
<div class="text-grey">ตำแหน่งเลขที่</div>
|
||||
<div class="text-subtitle2 text-black q-ml-sm">
|
||||
{{ props.row.posNo ? props.row.posNo : "-" }}
|
||||
</div>
|
||||
|
||||
<div class="text-grey">
|
||||
{{ empType === "officer" ? `ตำแหน่งในสายงาน` : `ตำแหน่ง` }}
|
||||
</div>
|
||||
<div class="text-subtitle2 text-black q-ml-sm">
|
||||
{{ props.row.position ? props.row.position : "-" }}
|
||||
</div>
|
||||
|
||||
<div class="text-grey">
|
||||
{{ empType === "officer" ? "ตำแหน่งประเภท" : "กลุ่มงาน" }}
|
||||
</div>
|
||||
<div class="text-subtitle2 text-black q-ml-sm">
|
||||
{{ props.row.posType ? props.row.posType : "-" }}
|
||||
</div>
|
||||
|
||||
<div class="text-grey">
|
||||
{{ empType === "officer" ? "ระดับ" : "ระดับชั้นงาน" }}
|
||||
</div>
|
||||
<div class="text-subtitle2 text-black q-ml-sm">
|
||||
{{
|
||||
props.row.posLevel
|
||||
? props.row.posTypeShortName
|
||||
? `${props.row.posTypeShortName} ${props.row.posLevel}`
|
||||
: props.row.posLevel
|
||||
: "-"
|
||||
}}
|
||||
</div>
|
||||
</q-card-section>
|
||||
|
||||
<!-- <q-list dense class="q-py-sm"> -->
|
||||
<!-- <q-item dense>
|
||||
<q-item-section>
|
||||
<q-item-label caption>ตำแหน่งเลขที่</q-item-label>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label caption class="text-black">{{
|
||||
props.row.posNo ? props.row.posNo : "-"
|
||||
}}</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item> -->
|
||||
|
||||
<!-- <q-item dense>
|
||||
<q-item-section>
|
||||
<q-item-label caption>{{
|
||||
empType === "officer" ? `ตำแหน่งในสายงาน` : `ตำแหน่ง`
|
||||
}}</q-item-label>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label caption class="text-black">
|
||||
{{
|
||||
props.row.position ? props.row.position : "-"
|
||||
}}</q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
</q-item> -->
|
||||
|
||||
<!-- <q-item dense>
|
||||
<q-item-section>
|
||||
<q-item-label caption>
|
||||
{{
|
||||
empType === "officer" ? "ตำแหน่งประเภท" : "กลุ่มงาน"
|
||||
}}</q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label caption class="text-black">
|
||||
{{
|
||||
props.row.posType ? props.row.posType : "-"
|
||||
}}</q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
</q-item> -->
|
||||
|
||||
<!-- <q-item dense>
|
||||
<q-item-section>
|
||||
<q-item-label caption>
|
||||
{{
|
||||
empType === "officer" ? "ระดับ" : "ระดับชั้นงาน"
|
||||
}}</q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label caption class="text-black">
|
||||
{{
|
||||
props.row.posLevel
|
||||
? props.row.posTypeShortName
|
||||
? `${props.row.posTypeShortName} ${props.row.posLevel}`
|
||||
: props.row.posLevel
|
||||
: "-"
|
||||
}}</q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
</q-item> -->
|
||||
<!-- </q-list> -->
|
||||
</q-card>
|
||||
</q-card-section>
|
||||
<q-separator inset />
|
||||
<q-btn
|
||||
flat
|
||||
color="black"
|
||||
label="ดูเพิ่มเติม"
|
||||
class="hover-button full-width q-pa-md"
|
||||
@click="onClickViewDetail(props.row.id)"
|
||||
/>
|
||||
</q-card>
|
||||
</div>
|
||||
</template>
|
||||
<template v-slot:pagination="scope">
|
||||
ทั้งหมด {{ props.total }} รายการ
|
||||
<q-pagination
|
||||
v-model="formFilter.page"
|
||||
active-color="primary"
|
||||
color="dark"
|
||||
:max="Number(maxPage)"
|
||||
:max-pages="5"
|
||||
size="sm"
|
||||
boundary-links
|
||||
direction-links
|
||||
@update:model-value="updatePagePagination()"
|
||||
></q-pagination>
|
||||
</template>
|
||||
<template v-slot:no-data="{ icon, message, filter }">
|
||||
<div class="full-width row flex-center text-accent q-gutter-sm">
|
||||
<span
|
||||
><div
|
||||
style="
|
||||
height: 50vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
"
|
||||
class="text-grey-5"
|
||||
>
|
||||
<q-icon name="search" size="4rem" />
|
||||
|
||||
<span>ไม่พบข้อมูล</span>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</d-table>
|
||||
|
||||
<DialogAddData
|
||||
v-model:modal="modalDialogAdd"
|
||||
:fetchData="props.fetchData"
|
||||
:fetchType="props.fetchType"
|
||||
:empType="empType"
|
||||
/>
|
||||
|
||||
<DialogHistory v-model:modal="modalHistory" />
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.hover-button:hover {
|
||||
background-color: #089cfc;
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
.my-card {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.bg-grey-13 {
|
||||
background: #f1f2f496 !important;
|
||||
}
|
||||
|
||||
.my-custom-toggle {
|
||||
border: 1px solid #d0d0d2;
|
||||
}
|
||||
.cardRO {
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.cardRO:hover {
|
||||
cursor: pointer;
|
||||
background: #dcdcdc33 !important;
|
||||
}
|
||||
.cardRO:hover .textName {
|
||||
color: #02a998;
|
||||
}
|
||||
</style>
|
||||
Loading…
Add table
Add a link
Reference in a new issue