From 54cfdd2f9b052fa87f4453e1a88fd57cfd0e90bd Mon Sep 17 00:00:00 2001 From: "STW_TTTY\\stwtt" Date: Tue, 10 Sep 2024 15:58:58 +0700 Subject: [PATCH] Refactoring code module 13_portfolio --- src/modules/13_portfolio/interface/Main.ts | 13 ++++++ src/modules/13_portfolio/views/Add.vue | 32 ++++++------- src/modules/13_portfolio/views/Main.vue | 52 +++++++++++----------- 3 files changed, 54 insertions(+), 43 deletions(-) create mode 100644 src/modules/13_portfolio/interface/Main.ts diff --git a/src/modules/13_portfolio/interface/Main.ts b/src/modules/13_portfolio/interface/Main.ts new file mode 100644 index 0000000..e0a84da --- /dev/null +++ b/src/modules/13_portfolio/interface/Main.ts @@ -0,0 +1,13 @@ +interface PortfolioRowsType { + id: string; + createdAt: Date | null; + lastUpdatedAt: Date | null; + createdFullName: string; + lastUpdateFullName: string; + name: string; + detail: string; +} + +export type { + PortfolioRowsType +} \ No newline at end of file diff --git a/src/modules/13_portfolio/views/Add.vue b/src/modules/13_portfolio/views/Add.vue index bc0cf83..b18ab7e 100644 --- a/src/modules/13_portfolio/views/Add.vue +++ b/src/modules/13_portfolio/views/Add.vue @@ -2,14 +2,14 @@ import { ref, onMounted } from "vue"; import { useQuasar } from "quasar"; import { useRouter, useRoute } from "vue-router"; -import { useCounterMixin } from "@/stores/mixin"; +import axios from "axios"; + import http from "@/plugins/http"; import config from "@/app.config"; -import axios from "axios"; -import type { QForm } from "quasar"; +import { useCounterMixin } from "@/stores/mixin"; -const router = useRouter(); const $q = useQuasar(); +const router = useRouter(); const mixin = useCounterMixin(); const { success, messageError, showLoader, hideLoader, dialogConfirm } = mixin; @@ -18,22 +18,12 @@ const { success, messageError, showLoader, hideLoader, dialogConfirm } = mixin; */ const route = useRoute(); const files = ref(); -const name = ref(""); -const detail = ref(""); +const name = ref(""); +const detail = ref(""); const id = ref(""); const routeName = router.currentRoute.value.name; const fileList = ref([]); -/** - * เรียกฟังก์ชันทั้งหมดตอนเรียกใช้ไฟล์นี้ - */ -onMounted(() => { - if (route.params.id !== undefined) { - id.value = route.params.id.toString(); - fecthData(id.value); - } -}); - const saveData = async () => { dialogConfirm( $q, @@ -174,6 +164,16 @@ function fileOpen(fileName: string) { hideLoader(); }); } + +/** + * เรียกฟังก์ชันทั้งหมดตอนเรียกใช้ไฟล์นี้ + */ +onMounted(() => { + if (route.params.id !== undefined) { + id.value = route.params.id.toString(); + fecthData(id.value); + } +});