Refactor Code การทดลองปฏิบัติหน้าที่ราชการ
This commit is contained in:
parent
01f23e51f8
commit
a8f24024bf
14 changed files with 898 additions and 1269 deletions
|
|
@ -1,21 +1,51 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, useAttrs, onMounted, watch } from "vue";
|
||||
import { ref, useAttrs, onMounted } from "vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useTransferDataStore } from "@/modules/05_placement/store"
|
||||
import type { QTableProps } from "quasar";
|
||||
import type {
|
||||
FormMainProbation,
|
||||
FormMainProbation2,
|
||||
} from "@/modules/05_placement/interface/request/Main";
|
||||
import type { FormMainProbation, FormMainProbation2 } from "@/modules/05_placement/interface/request/Main";
|
||||
|
||||
import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue";
|
||||
import router from "@/router";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import router from "@/router";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
const $q = useQuasar(); //ใช้ noti quasar
|
||||
const rows = ref<FormMainProbation[]>([]);
|
||||
const rows2 = ref<FormMainProbation2[]>([]);
|
||||
const modal = ref<boolean>(false);
|
||||
const attrs = ref<any>(useAttrs());
|
||||
const paging = ref<boolean>(true);
|
||||
const fillter = ref<number>(0);
|
||||
const paging2 = ref<boolean>(true);
|
||||
const Opfillter = ref<any>([{ id: 0, value: "ทั้งหมด" }]);
|
||||
const filterRef = ref<any>(null);
|
||||
const filterRef2 = ref<any>(null);
|
||||
const dataUpdate = ref<any>([]);
|
||||
const probationlist = ref<any>([]);
|
||||
const filterKeyword = ref<string>("");
|
||||
const fillterStatus = ref<any>([]);
|
||||
const filterKeyword2 = ref<string>("");
|
||||
|
||||
const storeFn = useTransferDataStore()
|
||||
const mixin = useCounterMixin();
|
||||
const { statusProbationMain } = storeFn
|
||||
const { messageError, success, showLoader, hideLoader, dialogConfirm } = mixin;
|
||||
|
||||
const pagination = ref({
|
||||
sortBy: "desc",
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
const pagination2 = ref({
|
||||
sortBy: "desc",
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
const visibleColumns = ref<string[]>([
|
||||
"no",
|
||||
"name",
|
||||
|
|
@ -26,6 +56,7 @@ const visibleColumns = ref<string[]>([
|
|||
"order_number",
|
||||
"probation_status",
|
||||
]);
|
||||
|
||||
// หัวตาราง
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
|
|
@ -101,8 +132,7 @@ const columns = ref<QTableProps["columns"]>([
|
|||
style: "font-size: 14px",
|
||||
},
|
||||
]);
|
||||
// ข้อมูลตาราง (จำลอง)
|
||||
const rows = ref<FormMainProbation[]>([]);
|
||||
|
||||
// หัวตาราง2
|
||||
const columns2 = ref<QTableProps["columns"]>([
|
||||
{
|
||||
|
|
@ -160,18 +190,7 @@ const columns2 = ref<QTableProps["columns"]>([
|
|||
style: "font-size: 14px",
|
||||
},
|
||||
]);
|
||||
// ข้อมูลตาราง (จำลอง)
|
||||
const rows2 = ref<FormMainProbation2[]>([]);
|
||||
|
||||
const modal = ref<boolean>(false);
|
||||
const probationlist = ref<any>([]);
|
||||
|
||||
onMounted(async () => {
|
||||
getpersonalList();
|
||||
});
|
||||
const fillter = ref<number>(0);
|
||||
const Opfillter = ref<any>([{ id: 0, value: "ทั้งหมด" }]);
|
||||
const fillterStatus = ref<any>([]);
|
||||
const ProbationMainFilter = () => {
|
||||
const useStatus = new Set();
|
||||
fillterStatus.value.forEach((item: any) => {
|
||||
|
|
@ -187,9 +206,8 @@ const ProbationMainFilter = () => {
|
|||
});
|
||||
Opfillter.value.sort((a: any, b: any) => a.id - b.id);
|
||||
};
|
||||
const dataUpdate = ref<any>([]);
|
||||
|
||||
const updateRows = (body: any) => {
|
||||
// console.log(body.value);
|
||||
if (body.value !== "ทั้งหมด") {
|
||||
const filteredRows = dataUpdate.value.filter(
|
||||
(item: any) => item.probation_status === body.value
|
||||
|
|
@ -278,7 +296,6 @@ const findlist = async (id: string) => {
|
|||
response2.forEach((e: any) =>
|
||||
probationlist.value.push({ ...e, probation: false })
|
||||
);
|
||||
// console.log(probationlist.value);
|
||||
rows2.value = probationlist.value.map((e: any) => ({
|
||||
id: e.id,
|
||||
fullname: e.fullname,
|
||||
|
|
@ -318,67 +335,30 @@ const clickAdd = (id: string) => {
|
|||
const clickClose = async () => {
|
||||
modal.value = false;
|
||||
};
|
||||
const statusProbationMain = (val: number) => {
|
||||
switch (val) {
|
||||
case 1:
|
||||
return "อยู่ระหว่างการทดลองปฏิบัติหน้าที่ราชการ";
|
||||
case 2:
|
||||
return "พ้นการทดลองปฏิบัติหน้าที่ราชการ";
|
||||
case 3:
|
||||
return "ไม่พ้นการทดลองปฏิบัติหน้าที่ราชการ";
|
||||
case 4:
|
||||
return "ยุติการทดลองปฏิบัติหน้าที่ราชการเนื่องจากเปลี่ยนตำแหน่ง";
|
||||
case 5:
|
||||
return "ยุติการทดลองปฏิบัติหน้าที่ราชการเนื่องจากลาออก";
|
||||
case 6:
|
||||
return "ยุติการทดลองปฏิบัติหน้าที่ราชการเนื่องจากถึงแก่กรรม";
|
||||
case 7:
|
||||
return "ขยายระยะเวลาทดลองปฏิบัติหน้าที่ราชการ";
|
||||
case 8:
|
||||
return "ดึงรายชื่อไปออกคำสั่งแล้ว";
|
||||
default:
|
||||
return " ";
|
||||
}
|
||||
};
|
||||
|
||||
// ค้นหาในตาราง
|
||||
const filterKeyword = ref<string>("");
|
||||
const filterRef = ref<any>(null);
|
||||
|
||||
const resetFilter = () => {
|
||||
filterKeyword.value = "";
|
||||
filterRef.value.focus();
|
||||
};
|
||||
|
||||
const filterKeyword2 = ref<string>("");
|
||||
const filterRef2 = ref<any>(null);
|
||||
const resetFilter2 = () => {
|
||||
filterKeyword2.value = "";
|
||||
filterRef2.value.focus();
|
||||
};
|
||||
const pagination = ref({
|
||||
sortBy: "desc",
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
const pagination2 = ref({
|
||||
sortBy: "desc",
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
|
||||
const attrs = ref<any>(useAttrs());
|
||||
const paging = ref<boolean>(true);
|
||||
const paginationLabel = (start: string, end: string, total: string) => {
|
||||
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
|
||||
else return start + "-" + end + " ใน " + total;
|
||||
};
|
||||
const paging2 = ref<boolean>(true);
|
||||
|
||||
const paginationLabel2 = (start: string, end: string, total: string) => {
|
||||
if (paging2.value == true) return " " + start + "-" + end + " ใน " + total;
|
||||
else return start + "-" + end + " ใน " + total;
|
||||
};
|
||||
onMounted(async () => {
|
||||
getpersonalList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -431,43 +411,6 @@ const paginationLabel2 = (start: string, end: string, total: string) => {
|
|||
<div v-if="col.name == 'no'">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</div>
|
||||
<!-- <div v-else-if="col.name === 'probation_status'">
|
||||
<q-icon
|
||||
size="20px"
|
||||
v-if="props.row.probation_status === 'PENDING'"
|
||||
name="mdi-timer-sand"
|
||||
color="deep-orange"
|
||||
/>
|
||||
<q-icon
|
||||
size="20px"
|
||||
v-else-if="props.row.probation_status === 'PROCESS'"
|
||||
name="mdi-timer-sand"
|
||||
color="deep-orange"
|
||||
/>
|
||||
<q-icon
|
||||
size="20px"
|
||||
v-else-if="props.row.probation_status === 'PASS'"
|
||||
name="mdi-check"
|
||||
color="teal"
|
||||
/>
|
||||
<q-icon
|
||||
size="20px"
|
||||
v-else-if="props.row.probation_status === 'NO-PASS'"
|
||||
name="mdi-close"
|
||||
color="red"
|
||||
/>
|
||||
{{
|
||||
props.row.probation_status === "PENDING"
|
||||
? "รอมอบหมายงาน"
|
||||
: props.row.probation_status === "PROCESS"
|
||||
? "อยู่ระหว่างทดลองงาน"
|
||||
: props.row.probation_status === "PASS"
|
||||
? "ผ่านการทดลองงาน"
|
||||
: props.row.probation_status === "NO-PASS"
|
||||
? "ไม่ผ่านการทดลองงาน"
|
||||
: ""
|
||||
}}
|
||||
</div> -->
|
||||
<div v-else>
|
||||
{{ col.value }}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue