Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2024-02-01 13:45:31 +07:00
commit 0cda16d094
4 changed files with 78 additions and 86 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: "",
@ -166,17 +166,18 @@ 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);
}
}
function deleteNode(treeNode: any, rootId: string, treeId: string): boolean {
if (treeNode.orgTreeId === rootId) {
const childrenNew = treeNode.children.filter(
(x: any) => x.orgTreeId != treeId
);
let newData = {
...treeNode,
children: [],
children: childrenNew,
};
Object.assign(treeNode, newData);
@ -239,7 +240,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;
@ -293,9 +295,9 @@ onMounted(async () => {});
</script>
<template>
<div class="col-12 q-py-md q-px-lg">
<div class="q-gutter-md">
<div class="row q-col-gutter-sm">
<div class="col-12 q-py-md q-px-sm">
<div class="q-gutter-sm">
<div class="row q-col-gutter-sm q-pl-sm">
<div class="col-2" v-if="store.typeOrganizational === 'draft'">
<q-btn
dense
@ -312,7 +314,13 @@ onMounted(async () => {});
<div
:class="store.typeOrganizational === 'draft' ? 'col-10' : 'col-12'"
>
<q-input dense outlined v-model="filter" label="ค้นหา">
<q-input
dense
outlined
v-model="filter"
label="ค้นหา"
class="bg-white"
>
<template v-slot:append>
<q-icon
v-if="filter !== ''"
@ -324,14 +332,7 @@ onMounted(async () => {});
</q-input>
</div>
</div>
<div
class="bg-white"
style="
height: 60vh;
border: 1px solid rgb(210, 210, 210);
border-radius: 10px;
"
>
<div class="bg-white tree-container">
<q-tree
class="q-pa-md q-gutter-sm"
dense
@ -403,7 +404,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,
@ -420,14 +421,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>
@ -436,7 +439,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
>
@ -466,19 +470,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>
@ -490,31 +482,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>
@ -540,6 +508,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"
@ -548,4 +518,11 @@ onMounted(async () => {});
/>
</template>
<style scoped></style>
<style scoped>
.tree-container {
overflow: auto;
height: 60vh;
border: 1px solid rgb(210, 210, 210);
border-radius: 10px;
}
</style>