2023-06-23 12:10:59 +07:00
|
|
|
<template>
|
|
|
|
|
<div>
|
2023-06-29 11:05:21 +07:00
|
|
|
<div class="q-pa-sm" style="max-height: 68vh; overflow-y: scroll">
|
|
|
|
|
<div class="col-12 row q-pb-sm items-center">
|
2023-06-23 13:18:22 +07:00
|
|
|
<q-btn flat round color="primary" @click="refresh" icon="mdi-refresh">
|
|
|
|
|
<q-tooltip>อัปเดตข้อมูล</q-tooltip>
|
|
|
|
|
</q-btn>
|
|
|
|
|
<q-space />
|
|
|
|
|
<div class="items-center" style="display: flex">
|
|
|
|
|
<!-- ค้นหาข้อความใน table -->
|
|
|
|
|
<q-input
|
|
|
|
|
standout
|
|
|
|
|
dense
|
|
|
|
|
v-model="filter"
|
|
|
|
|
ref="filterRef"
|
|
|
|
|
outlined
|
|
|
|
|
debounce="300"
|
|
|
|
|
placeholder="ค้นหา"
|
|
|
|
|
style="max-width: 200px"
|
|
|
|
|
class="q-ml-sm"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:append>
|
2023-06-30 08:29:38 +07:00
|
|
|
<q-icon v-if="filter == ''" name="search" />
|
2023-06-23 13:18:22 +07:00
|
|
|
<q-icon
|
2023-06-30 08:29:38 +07:00
|
|
|
v-if="filter !== ''"
|
2023-06-23 13:18:22 +07:00
|
|
|
name="clear"
|
|
|
|
|
class="cursor-pointer"
|
|
|
|
|
@click="resetFilter"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</q-input>
|
|
|
|
|
<!-- แสดงคอลัมน์ใน table -->
|
|
|
|
|
<q-select
|
|
|
|
|
v-model="visibleColumns"
|
|
|
|
|
:display-value="$q.lang.table.columns"
|
|
|
|
|
multiple
|
|
|
|
|
outlined
|
|
|
|
|
dense
|
|
|
|
|
:options="columns"
|
|
|
|
|
options-dense
|
|
|
|
|
option-value="name"
|
|
|
|
|
map-options
|
|
|
|
|
emit-value
|
|
|
|
|
style="min-width: 150px"
|
|
|
|
|
class="gt-xs q-ml-sm"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<q-table
|
|
|
|
|
flat
|
|
|
|
|
bordered
|
|
|
|
|
dense
|
2023-06-23 12:10:59 +07:00
|
|
|
:rows="rows"
|
|
|
|
|
:columns="columns"
|
|
|
|
|
:visible-columns="visibleColumns"
|
2023-06-23 13:18:22 +07:00
|
|
|
:filter="filter"
|
|
|
|
|
row-key="name"
|
2023-06-23 12:10:59 +07:00
|
|
|
selection="multiple"
|
|
|
|
|
v-model:selected="selected"
|
2023-06-23 13:18:22 +07:00
|
|
|
class="custom-header-table"
|
|
|
|
|
:pagination-label="paginationLabel"
|
2023-06-26 09:54:58 +07:00
|
|
|
v-model:pagination="pagination"
|
2023-06-23 12:10:59 +07:00
|
|
|
>
|
2023-06-23 13:18:22 +07:00
|
|
|
<template v-slot:header-selection="scope">
|
2023-06-30 08:29:38 +07:00
|
|
|
<q-checkbox
|
|
|
|
|
keep-color
|
|
|
|
|
color="primary"
|
|
|
|
|
dense
|
|
|
|
|
v-model="scope.selected"
|
|
|
|
|
/>
|
2023-06-23 13:18:22 +07:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template v-slot:body-selection="scope">
|
|
|
|
|
<q-checkbox
|
|
|
|
|
keep-color
|
|
|
|
|
color="primary"
|
2023-06-30 08:29:38 +07:00
|
|
|
dense
|
2023-06-23 13:18:22 +07:00
|
|
|
:model-value="scope.selected"
|
|
|
|
|
@update:model-value="
|
|
|
|
|
(val, evt) => {
|
|
|
|
|
Object.getOwnPropertyDescriptor(scope, 'selected').set(
|
|
|
|
|
val,
|
|
|
|
|
evt
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
2023-06-30 08:29:38 +07:00
|
|
|
|
2023-06-23 13:18:22 +07:00
|
|
|
<template v-slot:body-cell="props">
|
|
|
|
|
<q-td :props="props">
|
2023-06-26 09:54:58 +07:00
|
|
|
<div v-if="props.col.name == 'no'">
|
2023-06-23 13:18:22 +07:00
|
|
|
{{ props.rowIndex + 1 }}
|
|
|
|
|
</div>
|
2023-06-26 09:54:58 +07:00
|
|
|
<div v-else-if="props.col.name == 'educate'">
|
|
|
|
|
<q-select
|
|
|
|
|
:class="getClass(true)"
|
|
|
|
|
hide-bottom-space
|
|
|
|
|
multiple
|
|
|
|
|
:outlined="true"
|
|
|
|
|
dense
|
|
|
|
|
lazy-rules
|
|
|
|
|
:readonly="!true"
|
|
|
|
|
:borderless="!true"
|
|
|
|
|
v-model="props.value"
|
2023-06-30 08:29:38 +07:00
|
|
|
:rules="[(val:any) => !!val || `${'กรุณาเลือกวุฒิการศึกษา'}`,(val:any) => val.length > 0 || `${'กรุณาเลือกวุฒิการศึกษา'}`]"
|
2023-06-26 09:54:58 +07:00
|
|
|
:label="`${'เลือกวุฒิการศึกษา'}`"
|
|
|
|
|
emit-value
|
|
|
|
|
map-options
|
|
|
|
|
option-label="name"
|
|
|
|
|
:options="[]"
|
|
|
|
|
option-value="id"
|
|
|
|
|
input-debounce="0"
|
|
|
|
|
color="primary"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:prepend>
|
|
|
|
|
<q-icon name="cast_for_education" color="primary" />
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:no-option>
|
|
|
|
|
<q-item>
|
|
|
|
|
<q-item-section class="text-black">
|
|
|
|
|
ไม่พบข้อมูลที่ค้นหา
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</template>
|
|
|
|
|
</q-select>
|
|
|
|
|
</div>
|
2023-06-23 13:18:22 +07:00
|
|
|
<div v-else @click="click(props)">
|
|
|
|
|
{{ props.value }}
|
|
|
|
|
</div>
|
|
|
|
|
</q-td>
|
2023-06-23 12:10:59 +07:00
|
|
|
</template>
|
2023-06-30 08:29:38 +07:00
|
|
|
<template v-slot:pagination="scope">
|
|
|
|
|
<q-pagination
|
|
|
|
|
v-model="pagination.page"
|
|
|
|
|
color="primary"
|
|
|
|
|
:max="scope.pagesNumber"
|
|
|
|
|
:max-pages="5"
|
|
|
|
|
size="sm"
|
|
|
|
|
boundary-links
|
|
|
|
|
direction-links
|
|
|
|
|
></q-pagination>
|
|
|
|
|
</template>
|
2023-06-23 13:18:22 +07:00
|
|
|
</q-table>
|
2023-06-23 12:10:59 +07:00
|
|
|
</div>
|
|
|
|
|
<q-separator />
|
2023-06-29 11:05:21 +07:00
|
|
|
<div class="flex justify-end q-pa-sm q-gutter-sm">
|
|
|
|
|
<q-btn
|
|
|
|
|
dense
|
|
|
|
|
outline
|
|
|
|
|
color="primary"
|
|
|
|
|
icon="chevron_left"
|
|
|
|
|
@click="previous"
|
|
|
|
|
class="q-pr-md"
|
|
|
|
|
label="กรอกรายละเอียด">
|
|
|
|
|
</q-btn>
|
2023-06-23 12:10:59 +07:00
|
|
|
<q-btn
|
2023-06-29 11:05:21 +07:00
|
|
|
dense
|
|
|
|
|
unelevated
|
|
|
|
|
label="บันทึก"
|
2023-06-23 12:10:59 +07:00
|
|
|
color="public"
|
|
|
|
|
@click="next"
|
2023-06-29 11:05:21 +07:00
|
|
|
class="q-px-md"
|
|
|
|
|
><!-- icon="mdi-content-save-outline"
|
|
|
|
|
<q-tooltip>บันทึก</q-tooltip> -->
|
2023-06-23 12:10:59 +07:00
|
|
|
</q-btn>
|
2023-06-29 11:05:21 +07:00
|
|
|
<!-- <q-btn dense flat round color="primary" icon="chevron_right" @click="next">
|
2023-06-23 12:10:59 +07:00
|
|
|
<q-tooltip>ต่อไป</q-tooltip>
|
2023-06-29 11:05:21 +07:00
|
|
|
</q-btn> -->
|
2023-06-23 12:10:59 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { ref } from "vue";
|
2023-06-23 13:18:22 +07:00
|
|
|
import { useQuasar } from "quasar";
|
|
|
|
|
import type { QInput } from "quasar";
|
2023-06-23 12:10:59 +07:00
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
next: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
},
|
|
|
|
|
previous: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const next = () => props.next();
|
|
|
|
|
const previous = () => props.previous();
|
|
|
|
|
|
2023-06-23 13:18:22 +07:00
|
|
|
const $q = useQuasar();
|
|
|
|
|
|
|
|
|
|
const filterRef = ref<QInput>();
|
2023-06-23 12:10:59 +07:00
|
|
|
const filter = ref<string>("");
|
2023-06-26 09:54:58 +07:00
|
|
|
const visibleColumns = ref<String[]>(["no", "idcard", "name", "educate"]);
|
2023-06-23 12:10:59 +07:00
|
|
|
const columns = [
|
2023-06-26 09:54:58 +07:00
|
|
|
{ name: "no", align: "left", label: "ลำดับ", field: "no", sortable: true },
|
2023-06-23 12:10:59 +07:00
|
|
|
{
|
2023-06-26 09:54:58 +07:00
|
|
|
name: "idcard",
|
2023-06-23 12:10:59 +07:00
|
|
|
align: "left",
|
2023-06-26 09:54:58 +07:00
|
|
|
label: "เลขประจำตัวประชาชน",
|
|
|
|
|
field: "idcard",
|
2023-06-23 12:10:59 +07:00
|
|
|
sortable: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
2023-06-26 09:54:58 +07:00
|
|
|
name: "name",
|
|
|
|
|
align: "left",
|
|
|
|
|
label: "ชื่อ-สกุล",
|
|
|
|
|
field: "name",
|
2023-06-23 12:10:59 +07:00
|
|
|
sortable: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
2023-06-26 09:54:58 +07:00
|
|
|
name: "educate",
|
|
|
|
|
align: "left",
|
|
|
|
|
label: "วุฒิการศึกษาในการออกคำสั่ง",
|
|
|
|
|
field: "educate",
|
2023-06-23 12:10:59 +07:00
|
|
|
sortable: true,
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const rows = [
|
|
|
|
|
{
|
2023-06-26 09:54:58 +07:00
|
|
|
no: "0ac56905-1a74-4606-a120-233340adde95",
|
|
|
|
|
name: "นางนัทธ์ เหล่าสกุล",
|
|
|
|
|
idcard: "9158455632145",
|
|
|
|
|
educate: "",
|
2023-06-23 12:10:59 +07:00
|
|
|
},
|
|
|
|
|
{
|
2023-06-26 09:54:58 +07:00
|
|
|
no: "0de607a0-b094-4a6d-9e30-979343ab5e53",
|
|
|
|
|
name: "นางขรรค์ จันทรสมบัติ",
|
|
|
|
|
idcard: "8558455632126",
|
|
|
|
|
educate: "",
|
2023-06-23 12:10:59 +07:00
|
|
|
},
|
|
|
|
|
{
|
2023-06-26 09:54:58 +07:00
|
|
|
no: "93ca7366-2a35-4f94-a331-9c23c9ea78d3",
|
|
|
|
|
name: "นางโอภาส จรัสวงศ์",
|
|
|
|
|
idcard: "8158455635425",
|
|
|
|
|
educate: "",
|
2023-06-23 12:10:59 +07:00
|
|
|
},
|
|
|
|
|
{
|
2023-06-26 09:54:58 +07:00
|
|
|
no: "d3777c19-2bd0-42df-90ce-c3eeeee55ac6",
|
|
|
|
|
name: "นางธิญา หงษ์ทอง",
|
|
|
|
|
idcard: "4558455632145",
|
|
|
|
|
educate: "",
|
2023-06-23 12:10:59 +07:00
|
|
|
},
|
|
|
|
|
{
|
2023-06-26 09:54:58 +07:00
|
|
|
no: "1ccead6f-a851-4291-b3ab-a20757ecddbd",
|
|
|
|
|
name: "นางธนวิทย์ พิกุลเทพ",
|
|
|
|
|
idcard: "5542455632145",
|
|
|
|
|
educate: "",
|
2023-06-23 12:10:59 +07:00
|
|
|
},
|
|
|
|
|
{
|
2023-06-26 09:54:58 +07:00
|
|
|
no: "1ccead6f-a851-4291-b3ab-a20757ecddbd",
|
|
|
|
|
name: "นางหนึ่ง สตาภิรมย์",
|
|
|
|
|
idcard: "7448455632145",
|
|
|
|
|
educate: "",
|
2023-06-23 12:10:59 +07:00
|
|
|
},
|
|
|
|
|
{
|
2023-06-26 09:54:58 +07:00
|
|
|
no: "1ccead6f-a851-4291-b3ab-a20757ecddbd",
|
|
|
|
|
name: "นางสัจพร คมคาย",
|
|
|
|
|
idcard: "1236455632145",
|
|
|
|
|
educate: "",
|
2023-06-23 12:10:59 +07:00
|
|
|
},
|
|
|
|
|
{
|
2023-06-26 09:54:58 +07:00
|
|
|
no: "1ccead6f-a851-4291-b3ab-a20757ecddbd",
|
|
|
|
|
name: "นางตุลยากร ปรีดาศิริกุล",
|
|
|
|
|
idcard: "1523455632145",
|
|
|
|
|
educate: "",
|
2023-06-23 12:10:59 +07:00
|
|
|
},
|
|
|
|
|
{
|
2023-06-26 09:54:58 +07:00
|
|
|
no: "1ccead6f-a851-4291-b3ab-a20757ecddbd",
|
|
|
|
|
name: "นางบัลลังค์ จิรวาณิชย์",
|
|
|
|
|
idcard: "1258455632145",
|
|
|
|
|
educate: "",
|
2023-06-23 12:10:59 +07:00
|
|
|
},
|
|
|
|
|
{
|
2023-06-26 09:54:58 +07:00
|
|
|
no: "1ccead6f-a851-4291-b3ab-a20757ecddbd",
|
|
|
|
|
name: "นางคมคาย เรืองรังสรรค์",
|
|
|
|
|
idcard: "8548455632145",
|
|
|
|
|
educate: "",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
no: "1ccead6f-a851-4291-b3ab-a20757ecddbd",
|
|
|
|
|
name: "นางพรทิพา คมคาย",
|
|
|
|
|
idcard: "6598455632145",
|
|
|
|
|
educate: "",
|
2023-06-23 12:10:59 +07:00
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
const selected = ref([]);
|
2023-06-26 09:54:58 +07:00
|
|
|
const pagination = ref({
|
|
|
|
|
sortBy: "desc",
|
|
|
|
|
descending: false,
|
|
|
|
|
page: 1,
|
|
|
|
|
rowsPerPage: 10,
|
|
|
|
|
});
|
2023-06-23 12:10:59 +07:00
|
|
|
|
2023-06-23 13:18:22 +07:00
|
|
|
const click = (e: any) => {
|
|
|
|
|
console.log(e);
|
|
|
|
|
};
|
|
|
|
|
|
2023-06-23 12:10:59 +07:00
|
|
|
const selectData = (row: any) => {};
|
2023-06-23 13:18:22 +07:00
|
|
|
|
|
|
|
|
const refresh = () => {};
|
|
|
|
|
|
|
|
|
|
const paginationLabel = (start: string, end: string, total: string) => {
|
|
|
|
|
// if (props.paging == true)
|
|
|
|
|
// return " " + start + " ใน " + end + " จากจำนวน " + total + " รายการ";
|
|
|
|
|
// else
|
|
|
|
|
return start + "-" + end + " ใน " + total;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const resetFilter = () => {
|
|
|
|
|
// reset ค่าที่ค้นหาเมื่อกดปุ่ม X ในกล่องค้นหา
|
|
|
|
|
filter.value = "";
|
|
|
|
|
filterRef.value!.focus();
|
|
|
|
|
};
|
2023-06-26 09:54:58 +07:00
|
|
|
|
|
|
|
|
const getClass = (val: boolean) => {
|
|
|
|
|
return {
|
|
|
|
|
"full-width inputgreen cursor-pointer": val,
|
|
|
|
|
"full-width cursor-pointer": !val,
|
|
|
|
|
};
|
|
|
|
|
};
|
2023-06-23 12:10:59 +07:00
|
|
|
</script>
|
2023-06-23 13:18:22 +07:00
|
|
|
<style lang="scss">
|
|
|
|
|
.icon-color {
|
|
|
|
|
color: #4154b3;
|
|
|
|
|
}
|
|
|
|
|
.custom-header-table {
|
|
|
|
|
.q-table tr:nth-child(odd) td {
|
|
|
|
|
background: white;
|
|
|
|
|
}
|
|
|
|
|
.q-table tr:nth-child(even) td {
|
|
|
|
|
background: #f8f8f8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.q-table thead tr {
|
|
|
|
|
background: #ecebeb;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.q-table thead tr th {
|
|
|
|
|
position: sticky;
|
|
|
|
|
z-index: 1;
|
|
|
|
|
}
|
|
|
|
|
/* this will be the loading indicator */
|
|
|
|
|
.q-table thead tr:last-child th {
|
|
|
|
|
/* height of all previous header rows */
|
|
|
|
|
top: 48px;
|
|
|
|
|
}
|
|
|
|
|
.q-table thead tr:first-child th {
|
|
|
|
|
top: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|