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

View file

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

View file

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

View file

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