updated probation

This commit is contained in:
Warunee Tamkoo 2024-09-06 16:21:25 +07:00
parent 4c85c5bc8c
commit 77609f20ad
13 changed files with 93 additions and 54 deletions

View file

@ -9,7 +9,7 @@ import config from "@/app.config";
import genReport from "@/plugins/genreport"; import genReport from "@/plugins/genreport";
const $q = useQuasar(); const $q = useQuasar();
const isEdit = ref<boolean>(true); const isEdit = ref<boolean>(false);
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
const checkRoutePermisson = ref<boolean>(route.name == "probationFormDetail"); const checkRoutePermisson = ref<boolean>(route.name == "probationFormDetail");

View file

@ -256,6 +256,7 @@ function save() {
}; };
dialogConfirm($q, async () => { dialogConfirm($q, async () => {
showLoader();
await http await http
.put( .put(
config.API.editFormEvaluateCommader(assignId.value, evaluate_id.value), config.API.editFormEvaluateCommader(assignId.value, evaluate_id.value),
@ -264,9 +265,11 @@ function save() {
.then((res: any) => { .then((res: any) => {
status.value = false; status.value = false;
success($q, "บันทึกสำเร็จ"); success($q, "บันทึกสำเร็จ");
hideLoader();
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
hideLoader();
}); });
}); });
} }

View file

@ -228,6 +228,7 @@ function putformData() {
commander_dated: dateToISO(dateAutherise.value), commander_dated: dateToISO(dateAutherise.value),
}; };
dialogConfirm($q, async () => { dialogConfirm($q, async () => {
showLoader();
await http await http
.post(config.API.createformCommader(assignId.value), data) .post(config.API.createformCommader(assignId.value), data)
.then(() => { .then(() => {
@ -236,6 +237,9 @@ function putformData() {
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
})
.finally(() => {
hideLoader();
}); });
}); });
} }

View file

@ -376,6 +376,7 @@ function putformData() {
}; };
dialogConfirm($q, async () => { dialogConfirm($q, async () => {
showLoader();
await http await http
.put( .put(
config.API.editFormEvaluateChairman(assignId.value, evaluate_id.value), config.API.editFormEvaluateChairman(assignId.value, evaluate_id.value),
@ -388,6 +389,9 @@ function putformData() {
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
})
.finally(() => {
hideLoader();
}); });
}); });
} }

View file

@ -354,6 +354,7 @@ const putformData = () => {
director2_dated: dateToISO(director2_dated.value), director2_dated: dateToISO(director2_dated.value),
}; };
dialogConfirm($q, async () => { dialogConfirm($q, async () => {
showLoader();
await http await http
.post(config.API.createformChairman(assignId.value), data) .post(config.API.createformChairman(assignId.value), data)
.then(() => { .then(() => {
@ -362,6 +363,9 @@ const putformData = () => {
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
})
.finally(() => {
hideLoader();
}); });
}); });
}; };

View file

@ -191,6 +191,7 @@ async function postData(action: string) {
expand_month: expand_month.value, expand_month: expand_month.value,
}; };
if (action === "post") { if (action === "post") {
showLoader();
await http await http
.post(config.API.createformReport(assignId.value), data) .post(config.API.createformReport(assignId.value), data)
.then(() => { .then(() => {
@ -202,9 +203,10 @@ async function postData(action: string) {
}) })
.finally(() => { .finally(() => {
status.value = false; status.value = false;
fecthResult(assignId.value); hideLoader();
}); });
} else if (action === "put") { } else if (action === "put") {
showLoader();
await http await http
.put(config.API.createformReport(assignId.value), data) .put(config.API.createformReport(assignId.value), data)
.then(() => { .then(() => {
@ -216,7 +218,7 @@ async function postData(action: string) {
}) })
.finally(() => { .finally(() => {
status.value = false; status.value = false;
fecthResult(assignId.value); hideLoader();
}); });
} }
} }

View file

