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";
const $q = useQuasar();
const isEdit = ref<boolean>(true);
const isEdit = ref<boolean>(false);
const router = useRouter();
const route = useRoute();
const checkRoutePermisson = ref<boolean>(route.name == "probationFormDetail");

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,5 @@
<script setup lang="ts">
import { ref, onMounted, reactive } from "vue";
import { QForm, useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useRoute, useRouter } from "vue-router";
import http from "@/plugins/http";
@ -8,7 +7,7 @@ import config from "@/app.config";
const mixin = useCounterMixin();
const { date2Thai } = mixin;
const { date2Thai, showLoader, hideLoader } = mixin;
const route = useRoute();
const checkRoutePermisson = ref<boolean>(route.name == "probationFormDetail");
const assignId = ref<string>(route.params.form.toString());
@ -48,53 +47,48 @@ const result_option = reactive([
{ 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 คะแนน */
async function getReportScore() {
await http.get(config.API.summaryReportDetail(assignId.value)).then((res) => {
const data = res.data.data;
develop_orientation_score.value = data.develop_orientation_score;
develop_self_learning_score.value = data.develop_self_learning_score;
develop_training_seminar_score.value = data.develop_training_seminar_score;
develop_other_training_score.value = data.develop_other_training_score;
develop_total_score.value = data.develop_total_score;
develop_orientation_percent.value = data.develop_orientation_percent;
develop_self_learning_percent.value = data.develop_self_learning_percent;
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;
showLoader();
await http
.get(config.API.summaryReportDetail(assignId.value))
.then((res) => {
const data = res.data.data;
develop_orientation_score.value = data.develop_orientation_score;
develop_self_learning_score.value = data.develop_self_learning_score;
develop_training_seminar_score.value =
data.develop_training_seminar_score;
develop_other_training_score.value = data.develop_other_training_score;
develop_total_score.value = data.develop_total_score;
develop_orientation_percent.value = data.develop_orientation_percent;
develop_self_learning_percent.value = data.develop_self_learning_percent;
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_total.value = data.achievement_score_total;
achievement_percent.value = data.achievement_percent;
achievement_result.value = data.achievement_result;
achievement_score.value = data.achievement_score;
achievement_score_total.value = data.achievement_score_total;
achievement_percent.value = data.achievement_percent;
achievement_result.value = data.achievement_result;
behavior_score.value = data.behavior_score;
behavior_score_total.value = data.behavior_score_total;
behavior_percent.value = data.behavior_percent;
behavior_result.value = data.behavior_result;
behavior_score.value = data.behavior_score;
behavior_score_total.value = data.behavior_score_total;
behavior_percent.value = data.behavior_percent;
behavior_result.value = data.behavior_result;
sum_score.value = data.sum_score;
sum_percent.value = data.sum_percent;
sum_score.value = data.sum_score;
sum_percent.value = data.sum_percent;
reason.value = data.reason;
pass_result.value = data.pass_result;
evaluate_date.value = data.evaluate_date;
});
reason.value = data.reason;
pass_result.value = data.pass_result;
evaluate_date.value = data.evaluate_date;
})
.finally(() => {
hideLoader();
});
}
/** get ค่า เมื่อโหลดหน้า */

View file

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