ปรับโครงสร้าง

This commit is contained in:
Warunee Tamkoo 2024-02-01 10:32:34 +07:00
parent dd9239ac25
commit ea1f76125a
4 changed files with 40 additions and 72 deletions

View file

@ -65,9 +65,9 @@ const listAdd = ref<ListMenu[]>([
},
{
label: "จัดลำดับ",
icon: "filter_list",
icon: "mdi-sort",
type: "SORT",
color: "green-7",
color: "blue-6",
},
// {
// label: "",
@ -164,8 +164,6 @@ async function deleteUpdate(rootId: string, treeId: string) {
if (breakLoop.value) break;
}
} else {
console.log("rootId===>", rootId);
console.log("treeId===>", treeId);
nodes.value = nodes.value.filter((x: any) => x.orgTreeId != treeId);
}
}
@ -237,7 +235,8 @@ async function onClickDel(type: number, id: string, rootId: string) {
});
}
async function onClickSort(id: string) {
async function onClickSort(id: string, level: number) {
type.value = level;
modalSortAgency.value = true;
if (id) {
breakLoop.value = false;
@ -401,7 +400,7 @@ onMounted(async () => {});
prop.node.orgRootId
)
: item.type === 'SORT'
? onClickSort(prop.node.orgRootId)
? onClickSort(prop.node.orgRootId, prop.node.orgLevel)
: item.type === 'HISTORY'
? onClickHistory(
prop.node.orgLevel,
@ -418,14 +417,16 @@ onMounted(async () => {});
v-if="
item.type === 'EDIT' ||
item.type === 'DEL' ||
item.type === 'HISTORY'
item.type === 'HISTORY' ||
item.type === 'SORT'
"
>{{ item.label }}หนวยงาน</q-item-section
>
<q-item-section v-else-if="item.type === 'ADD'"
>{{ item.label }}วนราชการ</q-item-section
>
<q-item-section v-else>{{ item.label }}</q-item-section>
{{ item.label }}หนวยงาน
</q-item-section>
<q-item-section v-else-if="item.type === 'ADD'">
{{ item.label }}วนราชการ
</q-item-section>
<q-item-section v-else> {{ item.label }} </q-item-section>
</div>
<div v-else>
@ -434,7 +435,8 @@ onMounted(async () => {});
item.type === 'ADD' ||
item.type === 'EDIT' ||
item.type === 'DEL' ||
item.type === 'HISTORY'
item.type === 'HISTORY' ||
item.type === 'SORT'
"
>{{ item.label }}วนราชการ</q-item-section
>
@ -464,19 +466,7 @@ onMounted(async () => {});
clickable
v-close-popup
@click="
item.type === 'EDIT'
? onClickEdit(prop.node)
: item.type === 'ADD'
? onClickAgency(prop.node.orgLevel + 1, prop.node)
: item.type === 'DETAIL'
? onClickDetail(prop.node.orgTreeId, prop.node.orgLevel)
: item.type === 'DEL'
? onClickDel(
prop.node.orgLevel,
prop.node.orgTreeId,
prop.node.orgRootId
)
: null
onClickDetail(prop.node.orgTreeId, prop.node.orgLevel)
"
>
<q-item-section avatar>
@ -488,31 +478,7 @@ onMounted(async () => {});
</q-menu>
</q-btn>
</template>
<!-- <template v-slot:default-body="prop">
<div v-if="prop.node.orgCode">
<span class="text-grey-13"
>{{ prop.node.orgCode }} {{ prop.node.orgTreeShortName }}</span
>
</div>
</template> -->
</q-tree>
<!-- <div class="q-pa-md q-gutter-sm">
<q-tree :nodes="nodes" node-key="orgRootName" default-expand-all>
<template v-slot:default-header="prop">
<div class="row">
<div class="text-weight-bold text-primary">
{{ prop.node.orgRootName }}
</div>
</div>
</template>
<template v-slot:default-body="prop">
</template>
</q-tree>
</div> -->
</div>
</div>
</div>
@ -538,6 +504,8 @@ onMounted(async () => {});
<DialogSortAgency
v-model:sort-agency="modalSortAgency"
v-model:data="dataSort"
:fetchDataTree="props.fetchDataTree"
v-model:type="type"
/>
<DialogHistory
v-model:history="modalHistory"