@ -28,6 +28,7 @@ const {
dateToISO, dateToISO,
messageError, messageError,
hideLoader, hideLoader,
showLoader,
dialogConfirm, dialogConfirm,
} = mixin; } = mixin;
const { ratingColors } = probationStore; const { ratingColors } = probationStore;
@ -312,6 +313,7 @@ function putformData() {
* @param data อมลทงไป * @param data อมลทงไป
*/ */
async function saveformdata(data: any) { async function saveformdata(data: any) {
showLoader();
await http await http
.post(config.API.createformevaluate(assignId.value), data) .post(config.API.createformevaluate(assignId.value), data)
.then((res: any) => { .then((res: any) => {
@ -320,6 +322,9 @@ async function saveformdata(data: any) {
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
})
.finally(() => {
hideLoader();
}); });
} }
@ -328,14 +333,17 @@ async function saveformdata(data: any) {
* @param data อมลทปเดต * @param data อมลทปเดต
*/ */
async function editData(data: any) { async function editData(data: any) {
showLoader();
await http await http
.put(config.API.editFormEvaluate(assignId.value, evaluate_id.value), data) .put(config.API.editFormEvaluate(assignId.value, evaluate_id.value), data)
.then((res: any) => { .then((res: any) => {
status.value = false; status.value = false;
success($q, "บันทึกสำเร็จ"); success($q, "บันทึกสำเร็จ");
hideLoader();
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
hideLoader();
}); });
} }

View file

@ -26,6 +26,8 @@ const {
messageError, messageError,
dialogConfirm, dialogConfirm,
dialogMessageNotify, dialogMessageNotify,
showLoader,
hideLoader,
} = mixin; } = mixin;
const { ratingColors } = probationStore; const { ratingColors } = probationStore;
@ -292,6 +294,7 @@ function putformData() {
* @param data อมลทไดจาก งช putformData * @param data อมลทไดจาก งช putformData
*/ */
async function saveformdata(data: any) { async function saveformdata(data: any) {
showLoader();
await http await http
.post(config.API.createformevaluate(assignId.value), data) .post(config.API.createformevaluate(assignId.value), data)
.then(() => { .then(() => {
@ -300,6 +303,9 @@ async function saveformdata(data: any) {
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
})
.finally(() => {
hideLoader();
}); });
} }

View file

@ -20,7 +20,8 @@ const mixin = useCounterMixin();
const { const {
date2Thai, date2Thai,
success, success,
notifyError, showLoader,
hideLoader,
dateToISO, dateToISO,
messageError, messageError,
dialogConfirm, dialogConfirm,
@ -297,6 +298,7 @@ function putformData() {
* @param data อมลท save * @param data อมลท save
*/ */
async function saveformdata(data: any) { async function saveformdata(data: any) {
showLoader();
await http await http
.post(config.API.formevaluateCommander(assignId.value), data) .post(config.API.formevaluateCommander(assignId.value), data)
.then(() => { .then(() => {
@ -305,6 +307,9 @@ async function saveformdata(data: any) {
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
})
.finally(() => {
hideLoader();
}); });
} }

View file

@ -324,6 +324,7 @@ function putformData() {
/** save data */ /** save data */
async function saveformdata(data: any) { async function saveformdata(data: any) {
showLoader();
await http await http
.post(config.API.formevaluateCommander(assignId.value), data) .post(config.API.formevaluateCommander(assignId.value), data)
.then((res: any) => { .then((res: any) => {
@ -332,6 +333,9 @@ async function saveformdata(data: any) {
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
})
.finally(() => {
hideLoader();
}); });
} }

View file

@ -63,7 +63,9 @@ function changeTab(tab: string) {
/** ปุ่มกลับ */ /** ปุ่มกลับ */
function clickBack() { function clickBack() {
router.go(-1); router.push({
path: `/probation/detail/${personalId.value}`,
});
DataStore.mainTab = "tab1"; DataStore.mainTab = "tab1";
} }

View file

@ -1,6 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, reactive } from "vue"; import { ref, onMounted, reactive } from "vue";
import { QForm, useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import http from "@/plugins/http"; import http from "@/plugins/http";
@ -8,7 +7,7 @@ import config from "@/app.config";
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { date2Thai } = mixin; const { date2Thai, showLoader, hideLoader } = mixin;
const route = useRoute(); const route = useRoute();
const checkRoutePermisson = ref<boolean>(route.name == "probationFormDetail"); const checkRoutePermisson = ref<boolean>(route.name == "probationFormDetail");
const assignId = ref<string>(route.params.form.toString()); const assignId = ref<string>(route.params.form.toString());
@ -48,53 +47,48 @@ const result_option = reactive([
{ name: "เห็นควรให้ขยายระยะเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก", value: 3 }, { name: "เห็นควรให้ขยายระยะเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก", value: 3 },
]); ]);
const note = ref<string>("");
const date = ref<Date>(new Date());
/** เปิด dialog */
function edit() {
status.value = true;
}
/** ปิด dialog */
function cancel() {
status.value = false;
}
/** get คะแนน */ /** get คะแนน */
async function getReportScore() { async function getReportScore() {
await http.get(config.API.summaryReportDetail(assignId.value)).then((res) => { showLoader();
const data = res.data.data; await http
develop_orientation_score.value = data.develop_orientation_score; .get(config.API.summaryReportDetail(assignId.value))
develop_self_learning_score.value = data.develop_self_learning_score; .then((res) => {
develop_training_seminar_score.value = data.develop_training_seminar_score; const data = res.data.data;
develop_other_training_score.value = data.develop_other_training_score; develop_orientation_score.value = data.develop_orientation_score;
develop_total_score.value = data.develop_total_score; develop_self_learning_score.value = data.develop_self_learning_score;
develop_orientation_percent.value = data.develop_orientation_percent; develop_training_seminar_score.value =
develop_self_learning_percent.value = data.develop_self_learning_percent; data.develop_training_seminar_score;
develop_training_seminar_percent.value = develop_other_training_score.value = data.develop_other_training_score;
data.develop_training_seminar_percent; develop_total_score.value = data.develop_total_score;
develop_other_training_percent.value = data.develop_other_training_percent; develop_orientation_percent.value = data.develop_orientation_percent;
develop_total_percent.value = data.develop_total_percent; develop_self_learning_percent.value = data.develop_self_learning_percent;
develop_result.value = data.develop_result == 0 ? 2 : data.develop_result; develop_training_seminar_percent.value =
data.develop_training_seminar_percent;
develop_other_training_percent.value =
data.develop_other_training_percent;
develop_total_percent.value = data.develop_total_percent;
develop_result.value = data.develop_result == 0 ? 2 : data.develop_result;
achievement_score.value = data.achievement_score; achievement_score.value = data.achievement_score;
achievement_score_total.value = data.achievement_score_total; achievement_score_total.value = data.achievement_score_total;
achievement_percent.value = data.achievement_percent; achievement_percent.value = data.achievement_percent;
achievement_result.value = data.achievement_result; achievement_result.value = data.achievement_result;
behavior_score.value = data.behavior_score; behavior_score.value = data.behavior_score;
behavior_score_total.value = data.behavior_score_total; behavior_score_total.value = data.behavior_score_total;
behavior_percent.value = data.behavior_percent; behavior_percent.value = data.behavior_percent;
behavior_result.value = data.behavior_result; behavior_result.value = data.behavior_result;
sum_score.value = data.sum_score; sum_score.value = data.sum_score;
sum_percent.value = data.sum_percent; sum_percent.value = data.sum_percent;
reason.value = data.reason; reason.value = data.reason;
pass_result.value = data.pass_result; pass_result.value = data.pass_result;
evaluate_date.value = data.evaluate_date; evaluate_date.value = data.evaluate_date;
}); })
.finally(() => {
hideLoader();
});
} }
/** get ค่า เมื่อโหลดหน้า */ /** get ค่า เมื่อโหลดหน้า */

View file

@ -2,8 +2,7 @@
import { ref, onMounted, watch } from "vue"; import { ref, onMounted, watch } from "vue";
import { QForm, useQuasar } from "quasar"; import { QForm, useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useRoute, useRouter } from "vue-router"; import { useRoute } from "vue-router";
import { useProbationDataStore } from "@/modules/05_placement/storeProbation";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import criterion from "@/modules/05_placement/components/Other/Criterion.vue"; import criterion from "@/modules/05_placement/components/Other/Criterion.vue";
@ -21,7 +20,7 @@ const $q = useQuasar();
const myForm = ref<QForm>(); const myForm = ref<QForm>();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { messageError, success, dialogConfirm } = mixin; const { messageError, success, dialogConfirm, showLoader, hideLoader } = mixin;
const route = useRoute(); const route = useRoute();
const checkRoutePermisson = ref<boolean>(route.name == "probationFormDetail"); const checkRoutePermisson = ref<boolean>(route.name == "probationFormDetail");
const assignId = ref<string>(route.params.form.toString()); const assignId = ref<string>(route.params.form.toString());
@ -35,16 +34,18 @@ const classBordered = ref<string>("");
/** ดึง ข้อมูลแบบสำรวจ */ /** ดึง ข้อมูลแบบสำรวจ */
async function getSurveyData() { async function getSurveyData() {
showLoader();
await http await http
.get(config.API.summarySurveyDetail(assignId.value)) .get(config.API.summarySurveyDetail(assignId.value))
.then((res: any) => { .then(async (res: any) => {
const data = res.data.data; const data = await res.data.data;
if (data !== null) { if (data !== null) {
answer1.value = data.answer1; answer1.value = data.answer1;
answer2.value = data.answer2; answer2.value = data.answer2;
answer3.value = data.answer3; answer3.value = data.answer3;
status.value = false; status.value = false;
} }
hideLoader();
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -61,16 +62,18 @@ async function save() {
answer3: answer3.value, answer3: answer3.value,
}; };
dialogConfirm($q, async () => { dialogConfirm($q, async () => {
showLoader();
await http await http
.post(config.API.summarySurveyDetail(assignId.value), data) .post(config.API.summarySurveyDetail(assignId.value), data)
.then((res: any) => { .then((res: any) => {
success($q, "บันทึกสำเร็จ"); success($q, "บันทึกสำเร็จ");
getSurveyData();
}) })
.catch((e: any) => { .catch((e: any) => {
messageError($q, e); messageError($q, e);
}) })
.finally(() => { .finally(() => {
getSurveyData(); hideLoader();
}); });
}); });
} else if (answer3.value == 0) { } else if (answer3.value == 0) {