ปรับระบบพ้นจากราชการ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-12-02 15:19:11 +07:00
parent d043396010
commit 615b280979
26 changed files with 577 additions and 733 deletions

View file

@ -0,0 +1,906 @@
<script setup lang="ts">
import { onMounted, reactive, ref } from "vue";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import type { QForm } from "quasar";
const $q = useQuasar();
const router = useRouter();
const mixin = useCounterMixin();
const { messageError, showLoader, hideLoader, dialogConfirm, success } = mixin;
/**
* ฟอรมคำถาม
*/
const myForm = ref<QForm | null>(null);
// set 1
const question1Desc = ref<string>(
"เหตุใดท่านจึงตัดสินใจร่วมงานกับกรุงเทพมหานคร (เลือกได้มากกว่า 1 ข้อ)"
);
const question1Score = ref<number>(0);
const question1Answer = ref<any>([]);
// set 2
const question2Desc = ref<string>(
"สำหรับการลาออกในครั้งนี ท่านได้คิดทบทวนอย่างจริงจังเป็นระยะเวลานานเท่าใด"
);
const question2Score = ref<number>(0);
const question2Answer = ref<any>([
"น้อยกว่า 2 สัปดาห์",
"1 เดือน - 3 เดือน",
"3 เดือน - 6 เดือน",
"6 เดือนขึ้นไป",
]);
// set 3
const question3Desc = ref<string>(
"ปัจจัยใดที่ทำให้ท่านตัดสินใจลาออกจากราชการ (เลือกได้มากกว่า 1 ข้อ)"
);
const question3Score = ref<number>(0);
const question3Answer = ref<any>([
"อัตราเงินเดือน",
"สวัสดิการ",
"ลักษณะงาน",
"ระบบการทำงาน",
"ระบบสนับสนุนการปฏิบัติงาน",
"การมอบหมายงานที่ชัดเจนและเหมาะสม",
"การบริหารงานของผู้บังคับบัญช",
"การทำงานเป็นทีมกับเพื่อนร่วมงาน",
"ระบบบริหารงานภายในหน่วยงาน",
"บรรยากาศในการทำงาน",
"การปฏิบัติอย่างเป็นธรรม",
"การยอมรับความแตกต่างหลากหลาย",
"การดูแลและให้ความช่วยเหลือในช่วงเริ่มต้นปฏิบัติงาน",
"การพัฒนาอย่างเป็นระบบและต่อเนื่อง",
"โอกาสความก้าวหน้า",
]);
// set 4
const question4Desc = ref<string>(
"อะไรคือสิ่งที่ท่านเห็นว่าควรปรับปรุง (เลือกได้มากกว่า 1 ข้อ)"
);
const question4Score = ref<number>(0);
const question4Answer = ref<any>([
"อัตราเงินเดือน ",
"สวัสดิการ",
"ลักษณะงาน",
"ระบบการทำงาน",
"ระบบสนับสนุนการปฏิบัติงาน",
"การมอบหมายงานที่ชัดเจนและเหมาะสม",
"การบริหารงานของผู้บังคับบัญช",
"การทำงานเป็นทีมกับเพื่อนร่วมงาน",
"ระบบบริหารงานภายในหน่วยงาน",
"บรรยากาศในการทำงาน",
"การปฏิบัติอย่างเป็นธรรม",
"การยอมรับความแตกต่างหลากหลาย",
"การดูแลและให้ความช่วยเหลือในช่วงเริ่มต้นปฏิบัติงาน",
"การพัฒนาอย่างเป็นระบบและต่อเนื่อง",
"โอกาสความก้าวหน้า",
]);
// set 5
const question5Desc = ref<string>(
"โปรดระบุสาเหตุที่แท้จริง ที่ทำให้ท่านตัดสินใจลาออกจากการปฏิบัติราชการกับกรุงเทพมหานคร ?"
);
const question5Answer = ref<any>([]);
const question5Score = ref<number>(0);
// set 6
const question6Desc = ref<string>(
"ปัจจัยใดที่จะช่วยทำให้ท่านเปลี่ยนใจ ไม่อยากลาออกจากการปฏิบัติราชการกับกรุงเทพมหานคร"
);
const question6Answer = ref<any>([]);
const question6Score = ref<number>(0);
// set 7
const question7Desc = ref<string>(
"ท่านมีงานใหม่หรือไม่ ถ้ามี (โปรดระบุ ชื่อบริษัทเอกชน/หน่วยงานภาครัฐ) และอะไรคือสิ่งที่ที่ทำงานใหม่ให้กับท่าน ซึ่งท่านรู้สึกว่าเป็นที่น่าพอใจมากกว่าการปฏิบัติราชการกับกรุงเทพมหานคร"
);
const question7Score = ref<number>(0);
const question7Answer = ref<any>(["มี (ระบุ)", "ไม่มี"]);
// set 8
const question8Desc = ref<string>(
"ท่านจะแนะนำเพื่อนให้มาร่วมงานกับกรุงเทพมหานครหรือไม่ (ถ้าไม่ โปรดระบุเหตุผล)"
);
const question8Score = ref<number>(0);
const question8Answer = ref<any>(["แนะนำ", "ไม่แนะนำ (ระบุ)"]);
// set 9
const question9Desc = ref<string>(
"หากท่านมีโอกาสในอนาคต ท่านอยากกลับมาร่วมงานกับกรุงเทพมหานครหรือไม่ (ถ้าไม่ โปรดระบุเหตุผล)"
);
const question9Score = ref<number>(0);
const question9Answer = ref<any>(["อยาก", "ไม่อยาก (ระบุ)"]);
// set 10
const question10Desc = ref<string>("ความคิดเห็นและข้อเสนอแนะอื่นๆ");
const question10Answer = ref<any>([]);
const question10Score = ref<number>(0);
//
async function getData() {
showLoader();
await http
.get(config.API.questionExitInterview())
.then(async (res) => {
const data = await res.data.result;
question1Score.value = data.question1Score ?? 0;
question2Score.value = data.question2Score ?? 0;
question3Score.value = data.question3Score ?? 0;
question4Score.value = data.question4Score ?? 0;
question5Score.value = data.question5Score ?? 0;
question6Score.value = data.question6Score ?? 0;
question7Score.value = data.question7Score ?? 0;
question8Score.value = data.question8Score ?? 0;
question9Score.value = data.question9Score ?? 0;
question10Score.value = data.question10Score ?? 0;
question1Desc.value = data.question1Desc;
question1Answer.value = data.question1Answer;
question2Desc.value = data.question2Desc;
question2Answer.value = data.question2Answer;
question3Desc.value = data.question3Desc;
question3Answer.value = data.question3Answer;
question4Desc.value = data.question4Desc;
question4Answer.value = data.question4Answer;
question5Desc.value = data.question5Desc;
question5Answer.value = data.question5Answer;
question6Desc.value = data.question6Desc;
question6Answer.value = data.question6Answer;
question7Desc.value = data.question7Desc;
question7Answer.value = data.question7Answer;
question8Desc.value = data.question8Desc;
question8Answer.value = data.question8Answer;
question9Desc.value = data.question9Desc;
question9Answer.value = data.question9Answer;
question10Desc.value = data.question10Desc;
question10Answer.value = data.question10Answer;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**
* งกนเชคขอมลกอนคอนเฟร
*/
function confirmClick() {
dialogConfirm($q, () => putData());
}
function putData() {
const body = {
question1Desc: question1Desc.value,
question1Score: question1Score.value,
question1Answer: question1Answer.value,
question2Desc: question2Desc.value,
question2Score: question2Score.value,
question2Answer: question2Answer.value,
question3Desc: question3Desc.value,
question3Score: question3Score.value,
question3Answer: question3Answer.value,
question4Desc: question4Desc.value,
question4Score: question4Score.value,
question4Answer: question4Answer.value,
question5Desc: question5Desc.value,
question5Score: question5Score.value,
question5Answer: question5Answer.value,
question6Desc: question6Desc.value,
question6Score: question6Score.value,
question6Answer: question6Answer.value,
question7Desc: question7Desc.value,
question7Score: question7Score.value,
question7Answer: question7Answer.value,
question8Desc: question8Desc.value,
question8Score: question8Score.value,
question8Answer: question8Answer.value,
question9Desc: question9Desc.value,
question9Score: question9Score.value,
question9Answer: question9Answer.value,
question10Desc: question10Desc.value,
question10Score: question10Score.value,
question10Answer: question10Answer.value,
};
showLoader();
http
.put(config.API.questionExitInterview(), body)
.then(() => {
router.push(`/retirement/exit-interview`);
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**
* HOOK
*/
onMounted(async () => {
await getData();
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">
<q-btn
icon="mdi-arrow-left"
unelevated
round
dense
flat
color="primary"
class="q-mr-sm"
@click="router.go(-1)"
/>
แกไขคำถาม
</div>
<q-card bordered class="row col-12 text-dark q-mt-sm">
<div class="col-12"><q-separator /></div>
<q-form ref="myForm">
<div class="col-12 row q-col-gutter-md q-pa-md">
<div class="col-xs-12 col-sm-12">
<q-card bordered flat>
<div class="q-pa-xs bg-grey-2 row q-py-sm q-px-md text-bold">
คำถามขอท 1
</div>
<q-separator />
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<div class="col-10 text-top0">
<q-input
v-model="question1Desc"
label="คำถามข้อที่ 1"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) =>
(val && val.length > 0) || 'กรุณากรอกคำถามข้อที่ 1',
]"
/>
</div>
<div class="col-2 text-top0">
<q-input
v-model="question1Score"
label="กรอกคะแนน"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกคะแนน',
]"
/>
</div>
<div
v-for="(data, index) in question1Answer"
:key="index"
class="row col-12"
>
<div class="col-6">
<q-input
v-model="question1Answer[index]"
:label="`คำตอบที่ ${index + 1}`"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกคำตอบ',
]"
/>
</div>
</div>
</div>
</q-card>
</div>
</div>
<div class="col-12 row q-col-gutter-md q-pa-md">
<div class="col-xs-12 col-sm-12">
<q-card bordered flat>
<div class="q-pa-xs bg-grey-2 row q-py-sm q-px-md text-bold">
คำถามขอท 2
</div>
<q-separator />
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<div class="col-10 text-top0">
<q-input
v-model="question2Desc"
label="คำถามข้อที่ 2"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) =>
(val && val.length > 0) || 'กรุณากรอกคำถามข้อที่ 2',
]"
/>
</div>
<div class="col-2 text-top0">
<q-input
v-model="question2Score"
label="กรอกคะแนน"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกคะแนน',
]"
/>
</div>
<div
v-for="(data, index) in question2Answer"
:key="index"
class="row col-12"
>
<div class="col-6">
<q-input
v-model="question2Answer[index]"
:label="`คำตอบที่ ${index + 1}`"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกคำตอบ',
]"
/>
</div>
</div>
</div>
</q-card>
</div>
</div>
<div class="col-12 row q-col-gutter-md q-pa-md">
<div class="col-xs-12 col-sm-12">
<q-card bordered flat>
<div class="q-pa-xs bg-grey-2 row q-py-sm q-px-md text-bold">
คำถามขอท 3
</div>
<q-separator />
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<div class="col-10 text-top0">
<q-input
v-model="question3Desc"
label="คำถามข้อที่ 3"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) =>
(val && val.length > 0) || 'กรุณากรอกคำถามข้อที่ 3',
]"
/>
</div>
<div class="col-2 text-top0">
<q-input
v-model="question3Score"
label="กรอกคะแนน"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกคะแนน',
]"
/>
</div>
<div
v-for="(data, index) in question3Answer"
:key="index"
class="row col-12"
>
<div class="col-6">
<q-input
v-model="question3Answer[index]"
:label="`คำตอบที่ ${index + 1}`"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกคำตอบ',
]"
/>
</div>
</div>
</div>
</q-card>
</div>
</div>
<div class="col-12 row q-col-gutter-md q-pa-md">
<div class="col-xs-12 col-sm-12">
<q-card bordered flat>
<div class="q-pa-xs bg-grey-2 row q-py-sm q-px-md text-bold">
คำถามขอท 4
</div>
<q-separator />
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<div class="col-10 text-top0">
<q-input
v-model="question4Desc"
label="คำถามข้อที่ 4"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) =>
(val && val.length > 0) || 'กรุณากรอกคำถามข้อที่ 4',
]"
/>
</div>
<div class="col-2 text-top0">
<q-input
v-model="question4Score"
label="กรอกคะแนน"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกคะแนน',
]"
/>
</div>
<div
v-for="(data, index) in question4Answer"
:key="index"
class="row col-12"
>
<div class="col-6">
<q-input
v-model="question4Answer[index]"
:label="`คำตอบที่ ${index + 1}`"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกคำตอบ',
]"
/>
</div>
</div>
</div>
</q-card>
</div>
</div>
<div class="col-12 row q-col-gutter-md q-pa-md">
<div class="col-xs-12 col-sm-12">
<q-card bordered flat>
<div class="q-pa-xs bg-grey-2 row q-py-sm q-px-md text-bold">
คำถามขอท 5
</div>
<q-separator />
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<div class="col-10 text-top0">
<q-input
v-model="question5Desc"
label="คำถามข้อที่ 5"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) =>
(val && val.length > 0) || 'กรุณากรอกคำถามข้อที่ 5',
]"
/>
</div>
<div class="col-2 text-top0">
<q-input
v-model="question5Score"
label="กรอกคะแนน"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกคะแนน',
]"
/>
</div>
</div>
</q-card>
</div>
</div>
<div class="col-12 row q-col-gutter-md q-pa-md">
<div class="col-xs-12 col-sm-12">
<q-card bordered flat>
<div class="q-pa-xs bg-grey-2 row q-py-sm q-px-md text-bold">
คำถามขอท 6
</div>
<q-separator />
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<div class="col-10 text-top0">
<q-input
v-model="question6Desc"
label="คำถามข้อที่ 6"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) =>
(val && val.length > 0) || 'กรุณากรอกคำถามข้อที่ 6',
]"
/>
</div>
<div class="col-2 text-top0">
<q-input
v-model="question6Score"
label="กรอกคะแนน"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกคะแนน',
]"
/>
</div>
</div>
</q-card>
</div>
</div>
<div class="col-12 row q-col-gutter-md q-pa-md">
<div class="col-xs-12 col-sm-12">
<q-card bordered flat>
<div class="q-pa-xs bg-grey-2 row q-py-sm q-px-md text-bold">
คำถามขอท 7
</div>
<q-separator />
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<div class="col-10 text-top0">
<q-input
v-model="question7Desc"
label="คำถามข้อที่ 7"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) =>
(val && val.length > 0) || 'กรุณากรอกคำถามข้อที่ 7',
]"
/>
</div>
<div class="col-2 text-top0">
<q-input
v-model="question7Score"
label="กรอกคะแนน"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกคะแนน',
]"
/>
</div>
<div
v-for="(data, index) in question7Answer"
:key="index"
class="row col-12"
>
<div class="col-6">
<q-input
v-model="question7Answer[index]"
:label="`คำตอบที่ ${index + 1}`"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกคำตอบ',
]"
/>
</div>
</div>
</div>
</q-card>
</div>
</div>
<div class="col-12 row q-col-gutter-md q-pa-md">
<div class="col-xs-12 col-sm-12">
<q-card bordered flat>
<div class="q-pa-xs bg-grey-2 row q-py-sm q-px-md text-bold">
คำถามขอท 8
</div>
<q-separator />
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<div class="col-10 text-top0">
<q-input
v-model="question8Desc"
label="คำถามข้อที่ 8"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) =>
(val && val.length > 0) || 'กรุณากรอกคำถามข้อที่ 8',
]"
/>
</div>
<div class="col-2 text-top0">
<q-input
v-model="question8Score"
label="กรอกคะแนน"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกคะแนน',
]"
/>
</div>
<div
v-for="(data, index) in question8Answer"
:key="index"
class="row col-12"
>
<div class="col-6">
<q-input
v-model="question8Answer[index]"
:label="`คำตอบที่ ${index + 1}`"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกคำตอบ',
]"
/>
</div>
</div>
</div>
</q-card>
</div>
</div>
<div class="col-12 row q-col-gutter-md q-pa-md">
<div class="col-xs-12 col-sm-12">
<q-card bordered flat>
<div class="q-pa-xs bg-grey-2 row q-py-sm q-px-md text-bold">
คำถามขอท 9
</div>
<q-separator />
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<div class="col-10 text-top0">
<q-input
v-model="question9Desc"
label="คำถามข้อที่ 9"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) =>
(val && val.length > 0) || 'กรุณากรอกคำถามข้อที่ 9',
]"
/>
</div>
<div class="col-2 text-top0">
<q-input
v-model="question9Score"
label="กรอกคะแนน"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกคะแนน',
]"
/>
</div>
<div
v-for="(data, index) in question9Answer"
:key="index"
class="row col-12"
>
<div class="col-6">
<q-input
v-model="question9Answer[index]"
:label="`คำตอบที่ ${index + 1}`"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกคำตอบ',
]"
/>
</div>
</div>
</div>
</q-card>
</div>
</div>
<div class="col-12 row q-col-gutter-md q-pa-md">
<div class="col-xs-12 col-sm-12">
<q-card bordered flat>
<div class="q-pa-xs bg-grey-2 row q-py-sm q-px-md text-bold">
คำถามขอท 10
</div>
<q-separator />
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<div class="col-10 text-top0">
<q-input
v-model="question10Desc"
label="คำถามข้อที่ 10"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) =>
(val && val.length > 0) || 'กรุณากรอกคำถามข้อที่ 10',
]"
/>
</div>
<div class="col-2 text-top0">
<q-input
v-model="question10Score"
label="กรอกคะแนน"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="inputgreen"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกคะแนน',
]"
/>
</div>
</div>
</q-card>
</div>
</div>
<div class="col-12"><q-separator /></div>
<q-card-actions class="text-primary q-pa-md">
<q-space />
<q-btn unelevated label="บันทึก" color="public" @click="confirmClick">
</q-btn>
</q-card-actions>
</q-form>
</q-card>
</template>
<style lang="scss" scope>
.q-img {
border-radius: 5px;
height: 70px;
}
.text-top {
color: gray;
font-weight: 400;
padding-bottom: 3px;
}
.text-detail {
font-weight: 500;
}
</style>

