From 9c27d47092d72ea47a0e32a4bc9288de02d4deb6 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Mon, 20 Jan 2025 18:07:07 +0700 Subject: [PATCH] =?UTF-8?q?UI=20=E0=B8=9C=E0=B8=A5=E0=B8=81=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3=E0=B8=97=E0=B8=94=E0=B8=A5=E0=B8=AD=E0=B8=87=E0=B8=9B?= =?UTF-8?q?=E0=B8=8F=E0=B8=B4=E0=B8=9A=E0=B8=B1=E0=B8=95=E0=B8=B4=E0=B8=AB?= =?UTF-8?q?=E0=B8=99=E0=B9=89=E0=B8=B2=E0=B8=97=E0=B8=B5=E0=B9=88=E0=B8=A3?= =?UTF-8?q?=E0=B8=B2=E0=B8=8A=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B9=81=E0=B8=A5?= =?UTF-8?q?=E0=B8=B0=E0=B9=81=E0=B8=9A=E0=B8=9A=E0=B8=AA=E0=B8=B3=E0=B8=A3?= =?UTF-8?q?=E0=B8=A7=E0=B8=88=E0=B8=84=E0=B8=A7=E0=B8=B2=E0=B8=A1=E0=B8=84?= =?UTF-8?q?=E0=B8=B4=E0=B8=94=E0=B9=80=E0=B8=AB=E0=B9=87=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/probation/api.probation.ts | 2 + src/interface/Main.ts | 1 + .../components/01_SurveyPage.vue | 62 +- .../components/02_ResultPage.vue | 462 +-- .../components/03_AssignPage.vue | 2948 +++++++++++++++++ .../components/ResultTemplate.vue | 367 ++ .../15_probationReport/interface/Main.ts | 85 +- src/modules/15_probationReport/store.ts | 116 +- src/modules/15_probationReport/views/main.vue | 65 +- src/stores/data.ts | 4 + 10 files changed, 3695 insertions(+), 417 deletions(-) create mode 100644 src/modules/15_probationReport/components/03_AssignPage.vue create mode 100644 src/modules/15_probationReport/components/ResultTemplate.vue diff --git a/src/api/probation/api.probation.ts b/src/api/probation/api.probation.ts index fdd102b..003d1eb 100644 --- a/src/api/probation/api.probation.ts +++ b/src/api/probation/api.probation.ts @@ -57,4 +57,6 @@ export default { `${reportProbation}/14/${type}/${id}`, kpiCapacity, + + appointMainList: (id: string) => `${probation}/appoint/list/${id}`, }; diff --git a/src/interface/Main.ts b/src/interface/Main.ts index d330ce4..6c3f1f5 100644 --- a/src/interface/Main.ts +++ b/src/interface/Main.ts @@ -8,6 +8,7 @@ interface ProfileData { posTypeName: string; posLevelName: string; posNo: string; + profileId: string; } interface InformationData { diff --git a/src/modules/15_probationReport/components/01_SurveyPage.vue b/src/modules/15_probationReport/components/01_SurveyPage.vue index 6a06c7a..57456f5 100644 --- a/src/modules/15_probationReport/components/01_SurveyPage.vue +++ b/src/modules/15_probationReport/components/01_SurveyPage.vue @@ -10,6 +10,7 @@ import config from "@/app.config"; import { useProbationReport } from "@/modules/15_probationReport/store"; import type { ListDataText } from "@/modules/15_probationReport/interface/Main"; +import type { DataSurvey } from "@/modules/15_probationReport/interface/Main"; const store = useProbationReport(); const router = useRouter(); @@ -28,8 +29,13 @@ const mixin = useCounterMixin(); const { messageError, success, dialogConfirm, showLoader, hideLoader } = mixin; const route = useRoute(); -const assignId = ref("baa3d9f6-9d21-4c58-85f2-114abf8de25c"); +const props = defineProps({ + dataSurvey: Object, + getSurveyData: Function, +}); const isData = defineModel("isData", { required: true }); +const dataSurvey = defineModel("dataSurvey", { required: true }); + const status = ref(true); const answer1 = ref(""); @@ -38,32 +44,6 @@ const answer3 = ref(0); const classBordered = ref(""); -/** ดึง ข้อมูลแบบสำรวจ */ -async function getSurveyData() { - isData.value = true; - showLoader(); - await http - .get(config.API.summaryDetail()) - .then(async (res: any) => { - const data = await res.data.result.data; - isData.value = true; - assignId.value = res.data.result.assignId; - store.assignId = res.data.result.assignId; - if (data !== null) { - answer1.value = data.answer1; - answer2.value = data.answer2; - answer3.value = data.answer3; - status.value = false; - } - hideLoader(); - }) - .catch((e) => { - // messageError($q, e); - isData.value = false; - hideLoader(); - }); -} - /** save ข้อมูล */ async function save() { if (answer3.value !== 0) { @@ -75,10 +55,10 @@ async function save() { dialogConfirm($q, async () => { showLoader(); await http - .post(config.API.summarySurveyDetail(assignId.value), data) + .post(config.API.summarySurveyDetail(store.assignId), data) .then((res: any) => { success($q, "บันทึกสำเร็จ"); - getSurveyData(); + props.getSurveyData?.(); }) .catch((e: any) => { messageError($q, e); @@ -99,11 +79,31 @@ watch(answer3, () => { } else classBordered.value = ""; }); +watch( + () => dataSurvey.value, + () => { + if (store.tabMain === "SURVEY") { + if (dataSurvey.value !== null) { + answer1.value = dataSurvey.value.answer1; + answer2.value = dataSurvey.value.answer2; + answer3.value = dataSurvey.value.answer3; + status.value = false; + } + } + } +); + + /** get ค่า เมื่อโหลดหน้า */ onMounted(() => { if (store.tabMain === "SURVEY") { - getSurveyData(); - } + if (dataSurvey.value !== null) { + answer1.value = dataSurvey.value.answer1; + answer2.value = dataSurvey.value.answer2; + answer3.value = dataSurvey.value.answer3; + status.value = false; + } + } });