This commit is contained in:
Warunee Tamkoo 2024-12-24 22:23:39 +07:00
parent a43279b314
commit 21f1787dd0
3 changed files with 18 additions and 4 deletions

View file

@ -45,6 +45,7 @@ async function getSurveyData() {
.then(async (res: any) => {
const data = await res.data.result.data;
assignId.value = res.data.result.assignId;
store.assignId = res.data.result.assignId;
if (data !== null) {
answer1.value = data.answer1;
answer2.value = data.answer2;

View file

@ -5,12 +5,13 @@ import { useRoute, useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
import { useProbationReport } from "@/modules/15_probationReport/store";
const mixin = useCounterMixin();
const store = useProbationReport();
const { date2Thai, showLoader, hideLoader, messageError } = mixin;
const route = useRoute();
const assignId = ref<string>("baa3d9f6-9d21-4c58-85f2-114abf8de25c");
const status = ref<boolean>(false);
const $q = useQuasar();
@ -52,7 +53,7 @@ const result_option = reactive([
async function getReportScore() {
showLoader();
await http
.get(config.API.summaryReportDetail(assignId.value))
.get(config.API.summaryReportDetail(store.assignId))
.then((res) => {
const data = res.data.result;
develop_orientation_score.value = data.develop_orientation_score;
@ -95,8 +96,19 @@ async function getReportScore() {
});
}
/** ดึง ข้อมูลแบบสำรวจ */
async function getAssignId() {
await http.get(config.API.summaryDetail()).then(async (res: any) => {
store.assignId = res.data.result.assignId;
});
}
/** get ค่า เมื่อโหลดหน้า */
onMounted(() => {
onMounted(async () => {
if (!store.assignId) {
await getAssignId();
}
getReportScore();
});
</script>

View file

@ -4,5 +4,6 @@ import type { DataOption } from "@/modules/10_registry/interface/index/Main";
export const useProbationReport = defineStore("ProbationReportStore", () => {
const tabMain = ref<string>("SURVEY");
return { tabMain };
const assignId = ref<string>("");
return { tabMain, assignId };
});