Merge branch 'nice_dev' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-01-31 10:34:17 +07:00
commit 531b5a33db
4 changed files with 143 additions and 39 deletions

View file

@ -19,38 +19,50 @@ const { showLoader, hideLoader, messageError } = useCounterMixin();
const showData = ref<boolean>(false);
const nodeTree = ref<OrgTree[]>();
const historyId = defineModel<string>("historyId", { required: true });
const count = defineModel<number>("count", { required: true });
// defineProps<{ dataActive: DataActive }>();
async function fetchDataTree() {
async function fetchDataTree(id: string) {
showLoader();
const id =
store.typeOrganizational === "current" ? store.activeId : store.draftId;
id &&
(await http
.get(config.API.orgByid(id.toString()))
.then((res) => {
const data = res.data.result;
nodeTree.value = data;
console.log(res);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
}));
// const id =
// store.typeOrganizational === "current" ? store.activeId : store.draftId;
// id &&
await http
.get(config.API.orgByid(id.toString()))
.then((res) => {
const data = res.data.result;
nodeTree.value = data;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
// console.log(nodeTree.value);
}
onMounted(async () => {
await fetchDataTree();
const id =
store.typeOrganizational === "current" ? store.activeId : store.draftId;
id && (await fetchDataTree(id));
});
watch(
() => count.value,
() => {
fetchDataTree(historyId.value);
}
);
watch(
() => store.typeOrganizational,
() => {
fetchDataTree();
const id =
store.typeOrganizational === "current" ? store.activeId : store.draftId;
id && store.typeOrganizational !== "old" && fetchDataTree(id);
}
);
</script>

View file

@ -149,9 +149,6 @@ function deleteNode(treeNode: any, organizationId: any): boolean {
// console.log("tttttttttttttt", treeNode.orgTreeId, organizationId);
if (treeNode.orgTreeId === organizationId) {
console.log(treeNode);
// Node Node
treeNode.children = [];
breakLoop.value = true;
@ -351,6 +348,45 @@ onMounted(async () => {});
</q-list>
</q-menu>
</q-btn>
<q-btn
v-else
flat
dense
icon="mdi-dots-vertical"
class="q-pa-none q-ml-xs"
color="grey-13"
>
<q-menu>
<q-list
dense
v-for="(item, index) in listAdd.slice(5, 6)"
:key="index"
style="min-width: 100px"
>
<q-item
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)
: 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>
</template>
<template v-slot:default-body="prop">