เพิ่ม 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`,
createOrganization: `${organization}/draft`,
createOrgLevel: (type: string) => `${organization}/${type}`,
orgLevelByid: (type: string, id: string) => `${organization}/${type}/${id}`,
organizationHistoryNew: `${organization}/history`,
};

View file

@ -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();
});
});

View file

@ -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);

View file

@ -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<any>([
const listAdd = ref<ListMenu[]>([
{
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<any>("nodeTree", { required: true });
@ -231,6 +240,13 @@ function onClickAgency(level: string) {
orgLevel.value = level;
}
const dialogDetail = ref<boolean>(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"
/>
<!-- รายละเอยดโครงสราง -->
<DialogStructureDetail v-model:structure-detail="dialogDetail" />
</template>
<style scoped></style>

View file

@ -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<boolean>("showData", { required: true });
const stroe = useOrganizational();
const filter = ref<string>("");
const listMenu = ref<ListMenu[]>([
{
label: "ดูรายละเอียด",
icon: "mdi-eye",
type: "VIEWDETIAL",
color: "primary",
},
]);
const document = ref<any>([
{
name: "บัญชี 1",
@ -83,12 +93,25 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
]);
const rows = ref<any>([]);
const rows = ref<any>([
{
noPosition: "00011",
namePosition: "กองบริหารทั่วไป",
typePosition: "ทั่วไป",
levelPositoion: " ระดับกอง",
isStatus: "ไม่มี",
},
]);
const dialogPosition = ref<boolean>(false);
function onClickPosition() {
dialogPosition.value = !dialogPosition.value;
}
const dialogDetail = ref<boolean>(false);
function onClickViewDetail() {
dialogDetail.value = !dialogDetail.value;
}
</script>
<template>
<!-- TOOLBAR -->
@ -164,6 +187,7 @@ function onClickPosition() {
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th auto-width></q-th>
</q-tr>
</template>
<template v-slot:body="props">
@ -177,6 +201,37 @@ function onClickPosition() {
{{ col.value }}
</div>
</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>
</template>
<!-- <template v-slot:pagination="scope">
@ -194,6 +249,9 @@ function onClickPosition() {
</div>
<DialogFormPosotion :modal="dialogPosition" :close="onClickPosition" />
<!-- รายละเอยดตำแหน -->
<DialogPositionDetail v-model:position-detail="dialogDetail" />
</template>
<style scoped></style>

View file

@ -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,
};

View file

@ -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<boolean>(false);
const ishasActive = ref<boolean>(false);
const ishasDraft = ref<boolean>(false);
const itemStructure = ref<any>([
const itemStructure = ref<DataOption[]>([
{
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)"
>
<q-item-section>
<q-item-label>{{ item.name }}</q-item-label>
@ -242,14 +243,10 @@ onMounted(async () => {
<DialogHistory :modal="modalHistory" :close="onClickHistory" />
<!-- รายละเอยดโครงสราง -->
<DialogStructureDetail
v-model:structure-detail="modalStructureDetail"
/>
<DialogStructureDetail v-model:structure-detail="modalStructureDetail" />
<!-- รายละเอยดตำแหน -->
<DialogPositionDetail
v-model:position-detail="modalPositionDetail"
/>
<DialogPositionDetail v-model:position-detail="modalPositionDetail" />
</template>
<style scoped></style>