ปรัย UI โครงสร้าง
This commit is contained in:
parent
533ed31bc8
commit
33f887f792
4 changed files with 143 additions and 39 deletions
|
|
@ -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