Refactoring code module 06_retirement
This commit is contained in:
parent
1225254062
commit
ea921b39b0
29 changed files with 730 additions and 823 deletions
|
|
@ -2,9 +2,10 @@
|
|||
import { onMounted, reactive, ref } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
import type { QForm } from "quasar";
|
||||
|
||||
|
|
@ -116,64 +117,8 @@ const question10Desc = ref<string>("ความคิดเห็นและ
|
|||
const question10Answer = ref<any>([]);
|
||||
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();
|
||||
await http
|
||||
.get(config.API.questionExitInterview())
|
||||
|
|
@ -216,15 +161,15 @@ const getData = async () => {
|
|||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังก์ชั่นเช็คข้อมูลก่อนคอนเฟริม
|
||||
*/
|
||||
const confirmClick = () => {
|
||||
function confirmClick() {
|
||||
dialogConfirm($q, () => putData());
|
||||
};
|
||||
const putData = () => {
|
||||
}
|
||||
function putData() {
|
||||
const body = {
|
||||
question1Desc: question1Desc.value,
|
||||
question1Score: question1Score.value,
|
||||
|
|
@ -279,7 +224,14 @@ const putData = () => {
|
|||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* HOOK
|
||||
*/
|
||||
onMounted(async () => {
|
||||
await getData();
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
import { ref, onMounted } from "vue";
|
||||
import { useQuasar, QForm } from "quasar";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
|
||||
/**Import type */
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { ResponseItems } from "@/modules/06_retirement/interface/response/exitInterview";
|
||||
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 */
|
||||
const $q = useQuasar(); //ใช้ noti quasar
|
||||
|
|
@ -157,16 +157,8 @@ const modal = ref<boolean>(false);
|
|||
const filterKeyword = ref<string>("");
|
||||
const filterRef = ref<any>(null);
|
||||
|
||||
/** HOOK */
|
||||
onMounted(async () => {
|
||||
await fecthlist();
|
||||
if (columns.value) {
|
||||
visibleColumns.value = columns.value.map((r: any) => r.name);
|
||||
}
|
||||
});
|
||||
|
||||
//นำข้อมูลจาก API มาแสดง
|
||||
const fecthlist = async () => {
|
||||
async function fecthlist() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.listExitInterview())
|
||||
|
|
@ -202,10 +194,10 @@ const fecthlist = async () => {
|
|||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
//กําหนดวันนัดหมายเพื่อทําการสัมภาษณ์การลาออก
|
||||
const saveAppoint = async () => {
|
||||
async function saveAppoint() {
|
||||
await myForm.value!.validate().then(async (result: boolean) => {
|
||||
if (result) {
|
||||
dialogConfirm($q, async () => {
|
||||
|
|
@ -229,13 +221,13 @@ const saveAppoint = async () => {
|
|||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังก์ชั่น validate DATE ไทย
|
||||
* @param thaiDate วันที่ไทย
|
||||
*/
|
||||
const validationDate = (thaiDate: string | null) => {
|
||||
function validationDate(thaiDate: string | null) {
|
||||
if (thaiDate && daterow.value) {
|
||||
let a = convertThaiDateToNumeric(thaiDate);
|
||||
let b = daterow.value;
|
||||
|
|
@ -243,10 +235,10 @@ const validationDate = (thaiDate: string | null) => {
|
|||
return a > b;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//แปลงเดือนจากตัวเลขเป็นภาษาอ่าน
|
||||
const convertThaiDateToNumeric = (thaiDate: string) => {
|
||||
function convertThaiDateToNumeric(thaiDate: string) {
|
||||
const parts = thaiDate.split(" ");
|
||||
if (parts.length !== 3) return null;
|
||||
const [day, month, year] = parts;
|
||||
|
|
@ -267,22 +259,31 @@ const convertThaiDateToNumeric = (thaiDate: string) => {
|
|||
if (!(month in monthMap)) return null;
|
||||
const numericDate = `${year}${monthMap[month]}${day}`;
|
||||
return numericDate;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* modal Setting
|
||||
*/
|
||||
const openModal = () => (modal.value = true);
|
||||
const closeModal = () => (modal.value = false);
|
||||
const resetFilter = () => {
|
||||
function resetFilter() {
|
||||
filterKeyword.value = "";
|
||||
filterRef.value.focus();
|
||||
};
|
||||
const openModalCalendar = (rows: any) => {
|
||||
}
|
||||
|
||||
function openModalCalendar(rows: any) {
|
||||
openModal();
|
||||
dateBreak.value = null;
|
||||
id.value = rows.id;
|
||||
daterow.value = convertThaiDateToNumeric(rows.datetext);
|
||||
};
|
||||
}
|
||||
|
||||
/** HOOK */
|
||||
onMounted(async () => {
|
||||
await fecthlist();
|
||||
if (columns.value) {
|
||||
visibleColumns.value = columns.value.map((r: any) => r.name);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<template v-slot:body="props">
|
||||
<div class="toptitle text-dark col-12 row items-center">
|
||||
|
|
@ -445,9 +446,7 @@ const openModalCalendar = (rows: any) => {
|
|||
</div>
|
||||
</q-td>
|
||||
<q-td key="appointDate" :props="props">
|
||||
{{
|
||||
props.row.appointDate ? props.row.appointDate : "-"
|
||||
}}
|
||||
{{ props.row.appointDate ? props.row.appointDate : "-" }}
|
||||
</q-td>
|
||||
<q-td key="datetext" :props="props">
|
||||
{{ props.row.datetext ? props.row.datetext : "-" }}
|
||||
|
|
|
|||
|
|
@ -2,15 +2,17 @@
|
|||
import { onMounted, reactive, ref, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { tokenParsed } from "@/plugins/auth";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
/**import type*/
|
||||
import type {
|
||||
OptionQuestions,
|
||||
OptionQuestions2,
|
||||
QuestionDesc,
|
||||
} from "@/modules/06_retirement/interface/request/Main";
|
||||
import type { QForm } from "quasar";
|
||||
|
||||
|
|
@ -80,18 +82,29 @@ const haveJobReason = ref<any>("");
|
|||
const futureWorkReason = ref<any>("");
|
||||
const adjustOther = ref("");
|
||||
|
||||
/** HOOK */
|
||||
onMounted(async () => {
|
||||
const user = await tokenParsed();
|
||||
if (user) {
|
||||
roleAdmin.value = await user.role.includes("placement1");
|
||||
}
|
||||
await getData();
|
||||
await fecthquestion();
|
||||
// เรียกคำถามแบบสอบถาม
|
||||
const questionDesc = reactive<QuestionDesc>({
|
||||
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[]>([]);
|
||||
|
||||
//นำข้อมูลมาแสดง
|
||||
const getData = async () => {
|
||||
async function getData() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.ExitInterviewByid(dataId))
|
||||
|
|
@ -133,29 +146,8 @@ const getData = async () => {
|
|||
.finally(() => {
|
||||
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() {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -164,8 +156,8 @@ async function fecthquestion() {
|
|||
const data = await result.data.result;
|
||||
// คำถามแบบสอบถามหลัก
|
||||
for (let i = 1; i <= 10; i++) {
|
||||
questionDesc[`question${i}Desc`] =
|
||||
`${i}.` + " " + data[`question${i}Desc`];
|
||||
const key = `question${i}Desc` as keyof QuestionDesc;
|
||||
questionDesc[key] = `${i}.` + " " + data[key];
|
||||
}
|
||||
// คำถามแบบสอบถามย่อย
|
||||
const Answer1 = data.question1Answer.map((e: any, index: number) => ({
|
||||
|
|
@ -227,17 +219,11 @@ async function fecthquestion() {
|
|||
hideLoader();
|
||||
});
|
||||
}
|
||||
//รวมคะเเนน
|
||||
watch(score, () => {
|
||||
scoreTotal.value = score.reduce((accumulator, object) => {
|
||||
return accumulator + Number(object.score);
|
||||
}, 0);
|
||||
});
|
||||
|
||||
/**
|
||||
* บันทึกให้คะเเนน
|
||||
*/
|
||||
const saveClick = () => {
|
||||
function saveClick() {
|
||||
if (
|
||||
comment.value === "" ||
|
||||
score[0].score === "" ||
|
||||
|
|
@ -256,12 +242,12 @@ const saveClick = () => {
|
|||
} else {
|
||||
dialogConfirm($q, () => putData());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* ส่งคะเเนนผ่าน API
|
||||
*/
|
||||
const putData = () => {
|
||||
function putData() {
|
||||
const body = {
|
||||
score1: Number(score[0].score),
|
||||
score2: Number(score[1].score),
|
||||
|
|
@ -289,7 +275,24 @@ const putData = () => {
|
|||
.finally(() => {
|
||||
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>
|
||||
|
||||
<template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue