ปรับแสดงการเผยแพร่โครงสร้าง
This commit is contained in:
parent
039d4081d6
commit
76cd4e170b
4 changed files with 38 additions and 22 deletions
|
|
@ -11,6 +11,11 @@ import config from "@/app.config";
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modal: Boolean,
|
modal: Boolean,
|
||||||
close: Function,
|
close: Function,
|
||||||
|
fetchActive: {
|
||||||
|
type: Function,
|
||||||
|
require: true,
|
||||||
|
default: () => "Function fetchActive",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const store = useOrganizational();
|
const store = useOrganizational();
|
||||||
|
|
@ -67,6 +72,7 @@ function onSubmit() {
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
props.close?.();
|
props.close?.();
|
||||||
|
props.fetchActive();
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
|
@ -82,7 +88,7 @@ watch(
|
||||||
() => props.modal,
|
() => props.modal,
|
||||||
() => {
|
() => {
|
||||||
if (props.modal === true) {
|
if (props.modal === true) {
|
||||||
dateTime.value = null;
|
dateTime.value = store.orgPublishDate ? store.orgPublishDate : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ interface DataActive {
|
||||||
activeName: string;
|
activeName: string;
|
||||||
draftId: string;
|
draftId: string;
|
||||||
draftName: string;
|
draftName: string;
|
||||||
|
isPublic: boolean,
|
||||||
|
orgPublishDate: Date | null,
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OrgTree {
|
interface OrgTree {
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,14 @@ export const useOrganizational = defineStore("organizationalStore", () => {
|
||||||
const treeId = ref<string>();
|
const treeId = ref<string>();
|
||||||
const level = ref<number>();
|
const level = ref<number>();
|
||||||
const isPublic = ref<boolean>(false);
|
const isPublic = ref<boolean>(false);
|
||||||
const orgPublishDate = ref<Date>();
|
const orgPublishDate = ref<Date | null>(null);
|
||||||
|
|
||||||
function fetchDataActive(data: DataActive) {
|
function fetchDataActive(data: DataActive) {
|
||||||
activeId.value = data.activeId;
|
activeId.value = data.activeId;
|
||||||
draftId.value = data.draftId;
|
draftId.value = data.draftId;
|
||||||
dataActive.value = data;
|
dataActive.value = data;
|
||||||
|
isPublic.value = data.isPublic;
|
||||||
|
orgPublishDate.value = data.orgPublishDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchPosMaster(data: PosMaster[]) {
|
function fetchPosMaster(data: PosMaster[]) {
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,12 @@ import { useOrganizational } from "@/modules/02_organizationalNew/store/organiza
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
|
||||||
|
|
||||||
const modalNewStructure = ref<boolean>(false);
|
const modalNewStructure = ref<boolean>(false);
|
||||||
const modalPositionDetail = ref<boolean>(false);
|
const modalPositionDetail = ref<boolean>(false);
|
||||||
|
|
||||||
const stroe = useOrganizational();
|
const store = useOrganizational();
|
||||||
|
|
||||||
const isStatusData = ref<boolean>(false);
|
const isStatusData = ref<boolean>(false);
|
||||||
const ishasActive = ref<boolean>(false);
|
const ishasActive = ref<boolean>(false);
|
||||||
|
|
@ -56,7 +56,7 @@ async function fetchOrganizationActive() {
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
if (data) {
|
if (data) {
|
||||||
stroe.fetchDataActive(data);
|
store.fetchDataActive(data);
|
||||||
if (data.activeName === null && data.draftName === null) {
|
if (data.activeName === null && data.draftName === null) {
|
||||||
isStatusData.value = false;
|
isStatusData.value = false;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -64,10 +64,10 @@ async function fetchOrganizationActive() {
|
||||||
if (isStatusData.value) {
|
if (isStatusData.value) {
|
||||||
if (data.activeName === null) {
|
if (data.activeName === null) {
|
||||||
ishasActive.value = true;
|
ishasActive.value = true;
|
||||||
stroe.typeOrganizational = "draft";
|
store.typeOrganizational = "draft";
|
||||||
} else if (data.draftName === null) {
|
} else if (data.draftName === null) {
|
||||||
ishasDraft.value = true;
|
ishasDraft.value = true;
|
||||||
stroe.typeOrganizational = "current";
|
store.typeOrganizational = "current";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -88,7 +88,6 @@ async function fetchHistory() {
|
||||||
await http
|
await http
|
||||||
.get(config.API.organizationHistoryNew)
|
.get(config.API.organizationHistoryNew)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res);
|
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
const filterData = data.filter(
|
const filterData = data.filter(
|
||||||
(e: OrgRevision) => !e.orgRevisionIsDraft && !e.orgRevisionIsCurrent
|
(e: OrgRevision) => !e.orgRevisionIsDraft && !e.orgRevisionIsCurrent
|
||||||
|
|
@ -138,7 +137,14 @@ onMounted(async () => {
|
||||||
<div class="toptitle text-dark row items-center">โครงสร้างอัตรากำลัง</div>
|
<div class="toptitle text-dark row items-center">โครงสร้างอัตรากำลัง</div>
|
||||||
<q-space />
|
<q-space />
|
||||||
|
|
||||||
<div class="toptitle row" v-if="stroe.typeOrganizational === 'draft'">
|
<div class="toptitle row" v-if="store.typeOrganizational === 'draft'">
|
||||||
|
<div
|
||||||
|
v-if="store.isPublic && store.orgPublishDate"
|
||||||
|
class="q-pt-sm q-pr-sm text-caption"
|
||||||
|
>
|
||||||
|
วันที่เผยแพร่
|
||||||
|
{{ date2Thai(store.orgPublishDate) }}
|
||||||
|
</div>
|
||||||
<q-btn
|
<q-btn
|
||||||
color="indigo-9"
|
color="indigo-9"
|
||||||
icon="alarm"
|
icon="alarm"
|
||||||
|
|
@ -192,21 +198,21 @@ onMounted(async () => {
|
||||||
<q-toolbar class="q-gutter-md" style="padding: 0px">
|
<q-toolbar class="q-gutter-md" style="padding: 0px">
|
||||||
<q-btn-group outline>
|
<q-btn-group outline>
|
||||||
<q-btn
|
<q-btn
|
||||||
:outline="stroe.typeOrganizational === 'current' ? false : true"
|
:outline="store.typeOrganizational === 'current' ? false : true"
|
||||||
color="blue"
|
color="blue"
|
||||||
label="ปัจจุบัน"
|
label="ปัจจุบัน"
|
||||||
@click="
|
@click="
|
||||||
(stroe.typeOrganizational = 'current'),
|
(store.typeOrganizational = 'current'),
|
||||||
(labelHistory = 'ประวัติโครงสร้าง')
|
(labelHistory = 'ประวัติโครงสร้าง')
|
||||||
"
|
"
|
||||||
:disable="ishasActive"
|
:disable="ishasActive"
|
||||||
/>
|
/>
|
||||||
<q-btn
|
<q-btn
|
||||||
:outline="stroe.typeOrganizational === 'draft' ? false : true"
|
:outline="store.typeOrganizational === 'draft' ? false : true"
|
||||||
color="blue"
|
color="blue"
|
||||||
label="แบบร่าง"
|
label="แบบร่าง"
|
||||||
@click="
|
@click="
|
||||||
(stroe.typeOrganizational = 'draft'),
|
(store.typeOrganizational = 'draft'),
|
||||||
(labelHistory = 'ประวัติโครงสร้าง')
|
(labelHistory = 'ประวัติโครงสร้าง')
|
||||||
"
|
"
|
||||||
:disable="ishasDraft"
|
:disable="ishasDraft"
|
||||||
|
|
@ -214,8 +220,8 @@ onMounted(async () => {
|
||||||
<q-btn-dropdown
|
<q-btn-dropdown
|
||||||
color="blue"
|
color="blue"
|
||||||
:label="labelHistory"
|
:label="labelHistory"
|
||||||
@click="stroe.typeOrganizational = 'old'"
|
@click="store.typeOrganizational = 'old'"
|
||||||
:outline="stroe.typeOrganizational === 'old' ? false : true"
|
:outline="store.typeOrganizational === 'old' ? false : true"
|
||||||
>
|
>
|
||||||
<q-list>
|
<q-list>
|
||||||
<q-item
|
<q-item
|
||||||
|
|
@ -258,27 +264,27 @@ onMounted(async () => {
|
||||||
<q-btn
|
<q-btn
|
||||||
flat
|
flat
|
||||||
round
|
round
|
||||||
:color="stroe.statusView === 'list' ? 'grey-7' : 'grey-4'"
|
:color="store.statusView === 'list' ? 'grey-7' : 'grey-4'"
|
||||||
icon="list"
|
icon="list"
|
||||||
@click="stroe.statusView = 'list'"
|
@click="store.statusView = 'list'"
|
||||||
/>
|
/>
|
||||||
<q-btn
|
<q-btn
|
||||||
flat
|
flat
|
||||||
round
|
round
|
||||||
icon="mdi-sitemap"
|
icon="mdi-sitemap"
|
||||||
:color="stroe.statusView === 'tree' ? 'grey-7' : 'grey-4'"
|
:color="store.statusView === 'tree' ? 'grey-7' : 'grey-4'"
|
||||||
@click="stroe.statusView = 'tree'"
|
@click="store.statusView = 'tree'"
|
||||||
/>
|
/>
|
||||||
</q-toolbar>
|
</q-toolbar>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
<q-separator />
|
<q-separator />
|
||||||
<q-card-section style="padding: 0px">
|
<q-card-section style="padding: 0px">
|
||||||
<ListView
|
<ListView
|
||||||
v-if="stroe.statusView === 'list'"
|
v-if="store.statusView === 'list'"
|
||||||
v-model:historyId="historyId"
|
v-model:historyId="historyId"
|
||||||
v-model:count="count"
|
v-model:count="count"
|
||||||
/>
|
/>
|
||||||
<StructureView v-if="stroe.statusView === 'tree'" />
|
<StructureView v-if="store.statusView === 'tree'" />
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -293,7 +299,7 @@ onMounted(async () => {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- ตั้งเวลาเผยแพร่ -->
|
<!-- ตั้งเวลาเผยแพร่ -->
|
||||||
<DialogDateTime :modal="modalDateTime" :close="onClickDateTime" />
|
<DialogDateTime :modal="modalDateTime" :close="onClickDateTime" :fetchActive="fetchOrganizationActive"/>
|
||||||
|
|
||||||
<!-- ประวัติโครงสร้าง -->
|
<!-- ประวัติโครงสร้าง -->
|
||||||
<!-- <DialogHistory :modal="modalHistory" :close="onClickHistory" /> -->
|
<!-- <DialogHistory :modal="modalHistory" :close="onClickHistory" /> -->
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue