Refactoring code module 12_evaluatePersonal

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-20 13:13:43 +07:00
parent 381ec04492
commit 490f02309e
33 changed files with 598 additions and 1036 deletions

View file

@ -1,9 +1,12 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { ref, onBeforeMount } from "vue";
import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useEvaluateDetailStore } from "@/modules/12_evaluatePersonal/store/EvaluateDetail";
/** impolerType*/
import type { PersonInformation } from "@/modules/12_evaluatePersonal/interface/response/evalute";
@ -12,36 +15,31 @@ import type { PersonInformation } from "@/modules/12_evaluatePersonal/interface/
import Tab1 from "@/modules/12_evaluatePersonal/components/Detail/Tab1.vue"; //
import Tab2 from "@/modules/12_evaluatePersonal/components/Detail/Tab2.vue"; //
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
import { useEvaluateDetailStore } from "@/modules/12_evaluatePersonal/store/EvaluateDetail";
/** use*/
const mixin = useCounterMixin();
const store = useEvaluateDetailStore();
const router = useRouter();
const $q = useQuasar();
const route = useRoute();
const { showLoader, hideLoader, messageError } = mixin;
const id = ref<string>(route.params.id as string); // id
const data = ref<PersonInformation>(); //
const prefix = ref<string>(""); //
const fullName = ref<string>(""); //-
const data = ref<PersonInformation[]>([]);
const prefix = ref<string>("");
const fullName = ref<string>("");
/** funmction เรียกขอ้มูลคุณสมบัติ*/
/**
* funmction เรยกขอมลคณสมบ
*/
async function fetchFeature() {
showLoader();
await http
.get(config.API.evaluateGetDetail(id.value))
.then((res) => {
data.value = res.data.result;
const person: any = data.value;
if (data.value) {
fullName.value = person.fullName;
prefix.value = person.prefix;
fullName.value = data.value.fullName;
prefix.value = data.value.prefix;
}
})
.catch((e) => {
@ -54,8 +52,10 @@ async function fetchFeature() {
});
}
/** HookLifecycle*/
onMounted(async () => {
/**
* HookLifecycle ทำงานเม Components กเรยกใชงาน
*/
onBeforeMount(async () => {
await fetchFeature();
});
</script>