From d024c0541660b90782acd91eebcb202f7fb4a2b2 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 23 Jul 2024 11:11:03 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=82=E0=B8=84=E0=B8=A3=E0=B8=87=E0=B8=AA?= =?UTF-8?q?=E0=B8=A3=E0=B9=89=E0=B8=B2=E0=B8=87=E0=B8=AD=E0=B8=B1=E0=B8=95?= =?UTF-8?q?=E0=B8=A3=E0=B8=B2=E0=B8=81=E0=B8=B3=E0=B8=A5=E0=B8=B1=E0=B8=87?= =?UTF-8?q?=20=3D>=20=20router?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interface/response/Main.ts | 17 +++++ src/modules/02_organizationalNew/router.ts | 12 ---- .../02_organizationalNew/views/main.vue | 68 +++++++++++-------- 3 files changed, 58 insertions(+), 39 deletions(-) create mode 100644 src/modules/02_organizationalNew/interface/response/Main.ts diff --git a/src/modules/02_organizationalNew/interface/response/Main.ts b/src/modules/02_organizationalNew/interface/response/Main.ts new file mode 100644 index 000000000..696a5b0f7 --- /dev/null +++ b/src/modules/02_organizationalNew/interface/response/Main.ts @@ -0,0 +1,17 @@ +interface DataPosType { + id: string; + posLevels: DataLevel[]; + posTypeName: string; + posTypeRank: number; + posTypeShortName: string; +} + +interface DataLevel { + id: string; + posLevelName: number; + posTypeName: string; + posTypeId: string; + posLevelAuthority: string; +} + +export type { DataPosType }; diff --git a/src/modules/02_organizationalNew/router.ts b/src/modules/02_organizationalNew/router.ts index 22793bd7f..32b16995e 100644 --- a/src/modules/02_organizationalNew/router.ts +++ b/src/modules/02_organizationalNew/router.ts @@ -1,5 +1,4 @@ const mainPage = () => import("@/modules/02_organizationalNew/views/main.vue"); -const testPage = () => import("@/modules/02_organizationalNew/views/ExampleSearchTree.vue"); export default [ { @@ -12,15 +11,4 @@ export default [ Role: "organization", }, }, - { - path: "/organization-new/test", - name: "organizationalNewTest", - component: testPage, - meta: { - Auth: true, - Key: [7], - Role: "organization", - }, - }, - ]; diff --git a/src/modules/02_organizationalNew/views/main.vue b/src/modules/02_organizationalNew/views/main.vue index 8cc395034..967ac8447 100644 --- a/src/modules/02_organizationalNew/views/main.vue +++ b/src/modules/02_organizationalNew/views/main.vue @@ -4,34 +4,49 @@ import { useQuasar } from "quasar"; import http from "@/plugins/http"; import config from "@/app.config"; -/** importType*/ +/** + * importType + */ import type { DataOption } from "@/modules/02_organizationalNew/interface/index/Main"; import type { OrgRevision } from "@/modules/02_organizationalNew/interface/response/organizational"; -/** importComponents*/ +/** + * importComponents + */ import TreeView from "@/modules/02_organizationalNew/components/TreeView.vue"; import StructureView from "@/modules/02_organizationalNew/components/StructureMain.vue"; import DialogFormNewStructure from "@/modules/02_organizationalNew/components/DialogNewStructure.vue"; import DialogDateTime from "@/modules/02_organizationalNew/components/DialogFormDateTime.vue"; -/** importStore*/ +/** + * importStore + */ import { useOrganizational } from "@/modules/02_organizationalNew/store/organizational"; import { useCounterMixin } from "@/stores/mixin"; -/** use*/ +/** + * use + */ const $q = useQuasar(); const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin(); const store = useOrganizational(); -/** modalDialog*/ +/** + * ตัวแปร + */ const modalNewStructure = ref(false); // เพิ่มโครงสร้าง const modalDateTime = ref(false); // ตั้งเวลาเผยแพร่ - -/** สถานะ*/ const isStatusData = ref(false); // แสดงตั้งเวลาเผยแพร่ -// const ishasActive = ref(false); // สถานะการทำงาน -// const ishasDraft = ref(false); // สถานะแบบร่าง -/** List เพิ่มโครงสร้าง*/ +const typeStructure = ref(""); // ประเภทการเพิ่มโครงสร้าง +/** ประวัติโครงสร้าง*/ +const itemHistory = ref([]); // List ประวัติโครงสร้าง +const historyId = ref(""); // ID ประวัติโครงสร้าง +const labelHistory = ref("ประวัติโครงสร้าง"); // ชื่อประวัติโครงสร้าง +const count = ref(0); + +/** + * List เพิ่มโครงสร้าง + */ const itemStructure = ref([ { id: "NEW", @@ -50,18 +65,13 @@ const itemStructure = ref([ name: "ทำสำเนาโครงสร้าง ตำแหน่งและคนครอง", }, ]); -const typeStructure = ref(""); // ประเภทการเพิ่มโครงสร้าง -/** ประวัติโครงสร้าง*/ -const itemHistory = ref([]); // List ประวัติโครงสร้าง -const historyId = ref(""); // ID ประวัติโครงสร้าง -const labelHistory = ref("ประวัติโครงสร้าง"); // ชื่อประวัติโครงสร้าง -const count = ref(0); - -/** function เรียกข้อมูลโครงสร้าง แบบปัจุบันและ แบบร่าง*/ -async function fetchOrganizationActive() { +/** + * function เรียกข้อมูลโครงสร้าง แบบปัจุบันและ แบบร่าง + */ +function fetchOrganizationActive() { showLoader(); - await http + http .get(config.API.activeOrganization) .then((res) => { const data = res.data.result; @@ -73,10 +83,8 @@ async function fetchOrganizationActive() { isStatusData.value = true; if (isStatusData.value) { if (data.activeName === null) { - // ishasActive.value = true; store.typeOrganizational = "draft"; } else if (data.draftName === null) { - // ishasDraft.value = true; store.typeOrganizational = "current"; } } @@ -89,9 +97,11 @@ async function fetchOrganizationActive() { }); } -/** function เรียกข้อมูลประวัติโครงสร้าง*/ -async function fetchHistory() { - await http +/** + * function เรียกข้อมูลประวัติโครงสร้าง + */ +function fetchHistory() { + http .get(config.API.organizationHistoryNew) .then((res) => { const data = res.data.result; @@ -118,7 +128,9 @@ function ocClickAddStructure(type: string) { typeStructure.value = type; } -/** function openPopup ตั้งเวลาเผยแพร่*/ +/** + * function openPopup ตั้งเวลาเผยแพร่ + */ function onClickDateTime() { modalDateTime.value = !modalDateTime.value; } @@ -135,7 +147,9 @@ function onClickHistory(id: string, name: string) { count.value++; } -/** lifecycleHook */ +/** + * lifecycleHook + */ onMounted(async () => { store.typeOrganizational = "current"; await fetchOrganizationActive();