เพิ่ม dialog detail

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-01-29 14:22:25 +07:00
parent 46bee070f7
commit d7a79c2169
7 changed files with 127 additions and 29 deletions

View file

@ -7,6 +7,7 @@ export default {
activeOrganization: `${organization}/active`, activeOrganization: `${organization}/active`,
createOrganization: `${organization}/draft`, createOrganization: `${organization}/draft`,
createOrgLevel: (type: string) => `${organization}/${type}`, createOrgLevel: (type: string) => `${organization}/${type}`,
orgLevelByid: (type: string, id: string) => `${organization}/${type}/${id}`,
organizationHistoryNew: `${organization}/history`, organizationHistoryNew: `${organization}/history`,
}; };

View file

@ -99,6 +99,17 @@ function onSubmit() {
: level.value === "SECTION" : level.value === "SECTION"
? "Child3" ? "Child3"
: "child4"; : "child4";
const nameId =
level.value === "DEPARTMENT"
? "orgRevisionId"
: level.value === "OFFICE"
? "orgRootId"
: level.value === "DIVISION"
? "orgChild1Id"
: level.value === "SECTION"
? "orgChild2Id"
: "orgChild3Id";
const body = { const body = {
["org" + type + "Name"]: formData.orgName, ["org" + type + "Name"]: formData.orgName,
["org" + type + "ShortName"]: formData.orgShortName, ["org" + type + "ShortName"]: formData.orgShortName,
@ -106,8 +117,8 @@ function onSubmit() {
["org" + type + "PhoneEx"]: formData.orgPhoneEx, ["org" + type + "PhoneEx"]: formData.orgPhoneEx,
["org" + type + "PhoneIn"]: formData.orgPhoneIn, ["org" + type + "PhoneIn"]: formData.orgPhoneIn,
["org" + type + "Fax"]: formData.orgFax, ["org" + type + "Fax"]: formData.orgFax,
["org" + type + "Rank"] : formData.orgLevel, ["org" + type + "Rank"]: formData.orgLevel,
orgRevisionId: store.draftId, [nameId]: store.draftId,
}; };
console.log(body); console.log(body);
await http await http
@ -119,6 +130,7 @@ function onSubmit() {
console.log(err); console.log(err);
}) })
.finally(() => { .finally(() => {
close();
hideLoader(); hideLoader();
}); });
}); });

View file

