no message

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-09-15 15:42:23 +07:00
parent ab24770899
commit 67d62541f6
9 changed files with 988 additions and 1362 deletions

View file

@ -1,3 +1,164 @@
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import keycloak from "@/plugins/keycloak";
import type { QForm } from "quasar";
const $q = useQuasar();
const route = useRoute();
const router = useRouter();
const mixin = useCounterMixin();
const dataId = route.params.id.toString();
const { messageError, showLoader, hideLoader } = mixin;
const myForm = ref<QForm | null>(null);
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 reasonWorkOther = ref("");
const reasonWork_option = ref<any>([
{ label: "ความมั่นคงในการทำงาน ", value: 0 },
{ label: "สิทธิประโยชน์/สวัสดิการ", value: 1 },
{ label: "อัตราเงินเดือน ", value: 2 },
{ label: "ลักษณะงาน ", value: 3 },
{ label: "วัฒนธรรมการทำงานของข้าราชการ ", value: 4 },
{ label: "นโยบายของหน่วยงาน ", value: 5 },
{ label: "ระบบการทำงาน", value: 6 },
{ label: "สมดุลชีวิตการทำงาน ", value: 7 },
{ label: "บรรยากาศในการทำงาน ", value: 8 },
{ label: "การพัฒนาในสายอาชีพ ", value: 9 },
{ label: "โอกาสความก้าวหน้า ", value: 10 },
{ label: "การได้รับการยอมรับจากสังคม ", value: 11 },
{ label: "อื่น ๆ (ระบุ) ", value: 12 },
]);
const exitFactorOther = ref("");
const exitFactor_option = ref<any>([
{ label: "อัตราเงินเดือน ", value: 0 },
{ label: "สวัสดิการ", value: 1 },
{ label: "ลักษณะงาน ", value: 2 },
{ label: "ระบบการทำงาน ", value: 3 },
{ label: "ระบบสนับสนุนการปฏิบัติงาน ", value: 4 },
{ label: "การมอบหมายงานที่ชัดเจนและเหมาะสม ", value: 5 },
{ label: "การบริหารงานของผู้บังคับบัญชา", value: 6 },
{ label: "การทำงานเป็นทีมกับเพื่อนร่วมงาน ", value: 7 },
{ label: "ระบบบริหารงานภายในหน่วยงาน ", value: 8 },
{ label: "บรรยากาศในการทำงาน ", value: 9 },
{ label: "การปฏิบัติอย่างเป็นธรรม ", value: 10 },
{ label: "การยอมรับความแตกต่างหลากหลาย ", value: 11 },
{ label: "การดูแลและให้ความช่วยเหลือในช่วงเริ่มต้นปฏิบัติงาน ", value: 12 },
{ label: "การพัฒนาอย่างเป็นระบบและต่อเนื่อง ", value: 13 },
{ label: "โอกาสความก้าวหน้า ", value: 14 },
{ label: "อื่น ๆ (ระบุ) ", value: 15 },
]);
const suggestFriendsReason = ref("");
const suggestFriends_option = ref<any>([
{ label: "แนะนำ ", value: true },
{ label: "ไม่แนะนำ (ระบุ)", value: false },
]);
const timeThink_option = ref<any>([
{ label: "น้อยกว่า 2 สัปดาห์ ", value: 0 },
{ label: "1 เดือน - 3 เดือน", value: 1 },
{ label: "3 เดือน - 6 เดือน ", value: 2 },
{ label: "6 เดือนขึ้นไป ", value: 3 },
]);
const haveJobReason = ref<any>("");
const haveJob_option = ref<any>([
{ label: "มี (ระบุ) ", value: true },
{ label: "ไม่มี", value: false },
]);
const futureWorkReason = ref<any>("");
const futureWork_option = ref<any>([
{ label: "อยาก ", value: true },
{ label: "ไม่อยาก (ระบุ)", value: false },
]);
const adjustOther = ref("");
const adjust_option = ref<any>([
{ label: "อัตราเงินเดือน ", value: 0 },
{ label: "สวัสดิการ", value: 1 },
{ label: "ลักษณะงาน ", value: 2 },
{ label: "ระบบการทำงาน ", value: 3 },
{ label: "ระบบสนับสนุนการปฏิบัติงาน ", value: 4 },
{ label: "การมอบหมายงานที่ชัดเจนและเหมาะสม ", value: 5 },
{ label: "การบริหารงานของผู้บังคับบัญชา", value: 6 },
{ label: "การทำงานเป็นทีมกับเพื่อนร่วมงาน ", value: 7 },
{ label: "ระบบบริหารงานภายในหน่วยงาน ", value: 8 },
{ label: "บรรยากาศในการทำงาน ", value: 9 },
{ label: "การปฏิบัติอย่างเป็นธรรม ", value: 10 },
{ label: "การยอมรับความแตกต่างหลากหลาย ", value: 11 },
{ label: "การดูแลและให้ความช่วยเหลือในช่วงเริ่มต้นปฏิบัติงาน ", value: 12 },
{ label: "การพัฒนาอย่างเป็นระบบและต่อเนื่อง ", value: 13 },
{ label: "โอกาสความก้าวหน้า ", value: 14 },
{ label: "อื่น ๆ (ระบุ) ", value: 15 },
]);
onMounted(async () => {
if (keycloak.tokenParsed != null) {
roleAdmin.value = await keycloak.tokenParsed.role.includes("placement1");
console.log("roleAdmin===>", roleAdmin.value);
}
await getData();
});
const getData = async () => {
showLoader();
await http
.get(config.API.ExitInterviewByid(dataId))
.then((res: any) => {
const data = res.data.result;
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 ?? null;
haveJobReason.value = data.havejobReason ?? "";
suggestFriends.value = data.suggestFriends ?? null;
suggestFriendsReason.value = data.suggestFriendsReason ?? "";
futureWork.value = data.futureWork ?? null;
futureWorkReason.value = data.futureWorkReason ?? "";
suggestion.value = data.suggestion ?? "";
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">
<q-btn
@ -60,38 +221,6 @@
อมลการตอบแบบสอบถาม
</div>
<q-space />
<!-- <div class="q-gutter-sm" v-if="!edit">
<q-btn
outline
color="primary"
dense
icon-right="mdi-file-edit-outline"
class="q-px-sm"
label="แก้ไข"
style="width: 80px"
@click="edit = !edit"
/>
</div>
<div class="q-gutter-sm" v-else>
<q-btn
outline
color="public"
dense
class="q-px-sm"
label="บันทึก"
style="width: 80px"
@click="conditionSave"
/>
<q-btn
outline
color="red"
dense
class="q-px-sm"
label="ยกเลิก"
style="width: 80px"
@click="edit = !edit"
/>
</div> -->
</div>
<div class="col-12"><q-separator /></div>
<q-form ref="myForm">
@ -351,256 +480,6 @@
</q-form>
</q-card>
</template>
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import CurrencyInput from "@/components/CurruncyInput.vue";
import http from "@/plugins/http";
import config from "@/app.config";
import keycloak from "@/plugins/keycloak";
import type { QTableProps, QForm } from "quasar";
import type {
TypeFile,
ResponseDataDetail,
} from "@/modules/06_retirement/interface/response/exit";
import PositionSide from "@/modules/01_metadata/components/positionEmployee/PositionSide.vue";
import FullCalendarComponent from "@fullcalendar/vue3";
const $q = useQuasar();
const route = useRoute();
const router = useRouter();
const mixin = useCounterMixin();
const dataId = route.params.id.toString();
const {
date2Thai,
dialogMessage,
messageError,
showLoader,
hideLoader,
success,
} = mixin;
const myForm = ref<QForm | null>(null);
const roleAdmin = ref<boolean>(false);
const edit = 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 reasonWorkOther = ref("");
const reasonWork_option = ref<any>([
{ label: "ความมั่นคงในการทำงาน ", value: 0 },
{ label: "สิทธิประโยชน์/สวัสดิการ", value: 1 },
{ label: "อัตราเงินเดือน ", value: 2 },
{ label: "ลักษณะงาน ", value: 3 },
{ label: "วัฒนธรรมการทำงานของข้าราชการ ", value: 4 },
{ label: "นโยบายของหน่วยงาน ", value: 5 },
{ label: "ระบบการทำงาน", value: 6 },
{ label: "สมดุลชีวิตการทำงาน ", value: 7 },
{ label: "บรรยากาศในการทำงาน ", value: 8 },
{ label: "การพัฒนาในสายอาชีพ ", value: 9 },
{ label: "โอกาสความก้าวหน้า ", value: 10 },
{ label: "การได้รับการยอมรับจากสังคม ", value: 11 },
{ label: "อื่น ๆ (ระบุ) ", value: 12 },
]);
const exitFactorOther = ref("");
const exitFactor_option = ref<any>([
{ label: "อัตราเงินเดือน ", value: 0 },
{ label: "สวัสดิการ", value: 1 },
{ label: "ลักษณะงาน ", value: 2 },
{ label: "ระบบการทำงาน ", value: 3 },
{ label: "ระบบสนับสนุนการปฏิบัติงาน ", value: 4 },
{ label: "การมอบหมายงานที่ชัดเจนและเหมาะสม ", value: 5 },
{ label: "การบริหารงานของผู้บังคับบัญชา", value: 6 },
{ label: "การทำงานเป็นทีมกับเพื่อนร่วมงาน ", value: 7 },
{ label: "ระบบบริหารงานภายในหน่วยงาน ", value: 8 },
{ label: "บรรยากาศในการทำงาน ", value: 9 },
{ label: "การปฏิบัติอย่างเป็นธรรม ", value: 10 },
{ label: "การยอมรับความแตกต่างหลากหลาย ", value: 11 },
{ label: "การดูแลและให้ความช่วยเหลือในช่วงเริ่มต้นปฏิบัติงาน ", value: 12 },
{ label: "การพัฒนาอย่างเป็นระบบและต่อเนื่อง ", value: 13 },
{ label: "โอกาสความก้าวหน้า ", value: 14 },
{ label: "อื่น ๆ (ระบุ) ", value: 15 },
]);
const suggestFriendsReason = ref("");
const suggestFriends_option = ref<any>([
{ label: "แนะนำ ", value: true },
{ label: "ไม่แนะนำ (ระบุ)", value: false },
]);
const timeThink_option = ref<any>([
{ label: "น้อยกว่า 2 สัปดาห์ ", value: 0 },
{ label: "1 เดือน - 3 เดือน", value: 1 },
{ label: "3 เดือน - 6 เดือน ", value: 2 },
{ label: "6 เดือนขึ้นไป ", value: 3 },
]);
const haveJobReason = ref<any>("");
const haveJob_option = ref<any>([
{ label: "มี (ระบุ) ", value: true },
{ label: "ไม่มี", value: false },
]);
const futureWorkReason = ref<any>("");
const futureWork_option = ref<any>([
{ label: "อยาก ", value: true },
{ label: "ไม่อยาก (ระบุ)", value: false },
]);
const adjustOther = ref("");
const adjust_option = ref<any>([
{ label: "อัตราเงินเดือน ", value: 0 },
{ label: "สวัสดิการ", value: 1 },
{ label: "ลักษณะงาน ", value: 2 },
{ label: "ระบบการทำงาน ", value: 3 },
{ label: "ระบบสนับสนุนการปฏิบัติงาน ", value: 4 },
{ label: "การมอบหมายงานที่ชัดเจนและเหมาะสม ", value: 5 },
{ label: "การบริหารงานของผู้บังคับบัญชา", value: 6 },
{ label: "การทำงานเป็นทีมกับเพื่อนร่วมงาน ", value: 7 },
{ label: "ระบบบริหารงานภายในหน่วยงาน ", value: 8 },
{ label: "บรรยากาศในการทำงาน ", value: 9 },
{ label: "การปฏิบัติอย่างเป็นธรรม ", value: 10 },
{ label: "การยอมรับความแตกต่างหลากหลาย ", value: 11 },
{ label: "การดูแลและให้ความช่วยเหลือในช่วงเริ่มต้นปฏิบัติงาน ", value: 12 },
{ label: "การพัฒนาอย่างเป็นระบบและต่อเนื่อง ", value: 13 },
{ label: "โอกาสความก้าวหน้า ", value: 14 },
{ label: "อื่น ๆ (ระบุ) ", value: 15 },
]);
const responseData = ref<any>({
Position: "",
PositionLevel: "",
Org: "",
Prefix: "",
Avatar: "",
reason: "",
salary: 0,
status: "",
fullname: "",
ReasonWork: 0,
ReasonWorkOther: "",
TimeThink: 0,
ExitFactor: 0,
ExitFactorOther: "",
Adjust: 0,
AdjustOther: "",
RealReason: "",
NotExitFactor: "",
Havejob: null,
HavejobReason: "",
SuggestFriends: null,
SuggestFriendsReason: "",
FutureWork: null,
FutureWorkReason: "",
});
onMounted(async () => {
if (keycloak.tokenParsed != null) {
roleAdmin.value = await keycloak.tokenParsed.role.includes("placement1");
console.log("roleAdmin===>", roleAdmin.value);
}
await getData();
});
const getData = async () => {
showLoader();
await http
.get(config.API.ExitInterviewByid(dataId))
.then((res: any) => {
const data = res.data.result;
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 ?? null;
haveJobReason.value = data.havejobReason ?? "";
suggestFriends.value = data.suggestFriends ?? null;
suggestFriendsReason.value = data.suggestFriendsReason ?? "";
futureWork.value = data.futureWork ?? null;
futureWorkReason.value = data.futureWorkReason ?? "";
suggestion.value = data.suggestion ?? "";
// console.log(data.value);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
const conditionSave = async () => {
if (myForm.value !== null) {
myForm.value.validate().then((success) => {
if (success) {
dialogMessage(
$q,
"ต้องการแก้ไขข้อมูลหรือไม่?",
"แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย",
"mdi-help-circle-outline",
"ตกลง",
"public",
async () => await saveData(),
undefined
);
}
});
}
};
const saveData = async () => {
const body = {};
showLoader();
await http
.put(config.API.ExitInterviewByid(dataId), body)
.then((res: any) => {
// const data = res.data.result;
// console.log(data);
success($q, "แก้ไขข้อมูลเพื่อลงบัญชีแนบท้ายสำเร็จ");
edit.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await getData();
hideLoader();
});
};
const getClass = (val: boolean) => {
return {
"full-width inputgreen cursor-pointer": val,
"full-width cursor-pointer": !val,
};
};
</script>
<style lang="scss" scope>
.q-img {
border-radius: 5px;