ปรับรายการลาออก และ dialog confrim

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-05-21 10:21:38 +07:00
parent c1db58e570
commit 19da1d284a
5 changed files with 558 additions and 519 deletions

View file

@ -51,36 +51,6 @@ const saveData = async () => {
"ยืนยันการยื่นข้อมูลการโอน", "ยืนยันการยื่นข้อมูลการโอน",
"ต้องการยื่นข้อมูลการโอนนี้ใช่หรือไม่" "ต้องการยื่นข้อมูลการโอนนี้ใช่หรือไม่"
); );
// if (myform.value != null) {
// await myform.value.validate().then(async (saveDataTest: Boolean) => {
// if (saveDataTest) {
// saveTransfer();
// }
// });
// }
};
//
const saveTransfer = () => {
$q.dialog({
title: "ยืนยันการยื่นข้อมูลการโอน",
message: "ต้องการยื่นข้อมูลการโอนนี้ใช่หรือไม่?",
cancel: {
flat: true,
color: "negative",
},
persistent: true,
})
.onOk(async () => {
if (files.value == undefined) {
fails($q, "กรุณากรอกอัพโหลดเอกสารเพิ่มเติม");
} else {
createTransfer();
}
})
.onCancel(() => {})
.onDismiss(() => {});
}; };
/** /**

View file

@ -13,7 +13,7 @@ const type = ref<string>("");
const isReadonly = ref<boolean>(false); // const isReadonly = ref<boolean>(false); //
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { dialogConfirm, date2Thai, messageError } = mixin; const { dialogConfirm, date2Thai, messageError } = mixin;
const reason = ref<string>('') const reason = ref<string>("");
/*** ฟังก์ชั่นสำหรับ validate ฟอร์ม */ /*** ฟังก์ชั่นสำหรับ validate ฟอร์ม */
function validateForm() { function validateForm() {
@ -26,17 +26,15 @@ function close() {
} }
function onSubmit() { function onSubmit() {
dialogConfirm($q,()=>{ dialogConfirm(
modal.value = false $q,
reason.value = ""; () => {
},"ยืนยันการยกเลิก", "ต้องการยืนยันการยกเลิกกนี้ใช่หรือไม่?") modal.value = false;
} reason.value = "";
},
function inputEdit(val: boolean) { "ยืนยันการยกเลิก",
return { "ต้องการยืนยันการยกเลิกกนี้ใช่หรือไม่?"
"full-width cursor-pointer inputgreen ": val, );
"full-width cursor-pointer inputgreen": !val,
};
} }
</script> </script>
@ -48,13 +46,13 @@ function inputEdit(val: boolean) {
<q-card-section class="scroll" style="max-height: 70vh"> <q-card-section class="scroll" style="max-height: 70vh">
<div class="q-gutter-y-sm"> <div class="q-gutter-y-sm">
<q-input <q-input
label="เหตุผลที่ขอยกเลิกการลาออก" label="เหตุผลที่ขอยกเลิกการลาออก"
v-model="reason" v-model="reason"
outlined outlined
dense dense
type="textarea" type="textarea"
/> />
</div> </div>
</q-card-section> </q-card-section>
<q-separator /> <q-separator />

View file

@ -16,7 +16,7 @@ const {
messageError, messageError,
showLoader, showLoader,
hideLoader, hideLoader,
fails, dialogConfirm,
} = mixin; } = mixin;
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
@ -90,105 +90,44 @@ onMounted(() => {
/** /**
* นทกขอมลการลาออก * นทกขอมลการลาออก
*/ */
const saveData = async () => { const onSubmit = async () => {
if (myform.value != null) { dialogConfirm(
await myform.value.validate().then(async (saveDataTest: Boolean) => { $q,
if (saveDataTest) { () => {
saveResing(); showLoader();
} const formData = new FormData();
}); formData.append("Location", tranferOrg.value);
} formData.append("SendDate", dateToISO(dateCommand.value));
}; formData.append("ActiveDate", dateToISO(dateLeave.value));
formData.append("Reason", noteReason.value);
formData.append("file", files.value);
/** http
* งกนดาวโหลดอพโหลดไฟล .post(config.API.listResign(), formData)
*/ .then((res) => {
const filesNull = () => { let data = res.data.result.id;
files.value = null; success($q, "บันทึกข้อมูลสำเร็จ");
}; router.push(`/retire/result/${data}`);
const nameFile = ref<string>(""); })
const fileDocDataUpload = ref<File[]>([]); .catch((e) => {
const files = ref<any>(); messageError($q, e);
// })
const fileUploadDoc = async (file: any) => { .finally(() => {
fileDocDataUpload.value.push(file); hideLoader();
nameFile.value = file[0].name; });
files.value = file;
};
/**
* งกนเซฟขอมลลาออกเเลวเรยกใชงานApi
*/
const saveResing = () => {
$q.dialog({
title: "ยืนยันการยื่นข้อมูลลาออก",
message: "ต้องการยื่นข้อมูลลาออกนี้ใช่หรือไม่?",
cancel: {
flat: true,
color: "negative",
}, },
persistent: true, "ยืนยันการยื่นข้อมูลลาออก",
}) "ต้องการยื่นข้อมูลลาออกนี้ใช่หรือไม่"
.onOk(() => { );
createFormresign();
})
.onCancel(() => {})
.onDismiss(() => {});
}; };
const files = ref<any>();
// //
const cancelResing = () => { const cancelResing = () => {
modal.value = true; modal.value = true;
}; };
/**
* งกนลบ
* @param id ไอดของขอมลการลาออก
*/
const deleteResting = async (id: string) => {
showLoader();
await http
.delete(config.API.resingByid(id))
.then(() => {
success($q, "ยกเลิกการลาออกขอสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
clickBack();
});
};
//
const createFormresign = async () => {
const formData = new FormData();
if (files.value.length > 0) {
const blob = files.value.slice(0, files.value[0].size);
const newFile = new File(blob, nameFile.value, {
type: files.value[0].type,
});
formData.append("file", newFile);
}
formData.append("Location", tranferOrg.value);
formData.append("SendDate", dateToISO(dateCommand.value));
formData.append("ActiveDate", dateToISO(dateLeave.value));
formData.append("Reason", noteReason.value);
await http
.post(config.API.listResign(), formData)
.then((res: any) => {
let data = res.data.result.id;
success($q, "บันทึกข้อมูลสำเร็จ");
router.push(`/retire/result/${data}`);
})
.catch((e: any) => {
messageError($q, e);
});
};
/** /**
* งกนเรยกขอมลจาก Api * งกนเรยกขอมลจาก Api
* @param id ไอดของขอม * @param id ไอดของขอม
@ -197,16 +136,16 @@ const fectDataresign = async (id: string) => {
showLoader(); showLoader();
await http await http
.get(config.API.resingByid(id)) .get(config.API.resingByid(id))
.then((res: any) => { .then((res) => {
let data = res.data.result; let data = res.data.result;
(tranferOrg.value = data.location), tranferOrg.value = data.location;
(dateCommand.value = data.sendDate), dateCommand.value = data.sendDate;
(dateLeave.value = data.activeDate), dateLeave.value = data.activeDate;
(noteReason.value = data.reason), noteReason.value = data.reason;
(files.value = data.docs), files.value = data.docs;
(dataDetail.value = data); dataDetail.value = data;
}) })
.catch((e: any) => { .catch((e) => {
messageError($q, e); messageError($q, e);
}) })
.finally(() => { .finally(() => {
@ -235,7 +174,13 @@ function downloadFile(data: string) {
<div v-if="routeName == 'AddRetire'">เพิ่มเรื่องลาออก</div> <div v-if="routeName == 'AddRetire'">เพิ่มเรื่องลาออก</div>
<div v-else>รายละเอียดเรื่องลาออก</div> <div v-else>รายละเอียดเรื่องลาออก</div>
</div> </div>
<q-form ref="myform" class="col-12"> <q-form
ref="myform"
class="col-12"
greedy
@submit.prevent
@validation-success="onSubmit"
>
<q-card bordered> <q-card bordered>
<div class="col-12 row q-col-gutter-sm q-pa-md"> <div class="col-12 row q-col-gutter-sm q-pa-md">
<div class="col-xs-12 col-sm-12"> <div class="col-xs-12 col-sm-12">
@ -353,7 +298,23 @@ function downloadFile(data: string) {
/> />
<div class="col-12 row" v-if="routeName == 'AddRetire'"> <div class="col-12 row" v-if="routeName == 'AddRetire'">
<q-uploader <q-file
v-model="files"
class="col-xs-12 col-sm-12"
outlined
dense
lazy-rules
hide-bottom-space
accept=".pdf"
:rules="[
(val) => !!val || 'กรุณากรอกอัพโหลดเอกสารเพิ่มเติม',
]"
label="เอกสารเพิ่มเติม"
>
<template v-slot:prepend>
<q-icon name="attach_file" /> </template
></q-file>
<!-- <q-uploader
flat flat
bordered bordered
class="col-xs-12 col-sm-12" class="col-xs-12 col-sm-12"
@ -364,7 +325,7 @@ function downloadFile(data: string) {
@added="fileUploadDoc" @added="fileUploadDoc"
@removed="filesNull" @removed="filesNull"
style="max-width: px" style="max-width: px"
/> /> -->
</div> </div>
<div class="col-12 row"> <div class="col-12 row">
<q-card <q-card
@ -571,8 +532,7 @@ function downloadFile(data: string) {
class="q-px-md items-center" class="q-px-md items-center"
color="primary" color="primary"
label="ยื่นเรื่องขอลาออก" label="ยื่นเรื่องขอลาออก"
@click="saveData" type="submit"
:disable="tranferOrg == '' && noteReason == ''"
/> />
</div> </div>
</q-card> </q-card>

View file

@ -1,35 +1,46 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, onMounted } from "vue" import { ref, reactive, onMounted } from "vue";
import { useQuasar } from "quasar" import { useQuasar } from "quasar";
import { useRouter, useRoute } from "vue-router" import { useRouter, useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin" 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 type { QuestionDescription, OptionQuestions, OptionQuestions2 } from "@/modules/03_retire/interface/request/Main" import type {
QuestionDescription,
OptionQuestions,
OptionQuestions2,
} from "@/modules/03_retire/interface/request/Main";
const route = useRoute() const route = useRoute();
const router = useRouter() const router = useRouter();
const $q = useQuasar() const $q = useQuasar();
const mixin = useCounterMixin() const mixin = useCounterMixin();
const { success, messageError, notifyError, showLoader, hideLoader } = mixin const {
const dataId = ref<any>(route.params.id.toString()) success,
messageError,
notifyError,
showLoader,
hideLoader,
dialogConfirm,
} = mixin;
const dataId = ref<any>(route.params.id.toString());
/** /**
* วแปรแบบสอบถาม * วแปรแบบสอบถาม
*/ */
const exitFactor = ref<any>([]) const exitFactor = ref<any>([]);
const reasonWork = ref<any>([]) const reasonWork = ref<any>([]);
const adjust = ref<any>([]) const adjust = ref<any>([]);
const timeThink = ref<any>() const timeThink = ref<any>();
const realReason = ref<any>("") const realReason = ref<any>("");
const notExitFactor = ref<any>("") const notExitFactor = ref<any>("");
const haveJob = ref<any>() const haveJob = ref<any>();
const suggestFriends = ref<any>() const suggestFriends = ref<any>();
const futureWork = ref<any>() const futureWork = ref<any>();
const suggestion = ref<any>("") const suggestion = ref<any>("");
const reasonWorkOther = ref("") const reasonWorkOther = ref("");
// const reasonWork_option = ref<any>([ // const reasonWork_option = ref<any>([
// { label: " ", value: 0 }, // { label: " ", value: 0 },
// { label: "/", value: 1 }, // { label: "/", value: 1 },
@ -45,7 +56,7 @@ const reasonWorkOther = ref("")
// { label: " ", value: 11 }, // { label: " ", value: 11 },
// { label: " () ", value: 12 }, // { label: " () ", value: 12 },
// ]); // ]);
const exitFactorOther = ref("") const exitFactorOther = ref("");
// const exitFactor_option = ref<any>([ // const exitFactor_option = ref<any>([
// { label: " ", value: 0 }, // { label: " ", value: 0 },
// { label: "", value: 1 }, // { label: "", value: 1 },
@ -64,7 +75,7 @@ const exitFactorOther = ref("")
// { label: " ", value: 14 }, // { label: " ", value: 14 },
// { label: " () ", value: 15 }, // { label: " () ", value: 15 },
// ]); // ]);
const suggestFriendsReason = ref("") const suggestFriendsReason = ref("");
// const suggestFriends_option = ref<any>([ // const suggestFriends_option = ref<any>([
// { label: " ", value: 0 }, // { label: " ", value: 0 },
// { label: " ()", value: 1 }, // { label: " ()", value: 1 },
@ -75,17 +86,17 @@ const suggestFriendsReason = ref("")
// { label: "3 - 6 ", value: 2 }, // { label: "3 - 6 ", value: 2 },
// { label: "6 ", value: 3 }, // { label: "6 ", value: 3 },
// ]); // ]);
const haveJobReason = ref<any>("") const haveJobReason = ref<any>("");
// const haveJob_option = ref<any>([ // const haveJob_option = ref<any>([
// { label: " ()", value: 0 }, // { label: " ()", value: 0 },
// { label: "", value: 1 }, // { label: "", value: 1 },
// ]); // ]);
const futureWorkReason = ref<any>("") const futureWorkReason = ref<any>("");
// const futureWork_option = ref<any>([ // const futureWork_option = ref<any>([
// { label: "", value: 0 }, // { label: "", value: 0 },
// { label: " ()", value: 1 }, // { label: " ()", value: 1 },
// ]); // ]);
const adjustOther = ref("") const adjustOther = ref("");
// const adjust_option = ref<any>([ // const adjust_option = ref<any>([
// { label: " ", value: 0 }, // { label: " ", value: 0 },
// { label: "", value: 1 }, // { label: "", value: 1 },
@ -109,378 +120,478 @@ const adjustOther = ref("")
* เรยกฟงกนทงหมดตอนเรยกใชไฟล * เรยกฟงกนทงหมดตอนเรยกใชไฟล
*/ */
onMounted(async () => { onMounted(async () => {
showLoader() showLoader();
await fecthQuestion() await fecthQuestion();
}) });
// //
// //
const questionDesc = ref<QuestionDescription>({ const questionDesc = ref<QuestionDescription>({
question1Desc: "", question1Desc: "",
question2Desc: "", question2Desc: "",
question3Desc: "", question3Desc: "",
question4Desc: "", question4Desc: "",
question5Desc: "", question5Desc: "",
question6Desc: "", question6Desc: "",
question7Desc: "", question7Desc: "",
question8Desc: "", question8Desc: "",
question9Desc: "", question9Desc: "",
question10Desc: "", question10Desc: "",
}) });
const question1Answer = ref<OptionQuestions[]>([]) const question1Answer = ref<OptionQuestions[]>([]);
const question2Answer = ref<OptionQuestions[]>([]) const question2Answer = ref<OptionQuestions[]>([]);
const question3Answer = ref<OptionQuestions[]>([]) const question3Answer = ref<OptionQuestions[]>([]);
const question4Answer = ref<OptionQuestions[]>([]) const question4Answer = ref<OptionQuestions[]>([]);
const question7Answer = ref<OptionQuestions2[]>([]) const question7Answer = ref<OptionQuestions2[]>([]);
const question8Answer = ref<OptionQuestions2[]>([]) const question8Answer = ref<OptionQuestions2[]>([]);
const question9Answer = ref<OptionQuestions2[]>([]) const question9Answer = ref<OptionQuestions2[]>([]);
/** /**
* งกนแบบสอบถาม * งกนแบบสอบถาม
*/ */
async function fecthQuestion() { async function fecthQuestion() {
await http await http
.get(config.API.questionList()) .get(config.API.questionList())
.then(res => { .then((res) => {
const data = res.data.result const data = res.data.result;
question1Answer.value = [] question1Answer.value = [];
question3Answer.value = [] question3Answer.value = [];
question4Answer.value = [] question4Answer.value = [];
// //
for (let i = 1; i <= 10; i++) { for (let i = 1; i <= 10; i++) {
const questionKey = `question${i}Desc` const questionKey = `question${i}Desc`;
questionDesc.value[questionKey] = `${i}. ${data[questionKey]}` questionDesc.value[questionKey] = `${i}. ${data[questionKey]}`;
} }
// //
const Answer1 = data.question1Answer.map((e: any, index: number) => ({ const Answer1 = data.question1Answer.map((e: any, index: number) => ({
label: e, label: e,
value: index, value: index,
})) }));
question1Answer.value = Answer1 question1Answer.value = Answer1;
question1Answer.value.push({ question1Answer.value.push({
label: "อื่น ๆ (ระบุ)", label: "อื่น ๆ (ระบุ)",
value: Answer1.length, value: Answer1.length,
}) });
question2Answer.value = data.question2Answer.map((e: any, index: number) => ({ question2Answer.value = data.question2Answer.map(
label: e, (e: any, index: number) => ({
value: index, label: e,
})) value: index,
const Answer3 = data.question3Answer.map((e: any, index: number) => ({ })
label: e, );
value: index, const Answer3 = data.question3Answer.map((e: any, index: number) => ({
})) label: e,
question3Answer.value = Answer3 value: index,
question3Answer.value.push({ }));
label: "อื่น ๆ (ระบุ)", question3Answer.value = Answer3;
value: Answer3.length, question3Answer.value.push({
}) label: "อื่น ๆ (ระบุ)",
const Answer4 = data.question4Answer.map((e: any, index: number) => ({ value: Answer3.length,
label: e, });
value: index, const Answer4 = data.question4Answer.map((e: any, index: number) => ({
})) label: e,
question4Answer.value = Answer4 value: index,
question4Answer.value.push({ }));
label: "อื่น ๆ (ระบุ)", question4Answer.value = Answer4;
value: Answer4.length, question4Answer.value.push({
}) label: "อื่น ๆ (ระบุ)",
question7Answer.value = data.question7Answer.map((e: any, index: number) => ({ value: Answer4.length,
label: e, });
value: index, question7Answer.value = data.question7Answer.map(
})) (e: any, index: number) => ({
question8Answer.value = data.question8Answer.map((e: any, index: number) => ({ label: e,
label: e, value: index,
value: index, })
})) );
question9Answer.value = data.question9Answer.map((e: any, index: number) => ({ question8Answer.value = data.question8Answer.map(
label: e, (e: any, index: number) => ({
value: index, label: e,
})) value: index,
}) })
.catch(err => { );
messageError($q, err) question9Answer.value = data.question9Answer.map(
}) (e: any, index: number) => ({
.finally(() => { label: e,
hideLoader() value: index,
}) })
);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
} }
/** /**
* นทกเเบบสอบถาม * นทกเเบบสอบถาม
*/ */
const saveForm = () => { const saveForm = () => {
let hasError = false let hasError = false;
if ( if (
reasonWork.value.length === 0 || reasonWork.value.length === 0 ||
(reasonWork.value.filter((x: any) => x == 12).length > 0 && (reasonWorkOther.value == null || reasonWorkOther.value == "")) || (reasonWork.value.filter((x: any) => x == 12).length > 0 &&
timeThink.value.length === 0 || (reasonWorkOther.value == null || reasonWorkOther.value == "")) ||
exitFactor.value.length === 0 || timeThink.value.length === 0 ||
(exitFactor.value.filter((x: any) => x == 15).length > 0 && (exitFactorOther.value == null || exitFactorOther.value == "")) || exitFactor.value.length === 0 ||
adjust.value.length === 0 || (exitFactor.value.filter((x: any) => x == 15).length > 0 &&
(adjust.value.filter((x: any) => x == 15).length > 0 && (adjustOther.value == null || adjustOther.value == "")) || (exitFactorOther.value == null || exitFactorOther.value == "")) ||
realReason.value.length < 1 || adjust.value.length === 0 ||
notExitFactor.value.length < 1 || (adjust.value.filter((x: any) => x == 15).length > 0 &&
haveJob.value.length === 0 || (adjustOther.value == null || adjustOther.value == "")) ||
(haveJob.value === 0 && (haveJobReason.value == null || haveJobReason.value == "")) || realReason.value.length < 1 ||
suggestFriends.value.length === 0 || notExitFactor.value.length < 1 ||
(suggestFriends.value === 1 && (suggestFriendsReason.value == null || suggestFriendsReason.value == "")) || haveJob.value.length === 0 ||
futureWork.value.length === 0 || (haveJob.value === 0 &&
(futureWork.value === 1 && (futureWorkReason.value == null || futureWorkReason.value == "")) || (haveJobReason.value == null || haveJobReason.value == "")) ||
suggestion.value.length < 1 suggestFriends.value.length === 0 ||
) { (suggestFriends.value === 1 &&
hasError = true (suggestFriendsReason.value == null ||
} else { suggestFriendsReason.value == "")) ||
$q.dialog({ futureWork.value.length === 0 ||
title: "ยืนยันข้อมูลแบบสอบถาม", (futureWork.value === 1 &&
message: "ต้องการส่งข้อมูลแบบสอบถามนี้ใช่หรือไม่?", (futureWorkReason.value == null || futureWorkReason.value == "")) ||
cancel: { suggestion.value.length < 1
flat: true, ) {
color: "negative", hasError = true;
}, } else {
persistent: true, dialogConfirm(
}) $q,
.onOk(async () => { () => {
createResult() createResult();
}) },
.onCancel(() => {}) "ยืนยันข้อมูลแบบสอบถาม",
.onDismiss(() => {}) "ต้องการส่งข้อมูลแบบสอบถามนี้ใช่หรือไม่"
} );
if (hasError === true) { }
notifyError($q, "กรุณากรอกข้อมูลให้ครบ") if (hasError === true) {
} notifyError($q, "กรุณากรอกข้อมูลให้ครบ");
} }
};
/** /**
* สรางเบบสอบถามไปย api * สรางเบบสอบถามไปย api
*/ */
const createResult = async () => { const createResult = async () => {
const data = { const data = {
RetirementResignId: dataId.value, RetirementResignId: dataId.value,
ReasonWork: reasonWork.value, ReasonWork: reasonWork.value,
ReasonWorkOther: reasonWorkOther.value, ReasonWorkOther: reasonWorkOther.value,
TimeThink: timeThink.value, TimeThink: timeThink.value,
ExitFactor: exitFactor.value, ExitFactor: exitFactor.value,
ExitFactorOther: exitFactorOther.value, ExitFactorOther: exitFactorOther.value,
Adjust: adjust.value, Adjust: adjust.value,
AdjustOther: adjustOther.value, AdjustOther: adjustOther.value,
RealReason: realReason.value, RealReason: realReason.value,
NotExitFactor: notExitFactor.value, NotExitFactor: notExitFactor.value,
Havejob: haveJob.value, Havejob: haveJob.value,
HavejobReason: haveJobReason.value, HavejobReason: haveJobReason.value,
SuggestFriends: suggestFriends.value, SuggestFriends: suggestFriends.value,
SuggestFriendsReason: suggestFriendsReason.value, SuggestFriendsReason: suggestFriendsReason.value,
FutureWork: futureWork.value, FutureWork: futureWork.value,
FutureWorkReason: futureWorkReason.value, FutureWorkReason: futureWorkReason.value,
Suggestion: suggestion.value, Suggestion: suggestion.value,
} };
await http await http
.post(config.API.listquestionnaire(), data) .post(config.API.listquestionnaire(), data)
.then(() => { .then(() => {
success($q, "บันทึกข้อมูลสำเร็จ") success($q, "บันทึกข้อมูลสำเร็จ");
router.push(`/retire`) router.push(`/retire`);
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e) messageError($q, e);
}) });
} };
</script> </script>
<template> <template>
<div class="col-12 row justify-center"> <div class="col-12 row justify-center">
<div class="col-xs-12 col-sm-12 col-md-11"> <div class="col-xs-12 col-sm-12 col-md-11">
<div class="toptitle text-white col-12 row items-center"> <div class="toptitle text-white col-12 row items-center">
<q-btn icon="mdi-arrow-left" unelevated round dense flat color="primary" class="q-mr-sm" @click="router.push(`/retire`)" /> <q-btn
</div> icon="mdi-arrow-left"
<div class="col-12"> unelevated
<q-card bordered> round
<div class="col-12 row q-col-gutter-md q-pa-md"> dense
<div class="col-xs-12 col-sm-12"> flat
<q-card bordered flat> color="primary"
<div class="q-pa-xs bg-white-2 row items-center q-py-sm q-px-md justify-center text-bold">เราไดบแบบฟอรมของคณแล กรณาตอบแบบสอบถาม</div> class="q-mr-sm"
<div class="q-pa-xs bg-grey-2 row items-center q-py-sm q-px-md justify-center text-bold">แบบสอบถาม</div> @click="router.push(`/retire`)"
<q-separator /> />
<div class="col-12 row q-pa-sm q-col-gutter-sm"> </div>
<div class="col-12 text-top0 items-center"> <div class="col-12">
<!-- 1. เหตใดทานจงตดสนใจรวมงานกบกรงเทพมหานคร <q-card bordered>
<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-white-2 row items-center q-py-sm q-px-md justify-center text-bold"
>
เราไดบแบบฟอรมของคณแล กรณาตอบแบบสอบถาม
</div>
<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="col-12 text-top0 items-center">
<!-- 1. เหตใดทานจงตดสนใจรวมงานกบกรงเทพมหานคร
(เลอกไดมากกว 1 ) --> (เลอกไดมากกว 1 ) -->
{{ questionDesc.question1Desc }} {{ questionDesc.question1Desc }}
</div> </div>
<q-option-group :options="question1Answer" type="checkbox" v-model="reasonWork" /> <q-option-group
<div class="col-12 text-top0 items-center"> :options="question1Answer"
<q-item-label> type="checkbox"
<q-input v-model="reasonWork"
v-if="reasonWork.includes(question1Answer.length - 1)" />
v-model="reasonWorkOther" <div class="col-12 text-top0 items-center">
label="กรอกอื่นๆ" <q-item-label>
dense <q-input
lazy-rules v-if="reasonWork.includes(question1Answer.length - 1)"
type="text" v-model="reasonWorkOther"
autogrow label="กรอกอื่นๆ"
hide-bottom-space dense
outlined lazy-rules
class="bg-white" type="text"
:rules="[val => (val && val.length > 0) || 'กรุณากรอกข้อความ']" autogrow
/> hide-bottom-space
</q-item-label> outlined
</div> class="bg-white"
<div class="col-12 text-top0 items-center"> :rules="[
<!-- 2. สำหรบการลาออกในครงน (val) =>
(val && val.length > 0) || 'กรุณากรอกข้อความ',
]"
/>
</q-item-label>
</div>
<div class="col-12 text-top0 items-center">
<!-- 2. สำหรบการลาออกในครงน
านไดดทบทวนอยางจรงจงเปนระยะเวลานานเทาใด --> านไดดทบทวนอยางจรงจงเปนระยะเวลานานเทาใด -->
{{ questionDesc.question2Desc }} {{ questionDesc.question2Desc }}
</div> </div>
<q-option-group :options="question2Answer" type="radio" v-model="timeThink" /> <q-option-group
:options="question2Answer"
type="radio"
v-model="timeThink"
/>
<div class="col-12 text-top0 items-center"> <div class="col-12 text-top0 items-center">
<!-- 3. จจยใดททำใหานตดสนใจลาออกจากราชการ <!-- 3. จจยใดททำใหานตดสนใจลาออกจากราชการ
(เลอกไดมากกว 1 ) --> (เลอกไดมากกว 1 ) -->
{{ questionDesc.question3Desc }} {{ questionDesc.question3Desc }}
</div> </div>
<q-option-group :options="question3Answer" type="checkbox" v-model="exitFactor" /> <q-option-group
<div class="col-12 text-top0 items-center"> :options="question3Answer"
<q-item-label> type="checkbox"
<q-input v-model="exitFactor"
v-if="exitFactor.includes(question3Answer.length - 1)" />
v-model="exitFactorOther" <div class="col-12 text-top0 items-center">
label="กรอกอื่นๆ" <q-item-label>
dense <q-input
lazy-rules v-if="exitFactor.includes(question3Answer.length - 1)"
type="text" v-model="exitFactorOther"
autogrow label="กรอกอื่นๆ"
hide-bottom-space dense
outlined lazy-rules
class="bg-white" type="text"
:rules="[val => (val && val.length > 0) || 'กรุณากรอกข้อความ']" autogrow
/> hide-bottom-space
</q-item-label> outlined
</div> class="bg-white"
:rules="[
(val) =>
(val && val.length > 0) || 'กรุณากรอกข้อความ',
]"
/>
</q-item-label>
</div>
<div class="col-12 text-top0 items-center"> <div class="col-12 text-top0 items-center">
{{ questionDesc.question4Desc }} {{ questionDesc.question4Desc }}
</div> </div>
<q-list> <q-list>
<q-option-group :options="question4Answer" type="checkbox" v-model="adjust" /> <q-option-group
</q-list> :options="question4Answer"
<div class="col-12 text-top0 items-center"> type="checkbox"
<q-item-label> v-model="adjust"
<q-input />
v-if="adjust.includes(question4Answer.length - 1)" </q-list>
v-model="adjustOther" <div class="col-12 text-top0 items-center">
label="กรอกอื่นๆ" <q-item-label>
dense <q-input
lazy-rules v-if="adjust.includes(question4Answer.length - 1)"
type="text" v-model="adjustOther"
autogrow label="กรอกอื่นๆ"
hide-bottom-space dense
outlined lazy-rules
class="bg-white" type="text"
:rules="[val => (val && val.length > 0) || 'กรุณากรอกข้อความ']" autogrow
/> hide-bottom-space
</q-item-label> outlined
</div> class="bg-white"
<div class="col-12 text-top0 items-center"> :rules="[
<!-- 5. โปรดระบสาเหตแทจร (val) =>
(val && val.length > 0) || 'กรุณากรอกข้อความ',
]"
/>
</q-item-label>
</div>
<div class="col-12 text-top0 items-center">
<!-- 5. โปรดระบสาเหตแทจร
ทำใหานตดสนใจลาออกจากการปฏราชการกบกรงเทพมหานคร ทำใหานตดสนใจลาออกจากการปฏราชการกบกรงเทพมหานคร
? --> ? -->
{{ questionDesc.question5Desc }} {{ questionDesc.question5Desc }}
</div> </div>
<q-input class="col-12" dense outlined v-model="realReason" label=" " type="textarea" /> <q-input
class="col-12"
dense
outlined
v-model="realReason"
label=" "
type="textarea"
/>
<div class="col-12 text-top0 items-center"> <div class="col-12 text-top0 items-center">
<!-- 6. จจยใดทจะชวยทำใหานเปลยนใจ <!-- 6. จจยใดทจะชวยทำใหานเปลยนใจ
ไมอยากลาออกจากการปฏราชการกบกรงเทพมหานคร --> ไมอยากลาออกจากการปฏราชการกบกรงเทพมหานคร -->
{{ questionDesc.question6Desc }} {{ questionDesc.question6Desc }}
</div> </div>
<q-input class="col-12" dense outlined v-model="notExitFactor" label=" " type="textarea" /> <q-input
class="col-12"
dense
outlined
v-model="notExitFactor"
label=" "
type="textarea"
/>
<div class="col-12 text-top0 items-center"> <div class="col-12 text-top0 items-center">
<!-- 7. านมงานใหมหรอไม าม (โปรดระบ <!-- 7. านมงานใหมหรอไม าม (โปรดระบ
อบรทเอกชน/หนวยงานภาคร) อบรทเอกชน/หนวยงานภาคร)
และอะไรคอสงททำงานใหมใหบทาน และอะไรคอสงททำงานใหมใหบทาน
งทานรกวาเปนทาพอใจมากกวาการปฏราชการกบกรงเทพมหานคร --> งทานรกวาเปนทาพอใจมากกวาการปฏราชการกบกรงเทพมหานคร -->
{{ questionDesc.question7Desc }} {{ questionDesc.question7Desc }}
</div> </div>
<q-option-group :options="question7Answer" type="radio" v-model="haveJob" /> <q-option-group
<div class="col-12 text-top0 items-center"> :options="question7Answer"
<q-item-label> type="radio"
<q-input v-model="haveJob"
v-if="haveJob === 0" />
v-model="haveJobReason" <div class="col-12 text-top0 items-center">
label="กรอกข้อความ" <q-item-label>
dense <q-input
lazy-rules v-if="haveJob === 0"
type="text" v-model="haveJobReason"
autogrow label="กรอกข้อความ"
hide-bottom-space dense
outlined lazy-rules
class="bg-white" type="text"
:rules="[val => (val && val.length > 0) || 'กรุณากรอกข้อความ']" autogrow
/> hide-bottom-space
</q-item-label> outlined
</div> class="bg-white"
<div class="col-12 text-top0 items-center"> :rules="[
<!-- 8. านจะแนะนำเพอนใหมารวมงานกบกรงเทพมหานครหรอไม (val) =>
(val && val.length > 0) || 'กรุณากรอกข้อความ',
]"
/>
</q-item-label>
</div>
<div class="col-12 text-top0 items-center">
<!-- 8. านจะแนะนำเพอนใหมารวมงานกบกรงเทพมหานครหรอไม
(าไม โปรดระบเหตผล) --> (าไม โปรดระบเหตผล) -->
{{ questionDesc.question8Desc }} {{ questionDesc.question8Desc }}
</div> </div>
<q-option-group :options="question8Answer" type="radio" v-model="suggestFriends" /> <q-option-group
<div class="col-12 text-top0 items-center"> :options="question8Answer"
<q-item-label> type="radio"
<q-input v-model="suggestFriends"
v-if="suggestFriends === 1" />
v-model="suggestFriendsReason" <div class="col-12 text-top0 items-center">
label="กรอกข้อความ" <q-item-label>
dense <q-input
lazy-rules v-if="suggestFriends === 1"
type="text" v-model="suggestFriendsReason"
autogrow label="กรอกข้อความ"
hide-bottom-space dense
outlined lazy-rules
class="bg-white" type="text"
:rules="[val => (val && val.length > 0) || 'กรุณากรอกข้อความ']" autogrow
/> hide-bottom-space
</q-item-label> outlined
</div> class="bg-white"
<div class="col-12 text-top0 items-center"> :rules="[
<!-- 9. หากทานมโอกาสในอนาคต (val) =>
(val && val.length > 0) || 'กรุณากรอกข้อความ',
]"
/>
</q-item-label>
</div>
<div class="col-12 text-top0 items-center">
<!-- 9. หากทานมโอกาสในอนาคต
านอยากกลบมารวมงานกบกรงเทพมหานครหรอไม (าไม านอยากกลบมารวมงานกบกรงเทพมหานครหรอไม (าไม
โปรดระบเหตผล) --> โปรดระบเหตผล) -->
{{ questionDesc.question9Desc }} {{ questionDesc.question9Desc }}
</div> </div>
<q-option-group :options="question9Answer" type="radio" v-model="futureWork" /> <q-option-group
<div class="col-12 text-top0 items-center"> :options="question9Answer"
<q-item-label> type="radio"
<q-input v-model="futureWork"
v-if="futureWork === 1" />
v-model="futureWorkReason" <div class="col-12 text-top0 items-center">
label="กรอกข้อความ" <q-item-label>
dense <q-input
lazy-rules v-if="futureWork === 1"
type="text" v-model="futureWorkReason"
autogrow label="กรอกข้อความ"
hide-bottom-space dense
outlined lazy-rules
class="bg-white" type="text"
:rules="[val => (val && val.length > 0) || 'กรุณากรอกข้อความ']" autogrow
/> hide-bottom-space
</q-item-label> outlined
</div> class="bg-white"
:rules="[
(val) =>
(val && val.length > 0) || 'กรุณากรอกข้อความ',
]"
/>
</q-item-label>
</div>
<div class="col-12 text-top0 items-center"> <div class="col-12 text-top0 items-center">
<!-- 10. ความคดเหนและขอเสนอแนะอ --> <!-- 10. ความคดเหนและขอเสนอแนะอ -->
{{ questionDesc.question10Desc }} {{ questionDesc.question10Desc }}
</div> </div>
<q-input class="col-12" dense outlined v-model="suggestion" label=" " type="textarea" /> <q-input
class="col-12"
dense
outlined
v-model="suggestion"
label=" "
type="textarea"
/>
<q-separator /> <q-separator />
</div> </div>
</q-card> </q-card>
</div> </div>
</div> </div>
<div class="row col-12 q-pa-sm"> <div class="row col-12 q-pa-sm">
<q-space /> <q-space />
<q-btn unelevated dense class="q-px-md items-center" color="primary" label="บันทึกข้อมูลแบบสอบถาม" @click="saveForm" /> <q-btn
</div> unelevated
</q-card> dense
</div> class="q-px-md items-center"
</div> color="primary"
</div> label="บันทึกข้อมูลแบบสอบถาม"
@click="saveForm"
/>
</div>
</q-card>
</div>
</div>
</div>
</template> </template>

View file

@ -20,6 +20,7 @@ const {
hideLoader, hideLoader,
messageError, messageError,
success, success,
dialogConfirm,
} = mixin; } = mixin;
const fullname = ref<string>(""); const fullname = ref<string>("");
@ -88,15 +89,14 @@ const fetchlistNotification = async (index: number, type: string) => {
* confirm อนออกจากระบบ * confirm อนออกจากระบบ
*/ */
const doLogout = () => { const doLogout = () => {
$q.dialog({ dialogConfirm(
title: "ยืนยันการออกจากระบบ", $q,
message: `ต้องการออกจากระบบใช่หรือไม่?`, () => {
cancel: "ยกเลิก", keycloak.logout();
ok: "ยืนยัน", },
persistent: true, "ยืนยันการออกจากระบบ",
}).onOk(() => { "ต้องการออกจากระบบใช่หรือไม่"
keycloak.logout(); );
});
}; };
const clickDelete = async (id: string, index: number) => { const clickDelete = async (id: string, index: number) => {