@ -94,11 +94,12 @@ function onSubmit() {
showLoader(); showLoader();
http http
.post(config.API.createOrganization, formData) .post(config.API.createOrganization, formData)
.then(() => { .then((res) => {
// status.value = true; status.value = true;
// store.typeOrganizational = "draft"; store.typeOrganizational = "draft";
store.draftId = res.data.result.id;
success($q, "บันทึกข้อมูลสำเร็จ"); success($q, "บันทึกข้อมูลสำเร็จ");
props.fetchActive?.(); // props.fetchActive?.();
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);

View file

@ -2,8 +2,11 @@
import { ref, onMounted, watch } from "vue"; import { ref, onMounted, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import type { ListMenu } from "@/modules/02_organizationalNew/interface/index/Main";
/** importComponents*/ /** importComponents*/
import DialogAgency from "@/modules/02_organizationalNew/components/DialogFormAgency.vue"; import DialogAgency from "@/modules/02_organizationalNew/components/DialogFormAgency.vue";
import DialogStructureDetail from "@/modules/02_organizationalNew/components/StructureDetail.vue";
/** importStore*/ /** importStore*/
import { useOrganizational } from "@/modules/02_organizationalNew/store/organizational"; import { useOrganizational } from "@/modules/02_organizationalNew/store/organizational";
@ -11,49 +14,55 @@ import { useOrganizational } from "@/modules/02_organizationalNew/store/organiza
const stroe = useOrganizational(); const stroe = useOrganizational();
const $q = useQuasar(); const $q = useQuasar();
const listAdd = ref<any>([ const listAdd = ref<ListMenu[]>([
{ {
label: "เพิ่มส่วนราชการ", label: "เพิ่มส่วนราชการ",
icon: "add", icon: "add",
val: "ADD", type: "ADD",
color: "primary", color: "primary",
}, },
{ {
label: "แก้ไขหน่วยงาน", label: "แก้ไขหน่วยงาน",
icon: "edit", icon: "edit",
val: "EDIT", type: "EDIT",
color: "info", color: "info",
}, },
{ {
label: "ลบหน่วยงาน", label: "ลบหน่วยงาน",
icon: "mdi-trash-can-outline", icon: "mdi-trash-can-outline",
val: "DEL", type: "DEL",
color: "red", color: "red",
}, },
{ {
label: "สำเนาหน่วยงาน", label: "สำเนาหน่วยงาน",
icon: "content_copy", icon: "content_copy",
val: "COPY", type: "COPY",
color: "blue", color: "blue",
}, },
{ {
label: "ดูประวัติหน่วยงาน", label: "ดูประวัติหน่วยงาน",
icon: "history", icon: "history",
val: "HISTORY", type: "HISTORY",
color: "purple", color: "purple",
}, },
{ {
label: "จัดลำดับ", label: "จัดลำดับ",
icon: "filter_list", icon: "filter_list",
val: "SORT", type: "SORT",
color: "green-7", color: "green-7",
}, },
{ {
label: "แก้ไขสถานะ", label: "แก้ไขสถานะ",
icon: "rule", icon: "rule",
val: "STATUS", type: "STATUS",
color: "yellow-9", color: "yellow-9",
}, },
{
label: "ดูรายละเอียด",
icon: "mdi-eye",
type: "DETAIL",
color: "blue-9",
},
]); ]);
const nodeTEST = defineModel<any>("nodeTree", { required: true }); const nodeTEST = defineModel<any>("nodeTree", { required: true });
@ -231,6 +240,13 @@ function onClickAgency(level: string) {
orgLevel.value = level; orgLevel.value = level;
} }
const dialogDetail = ref<boolean>(false);
function onClickDetail() {
console.log(dialogDetail.value);
dialogDetail.value = !dialogDetail.value;
}
watch( watch(
() => nodeTEST.value, () => nodeTEST.value,
() => { () => {
@ -347,10 +363,12 @@ onMounted(async () => {
clickable clickable
v-close-popup v-close-popup
@click=" @click="
item.val === 'EDIT' item.type === 'EDIT'
? edit(prop.node.organizationId) ? edit(prop.node.organizationId)
: item.val === 'ADD' : item.type === 'ADD'
? onClickAgency('TEST') ? onClickAgency('TEST')
: item.type === 'DETAIL'
? onClickDetail()
: null : null
" "
> >
@ -380,6 +398,9 @@ onMounted(async () => {
:close="onClickAgency" :close="onClickAgency"
v-model:orgLevel="orgLevel" v-model:orgLevel="orgLevel"
/> />
<!-- รายละเอยดโครงสราง -->
<DialogStructureDetail v-model:structure-detail="dialogDetail" />
</template> </template>
<style scoped></style> <style scoped></style>

View file

@ -3,9 +3,11 @@ import { ref } from "vue";
/** importType*/ /** importType*/
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { ListMenu } from "@/modules/02_organizationalNew/interface/index/Main";
/** importComponents*/ /** importComponents*/
import DialogFormPosotion from "@/modules/02_organizationalNew/components/DialogFormPosition.vue"; import DialogFormPosotion from "@/modules/02_organizationalNew/components/DialogFormPosition.vue";
import DialogPositionDetail from "@/modules/02_organizationalNew/components/PositionDetail.vue";
/** importStore*/ /** importStore*/
import { useOrganizational } from "@/modules/02_organizationalNew/store/organizational"; import { useOrganizational } from "@/modules/02_organizationalNew/store/organizational";
@ -13,6 +15,14 @@ import { useOrganizational } from "@/modules/02_organizationalNew/store/organiza
const showData = defineModel<boolean>("showData", { required: true }); const showData = defineModel<boolean>("showData", { required: true });
const stroe = useOrganizational(); const stroe = useOrganizational();
const filter = ref<string>(""); const filter = ref<string>("");
const listMenu = ref<ListMenu[]>([
{
label: "ดูรายละเอียด",
icon: "mdi-eye",
type: "VIEWDETIAL",
color: "primary",
},
]);
const document = ref<any>([ const document = ref<any>([
{ {
name: "บัญชี 1", name: "บัญชี 1",
@ -83,12 +93,25 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px", style: "font-size: 14px",
}, },
]); ]);
const rows = ref<any>([]); const rows = ref<any>([
{
noPosition: "00011",
namePosition: "กองบริหารทั่วไป",
typePosition: "ทั่วไป",
levelPositoion: " ระดับกอง",
isStatus: "ไม่มี",
},
]);
const dialogPosition = ref<boolean>(false); const dialogPosition = ref<boolean>(false);
function onClickPosition() { function onClickPosition() {
dialogPosition.value = !dialogPosition.value; dialogPosition.value = !dialogPosition.value;
} }
const dialogDetail = ref<boolean>(false);
function onClickViewDetail() {
dialogDetail.value = !dialogDetail.value;
}
</script> </script>
<template> <template>
<!-- TOOLBAR --> <!-- TOOLBAR -->
@ -164,6 +187,7 @@ function onClickPosition() {
<q-th v-for="col in props.cols" :key="col.name" :props="props"> <q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span> <span class="text-weight-medium">{{ col.label }}</span>
</q-th> </q-th>
<q-th auto-width></q-th>
</q-tr> </q-tr>
</template> </template>
<template v-slot:body="props"> <template v-slot:body="props">
@ -177,6 +201,37 @@ function onClickPosition() {
{{ col.value }} {{ col.value }}
</div> </div>
</q-td> </q-td>
<q-td>
<q-btn
flat
dense
icon="mdi-dots-vertical"
class="q-pa-none q-ml-xs"
color="grey-13"
>
<q-menu>
<q-list
dense
style="min-width: 200px"
v-for="(item, index) in listMenu"
:key="index"
>
<q-item
clickable
v-close-popup
@click="
item.type === 'VIEWDETIAL' ? onClickViewDetail() : null
"
>
<q-item-section avatar>
<q-icon :color="item.color" :name="item.icon" />
</q-item-section>
<q-item-section>{{ item.label }}</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
</q-td>
</q-tr> </q-tr>
</template> </template>
<!-- <template v-slot:pagination="scope"> <!-- <template v-slot:pagination="scope">
@ -194,6 +249,9 @@ function onClickPosition() {
</div> </div>
<DialogFormPosotion :modal="dialogPosition" :close="onClickPosition" /> <DialogFormPosotion :modal="dialogPosition" :close="onClickPosition" />
<!-- รายละเอยดตำแหน -->
<DialogPositionDetail v-model:position-detail="dialogDetail" />
</template> </template>
<style scoped></style> <style scoped></style>

View file

@ -7,6 +7,13 @@ interface DataOption {
name: string; name: string;
} }
interface ListMenu {
label: string;
icon: string;
type: string;
color: string;
}
interface FormDataAgency { interface FormDataAgency {
orgName: string; orgName: string;
orgShortName: string; orgShortName: string;
@ -77,4 +84,5 @@ export type {
FormDataNewStructure, FormDataNewStructure,
FormNewStructureRef, FormNewStructureRef,
HistoryType, HistoryType,
ListMenu,
}; };

View file

@ -5,6 +5,7 @@ import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
/** importType*/ /** importType*/
import type { DataOption } from "@/modules/02_organizationalNew/interface/index/Main";
/** importComponents*/ /** importComponents*/
import ListView from "@/modules/02_organizationalNew/components/listView.vue"; import ListView from "@/modules/02_organizationalNew/components/listView.vue";
@ -30,21 +31,21 @@ const stroe = useOrganizational();
const isStatusData = ref<boolean>(false); const isStatusData = ref<boolean>(false);
const ishasActive = ref<boolean>(false); const ishasActive = ref<boolean>(false);
const ishasDraft = ref<boolean>(false); const ishasDraft = ref<boolean>(false);
const itemStructure = ref<any>([ const itemStructure = ref<DataOption[]>([
{ {
val: "NEW", id: "NEW",
name: "สร้างใหม่", name: "สร้างใหม่",
}, },
{ {
val: "ORG", id: "ORG",
name: "ทำสำเนาเฉพาะโครงสร้าง", name: "ทำสำเนาเฉพาะโครงสร้าง",
}, },
{ {
val: "ORG_POSITION", id: "ORG_POSITION",
name: "ทำสำเนาโครงสร้างและตำแหน่ง", name: "ทำสำเนาโครงสร้างและตำแหน่ง",
}, },
{ {
val: "ORG_POSITION_PERSON", id: "ORG_POSITION_PERSON",
name: "ทำสำเนาโครงสร้าง ตำแหน่งและคนครอง", name: "ทำสำเนาโครงสร้าง ตำแหน่งและคนครอง",
}, },
]); ]);
@ -183,7 +184,7 @@ onMounted(async () => {
v-close-popup v-close-popup
v-for="(item, index) in itemStructure" v-for="(item, index) in itemStructure"
:key="index" :key="index"
@click="ocClickAddStructure(item.val)" @click="ocClickAddStructure(item.id)"
> >
<q-item-section> <q-item-section>
<q-item-label>{{ item.name }}</q-item-label> <q-item-label>{{ item.name }}</q-item-label>
@ -242,14 +243,10 @@ onMounted(async () => {
<DialogHistory :modal="modalHistory" :close="onClickHistory" /> <DialogHistory :modal="modalHistory" :close="onClickHistory" />
<!-- รายละเอยดโครงสราง --> <!-- รายละเอยดโครงสราง -->
<DialogStructureDetail <DialogStructureDetail v-model:structure-detail="modalStructureDetail" />
v-model:structure-detail="modalStructureDetail"
/>
<!-- รายละเอยดตำแหน --> <!-- รายละเอยดตำแหน -->
<DialogPositionDetail <DialogPositionDetail v-model:position-detail="modalPositionDetail" />
v-model:position-detail="modalPositionDetail"
/>
</template> </template>
<style scoped></style> <style scoped></style>