2023-06-07 13:42:11 +07:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { ref, useAttrs } from "vue";
|
2023-09-21 11:00:05 +07:00
|
|
|
import { QTooltip, useQuasar } from "quasar";
|
2025-05-29 14:17:39 +07:00
|
|
|
import {
|
|
|
|
|
checkPermission,
|
|
|
|
|
checkPermissionList,
|
|
|
|
|
checkPermissionCreate,
|
|
|
|
|
} from "@/utils/permissions";
|
2023-11-13 13:32:26 +07:00
|
|
|
|
2024-12-26 12:11:19 +07:00
|
|
|
import type { PropType } from "vue";
|
|
|
|
|
import type { optionData } from "@/modules/05_placement/interface/index/Main";
|
|
|
|
|
|
2023-06-07 13:42:11 +07:00
|
|
|
const $q = useQuasar();
|
|
|
|
|
const attrs = ref<any>(useAttrs());
|
2023-06-30 09:15:47 +07:00
|
|
|
const paging = ref<boolean>(true);
|
2023-06-07 13:42:11 +07:00
|
|
|
const table = ref<any>(null);
|
|
|
|
|
const filterRef = ref<any>(null);
|
2023-11-13 13:32:26 +07:00
|
|
|
|
2024-10-25 17:20:52 +07:00
|
|
|
const bmaOfficer = ref<string>("");
|
2024-10-25 15:15:43 +07:00
|
|
|
const bmaOfficerOption = ref<optionData[]>([
|
2024-10-25 17:20:52 +07:00
|
|
|
{ id: "", name: "ทั้งหมด" },
|
2024-10-25 15:15:43 +07:00
|
|
|
{ id: "OFFICER", name: "ขรก.กทม. สามัญ" },
|
|
|
|
|
{ id: "EXTERNAL", name: "บุคคลภายนอก" },
|
|
|
|
|
]);
|
2024-12-26 12:11:19 +07:00
|
|
|
|
|
|
|
|
const positionCandidate = ref<string>("");
|
|
|
|
|
|
2023-06-07 13:42:11 +07:00
|
|
|
const props = defineProps({
|
|
|
|
|
inputfilter: String,
|
|
|
|
|
inputvisible: Array,
|
|
|
|
|
inputvisibleFilter: String,
|
|
|
|
|
editvisible: Boolean,
|
|
|
|
|
titleText: String,
|
2023-07-20 17:57:05 +07:00
|
|
|
modaladdlist: Boolean,
|
2023-07-24 15:26:22 +07:00
|
|
|
displayAdd: Boolean,
|
2023-06-07 13:42:11 +07:00
|
|
|
optionsFilter: {
|
|
|
|
|
type: Array,
|
|
|
|
|
defualt: [],
|
|
|
|
|
},
|
|
|
|
|
boss: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: false,
|
|
|
|
|
},
|
2024-12-26 12:11:19 +07:00
|
|
|
positionCandidateData: {
|
|
|
|
|
type: Array as PropType<optionData[]>,
|
|
|
|
|
defualt: [],
|
|
|
|
|
},
|
2023-06-07 13:42:11 +07:00
|
|
|
saveNoDraft: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: false,
|
|
|
|
|
},
|
|
|
|
|
history: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: false,
|
|
|
|
|
},
|
|
|
|
|
paging: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: false,
|
|
|
|
|
},
|
|
|
|
|
nornmalData: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: false,
|
|
|
|
|
},
|
|
|
|
|
nextPageVisible: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: false,
|
|
|
|
|
},
|
|
|
|
|
publicData: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: true,
|
|
|
|
|
required: false,
|
|
|
|
|
},
|
|
|
|
|
updateData: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: true,
|
|
|
|
|
required: false,
|
|
|
|
|
},
|
|
|
|
|
publicNoBtn: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: false,
|
|
|
|
|
},
|
2023-06-23 12:10:59 +07:00
|
|
|
refreshBtn: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: false,
|
|
|
|
|
},
|
2023-06-07 13:42:11 +07:00
|
|
|
add: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
},
|
2024-12-04 13:47:44 +07:00
|
|
|
onSearch: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
},
|
2023-06-07 13:42:11 +07:00
|
|
|
edit: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
},
|
|
|
|
|
save: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
},
|
|
|
|
|
deleted: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
},
|
|
|
|
|
cancel: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
},
|
|
|
|
|
publish: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
},
|
|
|
|
|
validate: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
},
|
2023-06-23 12:10:59 +07:00
|
|
|
refresh: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
},
|
2023-07-13 14:20:28 +07:00
|
|
|
containStatus: Boolean,
|
2023-07-20 17:57:05 +07:00
|
|
|
roleAdmin: Boolean,
|
2023-06-07 13:42:11 +07:00
|
|
|
});
|
2023-11-13 13:32:26 +07:00
|
|
|
|
2024-12-26 16:02:23 +07:00
|
|
|
const positionCandidateOptions = ref<optionData[]>(
|
|
|
|
|
props?.positionCandidateData || []
|
|
|
|
|
);
|
|
|
|
|
|
2023-06-30 09:15:47 +07:00
|
|
|
const pagination = ref({
|
2023-09-13 09:37:51 +07:00
|
|
|
sortBy: "examNumber",
|
2023-07-13 14:20:28 +07:00
|
|
|
descending: false,
|
2023-06-30 09:15:47 +07:00
|
|
|
page: 1,
|
|
|
|
|
rowsPerPage: 10,
|
|
|
|
|
});
|
2023-06-07 13:42:11 +07:00
|
|
|
|
2023-11-13 13:32:26 +07:00
|
|
|
/** ส่งค่า*/
|
2023-06-07 13:42:11 +07:00
|
|
|
const emit = defineEmits([
|
|
|
|
|
"update:inputfilter",
|
|
|
|
|
"update:inputvisible",
|
|
|
|
|
"update:editvisible",
|
|
|
|
|
"update:titleText",
|
|
|
|
|
"update:inputvisibleFilter",
|
2023-07-20 17:57:05 +07:00
|
|
|
"update:containfilter",
|
|
|
|
|
"update-modaladdlist",
|
2024-09-25 10:17:33 +07:00
|
|
|
"update-modaladdSendPerson",
|
2024-10-25 15:15:43 +07:00
|
|
|
"update-newRows",
|
2023-06-07 13:42:11 +07:00
|
|
|
]);
|
|
|
|
|
|
2023-11-13 13:32:26 +07:00
|
|
|
function paginationLabel(start: string, end: string, total: string) {
|
|
|
|
|
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
|
|
|
|
|
else return start + "-" + end + " ใน " + total;
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-26 12:11:19 +07:00
|
|
|
/**.value
|
2023-11-13 13:32:26 +07:00
|
|
|
* update ค่าที่ค้นหา
|
|
|
|
|
* @param value string
|
|
|
|
|
*/
|
|
|
|
|
function updateInput(value: any) {
|
2023-06-07 13:42:11 +07:00
|
|
|
emit("update:inputfilter", value);
|
2023-11-13 13:32:26 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** update ข้อมูลที่ เเสดง */
|
|
|
|
|
function updateVisible(value: any) {
|
2023-06-07 13:42:11 +07:00
|
|
|
emit("update:inputvisible", value);
|
2023-11-13 13:32:26 +07:00
|
|
|
}
|
2023-07-07 09:45:54 +07:00
|
|
|
|
2023-11-13 13:32:26 +07:00
|
|
|
/**
|
|
|
|
|
* แสดงสถานะบรรจุแล้ว
|
|
|
|
|
* @param value true/false
|
|
|
|
|
*/
|
|
|
|
|
function updateContain(value: any) {
|
2023-07-13 14:20:28 +07:00
|
|
|
emit("update:containfilter", value);
|
2024-12-26 12:11:19 +07:00
|
|
|
onUpdateNewRows();
|
2023-11-13 13:32:26 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** ส่งรายชื่อไปยังหน่วยงาน */
|
|
|
|
|
function updateModaladdlist() {
|
2023-07-20 17:57:05 +07:00
|
|
|
emit("update-modaladdlist", true);
|
2023-11-13 13:32:26 +07:00
|
|
|
}
|
2024-09-25 10:17:33 +07:00
|
|
|
|
|
|
|
|
/** ส่งรายชื่อไปยังหน่วยงาน */
|
|
|
|
|
function openModalOrder() {
|
|
|
|
|
emit("update-modaladdSendPerson", true);
|
|
|
|
|
}
|
2024-10-25 15:15:43 +07:00
|
|
|
|
|
|
|
|
/** ส่งรายชื่อไปยังหน่วยงาน */
|
|
|
|
|
function onUpdateNewRows() {
|
2024-12-26 12:11:19 +07:00
|
|
|
emit("update-newRows", bmaOfficer.value, positionCandidate.value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ฟังชั่นฟิลเตอร์ input
|
|
|
|
|
* @param val input
|
|
|
|
|
* @param update Function quasar
|
|
|
|
|
*/
|
|
|
|
|
function filterSelector(val: string, update: Function) {
|
|
|
|
|
update(() => {
|
|
|
|
|
positionCandidateOptions.value =
|
|
|
|
|
props?.positionCandidateData?.filter(
|
|
|
|
|
(v: optionData) => v.name.indexOf(val) > -1
|
|
|
|
|
) || [];
|
|
|
|
|
});
|
2024-10-25 15:15:43 +07:00
|
|
|
}
|
2023-06-07 13:42:11 +07:00
|
|
|
</script>
|
2023-08-29 11:28:58 +07:00
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div class="q-px-md q-pb-md">
|
|
|
|
|
<div class="col-12 row q-py-sm">
|
2024-12-26 12:11:19 +07:00
|
|
|
<div class="row q-col-gutter-sm">
|
|
|
|
|
<q-select
|
|
|
|
|
outlined
|
|
|
|
|
dense
|
|
|
|
|
v-model="bmaOfficer"
|
|
|
|
|
:options="bmaOfficerOption"
|
|
|
|
|
emit-value
|
|
|
|
|
map-options
|
|
|
|
|
option-value="id"
|
|
|
|
|
option-label="name"
|
|
|
|
|
label="สถานภาพ"
|
|
|
|
|
:clearable="bmaOfficer !== ''"
|
|
|
|
|
style="width: 200px"
|
|
|
|
|
@update:model-value="onUpdateNewRows"
|
|
|
|
|
@clear="bmaOfficer = ''"
|
|
|
|
|
>
|
|
|
|
|
</q-select>
|
|
|
|
|
|
|
|
|
|
<q-select
|
|
|
|
|
outlined
|
|
|
|
|
dense
|
|
|
|
|
v-model="positionCandidate"
|
|
|
|
|
:options="positionCandidateOptions"
|
|
|
|
|
emit-value
|
|
|
|
|
map-options
|
|
|
|
|
option-value="id"
|
|
|
|
|
option-label="name"
|
|
|
|
|
label="ตำแหน่งที่สอบ"
|
|
|
|
|
style="width: 250px"
|
|
|
|
|
hide-selected
|
|
|
|
|
fill-input
|
|
|
|
|
use-input
|
|
|
|
|
:clearable="positionCandidate !== ''"
|
|
|
|
|
@clear="
|
|
|
|
|
(positionCandidate = ''),
|
|
|
|
|
(positionCandidateOptions = positionCandidateData || []),
|
|
|
|
|
onUpdateNewRows()
|
|
|
|
|
"
|
|
|
|
|
@update:model-value="onUpdateNewRows"
|
|
|
|
|
@filter="(inputValue:string,
|
|
|
|
|
doneFn:Function) => filterSelector(inputValue, doneFn
|
|
|
|
|
) "
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:no-option>
|
|
|
|
|
<q-item>
|
|
|
|
|
<q-item-section class="text-grey"> ไม่มีข้อมูล </q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</template>
|
|
|
|
|
</q-select>
|
|
|
|
|
</div>
|
2023-08-29 11:28:58 +07:00
|
|
|
<div>
|
|
|
|
|
<q-btn
|
|
|
|
|
flat
|
|
|
|
|
round
|
2024-09-26 11:02:52 +07:00
|
|
|
color="blue"
|
2023-08-29 11:28:58 +07:00
|
|
|
icon="mdi-account-arrow-right"
|
|
|
|
|
@click="updateModaladdlist"
|
2024-08-02 16:13:24 +07:00
|
|
|
v-if="displayAdd && checkPermission($route)?.attrIsUpdate"
|
2023-09-21 11:00:05 +07:00
|
|
|
>
|
|
|
|
|
<q-tooltip>ส่งรายชื่อไปยังหน่วยงาน</q-tooltip>
|
|
|
|
|
</q-btn>
|
2023-08-29 11:28:58 +07:00
|
|
|
</div>
|
2024-10-28 18:03:25 +07:00
|
|
|
|
|
|
|
|
<q-btn
|
2025-05-29 14:17:39 +07:00
|
|
|
v-if="
|
|
|
|
|
checkPermission($route)?.attrIsUpdate &&
|
|
|
|
|
checkPermissionList(['COMMAND']) &&
|
|
|
|
|
checkPermissionCreate('COMMAND')
|
|
|
|
|
"
|
2024-10-28 18:03:25 +07:00
|
|
|
flat
|
|
|
|
|
round
|
2024-12-04 16:13:12 +07:00
|
|
|
color="primary"
|
2024-10-28 18:03:25 +07:00
|
|
|
icon="mdi-account-arrow-right"
|
|
|
|
|
@click="openModalOrder()"
|
|
|
|
|
>
|
|
|
|
|
<q-tooltip>ส่งไปออกคำสั่ง</q-tooltip>
|
|
|
|
|
</q-btn>
|
|
|
|
|
|
2023-08-29 11:28:58 +07:00
|
|
|
<q-space />
|
2024-09-25 10:17:33 +07:00
|
|
|
|
2023-08-29 11:28:58 +07:00
|
|
|
<div class="items-center" style="display: flex">
|
2024-09-25 10:17:33 +07:00
|
|
|
<q-toggle
|
|
|
|
|
class="col-xs-12 col-sm-5 col-md-5 toggle-expired-account"
|
|
|
|
|
:model-value="containStatus"
|
|
|
|
|
color="blue"
|
|
|
|
|
label="แสดงสถานะบรรจุแล้ว"
|
|
|
|
|
@update:model-value="updateContain"
|
|
|
|
|
/>
|
2023-08-29 11:28:58 +07:00
|
|
|
<q-input
|
|
|
|
|
standout
|
|
|
|
|
dense
|
|
|
|
|
:model-value="inputfilter"
|
|
|
|
|
ref="filterRef"
|
|
|
|
|
@update:model-value="updateInput"
|
|
|
|
|
outlined
|
|
|
|
|
placeholder="ค้นหา"
|
|
|
|
|
style="max-width: 200px"
|
|
|
|
|
class="q-ml-sm"
|
2025-05-23 11:47:17 +07:00
|
|
|
@keydown.enter.prevent="onUpdateNewRows"
|
2023-08-29 11:28:58 +07:00
|
|
|
>
|
2024-12-26 12:11:19 +07:00
|
|
|
<template v-slot:append> </template>
|
2023-08-29 11:28:58 +07:00
|
|
|
</q-input>
|
|
|
|
|
<!-- แสดง table ใน คอลัมน์ -->
|
|
|
|
|
<q-select
|
|
|
|
|
:model-value="inputvisible"
|
|
|
|
|
@update:model-value="updateVisible"
|
|
|
|
|
:display-value="$q.lang.table.columns"
|
|
|
|
|
multiple
|
|
|
|
|
outlined
|
|
|
|
|
dense
|
|
|
|
|
:options="attrs.columns"
|
|
|
|
|
options-dense
|
|
|
|
|
option-value="name"
|
|
|
|
|
map-options
|
|
|
|
|
emit-value
|
2024-11-05 16:33:46 +07:00
|
|
|
style="min-width: 140px"
|
2023-08-29 11:28:58 +07:00
|
|
|
class="gt-xs q-ml-sm"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<q-table
|
|
|
|
|
ref="table"
|
|
|
|
|
flat
|
|
|
|
|
bordered
|
|
|
|
|
class="custom-header-table"
|
|
|
|
|
v-bind="attrs"
|
|
|
|
|
virtual-scroll
|
|
|
|
|
:virtual-scroll-sticky-size-start="48"
|
|
|
|
|
dense
|
|
|
|
|
:pagination-label="paginationLabel"
|
|
|
|
|
v-model:pagination="pagination"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:pagination="scope">
|
2025-04-25 17:01:48 +07:00
|
|
|
ทั้งหมด {{ attrs.rows.length.toLocaleString() }} รายการ
|
2023-08-29 11:28:58 +07:00
|
|
|
<q-pagination
|
|
|
|
|
v-model="pagination.page"
|
|
|
|
|
active-color="primary"
|
|
|
|
|
color="dark"
|
|
|
|
|
:max="scope.pagesNumber"
|
|
|
|
|
:max-pages="5"
|
|
|
|
|
size="sm"
|
|
|
|
|
boundary-links
|
|
|
|
|
direction-links
|
|
|
|
|
></q-pagination>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:header="props">
|
|
|
|
|
<q-tr :props="props">
|
2024-07-24 16:37:04 +07:00
|
|
|
<q-th auto-width v-if="history == true" />
|
2023-08-29 11:28:58 +07:00
|
|
|
<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 #body="props">
|
|
|
|
|
<slot v-bind="props" name="columns"></slot>
|
|
|
|
|
</template>
|
|
|
|
|
</q-table>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
2023-06-07 13:42:11 +07:00
|
|
|
<style lang="scss">
|
|
|
|
|
.icon-color {
|
|
|
|
|
color: #4154b3;
|
|
|
|
|
}
|
2023-06-08 18:24:09 +07:00
|
|
|
|
2023-06-07 13:42:11 +07:00
|
|
|
.custom-header-table {
|
|
|
|
|
max-height: 64vh;
|
2023-06-08 18:24:09 +07:00
|
|
|
|
2023-06-07 13:42:11 +07:00
|
|
|
.q-table tr:nth-child(odd) td {
|
|
|
|
|
background: white;
|
|
|
|
|
}
|
2023-06-08 18:24:09 +07:00
|
|
|
|
2023-06-07 13:42:11 +07:00
|
|
|
.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;
|
|
|
|
|
}
|
2023-06-08 18:24:09 +07:00
|
|
|
|
2023-06-07 13:42:11 +07:00
|
|
|
/* this will be the loading indicator */
|
|
|
|
|
.q-table thead tr:last-child th {
|
|
|
|
|
/* height of all previous header rows */
|
|
|
|
|
top: 48px;
|
|
|
|
|
}
|
2023-06-08 18:24:09 +07:00
|
|
|
|
2023-06-07 13:42:11 +07:00
|
|
|
.q-table thead tr:first-child th {
|
|
|
|
|
top: 0;
|
2023-06-06 14:32:36 +07:00
|
|
|
}
|
2023-06-07 13:42:11 +07:00
|
|
|
}
|
|
|
|
|
</style>
|