Merge branch 'nice_dev' into develop
This commit is contained in:
commit
531b5a33db
4 changed files with 143 additions and 39 deletions
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ interface DataActive {
|
|||
draftName: string;
|
||||
}
|
||||
|
||||
interface nodes {
|
||||
interface OrgTree {
|
||||
orgTreeId: string;
|
||||
orgRootId: string;
|
||||
orgLevel: number;
|
||||
|
|
@ -23,4 +23,12 @@ interface nodes {
|
|||
children: OrgTree[];
|
||||
}
|
||||
|
||||
export type { DataActive, OrgTree };
|
||||
interface OrgRevision {
|
||||
orgRevisionCreatedAt: string | null;
|
||||
orgRevisionId: string;
|
||||
orgRevisionIsCurrent: boolean;
|
||||
orgRevisionIsDraft: boolean;
|
||||
orgRevisionName: string;
|
||||
}
|
||||
|
||||
export type { DataActive, OrgTree, OrgRevision };
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import config from "@/app.config";
|
|||
|
||||
/** importType*/
|
||||
import type { DataOption } from "@/modules/02_organizationalNew/interface/index/Main";
|
||||
import type { OrgRevision } from "@/modules/02_organizationalNew/interface/response/organizational";
|
||||
|
||||
/** importComponents*/
|
||||
import ListView from "@/modules/02_organizationalNew/components/listView.vue";
|
||||
|
|
@ -13,7 +14,6 @@ import StructureView from "@/modules/02_organizationalNew/components/structureVi
|
|||
import DialogFormNewStructure from "@/modules/02_organizationalNew/components/DialogNewStructure.vue";
|
||||
import DialogDateTime from "@/modules/02_organizationalNew/components/DialogFormDateTime.vue";
|
||||
import DialogHistory from "@/modules/02_organizationalNew/components/DialogHistory.vue";
|
||||
import DialogStructureDetail from "@/modules/02_organizationalNew/components/StructureDetail.vue";
|
||||
import DialogPositionDetail from "@/modules/02_organizationalNew/components/PositionDetail.vue";
|
||||
/** importStore*/
|
||||
import { useOrganizational } from "@/modules/02_organizationalNew/store/organizational";
|
||||
|
|
@ -23,7 +23,6 @@ const $q = useQuasar();
|
|||
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
||||
|
||||
const modalNewStructure = ref<boolean>(false);
|
||||
const modalStructureDetail = ref<boolean>(false);
|
||||
const modalPositionDetail = ref<boolean>(false);
|
||||
|
||||
const stroe = useOrganizational();
|
||||
|
|
@ -82,6 +81,32 @@ async function fetchOrganizationActive() {
|
|||
});
|
||||
}
|
||||
|
||||
const itemHistory = ref<DataOption[]>([]);
|
||||
const historyId = ref<string>("");
|
||||
async function fetchHistory() {
|
||||
// showLoader();
|
||||
await http
|
||||
.get(config.API.organizationHistoryNew)
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
const data = res.data.result;
|
||||
const filterData = data.filter(
|
||||
(e: OrgRevision) => !e.orgRevisionIsDraft && !e.orgRevisionIsCurrent
|
||||
);
|
||||
|
||||
itemHistory.value = filterData.map((e: OrgRevision) => ({
|
||||
id: e.orgRevisionId,
|
||||
name: e.orgRevisionName,
|
||||
}));
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
const typeStructure = ref<string>("");
|
||||
function ocClickAddStructure(type: string) {
|
||||
modalNewStructure.value = !modalNewStructure.value;
|
||||
|
|
@ -94,12 +119,16 @@ function onClickDateTime() {
|
|||
}
|
||||
|
||||
const modalHistory = ref<boolean>(false);
|
||||
function onClickHistory() {
|
||||
modalHistory.value = !modalHistory.value;
|
||||
const count = ref<number>(0);
|
||||
function onClickHistory(id: string) {
|
||||
historyId.value = id;
|
||||
count.value++;
|
||||
// modalHistory.value = !modalHistory.value;
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchOrganizationActive();
|
||||
await fetchHistory();
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
|
|
@ -174,9 +203,30 @@ onMounted(async () => {
|
|||
@click="stroe.typeOrganizational = 'draft'"
|
||||
:disable="ishasDraft"
|
||||
/>
|
||||
<q-btn-dropdown
|
||||
color="blue"
|
||||
label="โครงสร้างแบบเก่า"
|
||||
@click="stroe.typeOrganizational = 'old'"
|
||||
:outline="stroe.typeOrganizational === 'old' ? false : true"
|
||||
>
|
||||
<q-list>
|
||||
<q-item
|
||||
dense
|
||||
clickable
|
||||
v-close-popup
|
||||
v-for="(item, index) in itemHistory"
|
||||
:key="index"
|
||||
@click="onClickHistory(item.id)"
|
||||
>
|
||||
<q-item-section>
|
||||
<q-item-label>{{ item.name }}</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-btn-dropdown>
|
||||
</q-btn-group>
|
||||
|
||||
<q-btn-dropdown color="green" label="ปรับโครงสร้าง">
|
||||
<q-btn-dropdown color="green" label="ประวัติโครงสร้าง">
|
||||
<q-list>
|
||||
<q-item
|
||||
dense
|
||||
|
|
@ -193,15 +243,9 @@ onMounted(async () => {
|
|||
</q-list>
|
||||
</q-btn-dropdown>
|
||||
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
color="primary"
|
||||
icon="history"
|
||||
@click="onClickHistory"
|
||||
>
|
||||
<!-- <q-btn flat round color="primary" icon="history">
|
||||
<q-tooltip>ประวัติโครงสร้าง</q-tooltip>
|
||||
</q-btn>
|
||||
</q-btn> -->
|
||||
<q-space />
|
||||
<q-btn
|
||||
flat
|
||||
|
|
@ -221,7 +265,11 @@ onMounted(async () => {
|
|||
</q-card-section>
|
||||
<q-separator />
|
||||
<q-card-section style="padding: 0px">
|
||||
<ListView v-if="stroe.statusView === 'list'" />
|
||||
<ListView
|
||||
v-if="stroe.statusView === 'list'"
|
||||
v-model:historyId="historyId"
|
||||
v-model:count="count"
|
||||
/>
|
||||
<StructureView v-if="stroe.statusView === 'tree'" />
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
|
|
@ -243,7 +291,7 @@ 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" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue