From 71be6d095f4dbd1d5f2e029efb01008a4a6cb8cf Mon Sep 17 00:00:00 2001 From: "STW_TTTY\\stwtt" Date: Thu, 12 Sep 2024 15:42:47 +0700 Subject: [PATCH] Refactoring code module 01_masterdata --- .../Indicators/Assignment/DetailView.vue | 41 +++++-- .../components/Indicators/DialogHistory.vue | 5 +- .../components/Indicators/Summary.vue | 8 +- .../competency/01ListCompetency.vue | 18 +-- .../competency/02ListLinkPosition.vue | 43 ++----- .../components/competency/03ListLinkGroup.vue | 31 +++-- .../components/competency/04ListCriteria.vue | 20 +-- .../components/competency/AddPage.vue | 36 +----- .../competency/Forms/01_FormMain.vue | 9 +- .../competency/Forms/02_FormGroup.vue | 14 +-- .../components/competency/Forms/Main.vue | 7 ++ .../components/competency/Summary.vue | 18 +-- .../01_masterdata/interface/index/Main.ts | 116 ++++++++++++++++++ .../interface/response/Strategic.ts | 2 +- .../01_masterdata/views/Assignment.vue | 7 +- src/modules/01_masterdata/views/Strategic.vue | 31 +---- .../01_masterdata/views/competency.vue | 9 -- .../01_masterdata/views/indicatorByPlan.vue | 36 ++++-- .../01_masterdata/views/indicatorByRole.vue | 27 ++-- src/modules/01_metadata/store.ts | 1 - .../03_recruiting/views/02_qualify/Period.vue | 1 - .../ChangePosition/PersonalList.vue | 1 - 22 files changed, 272 insertions(+), 209 deletions(-) diff --git a/src/modules/01_masterdata/components/Indicators/Assignment/DetailView.vue b/src/modules/01_masterdata/components/Indicators/Assignment/DetailView.vue index f45c8b9ea..812235b2a 100644 --- a/src/modules/01_masterdata/components/Indicators/Assignment/DetailView.vue +++ b/src/modules/01_masterdata/components/Indicators/Assignment/DetailView.vue @@ -2,12 +2,15 @@ import { ref, reactive, onMounted } from "vue"; import { useQuasar } from "quasar"; import { useRouter, useRoute } from "vue-router"; + import http from "@/plugins/http"; import config from "@/app.config"; -/** importType*/ import type { FormDataRole } from "@/modules/01_masterdata/interface/request/Main"; -import type { DataOption } from "@/modules/01_masterdata/interface/index/Main"; +import type { + DataOption, + SizeType, +} from "@/modules/01_masterdata/interface/index/Main"; /** importStore*/ import { useCounterMixin } from "@/stores/mixin"; @@ -40,15 +43,29 @@ const form = reactive({ date: [null, null], }); -const fieldLabels = { +const fieldLabels = reactive<{ + score5: string; + score4: string; + score3: string; + score2: string; + score1: string; +}>({ score5: "5", score4: "4", score3: "3", score2: "2", score1: "1", -}; +}); -const formScore = reactive({ +/** กำหนด type ให้ ScoreField*/ +type ScoreField = "score5" | "score4" | "score3" | "score2" | "score1"; +const formScore = reactive<{ + score5: string; + score4: string; + score3: string; + score2: string; + score1: string; +}>({ score5: "", score4: "", score3: "", @@ -62,12 +79,15 @@ const roundOp = ref([ { id: "OCT", name: "รอบตุลาคม" }, ]); +/** + * ดึงข้อมูลยุทธศาสตร์ + * @param id id rows + */ function fetchspecialByid(id: string) { showLoader(); http .get(config.API.kpiSpecial + `/edit/${id}`) .then((res) => { - console.log(res); const data = res.data.result; form.year = data.year; form.round = data.period; @@ -96,10 +116,15 @@ function fetchspecialByid(id: string) { }); } -function onResize(size: any) { +/** + * resize ตาม ขนาดของ box ที่ได้รับมา + * @param size size { width,height} + */ +function onResize(size: SizeType) { heightSize.value = `${size.height - 99}`; } +/** ทำงานเมื่อโหลด component */ onMounted(() => { fetchspecialByid(id.value); }); @@ -258,7 +283,7 @@ onMounted(() => {
("modal", { required: true }); const rows = defineModel("rows", { required: true }); diff --git a/src/modules/01_masterdata/components/Indicators/Summary.vue b/src/modules/01_masterdata/components/Indicators/Summary.vue index e1f7d31b6..6aefb7f08 100644 --- a/src/modules/01_masterdata/components/Indicators/Summary.vue +++ b/src/modules/01_masterdata/components/Indicators/Summary.vue @@ -6,10 +6,12 @@ import http from "@/plugins/http"; import config from "@/app.config"; import { useQuasar } from "quasar"; +import type { CompetencySumary } from "@/modules/01_masterdata/interface/index/Main"; + const $q = useQuasar(); -const { showLoader, hideLoader, dialogRemove, success, messageError } = - useCounterMixin(); -const indicatorTotal = ref([ +const { messageError } = useCounterMixin(); + +const indicatorTotal = ref([ { value: "kpiPlan", label: "ตัวชี้วัดตามแผน", diff --git a/src/modules/01_masterdata/components/competency/01ListCompetency.vue b/src/modules/01_masterdata/components/competency/01ListCompetency.vue index c9ba262d5..197ec0963 100644 --- a/src/modules/01_masterdata/components/competency/01ListCompetency.vue +++ b/src/modules/01_masterdata/components/competency/01ListCompetency.vue @@ -1,11 +1,14 @@