2023-07-07 17:26:40 +07:00
|
|
|
<script setup lang="ts">
|
2024-02-22 16:51:16 +07:00
|
|
|
import { ref, useAttrs, onMounted, reactive, watch } from "vue";
|
2023-09-21 16:08:12 +07:00
|
|
|
import { useCounterMixin } from "@/stores/mixin";
|
|
|
|
|
import { useQuasar } from "quasar";
|
2023-09-28 14:22:25 +07:00
|
|
|
import { useTransferDataStore } from "@/modules/05_placement/store";
|
2023-07-07 17:26:40 +07:00
|
|
|
import type { QTableProps } from "quasar";
|
2023-09-28 14:22:25 +07:00
|
|
|
import type {
|
|
|
|
|
FormMainProbation,
|
|
|
|
|
FormMainProbation2,
|
|
|
|
|
mapData,
|
|
|
|
|
OpfillterType,
|
|
|
|
|
CriteriaType,
|
|
|
|
|
} from "@/modules/05_placement/interface/request/Main";
|
2023-09-21 16:08:12 +07:00
|
|
|
|
2023-07-07 17:26:40 +07:00
|
|
|
import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue";
|
2023-09-21 16:08:12 +07:00
|
|
|
import router from "@/router";
|
|
|
|
|
|
2023-08-03 10:12:01 +07:00
|
|
|
import http from "@/plugins/http";
|
|
|
|
|
import config from "@/app.config";
|
2023-07-07 17:26:40 +07:00
|
|
|
|
|
|
|
|
const $q = useQuasar(); //ใช้ noti quasar
|
2023-09-21 16:08:12 +07:00
|
|
|
const rows = ref<FormMainProbation[]>([]);
|
|
|
|
|
const rows2 = ref<FormMainProbation2[]>([]);
|
|
|
|
|
const modal = ref<boolean>(false);
|
|
|
|
|
const attrs = ref<any>(useAttrs());
|
|
|
|
|
const paging = ref<boolean>(true);
|
2023-09-28 14:22:25 +07:00
|
|
|
const fillter = ref<number | null>(0);
|
2023-09-21 16:08:12 +07:00
|
|
|
const paging2 = ref<boolean>(true);
|
2023-09-22 16:10:30 +07:00
|
|
|
const Opfillter = ref<OpfillterType[]>([{ id: 0, value: "ทั้งหมด" }]);
|
2023-09-21 16:08:12 +07:00
|
|
|
const filterRef = ref<any>(null);
|
|
|
|
|
const filterRef2 = ref<any>(null);
|
2023-09-22 16:10:30 +07:00
|
|
|
const dataUpdate = ref<FormMainProbation[]>([]);
|
2023-09-21 16:08:12 +07:00
|
|
|
const probationlist = ref<any>([]);
|
|
|
|
|
const filterKeyword = ref<string>("");
|
|
|
|
|
const fillterStatus = ref<any>([]);
|
|
|
|
|
const filterKeyword2 = ref<string>("");
|
2024-02-22 11:45:47 +07:00
|
|
|
const Opfillter2 = ref<OpfillterType[]>([{ id: 0, value: "ทั้งหมด" }]);
|
2023-09-28 14:22:25 +07:00
|
|
|
|
|
|
|
|
const storeFn = useTransferDataStore();
|
2023-08-03 10:12:01 +07:00
|
|
|
const mixin = useCounterMixin();
|
2023-09-28 14:22:25 +07:00
|
|
|
const { statusProbationMain } = storeFn;
|
2023-08-29 17:09:25 +07:00
|
|
|
const { messageError, success, showLoader, hideLoader, dialogConfirm } = mixin;
|
2023-09-21 16:08:12 +07:00
|
|
|
const pagination = ref({
|
|
|
|
|
sortBy: "desc",
|
|
|
|
|
descending: false,
|
|
|
|
|
page: 1,
|
|
|
|
|
rowsPerPage: 10,
|
|
|
|
|
});
|
|
|
|
|
const pagination2 = ref({
|
|
|
|
|
sortBy: "desc",
|
|
|
|
|
descending: false,
|
|
|
|
|
page: 1,
|
|
|
|
|
rowsPerPage: 10,
|
|
|
|
|
});
|
2023-11-13 17:55:39 +07:00
|
|
|
|
|
|
|
|
/** ข้อมูลที่เเสดง */
|
2023-07-07 17:26:40 +07:00
|
|
|
const visibleColumns = ref<string[]>([
|
|
|
|
|
"no",
|
|
|
|
|
"name",
|
2023-08-09 12:09:46 +07:00
|
|
|
"position_line",
|
|
|
|
|
"position_level",
|
|
|
|
|
"organization",
|
|
|
|
|
"probation_no",
|
|
|
|
|
"order_number",
|
|
|
|
|
"probation_status",
|
2023-08-30 13:04:45 +07:00
|
|
|
]);
|
2023-09-21 16:08:12 +07:00
|
|
|
|
2023-11-13 17:55:39 +07:00
|
|
|
/** หัวตาราง */
|
2023-07-07 17:26:40 +07:00
|
|
|
const columns = ref<QTableProps["columns"]>([
|
|
|
|
|
{
|
|
|
|
|
name: "no",
|
|
|
|
|
align: "left",
|
|
|
|
|
label: "ลำดับ",
|
2023-09-20 13:58:12 +07:00
|
|
|
sortable: false,
|
2023-07-07 17:26:40 +07:00
|
|
|
field: "no",
|
|
|
|
|
headerStyle: "font-size: 14px",
|
|
|
|
|
style: "font-size: 14px",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "name",
|
|
|
|
|
align: "left",
|
2024-01-10 17:15:15 +07:00
|
|
|
label: "ชื่อ-นามสกุล",
|
2023-07-07 17:26:40 +07:00
|
|
|
sortable: true,
|
|
|
|
|
field: "name",
|
|
|
|
|
headerStyle: "font-size: 14px",
|
|
|
|
|
style: "font-size: 14px",
|
|
|
|
|
},
|
2023-08-03 10:12:01 +07:00
|
|
|
{
|
2023-08-09 12:09:46 +07:00
|
|
|
name: "position_line",
|
2023-07-07 17:26:40 +07:00
|
|
|
align: "left",
|
|
|
|
|
label: "ตำแหน่งในสายงาน",
|
|
|
|
|
sortable: true,
|
2023-08-09 12:09:46 +07:00
|
|
|
field: "position_line",
|
2023-07-07 17:26:40 +07:00
|
|
|
headerStyle: "font-size: 14px",
|
|
|
|
|
style: "font-size: 14px",
|
|
|
|
|
},
|
2023-08-03 10:12:01 +07:00
|
|
|
{
|
2023-08-09 12:09:46 +07:00
|
|
|
name: "position_level",
|
2023-07-07 17:26:40 +07:00
|
|
|
align: "left",
|
|
|
|
|
label: "ระดับ",
|
|
|
|
|
sortable: true,
|
2023-08-09 12:09:46 +07:00
|
|
|
field: "position_level",
|
2023-07-07 17:26:40 +07:00
|
|
|
headerStyle: "font-size: 14px",
|
|
|
|
|
style: "font-size: 14px",
|
|
|
|
|
},
|
2023-08-03 10:12:01 +07:00
|
|
|
{
|
2023-08-09 12:09:46 +07:00
|
|
|
name: "organization",
|
2023-07-07 17:26:40 +07:00
|
|
|
align: "left",
|
|
|
|
|
label: "สังกัด",
|
|
|
|
|
sortable: true,
|
2023-08-09 12:09:46 +07:00
|
|
|
field: "organization",
|
2023-07-07 17:26:40 +07:00
|
|
|
headerStyle: "font-size: 14px",
|
2024-06-11 13:35:46 +07:00
|
|
|
style: "font-size: 14px ",
|
|
|
|
|
classes: "table_ellipsis",
|
2023-07-07 17:26:40 +07:00
|
|
|
},
|
2023-08-03 10:12:01 +07:00
|
|
|
{
|
2023-08-09 12:09:46 +07:00
|
|
|
name: "probation_no",
|
2023-07-07 17:26:40 +07:00
|
|
|
align: "center",
|
2023-09-04 11:39:44 +07:00
|
|
|
label: "ครั้งที่ทดลองปฏิบัติหน้าที่ราชการ",
|
2023-07-07 17:26:40 +07:00
|
|
|
sortable: true,
|
2023-08-09 12:09:46 +07:00
|
|
|
field: "probation_no",
|
2023-07-07 17:26:40 +07:00
|
|
|
headerStyle: "font-size: 14px",
|
|
|
|
|
style: "font-size: 14px",
|
|
|
|
|
},
|
2023-08-03 10:12:01 +07:00
|
|
|
{
|
2023-08-09 12:09:46 +07:00
|
|
|
name: "order_number",
|
2023-07-07 17:26:40 +07:00
|
|
|
align: "center",
|
|
|
|
|
label: "เลขที่คําสั่งบรรจุแต่งตั้ง",
|
|
|
|
|
sortable: true,
|
2023-08-09 12:09:46 +07:00
|
|
|
field: "order_number",
|
2023-07-07 17:26:40 +07:00
|
|
|
headerStyle: "font-size: 14px",
|
|
|
|
|
style: "font-size: 14px",
|
|
|
|
|
},
|
|
|
|
|
{
|
2023-08-09 12:09:46 +07:00
|
|
|
name: "probation_status",
|
2023-07-10 17:44:24 +07:00
|
|
|
align: "left",
|
2023-09-04 11:39:44 +07:00
|
|
|
label: "สถานะ",
|
2023-07-07 17:26:40 +07:00
|
|
|
sortable: true,
|
2023-08-09 12:09:46 +07:00
|
|
|
field: "probation_status",
|
2023-07-07 17:26:40 +07:00
|
|
|
headerStyle: "font-size: 14px",
|
|
|
|
|
style: "font-size: 14px",
|
2023-08-03 10:12:01 +07:00
|
|
|
},
|
2023-07-07 17:26:40 +07:00
|
|
|
]);
|
2023-09-21 16:08:12 +07:00
|
|
|
|
2023-11-13 17:55:39 +07:00
|
|
|
/** หัวตาราง2 */
|
2023-07-07 17:26:40 +07:00
|
|
|
const columns2 = ref<QTableProps["columns"]>([
|
|
|
|
|
{
|
|
|
|
|
name: "no",
|
|
|
|
|
align: "left",
|
|
|
|
|
label: "ลำดับ",
|
2023-09-20 13:58:12 +07:00
|
|
|
sortable: false,
|
2023-07-07 17:26:40 +07:00
|
|
|
field: "no",
|
|
|
|
|
headerStyle: "font-size: 14px",
|
2023-08-03 10:12:01 +07:00
|
|
|
style: "font-size: 14px",
|
2023-07-07 17:26:40 +07:00
|
|
|
},
|
|
|
|
|
{
|
2023-08-03 10:12:01 +07:00
|
|
|
name: "fullname",
|
2023-07-07 17:26:40 +07:00
|
|
|
align: "left",
|
2024-01-10 17:15:15 +07:00
|
|
|
label: "ชื่อ-นามสกุล",
|
2023-07-07 17:26:40 +07:00
|
|
|
sortable: true,
|
2023-08-03 10:12:01 +07:00
|
|
|
field: "fullname",
|
2023-07-07 17:26:40 +07:00
|
|
|
headerStyle: "font-size: 14px",
|
|
|
|
|
style: "font-size: 14px",
|
|
|
|
|
},
|
2023-08-03 10:12:01 +07:00
|
|
|
{
|
2023-07-07 17:26:40 +07:00
|
|
|
name: "position",
|
|
|
|
|
align: "left",
|
|
|
|
|
label: "ตำแหน่งในสายงาน",
|
|
|
|
|
sortable: true,
|
|
|
|
|
field: "position",
|
|
|
|
|
headerStyle: "font-size: 14px",
|
|
|
|
|
style: "font-size: 14px",
|
|
|
|
|
},
|
2023-08-03 10:12:01 +07:00
|
|
|
{
|
2024-02-22 16:51:16 +07:00
|
|
|
name: "posLevelName",
|
2023-07-07 17:26:40 +07:00
|
|
|
align: "left",
|
2024-06-07 12:10:11 +07:00
|
|
|
label: "ประเภทตำแหน่ง",
|
2023-07-07 17:26:40 +07:00
|
|
|
sortable: true,
|
2024-02-22 16:51:16 +07:00
|
|
|
field: "posLevelName",
|
2023-07-07 17:26:40 +07:00
|
|
|
headerStyle: "font-size: 14px",
|
|
|
|
|
style: "font-size: 14px",
|
2024-06-07 12:10:11 +07:00
|
|
|
format(val, row) {
|
2024-06-11 13:35:46 +07:00
|
|
|
return (
|
|
|
|
|
(row.posTypeName ? row.posTypeName : "") +
|
|
|
|
|
(row.posLevelName !== null ? " (" + row.posLevelName + ")" : "")
|
|
|
|
|
);
|
2024-06-07 12:10:11 +07:00
|
|
|
},
|
2023-07-07 17:26:40 +07:00
|
|
|
},
|
2023-08-03 10:12:01 +07:00
|
|
|
{
|
|
|
|
|
name: "organizationOrganization",
|
2023-07-07 17:26:40 +07:00
|
|
|
align: "left",
|
|
|
|
|
label: "สังกัด",
|
|
|
|
|
sortable: true,
|
2023-08-03 10:12:01 +07:00
|
|
|
field: "organizationOrganization",
|
2023-07-07 17:26:40 +07:00
|
|
|
headerStyle: "font-size: 14px",
|
|
|
|
|
style: "font-size: 14px",
|
2023-08-03 10:12:01 +07:00
|
|
|
},
|
2023-08-30 13:04:45 +07:00
|
|
|
{
|
|
|
|
|
name: "status",
|
|
|
|
|
align: "left",
|
2023-09-08 13:20:57 +07:00
|
|
|
label: "ทดลองปฏิบัติหน้าที่ราชการ",
|
2023-08-30 13:04:45 +07:00
|
|
|
sortable: true,
|
|
|
|
|
field: "status",
|
|
|
|
|
headerStyle: "font-size: 14px",
|
|
|
|
|
style: "font-size: 14px",
|
|
|
|
|
},
|
2023-07-07 17:26:40 +07:00
|
|
|
]);
|
|
|
|
|
|
2023-11-13 17:55:39 +07:00
|
|
|
/** ฟังชั่น ฟิลเตอร์ หา status */
|
|
|
|
|
function ProbationMainFilter() {
|
2023-09-11 13:27:49 +07:00
|
|
|
const useStatus = new Set();
|
|
|
|
|
fillterStatus.value.forEach((item: any) => {
|
|
|
|
|
const ID = item.probation_status;
|
|
|
|
|
const title = statusProbationMain(Number(item.probation_status));
|
|
|
|
|
if (ID !== null && !useStatus.has(ID)) {
|
|
|
|
|
Opfillter.value.push({
|
|
|
|
|
id: ID,
|
|
|
|
|
value: title,
|
|
|
|
|
});
|
|
|
|
|
useStatus.add(ID);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
Opfillter.value.sort((a: any, b: any) => a.id - b.id);
|
2023-09-28 14:22:25 +07:00
|
|
|
Opfillter2.value = Opfillter.value;
|
2023-11-13 17:55:39 +07:00
|
|
|
}
|
2023-09-21 16:08:12 +07:00
|
|
|
|
2023-11-13 17:55:39 +07:00
|
|
|
/**
|
2024-02-22 16:51:16 +07:00
|
|
|
* อัพเดท rows ตาม status
|
2023-11-13 17:55:39 +07:00
|
|
|
* @param body {id:? , value: ?}
|
|
|
|
|
*/
|
|
|
|
|
function updateRows(body: any) {
|
2023-09-11 13:27:49 +07:00
|
|
|
if (body.value !== "ทั้งหมด") {
|
|
|
|
|
const filteredRows = dataUpdate.value.filter(
|
2023-09-22 16:10:30 +07:00
|
|
|
(item: FormMainProbation) => item.probation_status === body.value
|
2023-09-11 13:27:49 +07:00
|
|
|
);
|
|
|
|
|
rows.value = filteredRows;
|
|
|
|
|
} else {
|
|
|
|
|
rows.value = dataUpdate.value;
|
|
|
|
|
}
|
2023-11-13 17:55:39 +07:00
|
|
|
}
|
2023-08-03 10:12:01 +07:00
|
|
|
|
2023-11-13 17:55:39 +07:00
|
|
|
/** get ข้อมูล */
|
|
|
|
|
async function getpersonalList() {
|
2023-08-03 10:12:01 +07:00
|
|
|
showLoader();
|
|
|
|
|
await http
|
2023-08-09 16:38:17 +07:00
|
|
|
.get(config.API.probationPersonalList())
|
2023-08-03 10:12:01 +07:00
|
|
|
.then((res) => {
|
2023-08-09 12:09:46 +07:00
|
|
|
const data = res.data.data;
|
2023-09-11 13:27:49 +07:00
|
|
|
fillterStatus.value = data;
|
2023-08-09 12:09:46 +07:00
|
|
|
rows.value = data.map((item: FormMainProbation) => ({
|
|
|
|
|
personal_id: item.personal_id,
|
|
|
|
|
name: item.name,
|
|
|
|
|
position_line: item.position_line,
|
|
|
|
|
position_line_id: item.position_line_id,
|
|
|
|
|
position_level: item.position_level,
|
|
|
|
|
position_level_id: item.position_level_id,
|
2024-06-11 13:35:46 +07:00
|
|
|
organization: item.organization !== "" ? item.organization : "-",
|
2023-08-09 12:09:46 +07:00
|
|
|
probation_no: item.probation_no,
|
2023-09-11 15:04:40 +07:00
|
|
|
order_number: item.order_number != "xx/2566" ? item.order_number : "-",
|
2023-08-30 23:19:27 +07:00
|
|
|
probation_status: statusProbationMain(Number(item.probation_status)),
|
2023-08-09 12:09:46 +07:00
|
|
|
}));
|
2023-09-11 13:27:49 +07:00
|
|
|
dataUpdate.value = rows.value;
|
|
|
|
|
ProbationMainFilter();
|
2023-08-03 10:12:01 +07:00
|
|
|
})
|
2023-09-28 14:22:25 +07:00
|
|
|
.catch(() => {})
|
2023-08-03 10:12:01 +07:00
|
|
|
.finally(() => {
|
|
|
|
|
hideLoader();
|
|
|
|
|
});
|
2023-11-13 17:55:39 +07:00
|
|
|
}
|
|
|
|
|
|
2024-02-22 16:51:16 +07:00
|
|
|
const formProbation = reactive({ keyword: "", pageSize: 10, page: 1 });
|
|
|
|
|
const maxPage = ref<number>(1);
|
|
|
|
|
|
|
|
|
|
async function onclickAddProbation() {
|
|
|
|
|
modal.value = true;
|
|
|
|
|
modal.value && showLoader();
|
|
|
|
|
await http
|
|
|
|
|
.post(config.API.orgProfileProbation, formProbation)
|
|
|
|
|
.then((res) => {
|
|
|
|
|
maxPage.value = Math.ceil(res.data.result.total / formProbation.pageSize);
|
|
|
|
|
rows2.value = res.data.result.data;
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
messageError($q, err);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
hideLoader();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
watch([() => formProbation.page, () => formProbation.pageSize], () => {
|
|
|
|
|
onclickAddProbation();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* function updatePagination
|
|
|
|
|
* @param newPagination ข้อมูล Pagination ใหม่
|
|
|
|
|
*/
|
|
|
|
|
function updatePagination(newPagination: any) {
|
|
|
|
|
formProbation.page = 1;
|
|
|
|
|
formProbation.pageSize = newPagination.rowsPerPage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function filterKeyword2Fn(page: number) {
|
|
|
|
|
page !== 1 ? (formProbation.page = 1) : await onclickAddProbation();
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-13 17:55:39 +07:00
|
|
|
/** fecth profile */
|
2024-06-07 12:10:11 +07:00
|
|
|
// async function fecthlistPersonal() {
|
|
|
|
|
// showLoader();
|
|
|
|
|
// await http
|
|
|
|
|
// .get(config.API.profileOrganizRoot)
|
|
|
|
|
// .then((res) => {
|
|
|
|
|
// const id = res.data.result[0].id;
|
|
|
|
|
// if (id !== "") {
|
|
|
|
|
// findlist(id);
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// .catch((e) => {
|
|
|
|
|
// messageError($q, e);
|
|
|
|
|
// })
|
|
|
|
|
// .finally(() => {});
|
|
|
|
|
// }
|
2023-11-13 17:55:39 +07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ส่งข้อมูลเพื่อ รับ res
|
|
|
|
|
* @param id string
|
|
|
|
|
* @param data type
|
|
|
|
|
*/
|
|
|
|
|
async function fecthlistProbation(id: string, data: any) {
|
2023-08-30 13:04:45 +07:00
|
|
|
try {
|
|
|
|
|
probationlist.value = [];
|
|
|
|
|
const res = await http.post(
|
|
|
|
|
config.API.profileSearchNewOcIdType(id, "officer"),
|
|
|
|
|
{
|
|
|
|
|
criterias: data,
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
return res.data.result;
|
|
|
|
|
} catch (err) {
|
|
|
|
|
messageError($q, err);
|
|
|
|
|
} finally {
|
|
|
|
|
hideLoader();
|
|
|
|
|
}
|
2023-11-13 17:55:39 +07:00
|
|
|
}
|
2023-09-11 13:27:49 +07:00
|
|
|
|
2023-11-13 17:55:39 +07:00
|
|
|
/**
|
|
|
|
|
* ค้นหาข้อมูลตามไอดี
|
|
|
|
|
* @param id string
|
|
|
|
|
*/
|
2024-06-07 12:10:11 +07:00
|
|
|
// async function findlist(id: string) {
|
|
|
|
|
// let data: CriteriaType[] = [
|
|
|
|
|
// { criteriaType: "is_retire", criteriaValue: "false" },
|
|
|
|
|
// { criteriaType: "is_probation", criteriaValue: "true" },
|
|
|
|
|
// ];
|
|
|
|
|
// let data2: CriteriaType[] = [
|
|
|
|
|
// { criteriaType: "is_retire", criteriaValue: "false" },
|
|
|
|
|
// { criteriaType: "is_probation", criteriaValue: "false" },
|
|
|
|
|
// ];
|
|
|
|
|
// let response1 = await fecthlistProbation(id, data);
|
|
|
|
|
// let response2 = await fecthlistProbation(id, data2);
|
2023-08-03 10:12:01 +07:00
|
|
|
|
2024-06-07 12:10:11 +07:00
|
|
|
// response1.forEach((e: any) =>
|
|
|
|
|
// probationlist.value.push({ ...e, probation: true })
|
|
|
|
|
// );
|
|
|
|
|
// response2.forEach((e: any) =>
|
|
|
|
|
// probationlist.value.push({ ...e, probation: false })
|
|
|
|
|
// );
|
|
|
|
|
// rows2.value = probationlist.value.map((e: mapData) => ({
|
|
|
|
|
// id: e.id,
|
|
|
|
|
// fullname: e.fullname,
|
|
|
|
|
// position: e.position,
|
|
|
|
|
// level: e.positionEmployeeLevel,
|
|
|
|
|
// organizationOrganization: e.oc,
|
|
|
|
|
// status: e.probation,
|
|
|
|
|
// }));
|
|
|
|
|
// modal.value = true;
|
|
|
|
|
// }
|
2023-11-13 17:55:39 +07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* เพิ่มข้อมูล ผู้ทดลองปฏิบัติหน้าที่ราชการ
|
2024-02-22 16:51:16 +07:00
|
|
|
* @param id personal id
|
2023-11-13 17:55:39 +07:00
|
|
|
*/
|
2024-02-22 16:51:16 +07:00
|
|
|
function clickAdd(data: any) {
|
2023-08-29 17:09:25 +07:00
|
|
|
dialogConfirm(
|
|
|
|
|
$q,
|
|
|
|
|
async () => {
|
2023-08-11 10:44:03 +07:00
|
|
|
showLoader();
|
2024-06-11 13:35:46 +07:00
|
|
|
|
2023-08-11 10:44:03 +07:00
|
|
|
await http
|
2024-02-22 16:51:16 +07:00
|
|
|
.post(config.API.personalAdd(), data)
|
2023-08-29 17:09:25 +07:00
|
|
|
.then(() => {
|
2023-08-11 10:44:03 +07:00
|
|
|
getpersonalList();
|
2023-08-29 17:09:25 +07:00
|
|
|
success($q, "เพิ่มข้อมูลสำเร็จ");
|
2023-08-11 10:44:03 +07:00
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
clickClose();
|
|
|
|
|
hideLoader();
|
|
|
|
|
});
|
2023-08-29 17:09:25 +07:00
|
|
|
},
|
|
|
|
|
"ยันยันการเพิ่มข้อมูล",
|
|
|
|
|
"ต้องการเพิ่มข้อมูลนี้หรือไม่ ?"
|
|
|
|
|
);
|
2023-11-13 17:55:39 +07:00
|
|
|
}
|
|
|
|
|
/** ปิด dialog */
|
|
|
|
|
async function clickClose() {
|
2023-07-07 17:26:40 +07:00
|
|
|
modal.value = false;
|
2023-11-13 17:55:39 +07:00
|
|
|
}
|
2023-07-07 17:26:40 +07:00
|
|
|
|
2023-11-13 17:55:39 +07:00
|
|
|
/** reset ฟิลเตอร์ */
|
|
|
|
|
function resetFilter() {
|
2023-07-07 17:26:40 +07:00
|
|
|
filterKeyword.value = "";
|
|
|
|
|
filterRef.value.focus();
|
2023-11-13 17:55:39 +07:00
|
|
|
}
|
2023-07-07 17:26:40 +07:00
|
|
|
|
2023-11-13 17:55:39 +07:00
|
|
|
/** reset ฟิลเตอร์ ใน dialog */
|
|
|
|
|
function resetFilter2() {
|
2023-07-07 17:26:40 +07:00
|
|
|
filterKeyword2.value = "";
|
|
|
|
|
filterRef2.value.focus();
|
2023-11-13 17:55:39 +07:00
|
|
|
}
|
2023-07-07 17:26:40 +07:00
|
|
|
|
2023-11-13 17:55:39 +07:00
|
|
|
function paginationLabel(start: string, end: string, total: string) {
|
2023-07-07 17:26:40 +07:00
|
|
|
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
|
|
|
|
|
else return start + "-" + end + " ใน " + total;
|
2023-11-13 17:55:39 +07:00
|
|
|
}
|
2023-09-21 16:08:12 +07:00
|
|
|
|
2023-11-13 17:55:39 +07:00
|
|
|
function paginationLabel2(start: string, end: string, total: string) {
|
2023-08-30 13:04:45 +07:00
|
|
|
if (paging2.value == true) return " " + start + "-" + end + " ใน " + total;
|
|
|
|
|
else return start + "-" + end + " ใน " + total;
|
2023-11-13 17:55:39 +07:00
|
|
|
}
|
2023-09-28 14:22:25 +07:00
|
|
|
|
2023-11-13 17:55:39 +07:00
|
|
|
/**
|
|
|
|
|
* ค้นหาตาม text
|
|
|
|
|
* @param val ค่าที่ค้นหา
|
|
|
|
|
* @param update fn
|
|
|
|
|
*/
|
2023-09-28 14:22:25 +07:00
|
|
|
function filterFn(val: string, update: any) {
|
|
|
|
|
if (val == "") {
|
|
|
|
|
update(() => {
|
|
|
|
|
Opfillter2.value = Opfillter.value;
|
|
|
|
|
fillter.value = null;
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
update(() => {
|
|
|
|
|
Opfillter2.value = Opfillter.value.filter(
|
|
|
|
|
(e: any) => e.value.search(val) !== -1
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-11-13 17:55:39 +07:00
|
|
|
|
|
|
|
|
/** get ค่า เมื่อโหลดหน้า */
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
getpersonalList();
|
|
|
|
|
});
|
2023-07-07 17:26:40 +07:00
|
|
|
</script>
|
|
|
|
|
|
2023-08-29 11:28:58 +07:00
|
|
|
<template>
|
|
|
|
|
<div class="toptitle text-dark col-12 row items-center">
|
|
|
|
|
รายการผู้ทดลองปฏิบัติหน้าที่ราชการ
|
|
|
|
|
</div>
|
|
|
|
|
<q-card flat bordered class="col-12 q-mt-sm q-pa-md">
|
|
|
|
|
<div class="row q-col-gutter-sm">
|
|
|
|
|
<div class="row col-12 q-col-gutter-sm">
|
2023-09-11 13:27:49 +07:00
|
|
|
<div class="col-6">
|
|
|
|
|
<div class="row">
|
2023-09-28 14:22:25 +07:00
|
|
|
<q-select
|
2023-09-29 10:27:24 +07:00
|
|
|
class="col-5 col-sm-3 col-md-8"
|
2023-09-28 14:22:25 +07:00
|
|
|
v-model="fillter"
|
|
|
|
|
label="สถานะ"
|
|
|
|
|
dense
|
|
|
|
|
map-options
|
|
|
|
|
option-label="value"
|
|
|
|
|
:options="Opfillter2"
|
|
|
|
|
option-value="id"
|
|
|
|
|
lazy-rules
|
|
|
|
|
hide-bottom-space
|
|
|
|
|
:readonly="false"
|
|
|
|
|
:borderless="false"
|
|
|
|
|
:outlined="true"
|
|
|
|
|
:hide-dropdown-icon="false"
|
|
|
|
|
@update:model-value="updateRows(fillter)"
|
|
|
|
|
@filter="filterFn"
|
|
|
|
|
use-input
|
|
|
|
|
behavior="menu"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:no-option>
|
|
|
|
|
<q-item>
|
|
|
|
|
<q-item-section class="text-grey">
|
|
|
|
|
ไม่มีข้อมูล
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</template>
|
|
|
|
|
</q-select>
|
2023-11-13 17:55:39 +07:00
|
|
|
|
2023-09-13 17:45:54 +07:00
|
|
|
<div>
|
2023-09-28 14:22:25 +07:00
|
|
|
<q-btn
|
2024-02-22 16:51:16 +07:00
|
|
|
@click="onclickAddProbation"
|
2023-09-28 14:22:25 +07:00
|
|
|
size="12px"
|
|
|
|
|
flat
|
|
|
|
|
round
|
|
|
|
|
color="add"
|
|
|
|
|
icon="mdi-plus"
|
|
|
|
|
>
|
2023-09-13 17:45:54 +07:00
|
|
|
<q-tooltip>เพิ่มผู้ทดลองปฏิบัติหน้าที่ราชการ</q-tooltip>
|
|
|
|
|
</q-btn>
|
|
|
|
|
</div>
|
2023-09-11 13:27:49 +07:00
|
|
|
</div>
|
2023-08-29 11:28:58 +07:00
|
|
|
</div>
|
|
|
|
|
<q-space />
|
2024-02-22 16:51:16 +07:00
|
|
|
|
2023-09-28 14:22:25 +07:00
|
|
|
<q-input
|
|
|
|
|
class="col-xs-12 col-sm-3 col-md-2"
|
|
|
|
|
standout
|
|
|
|
|
dense
|
|
|
|
|
v-model="filterKeyword"
|
|
|
|
|
ref="filterRef"
|
|
|
|
|
outlined
|
|
|
|
|
debounce="300"
|
|
|
|
|
placeholder="ค้นหา"
|
|
|
|
|
>
|
2023-08-29 11:28:58 +07:00
|
|
|
<template v-slot:append>
|
|
|
|
|
<q-icon v-if="filterKeyword == ''" name="search" />
|
2023-09-28 14:22:25 +07:00
|
|
|
<q-icon
|
|
|
|
|
v-if="filterKeyword !== ''"
|
|
|
|
|
name="clear"
|
|
|
|
|
class="cursor-pointer"
|
|
|
|
|
@click="resetFilter"
|
|
|
|
|
/>
|
2023-08-29 11:28:58 +07:00
|
|
|
</template>
|
|
|
|
|
</q-input>
|
|
|
|
|
|
2023-09-28 14:22:25 +07:00
|
|
|
<q-select
|
|
|
|
|
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="col-xs-12 col-sm-3 col-md-2"
|
|
|
|
|
/>
|
2023-08-29 11:28:58 +07:00
|
|
|
</div>
|
|
|
|
|
<div class="col-12">
|
2023-10-18 17:39:08 +07:00
|
|
|
<d-table
|
2023-09-28 14:22:25 +07:00
|
|
|
ref="table"
|
|
|
|
|
:columns="columns"
|
|
|
|
|
:rows="rows"
|
|
|
|
|
:filter="filterKeyword"
|
|
|
|
|
row-key="Order"
|
|
|
|
|
flat
|
|
|
|
|
bordered
|
|
|
|
|
:paging="true"
|
|
|
|
|
dense
|
|
|
|
|
class="custom-header-table"
|
|
|
|
|
v-bind="attrs"
|
|
|
|
|
:visible-columns="visibleColumns"
|
|
|
|
|
:pagination-label="paginationLabel"
|
|
|
|
|
v-model:pagination="pagination"
|
|
|
|
|
>
|
2023-08-29 11:28:58 +07:00
|
|
|
<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">
|
2023-09-28 14:22:25 +07:00
|
|
|
<q-tr
|
|
|
|
|
:props="props"
|
|
|
|
|
class="cursor-pointer"
|
|
|
|
|
@click="router.push(`/probation/detail/${props.row.personal_id}`)"
|
|
|
|
|
>
|
2023-08-29 11:28:58 +07:00
|
|
|
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
|
|
|
|
<div v-if="col.name == 'no'">
|
|
|
|
|
{{ props.rowIndex + 1 }}
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else>
|
2024-06-11 13:35:46 +07:00
|
|
|
{{ col.value ?? "-" }}
|
2023-08-29 11:28:58 +07:00
|
|
|
</div>
|
|
|
|
|
</q-td>
|
|
|
|
|
</q-tr>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:pagination="scope">
|
2023-09-28 14:22:25 +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>
|
2023-08-29 11:28:58 +07:00
|
|
|
</template>
|
2023-10-18 17:39:08 +07:00
|
|
|
</d-table>
|
2023-08-29 11:28:58 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-card>
|
|
|
|
|
|
|
|
|
|
<q-dialog v-model="modal" persistent>
|
|
|
|
|
<q-card style="width: 900px; max-width: 80vw">
|
|
|
|
|
<q-form ref="myForm">
|
2023-09-28 14:22:25 +07:00
|
|
|
<DialogHeader
|
|
|
|
|
tittle="เพิ่มผู้ทดลองปฏิบัติหน้าที่ราชการ "
|
|
|
|
|
:close="clickClose"
|
|
|
|
|
/>
|
2023-08-29 11:28:58 +07:00
|
|
|
<q-separator />
|
|
|
|
|
<q-card-section class="q-pa-md q-col-gutter-sm">
|
2023-09-28 14:22:25 +07:00
|
|
|
<q-input
|
|
|
|
|
class="col-12"
|
|
|
|
|
standout
|
|
|
|
|
dense
|
2024-02-22 16:51:16 +07:00
|
|
|
v-model="formProbation.keyword"
|
2023-09-28 14:22:25 +07:00
|
|
|
ref="filterRef2"
|
|
|
|
|
outlined
|
|
|
|
|
debounce="300"
|
|
|
|
|
placeholder="ค้นหา"
|
2024-02-22 16:51:16 +07:00
|
|
|
@keydown.enter.prevent="filterKeyword2Fn(formProbation.page)"
|
2023-09-28 14:22:25 +07:00
|
|
|
>
|
2023-08-29 11:28:58 +07:00
|
|
|
<template v-slot:append>
|
|
|
|
|
<q-icon v-if="filterKeyword2 == ''" name="search" />
|
2023-09-28 14:22:25 +07:00
|
|
|
<q-icon
|
|
|
|
|
v-if="filterKeyword2 !== ''"
|
|
|
|
|
name="clear"
|
|
|
|
|
class="cursor-pointer"
|
|
|
|
|
@click="resetFilter2"
|
|
|
|
|
/>
|
2023-08-29 11:28:58 +07:00
|
|
|
</template>
|
|
|
|
|
</q-input>
|
|
|
|
|
<div class="col-12">
|
2023-10-18 17:39:08 +07:00
|
|
|
<d-table
|
2023-09-28 14:22:25 +07:00
|
|
|
ref="table2"
|
|
|
|
|
:columns="columns2"
|
|
|
|
|
:rows="rows2"
|
|
|
|
|
row-key="Order"
|
|
|
|
|
flat
|
|
|
|
|
bordered
|
|
|
|
|
:paging="true"
|
|
|
|
|
dense
|
|
|
|
|
class="custom-header-table"
|
|
|
|
|
v-bind="attrs"
|
|
|
|
|
:pagination-label="paginationLabel2"
|
|
|
|
|
v-model:pagination="pagination2"
|
2024-02-22 16:51:16 +07:00
|
|
|
@update:pagination="updatePagination"
|
|
|
|
|
:rows-per-page-options="[10, 25, 50, 100]"
|
2023-09-28 14:22:25 +07:00
|
|
|
>
|
2023-08-29 11:28:58 +07:00
|
|
|
<template v-slot:header="props">
|
|
|
|
|
<q-tr :props="props">
|
2023-09-28 14:22:25 +07:00
|
|
|
<q-th
|
|
|
|
|
v-for="col in props.cols"
|
|
|
|
|
:key="col.name"
|
|
|
|
|
:props="props"
|
|
|
|
|
>
|
2023-08-29 11:28:58 +07:00
|
|
|
<span class="text-weight-medium">{{ col.label }}</span>
|
|
|
|
|
</q-th>
|
|
|
|
|
<q-th auto-width />
|
|
|
|
|
</q-tr>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:body="props">
|
|
|
|
|
<q-tr :props="props" class="cursor-pointer">
|
2023-09-28 14:22:25 +07:00
|
|
|
<q-td
|
|
|
|
|
v-for="col in props.cols"
|
|
|
|
|
:key="col.name"
|
|
|
|
|
:props="props"
|
|
|
|
|
>
|
2023-08-29 11:28:58 +07:00
|
|
|
<div v-if="col.name == 'no'">
|
2024-02-22 16:51:16 +07:00
|
|
|
{{
|
|
|
|
|
(formProbation.page - 1) * formProbation.pageSize +
|
|
|
|
|
props.rowIndex +
|
|
|
|
|
1
|
|
|
|
|
}}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div v-else-if="col.name == 'fullname'">
|
|
|
|
|
{{
|
2024-06-11 13:35:46 +07:00
|
|
|
(props.row.prefix ? props.row.prefix : "") +
|
2024-02-22 16:51:16 +07:00
|
|
|
props.row.firstName +
|
|
|
|
|
" " +
|
|
|
|
|
props.row.lastName
|
|
|
|
|
}}
|
2023-08-29 11:28:58 +07:00
|
|
|
</div>
|
2023-09-08 13:20:57 +07:00
|
|
|
<div v-else-if="col.name == 'status'" class="text-center">
|
2023-09-28 14:22:25 +07:00
|
|
|
<q-icon
|
2024-02-22 16:51:16 +07:00
|
|
|
v-if="props.row.isProbation === true"
|
2023-09-28 14:22:25 +07:00
|
|
|
name="mdi-check"
|
|
|
|
|
color="positive"
|
|
|
|
|
size="sm"
|
|
|
|
|
/>
|
2023-09-01 15:18:01 +07:00
|
|
|
</div>
|
2024-02-22 16:51:16 +07:00
|
|
|
<div
|
|
|
|
|
v-else-if="col.name == 'organizationOrganization'"
|
|
|
|
|
class="table_ellipsis"
|
|
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
v-if="
|
|
|
|
|
props.row.orgChild4Name === null &&
|
|
|
|
|
props.row.orgChild3Name === null &&
|
|
|
|
|
props.row.orgChild2Name === null &&
|
|
|
|
|
props.row.orgChild1Name === null &&
|
|
|
|
|
props.row.orgRootName === null
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
-
|
|
|
|
|
</div>
|
|
|
|
|
{{
|
|
|
|
|
`${
|
|
|
|
|
props.row.orgChild4Name
|
|
|
|
|
? props.row.orgChild4Name + "/"
|
|
|
|
|
: ""
|
|
|
|
|
}${
|
|
|
|
|
props.row.orgChild3Name
|
|
|
|
|
? props.row.orgChild3Name + "/"
|
|
|
|
|
: ""
|
|
|
|
|
}${
|
|
|
|
|
props.row.orgChild2Name
|
|
|
|
|
? props.row.orgChild2Name + "-"
|
|
|
|
|
: ""
|
|
|
|
|
}${
|
|
|
|
|
props.row.orgChild1Name
|
|
|
|
|
? props.row.orgChild1Name + "/"
|
|
|
|
|
: ""
|
|
|
|
|
}${props.row.orgRootName ? props.row.orgRootName : ""}`
|
|
|
|
|
}}
|
|
|
|
|
</div>
|
2023-08-29 11:28:58 +07:00
|
|
|
<div v-else>
|
2024-02-22 16:51:16 +07:00
|
|
|
{{ col.value ? col.value : "-" }}
|
2023-08-29 11:28:58 +07:00
|
|
|
</div>
|
|
|
|
|
</q-td>
|
|
|
|
|
<q-td auto-width>
|
2023-09-28 14:22:25 +07:00
|
|
|
<q-btn
|
|
|
|
|
dense
|
|
|
|
|
class="q-px-md"
|
|
|
|
|
outline
|
|
|
|
|
color="primary"
|
|
|
|
|
label="เพิ่ม"
|
2024-02-22 16:51:16 +07:00
|
|
|
@click="clickAdd(props.row)"
|
2023-09-28 14:22:25 +07:00
|
|
|
>
|
2023-08-29 11:28:58 +07:00
|
|
|
</q-btn>
|
|
|
|
|
</q-td>
|
|
|
|
|
</q-tr>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:pagination="scope">
|
2023-09-28 14:22:25 +07:00
|
|
|
<q-pagination
|
2024-02-22 16:51:16 +07:00
|
|
|
v-model="formProbation.page"
|
2023-09-28 14:22:25 +07:00
|
|
|
active-color="primary"
|
|
|
|
|
color="dark"
|
2024-02-22 16:51:16 +07:00
|
|
|
:max="maxPage"
|
2023-09-28 14:22:25 +07:00
|
|
|
size="sm"
|
|
|
|
|
boundary-links
|
|
|
|
|
direction-links
|
2024-02-22 17:27:05 +07:00
|
|
|
:max-pages="5"
|
2023-09-28 14:22:25 +07:00
|
|
|
></q-pagination>
|
2023-08-29 11:28:58 +07:00
|
|
|
</template>
|
2023-10-18 17:39:08 +07:00
|
|
|
</d-table>
|
2023-08-29 11:28:58 +07:00
|
|
|
</div>
|
|
|
|
|
</q-card-section>
|
|
|
|
|
</q-form>
|
|
|
|
|
</q-card>
|
|
|
|
|
</q-dialog>
|
2023-11-13 17:55:39 +07:00
|
|
|
</template>
|