From d7a79c21690e1385f5afd363075522e9833af3e2 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Mon, 29 Jan 2024 14:22:25 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=20dialog=20detail?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/02_organizational/api.organization.ts | 1 + .../components/DialogFormAgency.vue | 16 ++++- .../components/DialogNewStructure.vue | 9 +-- .../components/mainTree.vue | 41 +++++++++---- .../components/tableTree.vue | 60 ++++++++++++++++++- .../interface/index/Main.ts | 8 +++ .../02_organizationalNew/views/main.vue | 21 +++---- 7 files changed, 127 insertions(+), 29 deletions(-) diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts index b0cf664ef..cff33b2ff 100644 --- a/src/api/02_organizational/api.organization.ts +++ b/src/api/02_organizational/api.organization.ts @@ -7,6 +7,7 @@ export default { activeOrganization: `${organization}/active`, createOrganization: `${organization}/draft`, createOrgLevel: (type: string) => `${organization}/${type}`, + orgLevelByid: (type: string, id: string) => `${organization}/${type}/${id}`, organizationHistoryNew: `${organization}/history`, }; diff --git a/src/modules/02_organizationalNew/components/DialogFormAgency.vue b/src/modules/02_organizationalNew/components/DialogFormAgency.vue index 9ac6a2d07..a4f33f7cf 100644 --- a/src/modules/02_organizationalNew/components/DialogFormAgency.vue +++ b/src/modules/02_organizationalNew/components/DialogFormAgency.vue @@ -99,6 +99,17 @@ function onSubmit() { : level.value === "SECTION" ? "Child3" : "child4"; + + const nameId = + level.value === "DEPARTMENT" + ? "orgRevisionId" + : level.value === "OFFICE" + ? "orgRootId" + : level.value === "DIVISION" + ? "orgChild1Id" + : level.value === "SECTION" + ? "orgChild2Id" + : "orgChild3Id"; const body = { ["org" + type + "Name"]: formData.orgName, ["org" + type + "ShortName"]: formData.orgShortName, @@ -106,8 +117,8 @@ function onSubmit() { ["org" + type + "PhoneEx"]: formData.orgPhoneEx, ["org" + type + "PhoneIn"]: formData.orgPhoneIn, ["org" + type + "Fax"]: formData.orgFax, - ["org" + type + "Rank"] : formData.orgLevel, - orgRevisionId: store.draftId, + ["org" + type + "Rank"]: formData.orgLevel, + [nameId]: store.draftId, }; console.log(body); await http @@ -119,6 +130,7 @@ function onSubmit() { console.log(err); }) .finally(() => { + close(); hideLoader(); }); }); diff --git a/src/modules/02_organizationalNew/components/DialogNewStructure.vue b/src/modules/02_organizationalNew/components/DialogNewStructure.vue index 5088bd6e4..113a38b66 100644 --- a/src/modules/02_organizationalNew/components/DialogNewStructure.vue +++ b/src/modules/02_organizationalNew/components/DialogNewStructure.vue @@ -94,11 +94,12 @@ function onSubmit() { showLoader(); http .post(config.API.createOrganization, formData) - .then(() => { - // status.value = true; - // store.typeOrganizational = "draft"; + .then((res) => { + status.value = true; + store.typeOrganizational = "draft"; + store.draftId = res.data.result.id; success($q, "บันทึกข้อมูลสำเร็จ"); - props.fetchActive?.(); + // props.fetchActive?.(); }) .catch((err) => { messageError($q, err); diff --git a/src/modules/02_organizationalNew/components/mainTree.vue b/src/modules/02_organizationalNew/components/mainTree.vue index 4846cb152..a6e1fcdc9 100644 --- a/src/modules/02_organizationalNew/components/mainTree.vue +++ b/src/modules/02_organizationalNew/components/mainTree.vue @@ -2,8 +2,11 @@ import { ref, onMounted, watch } from "vue"; import { useQuasar } from "quasar"; +import type { ListMenu } from "@/modules/02_organizationalNew/interface/index/Main"; + /** importComponents*/ import DialogAgency from "@/modules/02_organizationalNew/components/DialogFormAgency.vue"; +import DialogStructureDetail from "@/modules/02_organizationalNew/components/StructureDetail.vue"; /** importStore*/ import { useOrganizational } from "@/modules/02_organizationalNew/store/organizational"; @@ -11,49 +14,55 @@ import { useOrganizational } from "@/modules/02_organizationalNew/store/organiza const stroe = useOrganizational(); const $q = useQuasar(); -const listAdd = ref([ +const listAdd = ref([ { label: "เพิ่มส่วนราชการ", icon: "add", - val: "ADD", + type: "ADD", color: "primary", }, { label: "แก้ไขหน่วยงาน", icon: "edit", - val: "EDIT", + type: "EDIT", color: "info", }, { label: "ลบหน่วยงาน", icon: "mdi-trash-can-outline", - val: "DEL", + type: "DEL", color: "red", }, { label: "สำเนาหน่วยงาน", icon: "content_copy", - val: "COPY", + type: "COPY", color: "blue", }, { label: "ดูประวัติหน่วยงาน", icon: "history", - val: "HISTORY", + type: "HISTORY", color: "purple", }, { label: "จัดลำดับ", icon: "filter_list", - val: "SORT", + type: "SORT", color: "green-7", }, { label: "แก้ไขสถานะ", icon: "rule", - val: "STATUS", + type: "STATUS", color: "yellow-9", }, + { + label: "ดูรายละเอียด", + icon: "mdi-eye", + type: "DETAIL", + color: "blue-9", + }, ]); const nodeTEST = defineModel("nodeTree", { required: true }); @@ -231,6 +240,13 @@ function onClickAgency(level: string) { orgLevel.value = level; } +const dialogDetail = ref(false); +function onClickDetail() { + console.log(dialogDetail.value); + + dialogDetail.value = !dialogDetail.value; +} + watch( () => nodeTEST.value, () => { @@ -347,10 +363,12 @@ onMounted(async () => { clickable v-close-popup @click=" - item.val === 'EDIT' + item.type === 'EDIT' ? edit(prop.node.organizationId) - : item.val === 'ADD' + : item.type === 'ADD' ? onClickAgency('TEST') + : item.type === 'DETAIL' + ? onClickDetail() : null " > @@ -380,6 +398,9 @@ onMounted(async () => { :close="onClickAgency" v-model:orgLevel="orgLevel" /> + + + diff --git a/src/modules/02_organizationalNew/components/tableTree.vue b/src/modules/02_organizationalNew/components/tableTree.vue index 354ebcf5b..e0ca932cd 100644 --- a/src/modules/02_organizationalNew/components/tableTree.vue +++ b/src/modules/02_organizationalNew/components/tableTree.vue @@ -3,9 +3,11 @@ import { ref } from "vue"; /** importType*/ import type { QTableProps } from "quasar"; +import type { ListMenu } from "@/modules/02_organizationalNew/interface/index/Main"; /** importComponents*/ import DialogFormPosotion from "@/modules/02_organizationalNew/components/DialogFormPosition.vue"; +import DialogPositionDetail from "@/modules/02_organizationalNew/components/PositionDetail.vue"; /** importStore*/ import { useOrganizational } from "@/modules/02_organizationalNew/store/organizational"; @@ -13,6 +15,14 @@ import { useOrganizational } from "@/modules/02_organizationalNew/store/organiza const showData = defineModel("showData", { required: true }); const stroe = useOrganizational(); const filter = ref(""); +const listMenu = ref([ + { + label: "ดูรายละเอียด", + icon: "mdi-eye", + type: "VIEWDETIAL", + color: "primary", + }, +]); const document = ref([ { name: "บัญชี 1", @@ -83,12 +93,25 @@ const columns = ref([ style: "font-size: 14px", }, ]); -const rows = ref([]); +const rows = ref([ + { + noPosition: "00011", + namePosition: "กองบริหารทั่วไป", + typePosition: "ทั่วไป", + levelPositoion: " ระดับกอง", + isStatus: "ไม่มี", + }, +]); const dialogPosition = ref(false); function onClickPosition() { dialogPosition.value = !dialogPosition.value; } + +const dialogDetail = ref(false); +function onClickViewDetail() { + dialogDetail.value = !dialogDetail.value; +} + diff --git a/src/modules/02_organizationalNew/interface/index/Main.ts b/src/modules/02_organizationalNew/interface/index/Main.ts index dd654c81b..4c0bdf7b7 100644 --- a/src/modules/02_organizationalNew/interface/index/Main.ts +++ b/src/modules/02_organizationalNew/interface/index/Main.ts @@ -7,6 +7,13 @@ interface DataOption { name: string; } +interface ListMenu { + label: string; + icon: string; + type: string; + color: string; +} + interface FormDataAgency { orgName: string; orgShortName: string; @@ -77,4 +84,5 @@ export type { FormDataNewStructure, FormNewStructureRef, HistoryType, + ListMenu, }; diff --git a/src/modules/02_organizationalNew/views/main.vue b/src/modules/02_organizationalNew/views/main.vue index 42c09a7f2..695f0774a 100644 --- a/src/modules/02_organizationalNew/views/main.vue +++ b/src/modules/02_organizationalNew/views/main.vue @@ -5,6 +5,7 @@ import http from "@/plugins/http"; import config from "@/app.config"; /** importType*/ +import type { DataOption } from "@/modules/02_organizationalNew/interface/index/Main"; /** importComponents*/ import ListView from "@/modules/02_organizationalNew/components/listView.vue"; @@ -30,21 +31,21 @@ const stroe = useOrganizational(); const isStatusData = ref(false); const ishasActive = ref(false); const ishasDraft = ref(false); -const itemStructure = ref([ +const itemStructure = ref([ { - val: "NEW", + id: "NEW", name: "สร้างใหม่", }, { - val: "ORG", + id: "ORG", name: "ทำสำเนาเฉพาะโครงสร้าง", }, { - val: "ORG_POSITION", + id: "ORG_POSITION", name: "ทำสำเนาโครงสร้างและตำแหน่ง", }, { - val: "ORG_POSITION_PERSON", + id: "ORG_POSITION_PERSON", name: "ทำสำเนาโครงสร้าง ตำแหน่งและคนครอง", }, ]); @@ -183,7 +184,7 @@ onMounted(async () => { v-close-popup v-for="(item, index) in itemStructure" :key="index" - @click="ocClickAddStructure(item.val)" + @click="ocClickAddStructure(item.id)" > {{ item.name }} @@ -242,14 +243,10 @@ onMounted(async () => { - + - +