View file

@ -0,0 +1,795 @@
<script setup lang="ts">
import { onMounted, reactive, ref, watch } from "vue";
import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router";
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";
import type { DataProfile } from "@/modules/05_placement/interface/index/Main";
/** importComponents*/
import CardProfile from "@/components/CardProfile.vue";
/** use */
const $q = useQuasar();
const route = useRoute();
const router = useRouter();
const checkRoutePermisson = ref<boolean>(
route.name == "exit-Interview-detailsOnly"
);
const mixin = useCounterMixin();
const dataId = route.params.id.toString();
const {
messageError,
showLoader,
hideLoader,
dialogConfirm,
success,
dialogMessageNotify,
} = mixin;
/**
* วแปร
*/
const myForm = ref<QForm | null>(null);
const dataProfile = ref<DataProfile>();
const roleAdmin = ref<boolean>(false);
const Org = ref<string>("");
const PositionLevel = ref<string>("");
const Position = ref<string>("");
const prefix = ref<string>("");
const exitFactor = ref<any>([]);
const reasonWork = ref<any>([]);
const adjust = ref<any>([]);
const timeThink = ref<any>();
const fullname = ref<any>("");
const avata = 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 comment = ref<string>("");
const score = reactive([
{ no: 1, score: "" },
{ no: 2, score: "" },
{ no: 3, score: "" },
{ no: 4, score: "" },
{ no: 5, score: "" },
{ no: 6, score: "" },
{ no: 7, score: "" },
{ no: 8, score: "" },
{ no: 9, score: "" },
{ no: 10, score: "" },
]);
const scoreTotal = ref<number | string>("");
const reasonWorkOther = ref("");
const exitFactorOther = ref("");
const suggestFriendsReason = ref("");
const haveJobReason = ref<any>("");
const futureWorkReason = ref<any>("");
const adjustOther = ref("");
//
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[]>([]);
//
async function getData() {
showLoader();
await http
.get(config.API.ExitInterviewByid(dataId))
.then(async (res) => {
const data = await res.data.result;
dataProfile.value = data as DataProfile;
avata.value = data.avatar ?? "";
Position.value = data.position ?? "";
PositionLevel.value = data.positionLevel ?? "";
Org.value = data.org ?? "";
fullname.value = data.fullname ?? "";
prefix.value = data.prefix ?? "";
reasonWork.value = data.reasonWork ?? [];
reasonWorkOther.value = data.reasonWorkOther ?? "";
timeThink.value = data.TimeThink ?? 0;
exitFactor.value = data.exitFactor ?? [];
exitFactorOther.value = data.exitFactorOther ?? 0;
adjust.value = data.adjust ?? [];
adjustOther.value = data.adjustOther ?? "";
realReason.value = data.realReason ?? "";
notExitFactor.value = data.notExitFactor ?? "";
haveJob.value = data.havejob == false ? 0 : 1;
haveJobReason.value = data.havejobReason ?? "";
suggestFriends.value = data.suggestFriends == false ? 0 : 1;
suggestFriendsReason.value = data.suggestFriendsReason ?? "";
futureWork.value = data.futureWork == false ? 0 : 1;
futureWorkReason.value = data.futureWorkReason ?? "";
suggestion.value = data.suggestion ?? "";
score.forEach((item, index) => {
const scoreKey = `score${item.no}`;
item.score = data[scoreKey] ?? 0;
scoreTotal.value = data.scoreTotal ?? 0;
comment.value = data.comment;
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
async function fecthquestion() {
showLoader();
await http
.get(config.API.questionnaireList())
.then(async (result) => {
const data = await result.data.result;
//
for (let i = 1; i <= 10; i++) {
const key = `question${i}Desc` as keyof QuestionDesc;
questionDesc[key] = `${i}.` + " " + data[key];
}
//
const Answer1 = data.question1Answer.map((e: any, index: number) => ({
label: e,
value: index,
}));
question1Answer.value = Answer1;
question1Answer.value.push({
label: "อื่นๆ (ระบุ)",
value: Answer1.length,
});
question2Answer.value = data.question2Answer.map(
(e: any, index: number) => ({
label: e,
value: index,
})
);
const Answer3 = data.question3Answer.map((e: any, index: number) => ({
label: e,
value: index,
}));
question3Answer.value = Answer3;
question3Answer.value.push({
label: "อื่นๆ (ระบุ)",
value: Answer3.length,
});
const Answer4 = data.question4Answer.map((e: any, index: number) => ({
label: e,
value: index,
}));
question4Answer.value = Answer4;
question4Answer.value.push({
label: "อื่นๆ (ระบุ)",
value: Answer4.length,
});
question7Answer.value = data.question7Answer.map(
(e: any, index: number) => ({
label: e,
value: index,
})
);
question8Answer.value = data.question8Answer.map(
(e: any, index: number) => ({
label: e,
value: index,
})
);
question9Answer.value = data.question9Answer.map(
(e: any, index: number) => ({
label: e,
value: index,
})
);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/**
* นทกใหคะเเนน
*/
function saveClick() {
if (
comment.value === "" ||
score[0].score === "" ||
score[1].score === "" ||
score[2].score === "" ||
score[3].score === "" ||
score[4].score === "" ||
score[5].score === "" ||
score[6].score === "" ||
score[7].score === "" ||
score[8].score === "" ||
score[9].score === "" ||
scoreTotal.value === ""
) {
dialogMessageNotify($q, "กรุณากรอกคะแนน เเละ ความคิดเห็น");
} else {
dialogConfirm($q, () => putData());
}
}
/**
* งคะเเนนผาน API
*/
function putData() {
const body = {
score1: Number(score[0].score),
score2: Number(score[1].score),
score3: Number(score[2].score),
score4: Number(score[3].score),
score5: Number(score[4].score),
score6: Number(score[5].score),
score7: Number(score[6].score),
score8: Number(score[7].score),
score9: Number(score[8].score),
score10: Number(score[9].score),
scoreTotal: scoreTotal.value,
comment: comment.value,
};
showLoader();
http
.put(config.API.commentExitInterview(dataId), body)
.then(() => {
router.push(`/retirement/exit-interview`);
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.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>
<div class="toptitle text-dark col-12 row items-center">
<q-btn
icon="mdi-arrow-left"
unelevated
round
dense
flat
color="primary"
class="q-mr-sm"
@click="router.go(-1)"
/>
รายละเอยด Exit interview {{ fullname }}
</div>
<CardProfile :data="dataProfile as DataProfile" />
<q-card bordered class="row col-12 text-dark q-mt-sm">
<div class="bg-grey-1 q-pa-sm col-12 row items-center">
<div class="q-pl-sm text-weight-bold text-dark">
อมลการตอบแบบสอบถาม
</div>
<q-space />
</div>
<div class="col-12"><q-separator /></div>
<div class="col-12">
<q-form ref="myForm">
<div class="row q-col-gutter-md q-pa-md">
<div class="col-12">
<q-card bordered flat>
<div
class="q-pa-xs bg-grey-2 row items-center q-py-sm q-px-md justify-center text-bold"
>
แบบสอบถาม
</div>
<q-separator />
<!-- 1 -->
<q-card-section>
<div class="row">
<div class="col-10 items-center row inline">
{{ questionDesc.question1Desc }}
</div>
<div class="col-2">
<q-input
dense
outlined
:readonly="checkRoutePermisson"
v-model="score[0].score"
label="คะแนนข้อ 1"
type="number"
lazy-rules
:rules="[(val:string) => val !== '' || 'กรุณากรอกคะเเนน']"
/>
</div>
</div>
<q-option-group
:options="question1Answer"
type="checkbox"
v-model="reasonWork"
disable
/>
<q-item-label>
<q-input
v-if="reasonWork.includes(question1Answer.length - 1)"
v-model="reasonWorkOther"
disable
:readonly="checkRoutePermisson"
label="กรอกข้อความ"
dense
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="bg-white"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกข้อความ',
]"
/>
</q-item-label>
</q-card-section>
<!-- 2 -->
<q-card-section>
<div class="row">
<div class="col-10 items-center row inline">
{{ questionDesc.question2Desc }}
</div>
<div class="col-2">
<q-input
dense
:readonly="checkRoutePermisson"
outlined
v-model="score[1].score"
label="คะแนนข้อ 2"
type="number"
lazy-rules
:rules="[(val:string) => val !== '' || 'กรุณากรอกคะเเนน']"
/>
</div>
</div>
<q-option-group
:options="question2Answer"
type="radio"
v-model="timeThink"
disable
/>
</q-card-section>
<!-- 3 -->
<q-card-section>
<div class="row">
<div class="col-10 items-center row inline">
{{ questionDesc.question3Desc }}
</div>
<div class="col-2">
<q-input
dense
outlined
:readonly="checkRoutePermisson"
v-model="score[2].score"
label="คะแนนข้อ 3"
type="number"
lazy-rules
:rules="[(val:string) => val !== '' || 'กรุณากรอกคะเเนน']"
/>
</div>
</div>
<q-option-group
:options="question3Answer"
type="checkbox"
v-model="exitFactor"
disable
/>
<q-item-label>
<q-input
v-if="exitFactor.includes(question3Answer.length - 1)"
v-model="exitFactorOther"
label="กรอกข้อความ"
dense
disable
lazy-rules
:readonly="checkRoutePermisson"
type="text"
autogrow
hide-bottom-space
outlined
class="bg-white"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกข้อความ',
]"
/>
</q-item-label>
</q-card-section>
<!-- 4 -->
<q-card-section>
<div class="row">
<div class="col-10 items-center row inline">
{{ questionDesc.question4Desc }}
</div>
<div class="col-2">
<q-input
dense
:readonly="checkRoutePermisson"
outlined
v-model="score[3].score"
label="คะแนนข้อ 4"
type="number"
lazy-rules
:rules="[(val:string) => val !== '' || 'กรุณากรอกคะเเนน']"
/>
</div>
</div>
<q-option-group
:options="question4Answer"
type="checkbox"
v-model="adjust"
disable
/>
<q-item-label>
<q-input
v-if="adjust.includes(question4Answer.length - 1)"
v-model="adjustOther"
label="กรอกอื่นๆ"
dense
disable
lazy-rules
:readonly="checkRoutePermisson"
type="text"
autogrow
hide-bottom-space
outlined
class="bg-white"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกข้อความ',
]"
/>
</q-item-label>
</q-card-section>
<!-- 5 -->
<q-card-section>
<div class="row">
<div class="col-10 items-center row inline">
{{ questionDesc.question5Desc }}
</div>
<div class="col-2">
<q-input
dense
outlined
:readonly="checkRoutePermisson"
v-model="score[4].score"
label="คะแนนข้อ 5"
type="number"
lazy-rules
:rules="[(val:string) => val !== '' || 'กรุณากรอกคะเเนน']"
/>
</div>
</div>
<q-input
class="col-12"
dense
disable
outlined
v-model="realReason"
label=" "
type="textarea"
/>
</q-card-section>
<!-- 6 -->
<q-card-section>
<div class="row">
<div class="col-10 items-center row inline">
{{ questionDesc.question6Desc }}
</div>
<div class="col-2">
<q-input
dense
outlined
:readonly="checkRoutePermisson"
v-model="score[5].score"
label="คะแนนข้อ 6"
type="number"
lazy-rules
:rules="[(val:string) => val !== '' || 'กรุณากรอกคะเเนน']"
/>
</div>
</div>
<q-input
class="col-12"
dense
outlined
disable
v-model="notExitFactor"
label=" "
type="textarea"
/>
</q-card-section>
<!-- 7 -->
<q-card-section>
<div class="row">
<div class="col-10 items-center row inline">
{{ questionDesc.question7Desc }}
</div>
<div class="col-2">
<q-input
dense
outlined
:readonly="checkRoutePermisson"
v-model="score[6].score"
label="คะแนนข้อ 7"
type="number"
lazy-rules
:rules="[(val:string) => val !== '' || 'กรุณากรอกคะเเนน']"
/>
</div>
</div>
<q-option-group
:options="question7Answer"
type="radio"
v-model="haveJob"
disable
/>
<q-item-label>
<q-input
v-if="haveJob == 0"
v-model="haveJobReason"
label="กรอกอื่นๆ"
dense
disable
:readonly="checkRoutePermisson"
lazy-rules
type="text"
autogrow
hide-bottom-space
outlined
class="bg-white"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกข้อความ',
]"
/>
</q-item-label>
</q-card-section>
<!-- 8 -->
<q-card-section>
<div class="row">
<div class="col-10 items-center row inline">
{{ questionDesc.question8Desc }}
</div>
<div class="col-2">
<q-input
dense
outlined
:readonly="checkRoutePermisson"
v-model="score[7].score"
label="คะแนนข้อ 8"
type="number"
lazy-rules
:rules="[(val:string) => val !== '' || 'กรุณากรอกคะเเนน']"
/>
</div>
</div>
<q-option-group
:options="question8Answer"
type="radio"
v-model="suggestFriends"
disable
/>
<q-item-label>
<q-input
v-if="suggestFriends === 1"
v-model="suggestFriendsReason"
label="กรอกข้อความ"
dense
lazy-rules
disable
:readonly="checkRoutePermisson"
type="text"
autogrow
hide-bottom-space
outlined
class="bg-white"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกข้อความ',
]"
/>
</q-item-label>
</q-card-section>
<!-- 9 -->
<q-card-section>
<div class="row">
<div class="col-10 items-center row inline">
{{ questionDesc.question9Desc }}
</div>
<div class="col-2">
<q-input
dense
outlined
v-model="score[8].score"
:readonly="checkRoutePermisson"
label="คะแนนข้อ 9"
type="number"
lazy-rules
:rules="[(val:string) => val !== '' || 'กรุณากรอกคะเเนน']"
/>
</div>
</div>
<q-option-group
:options="question9Answer"
type="radio"
v-model="futureWork"
disable
/>
<q-item-label>
<q-input
v-if="futureWork === 1"
v-model="futureWorkReason"
label="กรอกข้อความ"
dense
lazy-rules
:readonly="checkRoutePermisson"
type="text"
autogrow
hide-bottom-space
outlined
disable
class="bg-white"
:rules="[
(val:string) => (val && val.length > 0) || 'กรุณากรอกข้อความ',
]"
/>
</q-item-label>
</q-card-section>
<!-- 10 -->
<q-card-section>
<div class="row">
<div class="col-10 items-center row inline">
{{ questionDesc.question10Desc }}
</div>
<div class="col-2">
<q-input
dense
outlined
v-model="score[9].score"
:readonly="checkRoutePermisson"
label="คะแนนข้อ 10"
type="number"
lazy-rules
:rules="[(val:string) => val !== '' || 'กรุณากรอกคะเเนน']"
/>
</div>
</div>
<q-input
class="col-12"
dense
disable
outlined
v-model="suggestion"
label=" "
type="textarea"
/>
</q-card-section>
</q-card>
<q-card bordered flat class="q-mt-md">
<div
class="q-pa-xs bg-grey-2 row items-center q-py-sm q-px-md justify-center text-bold"
>
ความคดเห
</div>
<q-separator />
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<div class="row col-12 q-pa-sm q-col-gutter-sm">
<div class="col-10">
<q-input
dense
lazy-rules
outlined
:readonly="checkRoutePermisson"
hide-bottom-space
v-model="comment"
label="กรอกความคิดเห็น"
type="textarea"
:rules="[(val:string) => !!val || 'กรุณากรอกความคิดเห็น']"
/>
</div>
<div class="col-2 text-top0">
<q-input
dense
outlined
readonly
v-model="scoreTotal"
label="คะแนนรวม"
type="number"
/>
</div>
</div>
<div class="col-12" v-if="!checkRoutePermisson">
<q-separator />
</div>
<q-card-actions
class="col-12 text-primary q-pa-md"
v-if="!checkRoutePermisson"
>
<q-space />
<q-btn
unelevated
label="บันทึก"
color="public"
@click="saveClick"
>
</q-btn>
</q-card-actions>
</div>
</q-card>
</div>
</div>
</q-form>
</div>
</q-card>
</template>
<style lang="scss" scope>
.q-img {
border-radius: 5px;
height: 70px;
}
.text-top {
color: gray;
font-weight: 400;
padding-bottom: 3px;
}
.text-detail {
font-weight: 500;
}
</style>