Refactoring code module 04_registryPerson
This commit is contained in:
parent
1164d79122
commit
eeb92dfb5d
46 changed files with 1935 additions and 2230 deletions
|
|
@ -1,20 +1,21 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from "vue";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import { useRoute } from "vue-router";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
import type { QTableProps } from "quasar";
|
||||
import type {
|
||||
RequestItemsHistoryObject,
|
||||
FormMain,
|
||||
} from "@/modules/04_registryPerson/interface/index/government";
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import type { QTableProps } from "quasar";
|
||||
import { useRoute } from "vue-router";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
/** ฟังชั่นกลาง */
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
const route = useRoute();
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
|
|
@ -42,7 +43,6 @@ const formMain = reactive<FormMain>({
|
|||
positionExecutiveSide: "", //ด้านตำแหน่งทางการบริหาร
|
||||
positionType: "", //ประเภท
|
||||
positionPathSide: "", //ด้าน/สาขา
|
||||
|
||||
containDate: null, //วันที่สั่งบรรจุ
|
||||
workDate: null, //วันที่เริ่มปฏิบัติราชการ
|
||||
reasonSameDate: "",
|
||||
|
|
@ -56,13 +56,7 @@ const formMain = reactive<FormMain>({
|
|||
age: 0, //อายุราชการเกื้อกูล
|
||||
});
|
||||
|
||||
/** dialog */
|
||||
const modalEdit = ref<boolean>(false);
|
||||
const modalHistory = ref<boolean>(false);
|
||||
const rowsHistory = ref<RequestItemsHistoryObject[]>([]);
|
||||
|
||||
const filterKeyword = ref<string>("");
|
||||
|
||||
const modalEdit = ref<boolean>(false); //แสดง popup แก้ไขข้อมูลราชการ
|
||||
const containDate = ref<Date | null>(null);
|
||||
const workDate = ref<Date | null>(null);
|
||||
const reasonSameDate = ref<string | null>(null);
|
||||
|
|
@ -70,6 +64,10 @@ const containDateRef = ref<object | null>(null);
|
|||
const workDateRef = ref<object | null>(null);
|
||||
const reasonSameDateRef = ref<object | null>(null);
|
||||
|
||||
//ประวัติแก้ไขข้อมูลราชการ
|
||||
const filterKeyword = ref<string>(""); //คำค้นหา
|
||||
const modalHistory = ref<boolean>(false); //แสดง popup ประวัติแก้ไขข้อมูลราชการ;
|
||||
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); //ข้อมูลรายการประวัติแก้ไขข้อมูลราชการ
|
||||
const visibleColumnsHistory = ref<String[]>([
|
||||
"dateAppoint",
|
||||
"dateStart",
|
||||
|
|
@ -77,7 +75,6 @@ const visibleColumnsHistory = ref<String[]>([
|
|||
"lastUpdateFullName",
|
||||
"lastUpdatedAt",
|
||||
]);
|
||||
|
||||
const columnsHistory = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "dateAppoint",
|
||||
|
|
@ -206,12 +203,12 @@ function onSubmit() {
|
|||
/**
|
||||
* ดึงข้อมูลราชการ
|
||||
*/
|
||||
function getData() {
|
||||
async function getData() {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.get(config.API.profileNewGovernmentById(profileId.value, empType.value))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
.then(async (res) => {
|
||||
const data = await res.data.result;
|
||||
formMain.ocId = data.org ?? "-"; //สังกัด
|
||||
formMain.positionId = data.position ?? "-"; //ตำแหน่ง
|
||||
formMain.positionLine = data.positionField ?? "-"; //สายงาน
|
||||
|
|
@ -242,12 +239,12 @@ function getData() {
|
|||
/**
|
||||
* ดึงข้อมูลประวัติ
|
||||
*/
|
||||
function getDataHistory() {
|
||||
async function getDataHistory() {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.get(config.API.profileNewGovernmentHistory(profileId.value, empType.value))
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
.then(async (res) => {
|
||||
let data = await res.data.result;
|
||||
rowsHistory.value = [];
|
||||
data.map((e: RequestItemsHistoryObject) => {
|
||||
rowsHistory.value.push({
|
||||
|
|
@ -277,13 +274,15 @@ function getDataHistory() {
|
|||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
modalHistory.value = false;
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ทำงานเมื่อ Components ถูกเรียกใช้งาน
|
||||
*/
|
||||
onMounted(() => {
|
||||
getData();
|
||||
});
|
||||
|
|
@ -547,7 +546,7 @@ onMounted(() => {
|
|||
: null
|
||||
"
|
||||
:rules="[
|
||||
(val) => !!val || 'กรุณาเลือก วัน/เดือน/ปี ที่บรรจุ',
|
||||
(val:string) => !!val || 'กรุณาเลือก วัน/เดือน/ปี ที่บรรจุ',
|
||||
]"
|
||||
label="วัน/เดือน/ปี ที่บรรจุ"
|
||||
>
|
||||
|
|
@ -588,7 +587,7 @@ onMounted(() => {
|
|||
? date2Thai(workDate as Date)
|
||||
: null
|
||||
"
|
||||
:rules="[(val) => !!val || 'กรุณาเลือกเริ่มปฎิบัติราชการ']"
|
||||
:rules="[(val:string) => !!val || 'กรุณาเลือกเริ่มปฎิบัติราชการ']"
|
||||
label="วัน/เดือน/ปี เริ่มปฎิบัติราชการ"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
|
|
@ -615,7 +614,7 @@ onMounted(() => {
|
|||
outlined
|
||||
dense
|
||||
hide-bottom-space
|
||||
:rules="[(val) => !!val || 'กรุณากรอก เหตุผลกรณีไม่ตรงกัน']"
|
||||
:rules="[(val:string) => !!val || 'กรุณากรอก เหตุผลกรณีไม่ตรงกัน']"
|
||||
v-model="reasonSameDate"
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,23 +1,24 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, reactive } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import { useRoute } from "vue-router";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
import type { QTableProps } from "quasar";
|
||||
import type {
|
||||
RequestItemsObject,
|
||||
FormFilter,
|
||||
DisciplineOps,
|
||||
DataOption,
|
||||
} from "@/modules/04_registryPerson/interface/index/discipline";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import DialogHistory from "@/modules/04_registryPerson/components/detail/GovernmentInformation/02_DisciplineHistory.vue";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
|
|
@ -35,42 +36,20 @@ const profileId = ref<string>(
|
|||
);
|
||||
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
||||
|
||||
//ฟอร์มข้อมูลวินัย
|
||||
const disciplineData = reactive<RequestItemsObject>({
|
||||
date: null,
|
||||
level: "",
|
||||
detail: "",
|
||||
unStigma: "",
|
||||
refCommandNo: "",
|
||||
date: null, //วัน/เดือน/ปี
|
||||
level: "", //ระดับการลงโทษทางวินัย
|
||||
detail: "", //รายละเอียด
|
||||
unStigma: "", //ประเภทคำสั่ง
|
||||
refCommandNo: "", //เลขที่คำสั่ง
|
||||
profileId: profileId.value,
|
||||
refCommandDate: null,
|
||||
refCommandDate: null, //เอกสารอ้างอิง (ลงวันที่)
|
||||
});
|
||||
const rows = ref<RequestItemsObject[]>([]);
|
||||
const mode = ref<string>("table");
|
||||
const filterKeyword = ref<string>("");
|
||||
const formFilter = reactive<FormFilter>({
|
||||
page: 1,
|
||||
pageSize: 12,
|
||||
keyword: "",
|
||||
type: "",
|
||||
posType: "",
|
||||
posLevel: "",
|
||||
retireYear: "",
|
||||
rangeYear: { min: 0, max: 60 },
|
||||
isShowRetire: false,
|
||||
isProbation: false,
|
||||
});
|
||||
const pagination = ref({
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
const visibleColumns = ref<String[]>([
|
||||
"level",
|
||||
"detail",
|
||||
"unStigma",
|
||||
"refCommandNo",
|
||||
"refCommandDate",
|
||||
"date",
|
||||
]);
|
||||
|
||||
const rows = ref<RequestItemsObject[]>([]); //รายการวินัย
|
||||
const mode = ref<string>("table"); //การแสดงผล Table card
|
||||
const filterKeyword = ref<string>(""); //คำค้นหา
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "date",
|
||||
|
|
@ -141,19 +120,25 @@ const columns = ref<QTableProps["columns"]>([
|
|||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
]);
|
||||
const visibleColumns = ref<String[]>([
|
||||
"level",
|
||||
"detail",
|
||||
"unStigma",
|
||||
"refCommandNo",
|
||||
"refCommandDate",
|
||||
"date",
|
||||
]);
|
||||
const pagination = ref({
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
|
||||
const dateRef = ref<object | null>(null);
|
||||
const detailRef = ref<object | null>(null);
|
||||
const refCommandNoRef = ref<object | null>(null);
|
||||
const edit = ref<boolean>(false); //สถานะการแก้ไข
|
||||
const modal = ref<boolean>(false); //แสดงข้อมูลวินัย
|
||||
const modalHistory = ref<boolean>(false); //แสดงประวัติแก้ไขวินัย
|
||||
const id = ref<string>(""); //id ที่ต้แงการแก้ไข
|
||||
|
||||
/** dialog */
|
||||
const edit = ref<boolean>(false);
|
||||
const modal = ref<boolean>(false);
|
||||
const modalHistory = ref<boolean>(false);
|
||||
|
||||
const id = ref<string>("");
|
||||
|
||||
const Ops = ref<any>({
|
||||
const Ops = ref<DisciplineOps>({
|
||||
levelOptions: [
|
||||
{ id: "0", name: "ไม่ร้ายแรง", disable: true },
|
||||
{ id: "ภาคทัณฑ์", name: "ภาคทัณฑ์", disable: false },
|
||||
|
|
@ -173,7 +158,7 @@ const Ops = ref<any>({
|
|||
{ id: "อื่นๆ", name: "อื่นๆ", disable: false },
|
||||
],
|
||||
});
|
||||
const OpsFilter = ref<any>({
|
||||
const OpsFilter = ref<DisciplineOps>({
|
||||
levelOptions: [
|
||||
{ id: "0", name: "ไม่ร้ายแรง", disable: true },
|
||||
{ id: "ภาคทัณฑ์", name: "ภาคทัณฑ์", disable: false },
|
||||
|
|
@ -349,6 +334,9 @@ function onSubmit() {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* ทำงานเมื่อ Components ถูกเรียกใช้งาน
|
||||
*/
|
||||
onMounted(() => {
|
||||
fetchData(profileId.value);
|
||||
});
|
||||
|
|
@ -490,12 +478,7 @@ onMounted(() => {
|
|||
</q-btn>
|
||||
</q-td>
|
||||
<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>
|
||||
<div>
|
||||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
</q-td>
|
||||
|
|
|
|||
|
|
@ -1,17 +1,15 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, watch, reactive } from "vue";
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar, type QTableProps } from "quasar";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
import { useRoute } from "vue-router";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/index/discipline";
|
||||
|
||||
const modal = defineModel<boolean>("modal", { required: true });
|
||||
const id = defineModel<string>("id", { required: true });
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
|
|
@ -19,26 +17,16 @@ const mixin = useCounterMixin();
|
|||
const { showLoader, hideLoader, messageError, date2Thai, pathRegistryEmp } =
|
||||
mixin;
|
||||
|
||||
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
||||
const filterKeyword = ref<string>("");
|
||||
const rows = ref<RequestItemsObject[]>([]); //select data history
|
||||
/**
|
||||
* props
|
||||
*/
|
||||
const modal = defineModel<boolean>("modal", { required: true }); //แสดงประวัติแก้ไขวินัย
|
||||
const id = defineModel<string>("id", { required: true }); //id วินัยที่ต้องการดูประวัติแก้ไขวินัย
|
||||
|
||||
const historyPagination = ref({
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
const visibleColumns = ref<String[]>([
|
||||
"level",
|
||||
"detail",
|
||||
"unStigma",
|
||||
"refCommandNo",
|
||||
"refCommandDate",
|
||||
"date",
|
||||
"createdFullName",
|
||||
"createdAt",
|
||||
"lastUpdateFullName",
|
||||
"lastUpdatedAt",
|
||||
]);
|
||||
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
||||
|
||||
const filterKeyword = ref<string>(""); //คำค้นหา
|
||||
const rows = ref<RequestItemsObject[]>([]); //รายการประวัติแก้ไขวินัย
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "date",
|
||||
|
|
@ -132,18 +120,34 @@ const columns = ref<QTableProps["columns"]>([
|
|||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
]);
|
||||
const visibleColumns = ref<String[]>([
|
||||
"level",
|
||||
"detail",
|
||||
"unStigma",
|
||||
"refCommandNo",
|
||||
"refCommandDate",
|
||||
"date",
|
||||
"createdFullName",
|
||||
"createdAt",
|
||||
"lastUpdateFullName",
|
||||
"lastUpdatedAt",
|
||||
]);
|
||||
const historyPagination = ref({
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
|
||||
/**
|
||||
* fetch ข้อมูลประวัติการแก่ไขข้อมูลวินัย
|
||||
*/
|
||||
function getHistory() {
|
||||
async function getHistory() {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.get(
|
||||
config.API.profileNewDisciplineHisByDisciplineId(id.value, empType.value)
|
||||
)
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
.then(async (res) => {
|
||||
let data = await res.data.result;
|
||||
rows.value = [];
|
||||
data.map((e: RequestItemsObject) => {
|
||||
rows.value.push({
|
||||
|
|
@ -166,6 +170,11 @@ function getHistory() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ดูการเปลี่ยนแปลงของ modal
|
||||
*
|
||||
* ถ้า modal เป็น true เรียก getHistory เพิ่อดึงข้อมูลประวัติการแก้ไขวินัย
|
||||
*/
|
||||
watch(modal, (status) => {
|
||||
if (status == true) {
|
||||
getHistory();
|
||||
|
|
@ -179,7 +188,10 @@ watch(modal, (status) => {
|
|||
<template>
|
||||
<q-dialog v-model="modal" persistent>
|
||||
<q-card style="min-width: 80%">
|
||||
<DialogHeader tittle="ประวัติแก้ไขวินัย" :close="() => (modal = false)" />
|
||||
<DialogHeader
|
||||
tittle="ประวัติแก้ไขวินัย"
|
||||
:close="() => ((modal = false), (rows = []))"
|
||||
/>
|
||||
<q-separator color="grey-4" />
|
||||
|
||||
<q-card-section style="max-height: 60vh" class="scroll">
|
||||
|
|
|
|||
|
|
@ -1,25 +1,27 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from "vue";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
|
||||
import { useRoute } from "vue-router";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { useQuasar, type QTableProps } from "quasar";
|
||||
|
||||
import { useRoute } from "vue-router";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
import type {
|
||||
DetailData,
|
||||
DataOptionLeave,
|
||||
DataOption,
|
||||
ResponseTotalObject,
|
||||
} from "@/modules/04_registryPerson/interface/index/leave";
|
||||
import type {
|
||||
DataLeave,
|
||||
DataLeaveType,
|
||||
} from "@/modules/04_registryPerson/interface/response/Main";
|
||||
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import DialogHistory from "@/modules/04_registryPerson/components/detail/GovernmentInformation/03_LeaveHistory.vue";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
const rowsTotal = ref<ResponseTotalObject[]>([]);
|
||||
const id = ref<string>("");
|
||||
const route = useRoute();
|
||||
|
||||
const $q = useQuasar();
|
||||
|
|
@ -39,7 +41,8 @@ const profileId = ref<string>(
|
|||
route.params.id ? route.params.id.toString() : ""
|
||||
);
|
||||
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
||||
|
||||
const rowsTotal = ref<ResponseTotalObject[]>([]);
|
||||
const id = ref<string>("");
|
||||
const pagination = ref({
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
|
|
@ -47,21 +50,18 @@ const pagination = ref({
|
|||
const mode = ref<string>("table");
|
||||
const filterKeyword = ref<string>("");
|
||||
|
||||
const rows = ref<DetailData[]>([]);
|
||||
|
||||
const modal = ref<boolean>(false);
|
||||
const edit = ref<boolean>(false);
|
||||
const modalHistory = ref<boolean>(false);
|
||||
|
||||
const typeLeave = ref<DataOptionLeave | undefined | null>(); //ประเภทการลา
|
||||
const dateRange = ref<[Date, Date]>([new Date(), new Date()]); //วัน เดือน ปีที่ล
|
||||
const numLeave = ref<number>(1); //จำนวนวันที่ลา
|
||||
const statLeave = ref<string>(""); //สถานะการลา
|
||||
const reason = ref<string>(""); //เหตุผล
|
||||
const numLeave = ref<number>(1);
|
||||
const dateRange = ref<[Date, Date]>([new Date(), new Date()]);
|
||||
const numUsedLeave = ref<number>(0);
|
||||
const typeLeave = ref<any>();
|
||||
const numUsedLeave = ref<number | undefined>(0);
|
||||
const typeLeaveOption = ref<DataOptionLeave[]>([]);
|
||||
const typeLeaveOptionFilter = ref<DataOptionLeave[]>([]);
|
||||
|
||||
const statLeave = ref<string>("");
|
||||
const statLeaveOption = ref<DataOption[]>([
|
||||
{ id: "approve", name: "ผ่านการอนุมัติ" },
|
||||
{ id: "reject", name: "ไม่ผ่านการอนุมัติ" },
|
||||
|
|
@ -75,39 +75,8 @@ const statLeaveOptionFilter = ref<DataOption[]>([
|
|||
{ id: "waitting", name: "รออนุมัติ" },
|
||||
]);
|
||||
|
||||
const statusLeave = (val: string) => {
|
||||
switch (val) {
|
||||
case "waitting":
|
||||
return "รออนุมัติ";
|
||||
case "reject":
|
||||
return "ไม่ผ่านการอนุมัติ";
|
||||
case "approve":
|
||||
return "ผ่านการอนุมัติ";
|
||||
case "cancel":
|
||||
return "ยกเลิก";
|
||||
default:
|
||||
return "-";
|
||||
}
|
||||
};
|
||||
|
||||
const clickEditRowType = () => {
|
||||
const filter = typeLeaveOptionFilter.value.filter(
|
||||
(v: DataOptionLeave) => v.id == typeLeave.value
|
||||
);
|
||||
if (filter.length > 0) {
|
||||
numUsedLeave.value = filter[0].totalLeave;
|
||||
}
|
||||
};
|
||||
|
||||
const visibleColumns = ref<String[]>([
|
||||
"no",
|
||||
"typeLeave",
|
||||
"dateLeave",
|
||||
"numLeave",
|
||||
"status",
|
||||
"reason",
|
||||
]);
|
||||
|
||||
//Table
|
||||
const rows = ref<DetailData[]>([]);
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "no",
|
||||
|
|
@ -176,6 +145,38 @@ const columns = ref<QTableProps["columns"]>([
|
|||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
]);
|
||||
const visibleColumns = ref<String[]>([
|
||||
"no",
|
||||
"typeLeave",
|
||||
"dateLeave",
|
||||
"numLeave",
|
||||
"status",
|
||||
"reason",
|
||||
]);
|
||||
|
||||
const statusLeave = (val: string) => {
|
||||
switch (val) {
|
||||
case "waitting":
|
||||
return "รออนุมัติ";
|
||||
case "reject":
|
||||
return "ไม่ผ่านการอนุมัติ";
|
||||
case "approve":
|
||||
return "ผ่านการอนุมัติ";
|
||||
case "cancel":
|
||||
return "ยกเลิก";
|
||||
default:
|
||||
return "-";
|
||||
}
|
||||
};
|
||||
|
||||
const clickEditRowType = () => {
|
||||
const filter = typeLeaveOptionFilter.value.filter(
|
||||
(v: DataOptionLeave) => v.id == typeLeave.value?.id
|
||||
);
|
||||
if (filter.length > 0) {
|
||||
numUsedLeave.value = filter[0].totalLeave;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* function เปิด dialog ข้อมูลการลา
|
||||
|
|
@ -187,7 +188,7 @@ function openDialogAdd() {
|
|||
http
|
||||
.get(config.API.profileNewLeaveType())
|
||||
.then((res) => {
|
||||
const dataOp = res.data.result.map((item: any) => ({
|
||||
const dataOp = res.data.result.map((item: DataLeaveType) => ({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
code: item.code,
|
||||
|
|
@ -271,7 +272,7 @@ function closeDialog() {
|
|||
modal.value = false;
|
||||
edit.value = false;
|
||||
id.value = "";
|
||||
typeLeave.value = "";
|
||||
typeLeave.value = null;
|
||||
statLeave.value = "";
|
||||
reason.value = "";
|
||||
dateRange.value = [new Date(), new Date()];
|
||||
|
|
@ -285,7 +286,7 @@ function closeDialog() {
|
|||
* @param update function
|
||||
* @param filtername type select
|
||||
*/
|
||||
function filterSelector(val: any, update: Function, filtername: string) {
|
||||
function filterSelector(val: string, update: Function, filtername: string) {
|
||||
switch (filtername) {
|
||||
case "typeLeaveOption":
|
||||
update(() => {
|
||||
|
|
@ -350,7 +351,7 @@ function saveData() {
|
|||
showLoader();
|
||||
http
|
||||
.post(config.API.profileNewLeave(empType.value), {
|
||||
leaveTypeId: typeLeave.value.id,
|
||||
leaveTypeId: typeLeave.value?.id,
|
||||
dateLeaveStart: dateToISO(dateRange.value[0]),
|
||||
dateLeaveEnd: dateToISO(dateRange.value[1]),
|
||||
leaveDays: numLeave.value,
|
||||
|
|
@ -377,11 +378,11 @@ function saveData() {
|
|||
/**
|
||||
* บันทึกแก้ไขข้อมูล
|
||||
*/
|
||||
const editData = async () => {
|
||||
async function editData() {
|
||||
showLoader();
|
||||
http
|
||||
.patch(config.API.profileNewLeaveById(id.value, empType.value), {
|
||||
leaveTypeId: typeLeave.value.id,
|
||||
leaveTypeId: typeLeave.value?.id,
|
||||
dateLeaveStart: dateToISO(dateRange.value[0]),
|
||||
dateLeaveEnd: dateToISO(dateRange.value[1]),
|
||||
leaveDays: numLeave.value,
|
||||
|
|
@ -401,19 +402,18 @@ const editData = async () => {
|
|||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* function fetch ข้อมูลรายการวินัย
|
||||
* function fetch ข้อมูลรายการลา
|
||||
*/
|
||||
function getData() {
|
||||
async function getData() {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.get(config.API.profileNewLeaveById(profileId.value, empType.value))
|
||||
.then((res) => {
|
||||
console.log(res.data.result);
|
||||
const data = res.data.result;
|
||||
rows.value = data.map((item: any) => ({
|
||||
.then(async (res) => {
|
||||
const data = await res.data.result;
|
||||
rows.value = data.map((item: DataLeave) => ({
|
||||
id: item.id,
|
||||
typeLeave: item.leaveType.name,
|
||||
code: item.leaveType.refCommandDate,
|
||||
|
|
@ -433,6 +433,9 @@ function getData() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ทำงานเมื่อ Components ถูกเรียกใช้งาน
|
||||
*/
|
||||
onMounted(() => {
|
||||
getData();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, watch, reactive } from "vue";
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar, type QTableProps } from "quasar";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
import { useRoute } from "vue-router";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
|
|
@ -12,6 +11,9 @@ import type {
|
|||
DetailData,
|
||||
FormFilter,
|
||||
} from "@/modules/04_registryPerson/interface/index/leave";
|
||||
import type { DataLeave } from "@/modules/04_registryPerson/interface/response/Main";
|
||||
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
const modal = defineModel<boolean>("modal", { required: true });
|
||||
const id = defineModel<string>("id", { required: true });
|
||||
|
|
@ -25,7 +27,7 @@ const { showLoader, hideLoader, messageError, date2Thai, pathRegistryEmp } =
|
|||
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
||||
|
||||
const filterKeyword = ref<string>("");
|
||||
const rows = ref<DetailData[]>([]); //select data history
|
||||
const rows = ref<DetailData[]>([]); //data history
|
||||
const formFilter = reactive<FormFilter>({
|
||||
page: 1,
|
||||
pageSize: 12,
|
||||
|
|
@ -39,22 +41,6 @@ const formFilter = reactive<FormFilter>({
|
|||
isProbation: false,
|
||||
});
|
||||
|
||||
const historyPagination = ref({
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
const visibleColumns = ref<String[]>([
|
||||
"no",
|
||||
"typeLeave",
|
||||
"dateLeave",
|
||||
"numLeave",
|
||||
"sumLeave",
|
||||
"totalLeave",
|
||||
"status",
|
||||
"reason",
|
||||
"lastUpdateFullName",
|
||||
"lastUpdatedAt",
|
||||
]);
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "no",
|
||||
|
|
@ -146,18 +132,34 @@ const columns = ref<QTableProps["columns"]>([
|
|||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
]);
|
||||
const visibleColumns = ref<String[]>([
|
||||
"no",
|
||||
"typeLeave",
|
||||
"dateLeave",
|
||||
"numLeave",
|
||||
"sumLeave",
|
||||
"totalLeave",
|
||||
"status",
|
||||
"reason",
|
||||
"lastUpdateFullName",
|
||||
"lastUpdatedAt",
|
||||
]);
|
||||
const historyPagination = ref({
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
|
||||
/**
|
||||
* function fetch ข้อมูลประวัติการแก้ไขการลา
|
||||
*/
|
||||
function getHistory() {
|
||||
async function getHistory() {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.get(config.API.profileNewLeaveHistory(id.value, empType.value))
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
.then(async (res) => {
|
||||
let data = await res.data.result;
|
||||
rows.value = [];
|
||||
data.map((e: any) => {
|
||||
data.map((e: DataLeave) => {
|
||||
rows.value.push({
|
||||
...e,
|
||||
id: e.id,
|
||||
|
|
@ -215,6 +217,11 @@ function statusLeave(val: string) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ดูการเปลี่ยนแปลงของ modal
|
||||
*
|
||||
* ถ้า modal เป็น true เรียก getHistory เพิ่อดึงข้อมูลประวัติการแก้ไข
|
||||
*/
|
||||
watch(modal, (status) => {
|
||||
if (status == true) {
|
||||
getHistory();
|
||||
|
|
@ -228,7 +235,10 @@ watch(modal, (status) => {
|
|||
<template>
|
||||
<q-dialog v-model="modal" persistent>
|
||||
<q-card style="min-width: 80%">
|
||||
<DialogHeader tittle="ประวัติแก้ไขการลา" :close="() => (modal = false)" />
|
||||
<DialogHeader
|
||||
tittle="ประวัติแก้ไขการลา"
|
||||
:close="() => ((modal = false), (rows = []))"
|
||||
/>
|
||||
<q-separator color="grey-4" />
|
||||
<q-card-section style="max-height: 60vh" class="scroll">
|
||||
<div class="row q-gutter-sm q-mb-sm">
|
||||
|
|
|
|||
|
|
@ -1,26 +1,19 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from "vue";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
|
||||
import { useQuasar, type QTableProps } from "quasar";
|
||||
import type {
|
||||
FormFilter,
|
||||
RequestItemsObject,
|
||||
} from "@/modules/04_registryPerson/interface/index/performSpecialWork";
|
||||
|
||||
import { useRoute } from "vue-router";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/index/performSpecialWork";
|
||||
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import DialogHistory from "@/modules/04_registryPerson/components/detail/GovernmentInformation/04_PerformSpecialWorkHistory.vue";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
const route = useRoute();
|
||||
const profileId = ref<string>(
|
||||
route.params.id ? route.params.id.toString() : ""
|
||||
);
|
||||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
|
|
@ -34,53 +27,29 @@ const {
|
|||
pathRegistryEmp,
|
||||
} = mixin;
|
||||
|
||||
const profileId = ref<string>(
|
||||
route.params.id ? route.params.id.toString() : ""
|
||||
);
|
||||
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
||||
|
||||
const modal = ref<boolean>(false);
|
||||
const edit = ref<boolean>(false);
|
||||
const modalHistory = ref<boolean>(false);
|
||||
|
||||
const id = ref<string>("");
|
||||
|
||||
const id = ref<string>(""); //id ที่ต้องการแก้ไข
|
||||
const modal = ref<boolean>(false); //แสดง popup ข้อมูลปฏิบัติราชการพิเศษ
|
||||
const modalHistory = ref<boolean>(false); //แสดง popup ประวัติการแก้ไขข้อมูลปฏิบัติราชการพิเศษ
|
||||
const edit = ref<boolean>(false); //สถานะการแก่ไข
|
||||
//ฟอร์มข้อมูลปฏิบัติราชการพิเศษ
|
||||
const dutyData = reactive<RequestItemsObject>({
|
||||
profileId: profileId.value,
|
||||
dateStart: new Date(),
|
||||
dateEnd: null,
|
||||
detail: "",
|
||||
reference: "",
|
||||
refCommandNo: "",
|
||||
refCommandDate: null,
|
||||
dateStart: new Date(), //วันที่เริ่มต้น
|
||||
dateEnd: null, //วันที่สิ้นสุด
|
||||
detail: "", //รายละเอียด
|
||||
reference: "", //เอกสารอ้างอิง
|
||||
refCommandNo: "", //เลขที่คำสั่ง
|
||||
refCommandDate: null, //'เอกสารอ้างอิง (ลงวันที่)'
|
||||
});
|
||||
|
||||
const pagination = ref({
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
const rows = ref<RequestItemsObject[]>([]);
|
||||
const filterKeyword = ref<string>("");
|
||||
const mode = ref<string>("table");
|
||||
|
||||
const formFilter = reactive<FormFilter>({
|
||||
page: 1,
|
||||
pageSize: 12,
|
||||
keyword: "",
|
||||
type: "",
|
||||
posType: "",
|
||||
posLevel: "",
|
||||
retireYear: "",
|
||||
rangeYear: { min: 0, max: 60 },
|
||||
isShowRetire: false,
|
||||
isProbation: false,
|
||||
});
|
||||
|
||||
const visibleColumns = ref<String[]>([
|
||||
"dateStart",
|
||||
"dateEnd",
|
||||
"detail",
|
||||
"reference",
|
||||
"refCommandNo",
|
||||
"refCommandDate",
|
||||
]);
|
||||
const mode = ref<string>("table"); //การแสดงผล Table card
|
||||
const filterKeyword = ref<string>(""); //คำค้นหา
|
||||
const rows = ref<RequestItemsObject[]>([]); //รายการปฏิบัติราชการพิเศษ
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "dateStart",
|
||||
|
|
@ -152,6 +121,18 @@ const columns = ref<QTableProps["columns"]>([
|
|||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
]);
|
||||
const visibleColumns = ref<String[]>([
|
||||
"dateStart",
|
||||
"dateEnd",
|
||||
"detail",
|
||||
"reference",
|
||||
"refCommandNo",
|
||||
"refCommandDate",
|
||||
]);
|
||||
const pagination = ref({
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
|
||||
/** เปิด dialog */
|
||||
function openDialogAdd() {
|
||||
|
|
@ -184,7 +165,6 @@ function openDialogHistory(idOrder: string) {
|
|||
function closeDialog() {
|
||||
modal.value = false;
|
||||
edit.value = false;
|
||||
|
||||
dutyData.dateStart = new Date();
|
||||
dutyData.dateEnd = null;
|
||||
dutyData.detail = "";
|
||||
|
|
@ -196,12 +176,12 @@ function closeDialog() {
|
|||
/**
|
||||
* fetch ข้อมูลรายการพิเศษ
|
||||
*/
|
||||
function fetchData(id: string) {
|
||||
async function fetchData(id: string) {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.get(config.API.profileNewDutyByProfileId(id, empType.value))
|
||||
.then(async (res) => {
|
||||
rows.value = res.data.result;
|
||||
rows.value = await res.data.result;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -278,6 +258,9 @@ function onSubmit() {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* ทำงานเมื่อ Components ถูกเรียกใช้งาน
|
||||
*/
|
||||
onMounted(() => {
|
||||
fetchData(profileId.value);
|
||||
});
|
||||
|
|
@ -418,13 +401,7 @@ onMounted(() => {
|
|||
</q-btn>
|
||||
</q-td>
|
||||
<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>
|
||||
<div>
|
||||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
</q-td>
|
||||
|
|
@ -541,7 +518,7 @@ onMounted(() => {
|
|||
outlined
|
||||
dense
|
||||
:model-value="date2Thai(dutyData.dateStart)"
|
||||
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่เริ่มต้น'}`]"
|
||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกวันที่เริ่มต้น'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'วันที่เริ่มต้น'}`"
|
||||
>
|
||||
|
|
@ -580,7 +557,7 @@ onMounted(() => {
|
|||
dense
|
||||
outlined
|
||||
:model-value="date2Thai(dutyData.dateEnd)"
|
||||
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่สิ้นสุด'}`]"
|
||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกวันที่สิ้นสุด'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'วันที่สิ้นสุด'}`"
|
||||
>
|
||||
|
|
@ -605,7 +582,7 @@ onMounted(() => {
|
|||
lazy-rules
|
||||
autogrow
|
||||
v-model="dutyData.reference"
|
||||
:rules="[(val) => !!val || `${'กรุณากรอกเอกสารอ้างอิง'}`]"
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอกเอกสารอ้างอิง'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'เอกสารอ้างอิง'}`"
|
||||
/>
|
||||
|
|
@ -619,7 +596,7 @@ onMounted(() => {
|
|||
lazy-rules
|
||||
autogrow
|
||||
v-model="dutyData.detail"
|
||||
:rules="[(val) => !!val || `${'กรุณากรอกรายละเอียด'}`]"
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอกรายละเอียด'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'รายละเอียด'}`"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, watch, reactive } from "vue";
|
||||
import { ref, watch } from "vue";
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar, type QTableProps } from "quasar";
|
||||
|
|
@ -7,10 +7,7 @@ import { useQuasar, type QTableProps } from "quasar";
|
|||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
import type {
|
||||
FormFilter,
|
||||
ResponseObject,
|
||||
} from "@/modules/04_registryPerson/interface/index/performSpecialWork";
|
||||
import type { ResponseObject } from "@/modules/04_registryPerson/interface/index/performSpecialWork";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
const modal = defineModel<boolean>("modal", { required: true });
|
||||
|
|
@ -24,23 +21,8 @@ const { showLoader, hideLoader, messageError, date2Thai, pathRegistryEmp } =
|
|||
|
||||
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
||||
|
||||
const filterKeyword = ref<string>("");
|
||||
const rows = ref<ResponseObject[]>([]); //select data history
|
||||
|
||||
const historyPagination = ref({
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
const visibleColumns = ref<String[]>([
|
||||
"dateStart",
|
||||
"dateEnd",
|
||||
"detail",
|
||||
"reference",
|
||||
"refCommandNo",
|
||||
"refCommandDate",
|
||||
"lastUpdateFullName",
|
||||
"lastUpdatedAt",
|
||||
]);
|
||||
const filterKeyword = ref<string>(""); //คำค้นหา
|
||||
const rows = ref<ResponseObject[]>([]); //data history
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "dateStart",
|
||||
|
|
@ -135,6 +117,20 @@ const columns = ref<QTableProps["columns"]>([
|
|||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
]);
|
||||
const visibleColumns = ref<String[]>([
|
||||
"dateStart",
|
||||
"dateEnd",
|
||||
"detail",
|
||||
"reference",
|
||||
"refCommandNo",
|
||||
"refCommandDate",
|
||||
"lastUpdateFullName",
|
||||
"lastUpdatedAt",
|
||||
]);
|
||||
const historyPagination = ref({
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
|
||||
/**
|
||||
* function fetch ข้อมูลประวติการแก้ไขข้อมูล
|
||||
|
|
@ -171,6 +167,11 @@ function getHistory() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ดูการเปลี่ยนแปลงของ modal
|
||||
*
|
||||
* ถ้า modal เป็น true เรียก getHistory เพิ่อดึงข้อมูลประวัติการแก้ไข
|
||||
*/
|
||||
watch(modal, (status) => {
|
||||
if (status == true) {
|
||||
getHistory();
|
||||
|
|
@ -186,7 +187,7 @@ watch(modal, (status) => {
|
|||
<q-card style="min-width: 80%">
|
||||
<DialogHeader
|
||||
tittle="ประวัติแก้ไขปฏิบัติราชการพิเศษ"
|
||||
:close="() => (modal = false)"
|
||||
:close="() => ((modal = false), (rows = []))"
|
||||
/>
|
||||
<q-card-section style="max-height: 60vh" class="scroll">
|
||||
<div class="row q-gutter-sm q-mb-sm">
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
import { ref } from "vue";
|
||||
|
||||
/** importComponents*/
|
||||
import Info from "@/modules/04_registryPerson/components/detail/GovernmentInformation/01_Info.vue";
|
||||
import Discipline from "@/modules/04_registryPerson/components/detail/GovernmentInformation/02_Discipline.vue";
|
||||
import Leave from "@/modules/04_registryPerson/components/detail/GovernmentInformation/03_Leave.vue";
|
||||
import PerformSpecialWork from "@/modules/04_registryPerson/components/detail/GovernmentInformation/04_PerformSpecialWork.vue";
|
||||
import Info from "@/modules/04_registryPerson/components/detail/GovernmentInformation/01_Info.vue"; //ข้อมูลราชการ
|
||||
import Discipline from "@/modules/04_registryPerson/components/detail/GovernmentInformation/02_Discipline.vue"; //วินัย
|
||||
import Leave from "@/modules/04_registryPerson/components/detail/GovernmentInformation/03_Leave.vue"; //การลา
|
||||
import PerformSpecialWork from "@/modules/04_registryPerson/components/detail/GovernmentInformation/04_PerformSpecialWork.vue"; //ปฏิบัติราชการพิเศษ
|
||||
|
||||
const tab = ref<string>("1");
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue