Refactoring code module 06_retirement

This commit is contained in:
STW_TTTY\stwtt 2024-09-18 15:18:57 +07:00
parent 1225254062
commit ea921b39b0
29 changed files with 730 additions and 823 deletions

View file

@ -26,19 +26,19 @@ const emit = defineEmits([
"update:previous", "update:previous",
]); ]);
const updateEdit = (value: Boolean) => { function updateEdit(value: Boolean) {
emit("update:editvisible", value); emit("update:editvisible", value);
}; }
const edit = async () => { async function edit() {
updateEdit(!props.editvisible); updateEdit(!props.editvisible);
props.edit(); props.edit();
}; }
/* บันทึกข้อมูล**/ /* บันทึกข้อมูล**/
const checkSave = () => { function checkSave() {
props.validate(); props.validate();
props.save(); props.save();
}; }
</script> </script>
<template> <template>
<q-card-actions class="text-primary"> <q-card-actions class="text-primary">
@ -49,8 +49,7 @@ const checkSave = () => {
:disabled="editvisible" :disabled="editvisible"
:color="editvisible ? 'grey-7' : 'primary'" :color="editvisible ? 'grey-7' : 'primary'"
@click="edit" @click="edit"
><!-- icon="mdi-pencil-outline" >
<q-tooltip>แกไขขอม</q-tooltip> -->
</q-btn> </q-btn>
<div v-else> <div v-else>
<q-btn <q-btn
@ -60,9 +59,7 @@ const checkSave = () => {
:color="!editvisible ? 'grey-7' : 'public'" :color="!editvisible ? 'grey-7' : 'public'"
@click="checkSave" @click="checkSave"
> >
</q-btn </q-btn>
><!-- icon="mdi-content-save-outline">
<q-tooltip>นท</q-tooltip> -->
</div> </div>
</q-card-actions> </q-card-actions>
</template> </template>

View file

@ -1,12 +1,15 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, watchEffect } from "vue"; import { ref, computed, watchEffect } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar";
import type { ResponseItems } from "@/modules/06_retirement/interface/response/Main";
import DialogHeader from "@/modules/06_retirement/components/DialogHeader.vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar";
import type { ResponseItems } from "@/modules/06_retirement/interface/response/Main";
import DialogHeader from "@/modules/06_retirement/components/DialogHeader.vue";
/** use */ /** use */
const $q = useQuasar(); const $q = useQuasar();
@ -98,17 +101,17 @@ const checkSelected = computed(() => {
}); });
//popup //popup
const saveOrder = () => { function saveOrder() {
dialogConfirm( dialogConfirm(
$q, $q,
() => Ordersave(), () => Ordersave(),
"ยืนยันส่งไปออกคำสั่ง", "ยืนยันส่งไปออกคำสั่ง",
"ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?" "ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?"
); );
}; }
// //
const Ordersave = async () => { async function Ordersave() {
const id = selected.value.map((r) => r.id); const id = selected.value.map((r) => r.id);
const body = { const body = {
id, id,
@ -127,17 +130,18 @@ const Ordersave = async () => {
props.getData?.(); props.getData?.();
hideLoader(); hideLoader();
}); });
}; }
const emit = defineEmits(["update:filterKeyword2", "update:selected"]); const emit = defineEmits(["update:filterKeyword2", "update:selected"]);
const updateInput = (value: any) => { function updateInput(value: any) {
emit("update:filterKeyword2", value); emit("update:filterKeyword2", value);
}; }
// //
const Reset = () => { function Reset() {
emit("update:filterKeyword2", ""); emit("update:filterKeyword2", "");
}; }
watchEffect(() => { watchEffect(() => {
if (props.modal === true) { if (props.modal === true) {
selected.value = []; selected.value = [];

View file

@ -3,18 +3,22 @@ import { ref, onMounted } from "vue";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import DialogSendToCommand from "@/modules/06_retirement/components/Discharged/DialogSendToCommand.vue"; import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
import type { ResponseData } from "@/modules/06_retirement/interface/response/discharged"; import type { ResponseData } from "@/modules/06_retirement/interface/response/discharged";
import DialogSendToCommand from "@/modules/06_retirement/components/Discharged/DialogSendToCommand.vue";
/** use */ /** use */
const $q = useQuasar(); const $q = useQuasar();
const router = useRouter(); const router = useRouter();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const transferStore = useTransferDataStore(); const transferStore = useTransferDataStore();
const { statusText } = transferStore;
const { const {
date2Thai, date2Thai,
messageError, messageError,
@ -23,7 +27,6 @@ const {
success, success,
dialogMessage, dialogMessage,
} = mixin; } = mixin;
const { statusText } = transferStore;
const modal = ref<boolean>(false); const modal = ref<boolean>(false);
@ -37,14 +40,6 @@ const visibleColumns = ref<string[]>([
"createdAt", "createdAt",
"statustext", "statustext",
]); ]);
const visibleColumns2 = ref<string[]>([
"no",
"fullname",
"position",
"positionLevel",
"organizationPositionOld",
"statustext",
]);
// //
const filterKeyword = ref<string>(""); const filterKeyword = ref<string>("");
@ -61,6 +56,16 @@ const resetFilter = () => {
const rows = ref<ResponseData[]>([]); const rows = ref<ResponseData[]>([]);
const rows2 = ref<ResponseData[]>([]); const rows2 = ref<ResponseData[]>([]);
/**
* Setting Pagination
*/
const pagination = ref({
sortBy: "createdAt",
descending: true,
page: 1,
rowsPerPage: 10,
});
/** คอลัมน์ */ /** คอลัมน์ */
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
@ -130,12 +135,7 @@ const columns = ref<QTableProps["columns"]>([
const openModal = () => (modal.value = true); const openModal = () => (modal.value = true);
const closeModal = () => (modal.value = false); const closeModal = () => (modal.value = false);
/** Hook */ function openModalOrder() {
onMounted(async () => {
await getData();
});
const openModalOrder = () => {
openModal(); openModal();
const row = filters.value.filter( const row = filters.value.filter(
(r: ResponseData) => (r: ResponseData) =>
@ -151,10 +151,10 @@ const openModalOrder = () => {
r.date r.date
); );
rows2.value = row; rows2.value = row;
}; }
/** Fnction เรียกข้อมูลจาก API */ /** Fnction เรียกข้อมูลจาก API */
const getData = async () => { async function getData() {
showLoader(); showLoader();
await http await http
.get(config.API.retirementDischarge) .get(config.API.retirementDischarge)
@ -194,13 +194,13 @@ const getData = async () => {
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
}; }
/** /**
* งกนลบขอม * งกนลบขอม
* @param id ไอดของขอม * @param id ไอดของขอม
*/ */
const clickDelete = async (id: string) => { async function clickDelete(id: string) {
dialogMessage( dialogMessage(
$q, $q,
`ลบข้อมูล`, `ลบข้อมูล`,
@ -211,9 +211,9 @@ const clickDelete = async (id: string) => {
async () => await deleteData(id), async () => await deleteData(id),
async () => await getData() async () => await getData()
); );
}; }
// Api // Api
const deleteData = async (id: string) => { async function deleteData(id: string) {
await http await http
.delete(config.API.dischargeByid(id)) .delete(config.API.dischargeByid(id))
.then((res) => { .then((res) => {
@ -225,16 +225,11 @@ const deleteData = async (id: string) => {
.finally(async () => { .finally(async () => {
await getData(); await getData();
}); });
}; }
/** /** Hook */
* Setting Pagination onMounted(async () => {
*/ await getData();
const pagination = ref({
sortBy: "createdAt",
descending: true,
page: 1,
rowsPerPage: 10,
}); });
</script> </script>
<template> <template>

View file

@ -4,17 +4,17 @@ import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import CurrencyInput from "@/components/CurruncyInput.vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { tokenParsed } from "@/plugins/auth";
/**Import type */ /**Import type */
import type { QForm } from "quasar"; import type { QForm } from "quasar";
import type { ResponseDataDetail } from "@/modules/06_retirement/interface/response/discharged"; import type { ResponseDataDetail } from "@/modules/06_retirement/interface/response/discharged";
import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue";
import { tokenParsed } from "@/plugins/auth";
const modalPersonal = ref<boolean>(false); import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue";
const personId = ref<string>(""); import CurrencyInput from "@/components/CurruncyInput.vue";
/** use */ /** use */
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute(); const route = useRoute();
@ -30,6 +30,9 @@ const {
dialogConfirm, dialogConfirm,
} = mixin; } = mixin;
const modalPersonal = ref<boolean>(false);
const personId = ref<string>("");
const myForm = ref<QForm | null>(null); const myForm = ref<QForm | null>(null);
const roleAdmin = ref<boolean>(false); const roleAdmin = ref<boolean>(false);
const edit = ref<boolean>(false); const edit = ref<boolean>(false);
@ -62,17 +65,8 @@ const responseData = ref<ResponseDataDetail>({
fullname: "", fullname: "",
}); });
/** Hook */
onMounted(async () => {
const user = await tokenParsed();
if (user) {
roleAdmin.value = await user.role.includes("placement1");
}
await getData();
});
/** Fnction เรียกข้อมูลจาก API */ /** Fnction เรียกข้อมูลจาก API */
const getData = async () => { async function getData() {
showLoader(); showLoader();
await http await http
.get(config.API.dischargeByid(dataId)) .get(config.API.dischargeByid(dataId))
@ -111,20 +105,20 @@ const getData = async () => {
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
}; }
/** /**
* งก Cancle * งก Cancle
*/ */
const clickCancel = async () => { async function clickCancel() {
await getData(); await getData();
edit.value = false; edit.value = false;
}; }
/** /**
* งก Save * งก Save
*/ */
const conditionSave = async () => { async function conditionSave() {
if (myForm.value !== null) { if (myForm.value !== null) {
myForm.value.validate().then((success) => { myForm.value.validate().then((success) => {
if (success) { if (success) {
@ -139,10 +133,10 @@ const conditionSave = async () => {
} }
}); });
} }
}; }
// //
const saveData = async () => { async function saveData() {
const body = { const body = {
organization: organization.value, organization: organization.value,
reason: reason.value, reason: reason.value,
@ -167,18 +161,18 @@ const saveData = async () => {
await getData(); await getData();
hideLoader(); hideLoader();
}); });
}; }
/** /**
* Function เพ Class เวลา Edit * Function เพ Class เวลา Edit
* @param val เมอเปนEdit จะเปลยน Class * @param val เมอเปนEdit จะเปลยน Class
*/ */
const getClass = (val: boolean) => { function getClass(val: boolean) {
return { return {
"full-width inputgreen cursor-pointer": val, "full-width inputgreen cursor-pointer": val,
"full-width cursor-pointer": !val, "full-width cursor-pointer": !val,
}; };
}; }
function onclickViewinfo(id: string) { function onclickViewinfo(id: string) {
modalPersonal.value = true; modalPersonal.value = true;
@ -188,6 +182,15 @@ function onclickViewinfo(id: string) {
function updatemodalPersonal(modal: boolean) { function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal; modalPersonal.value = modal;
} }
/** Hook */
onMounted(async () => {
const user = await tokenParsed();
if (user) {
roleAdmin.value = await user.role.includes("placement1");
}
await getData();
});
</script> </script>
<template> <template>
<div class="toptitle text-dark col-12 row items-center"> <div class="toptitle text-dark col-12 row items-center">

View file

@ -1,14 +1,16 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, watchEffect } from "vue"; import { ref, computed, watchEffect } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { ResponseItems } from "@/modules/06_retirement/interface/response/Main";
import DialogHeader from "@/modules/06_retirement/components/DialogHeader.vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store"; import { useTransferDataStore } from "@/modules/05_placement/store";
import type { ResponseItems } from "@/modules/06_retirement/interface/response/Main";
import DialogHeader from "@/modules/06_retirement/components/DialogHeader.vue";
/** use */ /** use */
const $q = useQuasar(); const $q = useQuasar();
const { statusText } = useTransferDataStore(); const { statusText } = useTransferDataStore();
@ -126,17 +128,17 @@ const checkSelected = computed(() => {
}); });
//popup //popup
const saveOrder = () => { function saveOrder() {
dialogConfirm( dialogConfirm(
$q, $q,
() => Ordersave(), () => Ordersave(),
"ยืนยันส่งไปออกคำสั่ง", "ยืนยันส่งไปออกคำสั่ง",
"ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?" "ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?"
); );
}; }
// //
const Ordersave = async () => { async function Ordersave() {
const id = selected.value.map((r) => r.id); const id = selected.value.map((r) => r.id);
const body = { const body = {
id, id,
@ -155,17 +157,18 @@ const Ordersave = async () => {
props.fecthlistRecevice?.(); props.fecthlistRecevice?.();
hideLoader(); hideLoader();
}); });
}; }
const emit = defineEmits(["update:filterKeyword2", "update:selected"]); const emit = defineEmits(["update:filterKeyword2", "update:selected"]);
const updateInput = (value: any) => { function updateInput(value: any) {
emit("update:filterKeyword2", value); emit("update:filterKeyword2", value);
}; }
// //
const Reset = () => { function Reset() {
emit("update:filterKeyword2", ""); emit("update:filterKeyword2", "");
}; }
watchEffect(() => { watchEffect(() => {
if (props.modal === true) { if (props.modal === true) {
selected.value = []; selected.value = [];

View file

@ -3,13 +3,16 @@ import { ref, onMounted } from "vue";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import DialogSendToCommand from "@/modules/06_retirement/components/DismissOrder/DialogSendToCommand.vue"; import { useCounterMixin } from "@/stores/mixin";
import type { ResponseData } from "@/modules/06_retirement/interface/response/out";
import { checkPermission } from "@/utils/permissions"; import { checkPermission } from "@/utils/permissions";
import { useTransferDataStore } from "@/modules/05_placement/store";
import type { ResponseData } from "@/modules/06_retirement/interface/response/out";
import DialogSendToCommand from "@/modules/06_retirement/components/DismissOrder/DialogSendToCommand.vue";
/** use */ /** use */
const $q = useQuasar(); const $q = useQuasar();
@ -23,7 +26,6 @@ const {
hideLoader, hideLoader,
success, success,
dialogMessage, dialogMessage,
findOrgNameOld,
} = mixin; } = mixin;
const { statusText } = transferStore; const { statusText } = transferStore;
const modal = ref<boolean>(false); const modal = ref<boolean>(false);
@ -119,11 +121,15 @@ const columns = ref<QTableProps["columns"]>([
format: (val) => statusText(val), format: (val) => statusText(val),
}, },
]); ]);
onMounted(async () => {
await getData(); const pagination = ref({
sortBy: "createdAt",
descending: true,
page: 1,
rowsPerPage: 10,
}); });
const openModalOrder = () => { function openModalOrder() {
openModal(); openModal();
const row = filters.value.filter( const row = filters.value.filter(
(r: ResponseData) => (r: ResponseData) =>
@ -139,10 +145,10 @@ const openModalOrder = () => {
r.date r.date
); );
rows2.value = row; rows2.value = row;
}; }
// //
const getData = async () => { async function getData() {
showLoader(); showLoader();
await http await http
.get(config.API.retirementOut) .get(config.API.retirementOut)
@ -157,9 +163,9 @@ const getData = async () => {
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
}; }
const clickDelete = async (id: string) => { async function clickDelete(id: string) {
dialogMessage( dialogMessage(
$q, $q,
`ลบข้อมูล`, `ลบข้อมูล`,
@ -170,9 +176,9 @@ const clickDelete = async (id: string) => {
async () => await deleteData(id), async () => await deleteData(id),
async () => await getData() async () => await getData()
); );
}; }
const deleteData = async (id: string) => { async function deleteData(id: string) {
await http await http
.delete(config.API.outByid(id)) .delete(config.API.outByid(id))
.then(() => { .then(() => {
@ -184,21 +190,19 @@ const deleteData = async (id: string) => {
.finally(async () => { .finally(async () => {
await getData(); await getData();
}); });
}; }
const openModal = () => (modal.value = true); const openModal = () => (modal.value = true);
const closeModal = () => (modal.value = false); const closeModal = () => (modal.value = false);
const resetFilter = () => { function resetFilter() {
filterKeyword.value = ""; filterKeyword.value = "";
filterKeyword2.value = ""; filterKeyword2.value = "";
filterRef.value.focus(); filterRef.value.focus();
}; }
const pagination = ref({
sortBy: "createdAt", onMounted(async () => {
descending: true, await getData();
page: 1,
rowsPerPage: 10,
}); });
</script> </script>
<template> <template>

View file

@ -2,9 +2,10 @@
import { onMounted, ref } from "vue"; import { onMounted, ref } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { tokenParsed } from "@/plugins/auth"; import { tokenParsed } from "@/plugins/auth";
/**Import type */ /**Import type */
@ -51,7 +52,7 @@ const fullName = ref<string>("");
const status = ref<string>(""); const status = ref<string>("");
// API // API
const getData = async () => { async function getData() {
showLoader(); showLoader();
await http await http
.get(config.API.outByid(dataId)) .get(config.API.outByid(dataId))
@ -81,21 +82,21 @@ const getData = async () => {
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
}; }
/** /**
* งก Cancle * งก Cancle
*/ */
const clickCancel = async () => { async function clickCancel() {
await getData(); await getData();
edit.value = false; edit.value = false;
myForm.value?.resetValidation(); myForm.value?.resetValidation();
}; }
/** /**
* งก Saveจาก API * งก Saveจาก API
*/ */
const onSubmit = async () => { async function onSubmit() {
dialogMessage( dialogMessage(
$q, $q,
"ต้องการแก้ไขข้อมูลหรือไม่?", "ต้องการแก้ไขข้อมูลหรือไม่?",
@ -131,18 +132,18 @@ const onSubmit = async () => {
}, },
undefined undefined
); );
}; }
/** /**
* Function เพ Class เวลา Edit * Function เพ Class เวลา Edit
* @param val เมอเปนEdit จะเปลยน Class * @param val เมอเปนEdit จะเปลยน Class
*/ */
const getClass = (val: boolean) => { function getClass(val: boolean) {
return { return {
"full-width inputgreen cursor-pointer": val, "full-width inputgreen cursor-pointer": val,
"full-width cursor-pointer": !val, "full-width cursor-pointer": !val,
}; };
}; }
/** Hook */ /** Hook */
onMounted(async () => { onMounted(async () => {

View file

@ -2,9 +2,10 @@
import { onMounted, reactive, ref } from "vue"; import { onMounted, reactive, ref } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import type { QForm } from "quasar"; import type { QForm } from "quasar";
@ -116,64 +117,8 @@ const question10Desc = ref<string>("ความคิดเห็นและ
const question10Answer = ref<any>([]); const question10Answer = ref<any>([]);
const question10Score = ref<number>(0); const question10Score = ref<number>(0);
/**
* วเลอกแบบสอบถาม(จำลอง)
*/
const exitFactor = ref<any>([]);
const reasonWork = ref<any>([]);
const adjust = ref<any>([]);
const timeThink = ref<any>();
const realReason = ref<any>("");
const notExitFactor = ref<any>("");
const haveJob = ref<any>();
const suggestFriends = ref<any>();
const futureWork = ref<any>();
const suggestion = ref<any>("");
const suggestFriendsReason = ref("");
const suggestFriends_option = ref<any>([
{ label: "แนะนำ ", value: true },
{ label: "ไม่แนะนำ (ระบุ)", value: false },
]);
const haveJobReason = ref<any>("");
const haveJob_option = ref<any>([
{ label: "มี (ระบุ) ", value: true },
{ label: "ไม่มี", value: false },
]);
const futureWorkReason = ref<any>("");
const futureWork_option = ref<any>([
{ label: "อยาก ", value: true },
{ label: "ไม่อยาก (ระบุ)", value: false },
]);
const adjustOther = ref("");
const adjust_option = ref<any>([
{ label: "อัตราเงินเดือน ", value: 0 },
{ label: "สวัสดิการ", value: 1 },
{ label: "ลักษณะงาน ", value: 2 },
{ label: "ระบบการทำงาน ", value: 3 },
{ label: "ระบบสนับสนุนการปฏิบัติงาน ", value: 4 },
{ label: "การมอบหมายงานที่ชัดเจนและเหมาะสม ", value: 5 },
{ label: "การบริหารงานของผู้บังคับบัญชา", value: 6 },
{ label: "การทำงานเป็นทีมกับเพื่อนร่วมงาน ", value: 7 },
{ label: "ระบบบริหารงานภายในหน่วยงาน ", value: 8 },
{ label: "บรรยากาศในการทำงาน ", value: 9 },
{ label: "การปฏิบัติอย่างเป็นธรรม ", value: 10 },
{ label: "การยอมรับความแตกต่างหลากหลาย ", value: 11 },
{ label: "การดูแลและให้ความช่วยเหลือในช่วงเริ่มต้นปฏิบัติงาน ", value: 12 },
{ label: "การพัฒนาอย่างเป็นระบบและต่อเนื่อง ", value: 13 },
{ label: "โอกาสความก้าวหน้า ", value: 14 },
// { label: " () ", value: 15 },
]);
/**
* HOOK
*/
onMounted(async () => {
await getData();
});
// //
const getData = async () => { async function getData() {
showLoader(); showLoader();
await http await http
.get(config.API.questionExitInterview()) .get(config.API.questionExitInterview())
@ -216,15 +161,15 @@ const getData = async () => {
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
}; }
/** /**
* งกนเชคขอมลกอนคอนเฟร * งกนเชคขอมลกอนคอนเฟร
*/ */
const confirmClick = () => { function confirmClick() {
dialogConfirm($q, () => putData()); dialogConfirm($q, () => putData());
}; }
const putData = () => { function putData() {
const body = { const body = {
question1Desc: question1Desc.value, question1Desc: question1Desc.value,
question1Score: question1Score.value, question1Score: question1Score.value,
@ -279,7 +224,14 @@ const putData = () => {
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
}; }
/**
* HOOK
*/
onMounted(async () => {
await getData();
});
</script> </script>
<template> <template>
<div class="toptitle text-dark col-12 row items-center"> <div class="toptitle text-dark col-12 row items-center">

View file

@ -2,17 +2,17 @@
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue";
import { useQuasar, QForm } from "quasar"; import { useQuasar, QForm } from "quasar";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { checkPermission } from "@/utils/permissions";
/**Import type */
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { ResponseItems } from "@/modules/06_retirement/interface/response/exitInterview"; import type { ResponseItems } from "@/modules/06_retirement/interface/response/exitInterview";
import DialogFooter from "@/modules/05_placement/components/PersonalList/DialogFooter.vue"; import DialogFooter from "@/modules/05_placement/components/PersonalList/DialogFooter.vue";
import DialogHeader from "@/components/DialogHeader.vue";
import { checkPermission } from "@/utils/permissions"; import DialogHeader from "@/components/DialogHeader.vue";
/** use */ /** use */
const $q = useQuasar(); // noti quasar const $q = useQuasar(); // noti quasar
@ -157,16 +157,8 @@ const modal = ref<boolean>(false);
const filterKeyword = ref<string>(""); const filterKeyword = ref<string>("");
const filterRef = ref<any>(null); const filterRef = ref<any>(null);
/** HOOK */
onMounted(async () => {
await fecthlist();
if (columns.value) {
visibleColumns.value = columns.value.map((r: any) => r.name);
}
});
// API // API
const fecthlist = async () => { async function fecthlist() {
showLoader(); showLoader();
await http await http
.get(config.API.listExitInterview()) .get(config.API.listExitInterview())
@ -202,10 +194,10 @@ const fecthlist = async () => {
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
}; }
// //
const saveAppoint = async () => { async function saveAppoint() {
await myForm.value!.validate().then(async (result: boolean) => { await myForm.value!.validate().then(async (result: boolean) => {
if (result) { if (result) {
dialogConfirm($q, async () => { dialogConfirm($q, async () => {
@ -229,13 +221,13 @@ const saveAppoint = async () => {
}); });
} }
}); });
}; }
/** /**
* งก validate DATE ไทย * งก validate DATE ไทย
* @param thaiDate นทไทย * @param thaiDate นทไทย
*/ */
const validationDate = (thaiDate: string | null) => { function validationDate(thaiDate: string | null) {
if (thaiDate && daterow.value) { if (thaiDate && daterow.value) {
let a = convertThaiDateToNumeric(thaiDate); let a = convertThaiDateToNumeric(thaiDate);
let b = daterow.value; let b = daterow.value;
@ -243,10 +235,10 @@ const validationDate = (thaiDate: string | null) => {
return a > b; return a > b;
} }
} }
}; }
// //
const convertThaiDateToNumeric = (thaiDate: string) => { function convertThaiDateToNumeric(thaiDate: string) {
const parts = thaiDate.split(" "); const parts = thaiDate.split(" ");
if (parts.length !== 3) return null; if (parts.length !== 3) return null;
const [day, month, year] = parts; const [day, month, year] = parts;
@ -267,22 +259,31 @@ const convertThaiDateToNumeric = (thaiDate: string) => {
if (!(month in monthMap)) return null; if (!(month in monthMap)) return null;
const numericDate = `${year}${monthMap[month]}${day}`; const numericDate = `${year}${monthMap[month]}${day}`;
return numericDate; return numericDate;
}; }
/** /**
* modal Setting * modal Setting
*/ */
const openModal = () => (modal.value = true); const openModal = () => (modal.value = true);
const closeModal = () => (modal.value = false); const closeModal = () => (modal.value = false);
const resetFilter = () => { function resetFilter() {
filterKeyword.value = ""; filterKeyword.value = "";
filterRef.value.focus(); filterRef.value.focus();
}; }
const openModalCalendar = (rows: any) => {
function openModalCalendar(rows: any) {
openModal(); openModal();
dateBreak.value = null; dateBreak.value = null;
id.value = rows.id; id.value = rows.id;
daterow.value = convertThaiDateToNumeric(rows.datetext); daterow.value = convertThaiDateToNumeric(rows.datetext);
}; }
/** HOOK */
onMounted(async () => {
await fecthlist();
if (columns.value) {
visibleColumns.value = columns.value.map((r: any) => r.name);
}
});
</script> </script>
<template v-slot:body="props"> <template v-slot:body="props">
<div class="toptitle text-dark col-12 row items-center"> <div class="toptitle text-dark col-12 row items-center">
@ -445,9 +446,7 @@ const openModalCalendar = (rows: any) => {
</div> </div>
</q-td> </q-td>
<q-td key="appointDate" :props="props"> <q-td key="appointDate" :props="props">
{{ {{ props.row.appointDate ? props.row.appointDate : "-" }}
props.row.appointDate ? props.row.appointDate : "-"
}}
</q-td> </q-td>
<q-td key="datetext" :props="props"> <q-td key="datetext" :props="props">
{{ props.row.datetext ? props.row.datetext : "-" }} {{ props.row.datetext ? props.row.datetext : "-" }}

View file

@ -2,15 +2,17 @@
import { onMounted, reactive, ref, watch } from "vue"; import { onMounted, reactive, ref, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { tokenParsed } from "@/plugins/auth"; import { tokenParsed } from "@/plugins/auth";
import { useCounterMixin } from "@/stores/mixin";
/**import type*/ /**import type*/
import type { import type {
OptionQuestions, OptionQuestions,
OptionQuestions2, OptionQuestions2,
QuestionDesc,
} from "@/modules/06_retirement/interface/request/Main"; } from "@/modules/06_retirement/interface/request/Main";
import type { QForm } from "quasar"; import type { QForm } from "quasar";
@ -80,18 +82,29 @@ const haveJobReason = ref<any>("");
const futureWorkReason = ref<any>(""); const futureWorkReason = ref<any>("");
const adjustOther = ref(""); const adjustOther = ref("");
/** HOOK */ //
onMounted(async () => { const questionDesc = reactive<QuestionDesc>({
const user = await tokenParsed(); question1Desc: "",
if (user) { question2Desc: "",
roleAdmin.value = await user.role.includes("placement1"); question3Desc: "",
} question4Desc: "",
await getData(); question5Desc: "",
await fecthquestion(); question6Desc: "",
question7Desc: "",
question8Desc: "",
question9Desc: "",
question10Desc: "",
}); });
const question1Answer = ref<OptionQuestions[]>([]);
const question2Answer = ref<OptionQuestions[]>([]);
const question3Answer = ref<OptionQuestions[]>([]);
const question4Answer = ref<OptionQuestions[]>([]);
const question7Answer = ref<OptionQuestions2[]>([]);
const question8Answer = ref<OptionQuestions2[]>([]);
const question9Answer = ref<OptionQuestions2[]>([]);
// //
const getData = async () => { async function getData() {
showLoader(); showLoader();
await http await http
.get(config.API.ExitInterviewByid(dataId)) .get(config.API.ExitInterviewByid(dataId))
@ -133,29 +146,8 @@ const getData = async () => {
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
}; }
//
const questionDesc = reactive<any>([
{
question1Desc: "",
question2Desc: "",
question3Desc: "",
question4Desc: "",
question5Desc: "",
question6Desc: "",
question7Desc: "",
question8Desc: "",
question9Desc: "",
question10Desc: "",
},
]);
const question1Answer = ref<OptionQuestions[]>([]);
const question2Answer = ref<OptionQuestions[]>([]);
const question3Answer = ref<OptionQuestions[]>([]);
const question4Answer = ref<OptionQuestions[]>([]);
const question7Answer = ref<OptionQuestions2[]>([]);
const question8Answer = ref<OptionQuestions2[]>([]);
const question9Answer = ref<OptionQuestions2[]>([]);
async function fecthquestion() { async function fecthquestion() {
showLoader(); showLoader();
await http await http
@ -164,8 +156,8 @@ async function fecthquestion() {
const data = await result.data.result; const data = await result.data.result;
// //
for (let i = 1; i <= 10; i++) { for (let i = 1; i <= 10; i++) {
questionDesc[`question${i}Desc`] = const key = `question${i}Desc` as keyof QuestionDesc;
`${i}.` + " " + data[`question${i}Desc`]; questionDesc[key] = `${i}.` + " " + data[key];
} }
// //
const Answer1 = data.question1Answer.map((e: any, index: number) => ({ const Answer1 = data.question1Answer.map((e: any, index: number) => ({
@ -227,17 +219,11 @@ async function fecthquestion() {
hideLoader(); hideLoader();
}); });
} }
//
watch(score, () => {
scoreTotal.value = score.reduce((accumulator, object) => {
return accumulator + Number(object.score);
}, 0);
});
/** /**
* นทกใหคะเเนน * นทกใหคะเเนน
*/ */
const saveClick = () => { function saveClick() {
if ( if (
comment.value === "" || comment.value === "" ||
score[0].score === "" || score[0].score === "" ||
@ -256,12 +242,12 @@ const saveClick = () => {
} else { } else {
dialogConfirm($q, () => putData()); dialogConfirm($q, () => putData());
} }
}; }
/** /**
* งคะเเนนผาน API * งคะเเนนผาน API
*/ */
const putData = () => { function putData() {
const body = { const body = {
score1: Number(score[0].score), score1: Number(score[0].score),
score2: Number(score[1].score), score2: Number(score[1].score),
@ -289,7 +275,24 @@ const putData = () => {
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
}; }
//
watch(score, () => {
scoreTotal.value = score.reduce((accumulator, object) => {
return accumulator + Number(object.score);
}, 0);
});
/** HOOK */
onMounted(async () => {
const user = await tokenParsed();
if (user) {
roleAdmin.value = await user.role.includes("placement1");
}
await getData();
await fecthquestion();
});
</script> </script>
<template> <template>

View file

@ -1,12 +1,15 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, watchEffect } from "vue"; import { ref, computed, watchEffect } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar";
import type { ResponseItems } from "@/modules/06_retirement/interface/response/Main";
import DialogHeader from "@/modules/06_retirement/components/DialogHeader.vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar";
import type { ResponseItems } from "@/modules/06_retirement/interface/response/Main";
import DialogHeader from "@/modules/06_retirement/components/DialogHeader.vue";
/** use */ /** use */
const $q = useQuasar(); const $q = useQuasar();
@ -101,17 +104,17 @@ const checkSelected = computed(() => {
}); });
//popup //popup
const saveOrder = () => { function saveOrder() {
dialogConfirm( dialogConfirm(
$q, $q,
() => Ordersave(), () => Ordersave(),
"ยืนยันส่งไปออกคำสั่ง", "ยืนยันส่งไปออกคำสั่ง",
"ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?" "ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?"
); );
}; }
// //
const Ordersave = async () => { async function Ordersave() {
const id = selected.value.map((r) => r.id); const id = selected.value.map((r) => r.id);
const body = { const body = {
id, id,
@ -130,16 +133,18 @@ const Ordersave = async () => {
props.getData?.(); props.getData?.();
hideLoader(); hideLoader();
}); });
}; }
const emit = defineEmits(["update:filterKeyword2", "update:selected"]); const emit = defineEmits(["update:filterKeyword2", "update:selected"]);
const updateInput = (value: any) => { function updateInput(value: any) {
emit("update:filterKeyword2", value); emit("update:filterKeyword2", value);
}; }
// //
const Reset = () => { function Reset() {
emit("update:filterKeyword2", ""); emit("update:filterKeyword2", "");
}; }
watchEffect(() => { watchEffect(() => {
if (props.modal === true) { if (props.modal === true) {
selected.value = []; selected.value = [];

View file

@ -3,14 +3,16 @@ import { ref, onMounted } from "vue";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useRetirementDataStore } from "@/modules/06_retirement/store";
import DialogSendToCommand from "@/modules/06_retirement/components/Expulsion/DialogSendToCommand.vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useRetirementDataStore } from "@/modules/06_retirement/store";
import type { ResponseData } from "@/modules/06_retirement/interface/response/expulsion"; import type { ResponseData } from "@/modules/06_retirement/interface/response/expulsion";
import DialogSendToCommand from "@/modules/06_retirement/components/Expulsion/DialogSendToCommand.vue";
/** use */ /** use */
const $q = useQuasar(); const $q = useQuasar();
const router = useRouter(); const router = useRouter();
@ -51,6 +53,14 @@ const resetFilter = () => {
const rows = ref<ResponseData[]>([]); const rows = ref<ResponseData[]>([]);
const rows2 = ref<ResponseData[]>([]); const rows2 = ref<ResponseData[]>([]);
const filters = ref<ResponseData[]>([]); const filters = ref<ResponseData[]>([]);
/** Setting Pagination */
const pagination = ref({
sortBy: "createdAt",
descending: true,
page: 1,
rowsPerPage: 10,
});
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "no", name: "no",
@ -117,15 +127,12 @@ const columns = ref<QTableProps["columns"]>([
}, },
]); ]);
/** HOOK */
onMounted(async () => {
await getData();
});
/** /**
* งก modal * งก modal
*/ */
const openModalOrder = () => { const openModal = () => (modal.value = true);
const closeModal = () => (modal.value = false);
function openModalOrder() {
openModal(); openModal();
const row = filters.value.filter( const row = filters.value.filter(
(r: ResponseData) => (r: ResponseData) =>
@ -141,14 +148,12 @@ const openModalOrder = () => {
r.date r.date
); );
rows2.value = row; rows2.value = row;
}; }
const openModal = () => (modal.value = true);
const closeModal = () => (modal.value = false);
/** /**
* นำขอมลมาจาก API * นำขอมลมาจาก API
*/ */
const getData = async () => { async function getData() {
showLoader(); showLoader();
await http await http
.get(config.API.retirementExpulsion) .get(config.API.retirementExpulsion)
@ -188,13 +193,13 @@ const getData = async () => {
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
}; }
/** /**
* ลบขอม * ลบขอม
* @param id ไอดอม * @param id ไอดอม
*/ */
const clickDelete = async (id: string) => { async function clickDelete(id: string) {
dialogRemove( dialogRemove(
$q, $q,
async () => { async () => {
@ -203,9 +208,9 @@ const clickDelete = async (id: string) => {
`ลบข้อมูล`, `ลบข้อมูล`,
`ต้องการทำการลบข้อมูลนี้ใช่หรือไม่?` `ต้องการทำการลบข้อมูลนี้ใช่หรือไม่?`
); );
}; }
//API //API
const deleteData = async (id: string) => { async function deleteData(id: string) {
await http await http
.delete(config.API.expulsionByid(id)) .delete(config.API.expulsionByid(id))
.then((res) => { .then((res) => {
@ -218,14 +223,11 @@ const deleteData = async (id: string) => {
hideLoader(); hideLoader();
await getData(); await getData();
}); });
}; }
/** Setting Pagination */ /** HOOK */
const pagination = ref({ onMounted(async () => {
sortBy: "createdAt", await getData();
descending: true,
page: 1,
rowsPerPage: 10,
}); });
</script> </script>
<template> <template>

View file

@ -2,19 +2,20 @@
import { onMounted, ref } from "vue"; import { onMounted, ref } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import CurrencyInput from "@/components/CurruncyInput.vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { tokenParsed } from "@/plugins/auth"; import { tokenParsed } from "@/plugins/auth";
/**Import Type */ /**Import Type */
import type { QForm } from "quasar"; import type { QForm } from "quasar";
import type { ResponseDataDetail } from "@/modules/06_retirement/interface/response/expulsion"; import type { ResponseDataDetail } from "@/modules/06_retirement/interface/response/expulsion";
import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue";
const modalPersonal = ref<boolean>(false); import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue";
const personId = ref<string>(""); import CurrencyInput from "@/components/CurruncyInput.vue";
/** Use */ /** Use */
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute(); const route = useRoute();
@ -30,6 +31,9 @@ const {
dialogConfirm, dialogConfirm,
} = mixin; } = mixin;
const modalPersonal = ref<boolean>(false);
const personId = ref<string>("");
/**ตัวแปร */ /**ตัวแปร */
const myForm = ref<QForm | null>(null); const myForm = ref<QForm | null>(null);
const roleAdmin = ref<boolean>(false); const roleAdmin = ref<boolean>(false);
@ -61,19 +65,10 @@ const responseData = ref<ResponseDataDetail>({
fullname: "", fullname: "",
}); });
/**Hook */
onMounted(async () => {
const user = await tokenParsed();
if (user) {
roleAdmin.value = await user.role.includes("placement1");
}
await getData();
});
/** /**
* นำขอมลมาจาก API * นำขอมลมาจาก API
*/ */
const getData = async () => { async function getData() {
showLoader(); showLoader();
await http await http
.get(config.API.expulsionByid(dataId)) .get(config.API.expulsionByid(dataId))
@ -115,18 +110,18 @@ const getData = async () => {
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
}; }
/**ฟังก์ชั่นcancel */ /**ฟังก์ชั่นcancel */
const clickCancel = async () => { async function clickCancel() {
await getData(); await getData();
edit.value = false; edit.value = false;
}; }
/** /**
* Functionบนท * Functionบนท
*/ */
const conditionSave = async () => { async function conditionSave() {
if (myForm.value !== null) { if (myForm.value !== null) {
myForm.value.validate().then((success) => { myForm.value.validate().then((success) => {
if (success) { if (success) {
@ -141,9 +136,9 @@ const conditionSave = async () => {
} }
}); });
} }
}; }
//Save Api //Save Api
const saveData = async () => { async function saveData() {
const body = { const body = {
organization: organization.value, organization: organization.value,
reason: reason.value, reason: reason.value,
@ -168,18 +163,18 @@ const saveData = async () => {
await getData(); await getData();
hideLoader(); hideLoader();
}); });
}; }
/** /**
* Function เพ Class เวลา Edit * Function เพ Class เวลา Edit
* @param val เมอเปนEdit จะเปลยน Class * @param val เมอเปนEdit จะเปลยน Class
*/ */
const getClass = (val: boolean) => { function getClass(val: boolean) {
return { return {
"full-width inputgreen cursor-pointer": val, "full-width inputgreen cursor-pointer": val,
"full-width cursor-pointer": !val, "full-width cursor-pointer": !val,
}; };
}; }
function onclickViewinfo(id: string) { function onclickViewinfo(id: string) {
modalPersonal.value = true; modalPersonal.value = true;
@ -189,6 +184,15 @@ function onclickViewinfo(id: string) {
function updatemodalPersonal(modal: boolean) { function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal; modalPersonal.value = modal;
} }
/**Hook */
onMounted(async () => {
const user = await tokenParsed();
if (user) {
roleAdmin.value = await user.role.includes("placement1");
}
await getData();
});
</script> </script>
<template> <template>
<div class="toptitle text-dark col-12 row items-center"> <div class="toptitle text-dark col-12 row items-center">
@ -377,20 +381,6 @@ function updatemodalPersonal(modal: boolean) {
</div> </div>
<div class="col-xs-6 col-sm-3 row"> <div class="col-xs-6 col-sm-3 row">
<div class="col-12"> <div class="col-12">
<!-- <q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="salary"
@update:model-value="salary.toLocaleString('en-US')"
:rules="[(val) => !!val || `${'กรุณากรอกเงินเดือน'}`]"
hide-bottom-space
:label="`${'เงินเดือน'}`"
type="number"
/> -->
<CurrencyInput <CurrencyInput
v-model="salary" v-model="salary"
:edit="edit" :edit="edit"

View file

@ -6,6 +6,7 @@ import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import type { PersonData } from "@/modules/06_retirement/interface/index/Main";
import DialogHeader from "@/components/DialogHeader.vue"; import DialogHeader from "@/components/DialogHeader.vue";
/** Use */ /** Use */
@ -36,7 +37,6 @@ const props = defineProps({
const modal = ref<boolean>(false); const modal = ref<boolean>(false);
const retireld = ref<any>(); const retireld = ref<any>();
const type = ref<any>(); const type = ref<any>();
const filter = ref<string>("");
/** คอลัมน์ */ /** คอลัมน์ */
const columns = ref<any["columns"]>([ const columns = ref<any["columns"]>([
@ -76,22 +76,7 @@ const columns = ref<any["columns"]>([
align: "left", align: "left",
}, },
]); ]);
const rows = ref<any[]>([]); const rows = ref<PersonData[]>([]);
watch(modal, () => {
if (modal.value === true) {
retireld.value = props.retireld;
formPagePersonList.page = 1;
formPagePersonList.keyword = "";
if (props.dataProfile) {
if (props.dataProfile.type === "OFFICER") {
type.value = "officer";
} else type.value = "all";
}
fecthProfile();
}
});
function findOrgChildName(obj: any) { function findOrgChildName(obj: any) {
if (obj) { if (obj) {
@ -134,7 +119,7 @@ const maxPage = ref<number>(1);
const totalList = ref<number>(0); const totalList = ref<number>(0);
// fecth profile // fecth profile
const fecthProfile = async () => { async function fecthProfile() {
showLoader(); showLoader();
if (props?.dataProfile?.type === "OFFICER") { if (props?.dataProfile?.type === "OFFICER") {
formPagePersonList.keyword = formPagePersonList.keyword =
@ -200,10 +185,10 @@ const fecthProfile = async () => {
hideLoader(); hideLoader();
}); });
} }
}; }
// //
const clickAdd = (props: any) => { function clickAdd(props: any) {
if (retireld.value == undefined) { if (retireld.value == undefined) {
retireld.value = retireld_params; retireld.value = retireld_params;
} }
@ -227,17 +212,22 @@ const clickAdd = (props: any) => {
"ยืนยันการเพิ่มข้อมูล", "ยืนยันการเพิ่มข้อมูล",
"ต้องการเพิ่มข้อมูลนี้ใช่หรือไม่ ?" "ต้องการเพิ่มข้อมูลนี้ใช่หรือไม่ ?"
); );
}; }
// update retireld // update retireld
const updateListData = (retireld: string, pId: string) => { function updateListData(retireld: string, pId: string) {
props.UpdateListId(retireld, pId); props.UpdateListId(retireld, pId);
}; }
function updatePageSize(newPagination: any) { function updatePageSize(newPagination: any) {
formPagePersonList.page = 1; formPagePersonList.page = 1;
formPagePersonList.pageSize = newPagination.rowsPerPage; formPagePersonList.pageSize = newPagination.rowsPerPage;
} }
function closeDialog() {
modal.value = false;
}
watch( watch(
() => formPagePersonList.pageSize, () => formPagePersonList.pageSize,
() => { () => {
@ -245,9 +235,20 @@ watch(
} }
); );
function closeDialog() { watch(modal, () => {
modal.value = false; if (modal.value === true) {
} retireld.value = props.retireld;
formPagePersonList.page = 1;
formPagePersonList.keyword = "";
if (props.dataProfile) {
if (props.dataProfile.type === "OFFICER") {
type.value = "officer";
} else type.value = "all";
}
fecthProfile();
}
});
</script> </script>
<template> <template>
@ -357,18 +358,6 @@ function closeDialog() {
</div> </div>
</div> </div>
</q-card-section> </q-card-section>
<!-- <q-toolbar class="q-py-md">
<q-toolbar-title class="text-h6">เพมรายช </q-toolbar-title>
<q-btn
icon="close"
unelevated
round
dense
@click="modal = false"
style="color: #ff8080; background-color: #ffdede"
/>
</q-toolbar>
-->
</q-card> </q-card>
</q-dialog> </q-dialog>
</template> </template>

View file

@ -9,6 +9,8 @@ import config from "@/app.config";
import genReport from "@/plugins/genreport"; import genReport from "@/plugins/genreport";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import type { RetirementList } from "@/modules/06_retirement/interface/index/Main";
import DialogHeader from "@/components/DialogHeader.vue"; import DialogHeader from "@/components/DialogHeader.vue";
import DialogPopupReason from "@/components/Dialogs/PopupReason.vue"; import DialogPopupReason from "@/components/Dialogs/PopupReason.vue";
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue"; import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
@ -55,7 +57,7 @@ const dataProfile = ref<Object>([]);
/** คอลัมน์ที่แสดง */ /** คอลัมน์ที่แสดง */
const columns = ref<any["columns"]>([]); const columns = ref<any["columns"]>([]);
const rows = ref<any[]>([]); const rows = ref<RetirementList[]>([]);
const visibleColumns = ref<string[]>([ const visibleColumns = ref<string[]>([
"order", "order",
"name", "name",
@ -71,13 +73,13 @@ const visibleColumns = ref<string[]>([
/** /**
* งกนป Dialog * งกนป Dialog
*/ */
const closeDialog = () => { function closeDialog() {
modalNote.value = false; modalNote.value = false;
modalUpload.value = false; modalUpload.value = false;
}; }
// fecthlist // fecthlist
const fecthlistprofile = async (id: string) => { async function fecthlistprofile(id: string) {
showLoader(); showLoader();
await http await http
.get(config.API.listRetire(id)) .get(config.API.listRetire(id))
@ -191,10 +193,10 @@ const fecthlistprofile = async (id: string) => {
hideLoader(); hideLoader();
}); });
}; }
// //
const fecthCheck = async (id: string) => { async function fecthCheck(id: string) {
await http await http
.get(config.API.checkfileupload(id)) .get(config.API.checkfileupload(id))
.then((res) => { .then((res) => {
@ -203,10 +205,10 @@ const fecthCheck = async (id: string) => {
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
}); });
}; }
// DelProfile // DelProfile
const clickDelete = () => { function clickDelete() {
dialogRemove( dialogRemove(
$q, $q,
async () => { async () => {
@ -230,10 +232,10 @@ const clickDelete = () => {
"ยืนยันการลบข้อมูล", "ยืนยันการลบข้อมูล",
"ต้องการลบข้อมูลนี้ใช่หรือไม่ ?" "ต้องการลบข้อมูลนี้ใช่หรือไม่ ?"
); );
}; }
// //
const saveNote = () => { function saveNote() {
dialogConfirm( dialogConfirm(
$q, $q,
async () => { async () => {
@ -257,18 +259,18 @@ const saveNote = () => {
"ยืนยันการบันทึกข้อมูล", "ยืนยันการบันทึกข้อมูล",
"ต้องการบันทึกข้อมูลนี้ใช่หรือไม่ ?" "ต้องการบันทึกข้อมูลนี้ใช่หรือไม่ ?"
); );
}; }
// ListId // ListId
const UpdateListId = (retireld: string, pId: string) => { function UpdateListId(retireld: string, pId: string) {
profileId.value = pId; profileId.value = pId;
fecthlistprofile(retireld); fecthlistprofile(retireld);
}; }
// //
const backHistory = () => { function backHistory() {
window.history.back(); window.history.back();
}; }
const visibleNote = computed(() => { const visibleNote = computed(() => {
if (note.value === "" || note.value === undefined) { if (note.value === "" || note.value === undefined) {
@ -279,7 +281,7 @@ const visibleNote = computed(() => {
// //
const modalUpload = ref<boolean>(false); const modalUpload = ref<boolean>(false);
const signDate = ref<Date | null>(null); const signDate = ref<Date | null>(null);
const uploadFile = async (event: any, signDate: any) => { async function uploadFile(event: any, signDate: any) {
if (myForm.value !== null) { if (myForm.value !== null) {
myForm.value.validate().then((successmyForm) => { myForm.value.validate().then((successmyForm) => {
if (successmyForm) { if (successmyForm) {
@ -317,7 +319,7 @@ const uploadFile = async (event: any, signDate: any) => {
} }
}); });
} }
}; }
/** /**
* ดาวหโหลด ไฟล * ดาวหโหลด ไฟล
@ -341,7 +343,7 @@ async function downloadAttachment(type: string, id: string) {
} }
// //
const saveEdiitReport = (reason: string) => { function saveEdiitReport(reason: string) {
const formdata = new FormData(); const formdata = new FormData();
formdata.append("Detail", reason); formdata.append("Detail", reason);
dialogConfirm( dialogConfirm(
@ -363,12 +365,12 @@ const saveEdiitReport = (reason: string) => {
"ยืนยันการแก้ไขข้อมูล", "ยืนยันการแก้ไขข้อมูล",
"ต้องการยืนยันการแก้ไขข้อมูลนี้หรือไม่ ?" "ต้องการยืนยันการแก้ไขข้อมูลนี้หรือไม่ ?"
); );
}; }
// popup // popup
const openmodalEditReport = () => { function openmodalEditReport() {
modalEdit.value = true; modalEdit.value = true;
}; }
/** Setting Pagination */ /** Setting Pagination */
const paging = ref<boolean>(true); const paging = ref<boolean>(true);
@ -378,16 +380,21 @@ const pagination = ref({
page: 1, page: 1,
rowsPerPage: 10, rowsPerPage: 10,
}); });
const paginationLabel = (start: number, end: number, total: number) => { function paginationLabel(start: number, end: number, total: number) {
if (paging.value == true) return " " + start + "-" + end + " ใน " + total; if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total; else return start + "-" + end + " ใน " + total;
}; }
/**
* อมลในทะเบยนประว
* @param id คคล
*/
function onclickViewinfo(id: string) { function onclickViewinfo(id: string) {
modalPersonal.value = true; modalPersonal.value = true;
personId.value = id; personId.value = id;
} }
/** ทะเบียนประวัติ */
function updatemodalPersonal(modal: boolean) { function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal; modalPersonal.value = modal;
} }
@ -489,22 +496,6 @@ onMounted(() => {
</q-menu> </q-menu>
<q-tooltip>ดาวนโหลดไฟล</q-tooltip> <q-tooltip>ดาวนโหลดไฟล</q-tooltip>
</q-btn> </q-btn>
<!-- <q-file
bg-color="white"
clearable
outlined
dense
v-model="fileUpload"
accept=".pdf"
:style="fileUpload === null ? 'width: 150px' : 'width: auto'"
label="อัปโหลดไฟล์"
v-if="statusUpload !== true"
>
<template v-slot:prepend>
<q-icon color="light-blue" name="attach_file" />
<q-tooltip>ปโหลดไฟล</q-tooltip>
</template>
</q-file> -->
</div> </div>
<q-space /> <q-space />
<div class="row"> <div class="row">

View file

@ -1,10 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import type { RoundData } from "@/modules/06_retirement/interface/index/Main";
/** Use */ /** Use */
const $q = useQuasar(); const $q = useQuasar();
@ -33,11 +36,11 @@ const props = defineProps({
const modal = ref<boolean>(false); const modal = ref<boolean>(false);
const radio = ref<string>(""); const radio = ref<string>("");
const actionOption = ref<any>([]); const actionOption = ref<RoundData[]>([]);
const action = ref<string>(""); const action = ref<string>("");
// //
const clickAdd = () => { function clickAdd() {
if (props.rows) { if (props.rows) {
// //
if (props.rows.length == 0) { if (props.rows.length == 0) {
@ -61,13 +64,14 @@ const clickAdd = () => {
round: `รอบ ${e.round} (ประกาศ ณ วันที่ ${e.signDate})`, round: `รอบ ${e.round} (ประกาศ ณ วันที่ ${e.signDate})`,
})); }));
actionOption.value = list; actionOption.value = list;
console.log("🚀 ~ clickAdd ~ actionOption.value:", actionOption.value);
} }
} }
} }
}; }
// //
const clickSelect = async (action: string) => { async function clickSelect(action: string) {
dialogConfirm( dialogConfirm(
$q, $q,
async () => { async () => {
@ -83,10 +87,10 @@ const clickSelect = async (action: string) => {
"ยืนยันการแก้ไขข้อมูลประกาศเกษียณ", "ยืนยันการแก้ไขข้อมูลประกาศเกษียณ",
"ต้องการแก้ไขข้อมูลประกาศเกษียณใช่หรือไม่ ?" "ต้องการแก้ไขข้อมูลประกาศเกษียณใช่หรือไม่ ?"
); );
}; }
// API // API
const cerateRetirement = async (data: object) => { async function cerateRetirement(data: object) {
await http await http
.post(config.API.createProfile(), data) .post(config.API.createProfile(), data)
.then((res) => { .then((res) => {
@ -97,7 +101,7 @@ const cerateRetirement = async (data: object) => {
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
}); });
}; }
</script> </script>
<template> <template>
<q-btn <q-btn

View file

@ -2,27 +2,27 @@
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { checkPermission } from "@/utils/permissions"; import { checkPermission } from "@/utils/permissions";
/** Use */ /** Use */
const router = useRouter();
const $q = useQuasar(); const $q = useQuasar();
const router = useRouter();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { const { showLoader, hideLoader, messageError, date2Thai, findOrgName } = mixin;
showLoader,
hideLoader,
messageError,
success,
date2Thai,
findOrgName,
} = mixin;
/** คอลัมน์ */ /** คอลัมน์ */
const rows = ref<any[]>([]); const rows = ref<any[]>([]);
const pagination = ref({
sortBy: "createdAt",
descending: true,
page: 1,
rowsPerPage: 10,
});
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "no", name: "no",
@ -74,16 +74,6 @@ const columns = ref<QTableProps["columns"]>([
return name; return name;
}, },
}, },
// {
// name: "positionExecutive",
// align: "left",
// label: "",
// sortable: true,
// field: "positionExecutive",
// headerStyle: "font-size: 14px",
// style: "font-size: 14px",
// },
{ {
name: "org", name: "org",
align: "left", align: "left",
@ -120,13 +110,8 @@ const visibleColumns = ref<string[]>([
"createdAt", "createdAt",
]); ]);
/**Hook */
onMounted(() => {
fectListDecased();
});
/**เรียกข้อมูลจาก APi */ /**เรียกข้อมูลจาก APi */
const fectListDecased = async () => { async function fectListDecased() {
showLoader(); showLoader();
await http await http
.get(config.API.listDeceased()) .get(config.API.listDeceased())
@ -140,25 +125,24 @@ const fectListDecased = async () => {
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
}; }
// //
const filterKeyword = ref<string>(""); const filterKeyword = ref<string>("");
const filterRef = ref<any>(null); const filterRef = ref<any>(null);
const resetFilter = () => { function resetFilter() {
filterKeyword.value = ""; filterKeyword.value = "";
filterRef.value.focus(); filterRef.value.focus();
}; }
/** Setting Pagination */ /** Setting Pagination */
const nextPage = (id: string) => { function nextPage(id: string) {
router.push("/retirement/deceased/" + id); router.push("/retirement/deceased/" + id);
}; }
const pagination = ref({
sortBy: "createdAt", /**Hook */
descending: true, onMounted(() => {
page: 1, fectListDecased();
rowsPerPage: 10,
}); });
</script> </script>
<template> <template>

View file

@ -1,22 +1,18 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, reactive } from "vue"; import { ref, onMounted, reactive } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin"; import { useRouter, useRoute } from "vue-router";
import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue";
import type { QInput, QForm } from "quasar"; import type { QInput, QForm } from "quasar";
import type { treeTab } from "@/modules/05_placement/interface/index/Main";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { import type {
requestSendNoti, requestSendNoti,
DataCopyOrder, DataCopyOrder,
FormActive,
ResponseOrganiz,
OrgTree,
TreeMain,
} from "@/modules/06_retirement/interface/response/Deceased"; } from "@/modules/06_retirement/interface/response/Deceased";
import { useRouter, useRoute } from "vue-router";
import DialogOrgSelectOneStep from "@/components/Dialogs/DialogOrgSelectOneStep.vue"; import DialogOrgSelectOneStep from "@/components/Dialogs/DialogOrgSelectOneStep.vue";
@ -45,7 +41,6 @@ const props = defineProps({
default: () => console.log("not function"), default: () => console.log("not function"),
}, },
}); });
const itemTaps = ref<string[]>();
const profileId = ref<string>(route.params.id.toString()); const profileId = ref<string>(route.params.id.toString());
const next = () => props.next(); const next = () => props.next();
@ -55,24 +50,10 @@ const filterRef = ref<QInput>();
const filter = ref<string>(""); const filter = ref<string>("");
const modalSelectOrg = ref<boolean>(false); const modalSelectOrg = ref<boolean>(false);
const nodes = ref<Array<OrgTree>>([]);
const selectedModal = ref<any[]>([]); const selectedModal = ref<any[]>([]);
const rows = ref<DataCopyOrder[]>([]); const rows = ref<DataCopyOrder[]>([]);
const editRows = ref<DataCopyOrder[]>([]); const editRows = ref<DataCopyOrder[]>([]);
/** active form */
const formActive = reactive<FormActive>({
activeId: "",
activeName: "",
draftId: "",
draftName: "",
orgPublishDate: null,
isPublic: false,
});
/** คอลัมน์Modal */
const rowsModal = ref<ResponseOrganiz[]>([]);
/** selcet OPtion */ /** selcet OPtion */
const optionSelect = ref<any>([ const optionSelect = ref<any>([
{ id: 1, name: "อีเมล" }, { id: 1, name: "อีเมล" },
@ -139,13 +120,8 @@ const columns = ref<QTableProps["columns"]>([
}, },
]); ]);
/** Hook */
onMounted(async () => {
await getData();
});
/** เรียกข้อมูลจาก api */ /** เรียกข้อมูลจาก api */
const getData = async () => { async function getData() {
showLoader(); showLoader();
await http await http
.get(config.API.detailByidDeceased(profileId.value)) .get(config.API.detailByidDeceased(profileId.value))
@ -189,7 +165,7 @@ const getData = async () => {
.finally(async () => { .finally(async () => {
hideLoader(); hideLoader();
}); });
}; }
/** /**
*งก Save *งก Save
@ -213,22 +189,22 @@ async function saveData() {
}); });
} }
const resetFilter = () => { function resetFilter() {
// reset X // reset X
filter.value = ""; filter.value = "";
filterRef.value!.focus(); filterRef.value!.focus();
}; }
/** /**
* class ดรปแบบแสดงระหวางขอมลทแกไขหรอแสดงเฉยๆ * class ดรปแบบแสดงระหวางขอมลทแกไขหรอแสดงเฉยๆ
* @param val อม input สำหรบแกไขหรอไม * @param val อม input สำหรบแกไขหรอไม
*/ */
const getClass = (val: boolean) => { function getClass(val: boolean) {
return { return {
"full-width inputgreen cursor-pointer": val, "full-width inputgreen cursor-pointer": val,
"full-width cursor-pointer": !val, "full-width cursor-pointer": !val,
}; };
}; }
/** /**
* กดปมเพมดานบน table * กดปมเพมดานบน table
@ -243,67 +219,12 @@ function clickAdd() {
/** /**
* ลบขอม * ลบขอม
*/ */
const clickDelete = (id: string) => { function clickDelete(id: string) {
dialogRemove($q, () => deleteData(id)); dialogRemove($q, () => deleteData(id));
};
/** ดึงข้อมูล active */
async function getActive() {
showLoader();
await http
.get(config.API.activeOrganization)
.then((res) => {
const data = res.data.result;
formActive.activeId = data.activeId;
formActive.activeName = data.activeName;
formActive.draftId = data.draftId;
formActive.draftName = data.draftName;
formActive.orgPublishDate = data.orgPublishDate;
formActive.isPublic = data.isPublic;
getTreeData(data.activeId);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/** ดึงข้อมูล หน่วยงาน */
async function getTreeData(id: string) {
showLoader();
await http
.get(config.API.orgByIdSystem(id, route.meta.Key as string))
.then((res) => {
const data = res.data.result;
nodes.value = data;
filterItemsTaps(data);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
function filterItemsTaps(data: TreeMain[]) {
let orgTreeIds: string[] = [];
for (const child of data) {
orgTreeIds.push(child.orgTreeId);
if (child.children) {
orgTreeIds = orgTreeIds.concat(filterItemsTaps(child.children));
}
}
itemTaps.value = orgTreeIds;
return orgTreeIds;
} }
/**ลบข้อมูล */ /**ลบข้อมูล */
const deleteData = async (id: string) => { async function deleteData(id: string) {
await http await http
.delete(config.API.detailByidDeceased(id)) .delete(config.API.detailByidDeceased(id))
.then((res) => { .then((res) => {
@ -315,12 +236,12 @@ const deleteData = async (id: string) => {
.finally(async () => { .finally(async () => {
await getData(); await getData();
}); });
}; }
/** /**
* Save อม * Save อม
*/ */
const saveDataCopyOrder = async () => { async function saveDataCopyOrder() {
if (myForm.value !== null) { if (myForm.value !== null) {
myForm.value.validate().then(async (result: boolean) => { myForm.value.validate().then(async (result: boolean) => {
if (result) { if (result) {
@ -333,9 +254,9 @@ const saveDataCopyOrder = async () => {
} }
}); });
} }
}; }
// Save // Save
const fetchSaveCopyOrder = async () => { async function fetchSaveCopyOrder() {
let list: requestSendNoti[] = []; let list: requestSendNoti[] = [];
rows.value.map((r: DataCopyOrder) => { rows.value.map((r: DataCopyOrder) => {
list.push({ list.push({
@ -359,10 +280,16 @@ const fetchSaveCopyOrder = async () => {
hideLoader(); hideLoader();
getData(); getData();
}); });
}; }
const updateData = (row: DataCopyOrder) => {
function updateData(row: DataCopyOrder) {
editRows.value.push(row); editRows.value.push(row);
}; }
/** Hook */
onMounted(async () => {
await getData();
});
</script> </script>
<template> <template>

View file

@ -2,21 +2,18 @@
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import genReport from "@/plugins/genreport";
/** importType*/
import type { DataProfile } from "@/modules/05_placement/interface/index/Main";
import type { ResDetailDeceased } from "@/modules/06_retirement/interface/response/Deceased";
/** importComponents*/
import CardProfile from "@/components/CardProfile.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { checkPermission } from "@/utils/permissions"; import { checkPermission } from "@/utils/permissions";
import genReport from "@/plugins/genreport"; import type { DataProfile } from "@/modules/05_placement/interface/index/Main";
import type { ResDetailDeceased } from "@/modules/06_retirement/interface/response/Deceased";
import CardProfile from "@/components/CardProfile.vue";
/**use*/ /**use*/
const $q = useQuasar(); const $q = useQuasar();
@ -30,13 +27,8 @@ const detail = ref<ResDetailDeceased>();
const dataProfile = ref<DataProfile>(); const dataProfile = ref<DataProfile>();
/** Hook */ /** นำข้อมูลจาก API มาแสดง */
onMounted(() => { async function fetchData() {
fetchData();
});
// API
const fetchData = async () => {
showLoader(); showLoader();
await http await http
.get(config.API.detailDeceased(profileId.value)) .get(config.API.detailDeceased(profileId.value))
@ -52,23 +44,23 @@ const fetchData = async () => {
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
}; }
//detail deceased /** เปิดdetail ของ deceased */
const openDeceased = (id: string) => { function openDeceased(id: string) {
router.push(`/retirement/deceased/detail/${id}`); router.push(`/retirement/deceased/detail/${id}`);
}; }
// /** ไปหน้าถัดไป */
const nextPage = (page: string) => { function nextPage(page: string) {
window.open(page, "_blank"); window.open(page, "_blank");
}; }
/** /**
* งก ดาวโหลด * งก ดาวโหลด
* @param type typeของรายละเอยด * @param type typeของรายละเอยด
*/ */
const fileDownload = async (type: string) => { async function fileDownload(type: string) {
showLoader(); showLoader();
await http await http
.get(config.API.DeceasedReport(type, profileId.value)) .get(config.API.DeceasedReport(type, profileId.value))
@ -86,7 +78,12 @@ const fileDownload = async (type: string) => {
hideLoader(); hideLoader();
}) })
.finally(() => {}); .finally(() => {});
}; }
/** Hook */
onMounted(() => {
fetchData();
});
</script> </script>
<template> <template>

View file

@ -1,21 +1,39 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, watchEffect } from "vue"; import { ref, computed, watchEffect } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { ResponseItems } from "@/modules/06_retirement/interface/response/Main";
import DialogHeader from "@/components/DialogHeader.vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import type { ResponseItems } from "@/modules/06_retirement/interface/response/Main";
import DialogHeader from "@/components/DialogHeader.vue";
/** use */ /** use */
const $q = useQuasar(); const $q = useQuasar();
const selected = ref<ResponseItems[]>([]); const selected = ref<ResponseItems[]>([]);
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { showLoader, success, messageError, dialogConfirm, hideLoader } = mixin; const { showLoader, success, messageError, dialogConfirm, hideLoader } = mixin;
const filterKeyword = ref<string>("");
const filterRef = ref<any>(null); /** props*/
const props = defineProps({
modal: Boolean,
closeModal: Function,
fecthlist: Function,
rows2: Array,
filterKeyword2: String,
});
/**
* งกนการ Selected Data
*/
const checkSelected = computed(() => {
if (selected.value.length === 0) {
return true;
}
});
/** คอลัมน์ */ /** คอลัมน์ */
const columns2 = ref<QTableProps["columns"]>([ const columns2 = ref<QTableProps["columns"]>([
@ -132,41 +150,17 @@ const visibleColumns2 = ref<string[]>([
"statustext", "statustext",
]); ]);
/** props*/ /** popup ยืนยันส่งัว */
const props = defineProps({ function saveOrder() {
modal: Boolean,
closeModal: Function,
fecthlist: Function,
rows2: Array,
filterKeyword2: String,
});
//reset
const resetFilter = () => {
filterKeyword.value = "";
filterRef.value.focus();
};
/**
* งกนการ Selected Data
*/
const checkSelected = computed(() => {
if (selected.value.length === 0) {
return true;
}
});
//popup
const saveOrder = () => {
dialogConfirm( dialogConfirm(
$q, $q,
() => Ordersave(), () => Ordersave(),
"ยืนยันส่งไปออกคำสั่ง", "ยืนยันส่งไปออกคำสั่ง",
"ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?" "ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?"
); );
}; }
// /** ส่งไปออกคำสั่ง */
const Ordersave = async () => { async function Ordersave() {
const id = selected.value.map((r) => r.id); const id = selected.value.map((r) => r.id);
const body = { const body = {
id, id,
@ -185,17 +179,18 @@ const Ordersave = async () => {
props.fecthlist?.(); props.fecthlist?.();
hideLoader(); hideLoader();
}); });
}; }
const emit = defineEmits(["update:filterKeyword2", "update:selected"]); const emit = defineEmits(["update:filterKeyword2", "update:selected"]);
const updateInput = (value: any) => { function updateInput(value: any) {
emit("update:filterKeyword2", value); emit("update:filterKeyword2", value);
}; }
// /** รีเซ็ตค่าในช่องค้นหา */
const Reset = () => { function Reset() {
emit("update:filterKeyword2", ""); emit("update:filterKeyword2", "");
}; }
watchEffect(() => { watchEffect(() => {
if (props.modal === true) { if (props.modal === true) {
selected.value = []; selected.value = [];

View file

@ -1,19 +1,23 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, computed } from "vue"; import { ref, onMounted } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin"; import type { QTableProps } from "quasar";
import { useRetirementDataStore } from "@/modules/06_retirement/store";
import DialogSendToCommand from "@/modules/06_retirement/components/resign/DialogSendToCommand.vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import type { QTableProps } from "quasar"; import { useCounterMixin } from "@/stores/mixin";
import type { ResponseItems } from "@/modules/06_retirement/interface/response/Main"; import { useRetirementDataStore } from "@/modules/06_retirement/store";
import { checkPermission } from "@/utils/permissions"; import { checkPermission } from "@/utils/permissions";
import type { ResponseItems } from "@/modules/06_retirement/interface/response/Main";
import DialogSendToCommand from "@/modules/06_retirement/components/resign/DialogSendToCommand.vue";
/** use */ /** use */
const $q = useQuasar(); // noti quasar
const RetirementData = useRetirementDataStore(); const RetirementData = useRetirementDataStore();
const { statusText } = RetirementData; const { statusText } = RetirementData;
const $q = useQuasar(); // noti quasar
const router = useRouter(); const router = useRouter();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { messageError, date2Thai, showLoader, hideLoader } = mixin; const { messageError, date2Thai, showLoader, hideLoader } = mixin;
@ -144,19 +148,27 @@ const filterRef = ref<any>(null);
const openModal = () => (modal.value = true); const openModal = () => (modal.value = true);
/**Setting pagination */
const pagination = ref({
sortBy: "datetext",
descending: true,
page: 1,
rowsPerPage: 10,
});
// //
const closeModal = () => { function closeModal(){
modal.value = false; modal.value = false;
filterKeyword2.value = ""; filterKeyword2.value = "";
}; };
//reset filter //reset filter
const resetFilter = () => { function resetFilter(){
filterKeyword.value = ""; filterKeyword.value = "";
filterRef.value.focus(); filterRef.value.focus();
}; };
// Modal // Modal
const openModalOrder = async () => { async function openModalOrder(){
openModal(); openModal();
const row = await filters.value.filter( const row = await filters.value.filter(
(r: ResponseItems) => (r: ResponseItems) =>
@ -172,13 +184,8 @@ const openModalOrder = async () => {
rows2.value = row; rows2.value = row;
}; };
/**Hook */
onMounted(async () => {
await fecthlist();
});
// API // API
const fecthlist = async () => { async function fecthlist(){
showLoader(); showLoader();
await http await http
.get(config.API.listResign()) .get(config.API.listResign())
@ -223,12 +230,9 @@ const fecthlist = async () => {
}); });
}; };
/**Setting pagination */ /**Hook */
const pagination = ref({ onMounted(async () => {
sortBy: "datetext", await fecthlist();
descending: true,
page: 1,
rowsPerPage: 10,
}); });
</script> </script>
<template> <template>

View file

@ -1,15 +1,17 @@
<script setup lang="ts"> <script setup lang="ts">
import axios from "axios";
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import { useQuasar, QForm } from "quasar"; import { useQuasar, QForm } from "quasar";
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue";
import DialogFooter from "@/modules/05_placement/components/PersonalList/DialogFooter.vue";
import DialogHeader from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin";
import { useRetirementDataStore } from "@/modules/06_retirement/store";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import axios from "axios"; import genReport from "@/plugins/genreport";
import { tokenParsed } from "@/plugins/auth"; import { tokenParsed } from "@/plugins/auth";
import { useCounterMixin } from "@/stores/mixin";
import DialogFooter from "@/modules/05_placement/components/PersonalList/DialogFooter.vue";
import DialogHeader from "@/components/DialogHeader.vue";
import type { import type {
TypeFile, TypeFile,
@ -18,23 +20,17 @@ import type {
CheckBoxType, CheckBoxType,
} from "@/modules/06_retirement/interface/response/Main"; } from "@/modules/06_retirement/interface/response/Main";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue";
import type { DataProfile } from "@/modules/05_placement/interface/index/Main"; import type { DataProfile } from "@/modules/05_placement/interface/index/Main";
/** importComponents*/ import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue";
import CardProfile from "@/components/CardProfile.vue"; import CardProfile from "@/components/CardProfile.vue";
import genReport from "@/plugins/genreport";
const modalPersonal = ref<boolean>(false);
const personId = ref<string>("");
/** Use */ /** Use */
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const checkRoutePermisson = ref<boolean>(route.name == "resignDetailbyid"); const checkRoutePermisson = ref<boolean>(route.name == "resignDetailbyid");
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const RetirementData = useRetirementDataStore();
const { const {
messageError, messageError,
date2Thai, date2Thai,
@ -45,9 +41,10 @@ const {
dialogConfirm, dialogConfirm,
dialogRemove, dialogRemove,
} = mixin; } = mixin;
const { statusText } = RetirementData;
/** ตัวแปร */ /** ตัวแปร */
const modalPersonal = ref<boolean>(false);
const personId = ref<string>("");
const roleUser = ref<string>(""); const roleUser = ref<string>("");
const dataProfile = ref<DataProfile>(); const dataProfile = ref<DataProfile>();
@ -78,6 +75,7 @@ const dataDetail = ref<any>({
statustext: "", statustext: "",
fullname: "", fullname: "",
}); });
const organizationPositionOld = ref<string>(""); const organizationPositionOld = ref<string>("");
const positionTypeOld = ref<string>(""); const positionTypeOld = ref<string>("");
const positionLevelOld = ref<string>(""); const positionLevelOld = ref<string>("");
@ -135,33 +133,16 @@ const fileList = ref<FileList[]>([]);
const isNoDebt = ref<boolean>(false); const isNoDebt = ref<boolean>(false);
const isNoBurden = ref<boolean>(false); const isNoBurden = ref<boolean>(false);
const isDiscipline = ref<boolean>(false); const isDiscipline = ref<boolean>(false);
const checkboxGroup = ref<CheckBoxType[]>([]);
const checkboxOp = ref<CheckBoxType[]>([ //
{ label: "ไม่เป็นหนี้สหกรณ์", value: "debt" }, const rowsFileDownload = ref<rowFile[]>([
{
fileName: "แบบฟอร์มหนังสือขอลาออกจากราชการ",
pathName: "",
},
]); ]);
/** Hook */ function diffDate() {
onMounted(async () => {
fetchData(id.value);
fetchFile();
const user = await tokenParsed();
if (user) {
const commander = await user.role.includes("commander");
const oligarch = await user.role.includes("oligarch");
const officer = await user.role.includes("officer");
if (commander) {
roleUser.value = "commander";
} else if (oligarch) {
roleUser.value = "oligarch";
} else if (officer) {
roleUser.value = "officer";
} else {
roleUser.value = "admin";
}
}
});
const diffDate = () => {
if (date.value !== null && dateLeave.value !== null) { if (date.value !== null && dateLeave.value !== null) {
const time = dateLeave.value.getTime() - date.value.getTime(); const time = dateLeave.value.getTime() - date.value.getTime();
// - // -
@ -172,10 +153,10 @@ const diffDate = () => {
return false; return false;
} }
return false; return false;
}; }
/** นำข้อมูลมาจาก API*/ /** นำข้อมูลมาจาก API*/
const fetchData = async (id: string) => { async function fetchData(id: string) {
showLoader(); showLoader();
await http await http
.get(config.API.resingByid(id)) .get(config.API.resingByid(id))
@ -216,18 +197,18 @@ const fetchData = async (id: string) => {
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
}; }
/**Pop up */ /**Pop up */
const popUp = (action: "pass" | "passNot") => { function popUp(action: "pass" | "passNot") {
reasonReign.value = ""; reasonReign.value = "";
dateBreak.value = null; dateBreak.value = null;
actionPass.value = action === "pass"; actionPass.value = action === "pass";
openModal(); openModal();
}; }
//pop up //pop up
const conditionPopup = () => { function conditionPopup() {
if (myFormConfirm.value !== null) { if (myFormConfirm.value !== null) {
myFormConfirm.value.validate().then(async (check) => { myFormConfirm.value.validate().then(async (check) => {
if (check) { if (check) {
@ -239,10 +220,10 @@ const conditionPopup = () => {
} }
}); });
} }
}; }
//pop up //pop up
const confirmpopUp = async () => { async function confirmpopUp() {
dialogConfirm( dialogConfirm(
$q, $q,
async () => { async () => {
@ -265,10 +246,10 @@ const confirmpopUp = async () => {
"ยืนยันการอนุญาต", "ยืนยันการอนุญาต",
"ต้องการยืนยันการอนุญาตการลานี้หรือไม่ ?" "ต้องการยืนยันการอนุญาตการลานี้หรือไม่ ?"
); );
}; }
//pop up //pop up
const rejectpopUp = async () => { async function rejectpopUp() {
dialogConfirm( dialogConfirm(
$q, $q,
async () => { async () => {
@ -292,26 +273,26 @@ const rejectpopUp = async () => {
"ยืนยันการยับยั้ง", "ยืนยันการยับยั้ง",
"ต้องการยืนยันการยับยั้งนี้หรือไม่ ?" "ต้องการยืนยันการยับยั้งนี้หรือไม่ ?"
); );
}; }
/** /**
* กดยกเล * กดยกเล
*/ */
const clickCancel = async () => { async function clickCancel() {
await fetchData(id.value); await fetchData(id.value);
edit.value = false; edit.value = false;
myForm.value?.resetValidation(); myForm.value?.resetValidation();
}; }
/** /**
* กดยกเล * กดยกเล
*/ */
const clickCancelConditions = async () => { async function clickCancelConditions() {
await fetchData(id.value); await fetchData(id.value);
conditions.value = false; conditions.value = false;
}; }
/** Function บันทึก รายการตรวจสอบเงื่อนไขต่าง ๆ*/ /** Function บันทึก รายการตรวจสอบเงื่อนไขต่าง ๆ*/
const onSubmitConditions = () => { function onSubmitConditions() {
dialogConfirm($q, () => { dialogConfirm($q, () => {
showLoader(); showLoader();
http http
@ -332,10 +313,10 @@ const onSubmitConditions = () => {
hideLoader(); hideLoader();
}); });
}); });
}; }
/** Function บันทึก ,แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย*/ /** Function บันทึก ,แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย*/
const onSubmitAttached = () => { function onSubmitAttached() {
dialogConfirm($q, () => { dialogConfirm($q, () => {
const formData = new FormData(); const formData = new FormData();
const send = date.value !== null ? new Date(date.value).toUTCString() : ""; const send = date.value !== null ? new Date(date.value).toUTCString() : "";
@ -366,39 +347,31 @@ const onSubmitAttached = () => {
await hideLoader(); await hideLoader();
}); });
}); });
}; }
/** /**
* Function เพ Class เวลา Edit * Function เพ Class เวลา Edit
* @param val เมอเปนEdit จะเปลยน Class * @param val เมอเปนEdit จะเปลยน Class
*/ */
const getClass = (val: boolean) => { function getClass(val: boolean) {
return { return {
"full-width inputgreen cursor-pointer": val, "full-width inputgreen cursor-pointer": val,
"full-width cursor-pointer": !val, "full-width cursor-pointer": !val,
}; };
}; }
/** แปลง StatusOrder */ /** แปลง StatusOrder */
const statusOrder = (val: boolean) => { function statusOrder(val: boolean) {
switch (val) { switch (val) {
case true: case true:
return "ยับยั้ง"; return "ยับยั้ง";
case false: case false:
return "อนุญาต"; return "อนุญาต";
} }
}; }
//
const rowsFileDownload = ref<rowFile[]>([
{
fileName: "แบบฟอร์มหนังสือขอลาออกจากราชการ",
pathName: "",
},
]);
// //
const fileDownload = async (type: string, fileName: string) => { async function fileDownload(type: string, fileName: string) {
showLoader(); showLoader();
await http await http
.get(config.API.reportResignList(type, id.value)) .get(config.API.reportResignList(type, id.value))
@ -412,18 +385,7 @@ const fileDownload = async (type: string, fileName: string) => {
hideLoader(); hideLoader();
}) })
.finally(() => {}); .finally(() => {});
}; }
//
const downloadFile = (response: any, filename: string) => {
const link = document.createElement("a");
var fileName = filename;
link.href = window.URL.createObjectURL(new Blob([response.data]));
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};
function updatemodalPersonal(modal: boolean) { function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal; modalPersonal.value = modal;
@ -541,6 +503,27 @@ function removeFile(fileName: string) {
}); });
}); });
} }
/** Hook */
onMounted(async () => {
fetchData(id.value);
fetchFile();
const user = await tokenParsed();
if (user) {
const commander = await user.role.includes("commander");
const oligarch = await user.role.includes("oligarch");
const officer = await user.role.includes("officer");
if (commander) {
roleUser.value = "commander";
} else if (oligarch) {
roleUser.value = "oligarch";
} else if (officer) {
roleUser.value = "officer";
} else {
roleUser.value = "admin";
}
}
});
</script> </script>
<template> <template>

View file

@ -1,12 +1,15 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, reactive, ref, useAttrs, computed } from "vue"; import { onMounted, reactive, ref, useAttrs, computed } from "vue";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import { useQuasar } from "quasar";
import router from "@/router";
import { useCounterMixin } from "@/stores/mixin";
import type { FormOrderPlacementMainData } from "@/modules/05_placement/interface/request/Main"; import type { FormOrderPlacementMainData } from "@/modules/05_placement/interface/request/Main";
import type { DataOption } from "@/modules/05_placement/interface/index/Main"; import type { DataOption } from "@/modules/05_placement/interface/index/Main";
import { useCounterMixin } from "@/stores/mixin";
import { useOrderPlacementDataStore } from "@/modules/05_placement/store"; import { useOrderPlacementDataStore } from "@/modules/05_placement/store";
import router from "@/router";
import { useQuasar } from "quasar";
/** Use */ /** Use */
const $q = useQuasar(); // noti quasar const $q = useQuasar(); // noti quasar
@ -264,34 +267,25 @@ const rows = ref<FormOrderPlacementMainData[]>([
let OriginalData = ref<FormOrderPlacementMainData[]>([]); let OriginalData = ref<FormOrderPlacementMainData[]>([]);
let UpdataData = ref<FormOrderPlacementMainData[]>([]); let UpdataData = ref<FormOrderPlacementMainData[]>([]);
/**Hook */
onMounted(async () => {
await OriginalDataFetch();
fiscalYearFilter();
searchFilterTable();
OrderStatusFilter();
OrderTypeFilter();
});
/** /**
* งคาขอมลจาก store * งคาขอมลจาก store
*/ */
const OriginalDataFetch = async () => { async function OriginalDataFetch() {
await DataStore.DataMainOrder(rows.value); await DataStore.DataMainOrder(rows.value);
OriginalData.value = await DataStore.DataMainOrigOrder; OriginalData.value = await DataStore.DataMainOrigOrder;
UpdataData.value = OriginalData.value; UpdataData.value = OriginalData.value;
}; }
// //
const redirectToPage = (id?: number) => { function redirectToPage(id?: number) {
router.push(`/placement/order/detail`); router.push(`/placement/order/detail`);
}; }
/** /**
* function delete * function delete
* @param id id delete * @param id id delete
*/ */
const clickDelete = (id: string) => { function clickDelete(id: string) {
$q.dialog({ $q.dialog({
title: "ยืนยันการลบข้อมูล", title: "ยืนยันการลบข้อมูล",
message: "ต้องการลบข้อมูลนี้ใช่หรือไม่?", message: "ต้องการลบข้อมูลนี้ใช่หรือไม่?",
@ -304,18 +298,18 @@ const clickDelete = (id: string) => {
.onOk(async () => {}) .onOk(async () => {})
.onCancel(() => {}) .onCancel(() => {})
.onDismiss(() => {}); .onDismiss(() => {});
}; }
//route OrderplacementDetail //route OrderplacementDetail
const clickAdd = () => { function clickAdd() {
router.push({ name: "OrderplacementDetail" }); router.push({ name: "OrderplacementDetail" });
}; }
// //
const fiscalyear = ref<number | null>(0); const fiscalyear = ref<number | null>(0);
const fiscalyearOP = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]); const fiscalyearOP = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]);
const addedfiscalYearValues: number[] = []; const addedfiscalYearValues: number[] = [];
const fiscalYearFilter = async () => { async function fiscalYearFilter() {
for (let data of OriginalData.value) { for (let data of OriginalData.value) {
const year = data.fiscalYear; const year = data.fiscalYear;
@ -328,7 +322,7 @@ const fiscalYearFilter = async () => {
addedfiscalYearValues.push(year); addedfiscalYearValues.push(year);
} }
} }
}; }
/** /**
* เลอกประเภทคำส * เลอกประเภทคำส
@ -336,7 +330,7 @@ const fiscalYearFilter = async () => {
const OrderType = ref<string>(""); const OrderType = ref<string>("");
const OrderTypeOption = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]); const OrderTypeOption = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]);
const addedOrderTypeValues: string[] = []; const addedOrderTypeValues: string[] = [];
const OrderTypeFilter = async () => { async function OrderTypeFilter() {
for (let data of OriginalData.value) { for (let data of OriginalData.value) {
const OrderTypeValue = data.OrderType; const OrderTypeValue = data.OrderType;
if (!addedOrderTypeValues.includes(OrderTypeValue)) { if (!addedOrderTypeValues.includes(OrderTypeValue)) {
@ -347,7 +341,7 @@ const OrderTypeFilter = async () => {
addedOrderTypeValues.push(OrderTypeValue); addedOrderTypeValues.push(OrderTypeValue);
} }
} }
}; }
/** /**
* เลอกStatus คำส * เลอกStatus คำส
@ -355,7 +349,7 @@ const OrderTypeFilter = async () => {
const OrderStatus = ref<string>(""); const OrderStatus = ref<string>("");
const OrderStatusOption = reactive<DataOption[]>([{ id: 1, name: "ทั้งหมด" }]); const OrderStatusOption = reactive<DataOption[]>([{ id: 1, name: "ทั้งหมด" }]);
const addedOrderStatusValues: string[] = []; const addedOrderStatusValues: string[] = [];
const OrderStatusFilter = async () => { async function OrderStatusFilter() {
for (let data of OriginalData.value) { for (let data of OriginalData.value) {
const OrderStatusValue = data.OrderStatus; const OrderStatusValue = data.OrderStatus;
@ -374,31 +368,42 @@ const OrderStatusFilter = async () => {
addedOrderStatusValues.push(OrderStatusValue); addedOrderStatusValues.push(OrderStatusValue);
} }
} }
}; }
// //
const filterKeyword = ref<string>(""); const filterKeyword = ref<string>("");
const filterRef = ref<any>(null); const filterRef = ref<any>(null);
const resetFilter = () => {
/** ล้างค่าในฟิลเตอร์ */
function resetFilter() {
filterKeyword.value = ""; filterKeyword.value = "";
filterRef.value.focus(); filterRef.value.focus();
}; }
const attrs = ref<any>(useAttrs()); const attrs = ref<any>(useAttrs());
const searchFilterTable = async () => { async function searchFilterTable() {
await DataStore.DataUpdateOrder( await DataStore.DataUpdateOrder(
OrderType.value, OrderType.value,
OrderStatus.value, OrderStatus.value,
fiscalyear.value fiscalyear.value
); );
UpdataData.value = DataStore.DataMainUpdateOrder; UpdataData.value = DataStore.DataMainUpdateOrder;
}; }
/**Setting pagination */ /**Setting pagination */
const paging = ref<boolean>(true); const paging = ref<boolean>(true);
const paginationLabel = (start: string, end: string, total: string) => { function paginationLabel(start: string, end: string, total: string) {
if (paging.value == true) return " " + start + "-" + end + " ใน " + total; if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total; else return start + "-" + end + " ใน " + total;
}; }
/**Hook */
onMounted(async () => {
await OriginalDataFetch();
fiscalYearFilter();
searchFilterTable();
OrderStatusFilter();
OrderTypeFilter();
});
</script> </script>
<template> <template>
<div class="toptitle text-dark col-12 row items-center">คำสงลาออก</div> <div class="toptitle text-dark col-12 row items-center">คำสงลาออก</div>

View file

@ -1,4 +1,48 @@
interface Pagination { interface Pagination {
rowsPerPage: number; rowsPerPage: number;
} }
export type { Pagination };
interface RetirementList {
id: string;
profileId: string;
order: number;
prefix: string;
firstName: string;
lastName: string;
name: string;
organization: string | null;
position: string;
positionNumber: string | null;
positionType: string;
positionLevel: string;
reason: string;
remove: string;
root: string | null;
rootId: string | null;
child1: string | null;
child1Id: string | null;
child2: string | null;
child2Id: string | null;
child3: string | null;
child3Id: string | null;
child4: string | null;
child4Id: string | null;
}
interface PersonData {
id: string;
prefix: string;
firstName: string;
lastName: string;
fullname: string;
position: string;
level: string;
organizationOrganization: string;
}
interface RoundData {
id: string;
round: string;
}
export type { Pagination, RetirementList, PersonData, RoundData };

View file

@ -7,4 +7,17 @@ interface OptionQuestions2 {
value: boolean; value: boolean;
} }
export type { OptionQuestions, OptionQuestions2 }; interface QuestionDesc {
question1Desc: string;
question2Desc: string;
question3Desc: string;
question4Desc: string;
question5Desc: string;
question6Desc: string;
question7Desc: string;
question8Desc: string;
question9Desc: string;
question10Desc: string;
}
export type { OptionQuestions, OptionQuestions2,QuestionDesc };

View file

@ -51,6 +51,7 @@ interface CheckBoxType {
label: string; label: string;
value: string; value: string;
} }
export type { export type {
resMain, resMain,
ResponseItems, ResponseItems,

View file

@ -26,4 +26,21 @@ interface TypeFile {
pathName: string; pathName: string;
} }
export type { ResponseData, TypeFile }; interface ResponseDataDetail {
personId: string;
avataPath: string;
createdAt: Date;
date: Date;
id: string;
organization: string;
organizationPositionOld: string;
positionLevelOld: string;
positionNumberOld: string;
positionTypeOld: string;
reason: string;
salary: number;
status: string;
fullname: string;
}
export type { ResponseData, TypeFile,ResponseDataDetail };

View file

@ -7,8 +7,6 @@ const Listretirement = () =>
import("@/modules/06_retirement/components/ListRetirement/TableList.vue"); import("@/modules/06_retirement/components/ListRetirement/TableList.vue");
const ListretirementDetail = () => const ListretirementDetail = () =>
import("@/modules/06_retirement/components/ListRetirement/TableList.vue"); import("@/modules/06_retirement/components/ListRetirement/TableList.vue");
// const resignOrder = () =>
// import("@/modules/06_retirement/components/resign/ResignOrder.vue");
const resign = () => const resign = () =>
import("@/modules/06_retirement/components/resign/Resign.vue"); import("@/modules/06_retirement/components/resign/Resign.vue");
const resignByid = () => const resignByid = () =>
@ -25,17 +23,6 @@ const outDetail = () =>
import("@/modules/06_retirement/components/DismissOrder/outRegistry.vue"); import("@/modules/06_retirement/components/DismissOrder/outRegistry.vue");
const outDetailOnly = () => const outDetailOnly = () =>
import("@/modules/06_retirement/components/DismissOrder/outRegistry.vue"); import("@/modules/06_retirement/components/DismissOrder/outRegistry.vue");
// const dischargedMain = () =>
// import("@/modules/06_retirement/components/Discharged/dischargedMain.vue");
// const dischargedDetails = () =>
// import(
// "@/modules/06_retirement/components/Discharged/dischargedRegistry.vue"
// );
// const expulsionMain = () =>
// import("@/modules/06_retirement/components/Expulsion/expulsionMain.vue");
// const expulsionDetails = () =>
// import("@/modules/06_retirement/components/Expulsion/expulsionRegistry.vue");
const exitInterviewMain = () => const exitInterviewMain = () =>
import("@/modules/06_retirement/components/ExitInterview/exitMain.vue"); import("@/modules/06_retirement/components/ExitInterview/exitMain.vue");
const exitInterviewDetails = () => const exitInterviewDetails = () =>

View file

@ -3,31 +3,41 @@ import { onMounted, ref, useAttrs, reactive, watch } from "vue";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { storeToRefs } from "pinia";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useDataStoreRetirement } from "@/modules/06_retirement/storeRetirement"; import { useDataStoreRetirement } from "@/modules/06_retirement/storeRetirement";
import type { resMain } from "@/modules/06_retirement/interface/response/Main";
import { storeToRefs } from "pinia";
import popupAdd from "../components/ListRetirement/popupAdd.vue";
import { checkPermission } from "@/utils/permissions"; import { checkPermission } from "@/utils/permissions";
const useStoreRetire = useDataStoreRetirement(); import type { resMain } from "@/modules/06_retirement/interface/response/Main";
const { clickTab } = useStoreRetire;
const { tab, type } = storeToRefs(useDataStoreRetirement());
const mixin = useCounterMixin();
const { messageError, date2Thai, showLoader, hideLoader, dialogConfirm } =
mixin;
const router = useRouter();
const $q = useQuasar(); // noti quasar
const fiscalyear = ref<number>(); import popupAdd from "@/modules/06_retirement/components/ListRetirement/popupAdd.vue";
const $q = useQuasar(); // noti quasar
const router = useRouter();
const mixin = useCounterMixin();
const useStoreRetire = useDataStoreRetirement();
const { tab, type } = storeToRefs(useDataStoreRetirement());
const { clickTab } = useStoreRetire;
const { messageError, date2Thai, showLoader, hideLoader } = mixin;
const fiscalyear = ref<number>(); //
const yearOptionsFilter = ref<any>({ const yearOptionsFilter = ref<any>({
yearOptions: [], yearOptions: [],
}); });
const actionOption = ref<resMain[]>([]); const actionOption = ref<resMain[]>([]);
const attrs = ref<any>(useAttrs());
const paging = ref<boolean>(true);
const pagination = ref({
sortBy: "",
descending: false,
page: 1,
rowsPerPage: 10,
});
const visibleColumns = ref<string[]>([ const visibleColumns = ref<string[]>([
"no", "no",
"signDate", "signDate",
@ -85,20 +95,10 @@ const currentYear = new Date().getFullYear();
const rows = ref<resMain[]>([]); const rows = ref<resMain[]>([]);
const yearOptions = ref<any>([{ id: "", year: "ทั้งหมด" }]); const yearOptions = ref<any>([{ id: "", year: "ทั้งหมด" }]);
onMounted(async () => {
await fetchRetirement(type.value, currentYear);
// fiscalyear.value = currentYear + 543
// await fetchRetirement(type.value, currentYear);
});
// //
const filteryear = () => {
// yearOptions.value.push({ id: currentYear, name: currentYear + 543 });
// yearOptionsFilter.value = [{ id: currentYear, name: currentYear + 543 }];
// yearOptionsFilter.value.push({ id: currentYear, name: currentYear + 543 });
fetchRetirement(type.value, currentYear);
};
// //
const fetchRetirement = async (type: string, year: any) => { async function fetchRetirement(type: string, year: any) {
showLoader(); showLoader();
await http await http
.get(config.API.retirement(type, year)) .get(config.API.retirement(type, year))
@ -155,57 +155,58 @@ const fetchRetirement = async (type: string, year: any) => {
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
}; }
const checkjson = ref<boolean>(); const checkjson = ref<boolean>();
// document // document
const checkststus = (data: any) => { function checkststus(data: any) {
let jsonfasle = data.find((e: any) => e.document == false); let jsonfasle = data.find((e: any) => e.document == false);
if (jsonfasle) { if (jsonfasle) {
checkjson.value = true; checkjson.value = true;
} else checkjson.value = false; } else checkjson.value = false;
}; }
// //
const filterKeyword = ref<string>(""); const filterKeyword = ref<string>("");
const filterRef = ref<any>(null); const filterRef = ref<any>(null);
const resetFilter = () => {
/** reset ฟิลเตอร์ */
function resetFilter() {
filterKeyword.value = ""; filterKeyword.value = "";
filterRef.value.focus(); filterRef.value.focus();
}; }
const attrs = ref<any>(useAttrs());
const paging = ref<boolean>(true); /**
const pagination = ref({ * งชนฟลเตอร input
sortBy: "", * @param val input
descending: false, * @param update Function quasar
page: 1, */
rowsPerPage: 10, function filterSelector(val: any, update: Function) {
});
const filterSelector = (val: any, update: Function) => {
update(() => { update(() => {
yearOptions.value = yearOptionsFilter.value.filter( yearOptions.value = yearOptionsFilter.value.filter(
(v: any) => v.year.indexOf(val) > -1 (v: any) => v.year.indexOf(val) > -1
); );
}); });
}; }
const paginationLabel = (start: string, end: string, total: string) => { /**
if (paging.value == true) return " " + start + "-" + end + " ใน " + total; * ไปหนาแกไขรายละเอยด
else return start + "-" + end + " ใน " + total; * @param prop อม
}; */
const nextPage = (prop: any) => { function nextPage(prop: any) {
router.push(`/retirement/${prop.id}`); router.push(`/retirement/${prop.id}`);
}; }
const nextPageDetail = (prop: any) => {
router.push(`/retirement-detail/${prop.id}`);
};
watch(type, () => { /**
fetchRetirement(type.value, currentYear); * ไปหนารายละเอยด
}); * @param prop อม
// */
const typeReportChangeName = (val: string) => { function nextPageDetail(prop: any) {
router.push(`/retirement-detail/${prop.id}`);
}
/** แปลง status เป็น text */
function typeReportChangeName(val: string) {
switch (val) { switch (val) {
case "EDIT": case "EDIT":
return "ประกาศแก้ไขเกษียณ"; return "ประกาศแก้ไขเกษียณ";
@ -216,7 +217,15 @@ const typeReportChangeName = (val: string) => {
default: default:
return "ประกาศข้อมูลเกษียณ"; return "ประกาศข้อมูลเกษียณ";
} }
}; }
watch(type, () => {
fetchRetirement(type.value, currentYear);
});
onMounted(async () => {
await fetchRetirement(type.value, currentYear);
});
</script> </script>
<template> <template>
<div class="toptitle text-dark col-12 row items-center"> <div class="toptitle text-dark col-12 row items-center">
@ -345,7 +354,6 @@ const typeReportChangeName = (val: string) => {
class="custom-header-table" class="custom-header-table"
v-bind="attrs" v-bind="attrs"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
:pagination-label="paginationLabel"
v-model:pagination="pagination" v-model:pagination="pagination"
> >
<template v-slot:header="props"> <template v-slot:header="props">