fix load เครื่องราช
This commit is contained in:
parent
64a640cf6a
commit
5d33b1babb
2 changed files with 91 additions and 86 deletions
|
|
@ -37,7 +37,6 @@ const { messageError, dialogConfirm, showLoader, hideLoader, success } = mixin;
|
|||
/**
|
||||
* ตัวแปร
|
||||
*/
|
||||
const loading = ref<boolean>(false); //การโหลด
|
||||
const loadview = ref<boolean>(false); //แสดง View
|
||||
const hideBottom = ref<boolean>(false);
|
||||
const round = ref<string>(""); //รอยการเสนอขอ
|
||||
|
|
@ -64,10 +63,12 @@ const modalbackInsignia2Role = ref<boolean>(false); // popup หมายเห
|
|||
* function เรียกรอบการเสนอขอพระราชทานเครื่อง
|
||||
*/
|
||||
async function fecthlistRound() {
|
||||
showLoader();
|
||||
loadview.value = false;
|
||||
await http
|
||||
.get(config.API.listRoundInsignia(), { params: { path: "MANAGE" } })
|
||||
.then(async (res) => {
|
||||
optionRound.value = res.data.result.map((e: ResponsePeriod) => ({
|
||||
optionRound.value = await res.data.result.map((e: ResponsePeriod) => ({
|
||||
id: e.period_id,
|
||||
year: e.period_year,
|
||||
name: e.period_name,
|
||||
|
|
@ -84,14 +85,15 @@ async function fecthlistRound() {
|
|||
}
|
||||
DataStore.roundId = round.value;
|
||||
roundName.value = lastValue.name;
|
||||
loadview.value = true;
|
||||
await fecthStat(round.value);
|
||||
} else {
|
||||
loadview.value = false;
|
||||
loading.value = false;
|
||||
hideLoader();
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -109,23 +111,6 @@ async function fecthStat(id: string) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* funcion เช็คหน่วยงาน
|
||||
*/
|
||||
async function fecthAgency() {
|
||||
await http
|
||||
.get(config.API.keycloakPosition())
|
||||
.then((res) => {
|
||||
loadview.value = true;
|
||||
DataStore.agency = res.data.result.rootId;
|
||||
DataStore.typeOc = DataStore.agency;
|
||||
loading.value = true;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function fetch โครองสร้างปัจจุบัน
|
||||
*/
|
||||
|
|
@ -145,9 +130,8 @@ function fetchActiveId() {
|
|||
* function fetch ข้อมูลโครองสร้างปัจจุบัน
|
||||
* @param id โครงสร้างปัจจุบัน
|
||||
*/
|
||||
function fetchListOrg(id: string) {
|
||||
showLoader();
|
||||
http
|
||||
async function fetchListOrg(id: string) {
|
||||
await http
|
||||
.get(config.API.orgByIdSystem(id, route.meta.Key as string))
|
||||
.then(async (res) => {
|
||||
const data = await res.data.result.map((item: DataStructureTree) => ({
|
||||
|
|
@ -156,11 +140,24 @@ function fetchListOrg(id: string) {
|
|||
}));
|
||||
optiontypeOc.value = data;
|
||||
DataStore.fetchOption(optiontypeOc.value); //ค่าของหน่วยงานทั้งหมดไว้ที่ DataStore
|
||||
await fecthAgency();
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* funcion เช็คหน่วยงาน
|
||||
*/
|
||||
async function fecthAgency() {
|
||||
await http
|
||||
.get(config.API.keycloakPosition())
|
||||
.then((res) => {
|
||||
DataStore.agency = res.data.result.rootId;
|
||||
DataStore.typeOc = DataStore.agency;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -191,7 +188,7 @@ async function changround() {
|
|||
DataStore.agency != null //ถ้ามี agency เรียกข้อมูลตาม agency ถ้าไม่มีเรียนตาม Oc ที่เลือก
|
||||
? DataStore.agency
|
||||
: DataStore.typeOc;
|
||||
fecthInsigniaByOc(round.value, organization, "officer", tab.value); // เรียกข้อมูลรายชื่อข้าราชการสามัญฯ ที่มีสิทธิ์ยื่นขอพระราชทานเครื่องราชอิสริยาภรณ์
|
||||
await fecthInsigniaByOc(round.value, organization, "officer", tab.value); // เรียกข้อมูลรายชื่อข้าราชการสามัญฯ ที่มีสิทธิ์ยื่นขอพระราชทานเครื่องราชอิสริยาภรณ์
|
||||
// get round name
|
||||
const roundFilter = optionRound.value.find((x: any) => round.value === x.id);
|
||||
if (roundFilter) {
|
||||
|
|
@ -214,6 +211,7 @@ async function fecthInsigniaByOc(
|
|||
role: string,
|
||||
status: string
|
||||
) {
|
||||
DataStore.rows = [];
|
||||
if (roundId && ocId && role && status) {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -225,7 +223,6 @@ async function fecthInsigniaByOc(
|
|||
document.value = res.data.result.document;
|
||||
await DataStore.fetchData(res.data.result.items); // ส่งรายชื่อข้าราชการสามัญฯ
|
||||
await DataStore.fetchDataInsignia(res.data.result); // ส่งข้อมูลรอบบการแสดง
|
||||
loading.value = true;
|
||||
// แสดงปุมล็อกข้อมูล
|
||||
if (res.data.result.items !== null) {
|
||||
if (res.data.result.items.length !== 0) {
|
||||
|
|
@ -434,7 +431,13 @@ async function uploadFile(event: any) {
|
|||
*/
|
||||
onMounted(async () => {
|
||||
tab.value = DataStore.mainTab ?? "";
|
||||
Promise.all([fecthInsignia(), fecthlistRound(), fetchActiveId()]);
|
||||
await Promise.all([
|
||||
fecthlistRound(),
|
||||
fecthInsignia(),
|
||||
fecthInsignia(),
|
||||
fetchActiveId(),
|
||||
fecthAgency(),
|
||||
]);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
@ -506,6 +509,7 @@ onMounted(async () => {
|
|||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
|
||||
<q-card v-else>
|
||||
<div class="q-pa-md q-gutter-sm">
|
||||
<q-banner inline-actions rounded class="bg-grey-1 text-center">
|
||||
|
|
@ -514,7 +518,7 @@ onMounted(async () => {
|
|||
</div>
|
||||
</q-card>
|
||||
|
||||
<q-card flat bordered class="col-12 q-mt-sm" v-if="loading">
|
||||
<q-card flat bordered class="col-12 q-mt-sm" v-if="loadview">
|
||||
<div
|
||||
v-if="
|
||||
(roleDataStore.insignia1Role && requestStatus == 'st4') ||
|
||||
|
|
@ -531,6 +535,7 @@ onMounted(async () => {
|
|||
{{ requestNote }}
|
||||
</q-banner>
|
||||
</div>
|
||||
|
||||
<div class="row col-12">
|
||||
<q-tabs
|
||||
v-model="tab"
|
||||
|
|
@ -550,48 +555,49 @@ onMounted(async () => {
|
|||
label="หน่วยงานที่ยังไม่ได้ส่งรายชื่อ"
|
||||
/>
|
||||
</q-tabs>
|
||||
|
||||
<div class="col-12"><q-separator /></div>
|
||||
<q-tab-panels v-model="tab" animated>
|
||||
<!-- แทบคนที่ยื่นขอ -->
|
||||
<q-tab-panel name="pending" class="q-pa-none">
|
||||
<tab1
|
||||
:tab="tab"
|
||||
:round-id="round"
|
||||
:round-name="roundName"
|
||||
:fecth-insignia-by-oc="fecthInsigniaByOc"
|
||||
:request-status="requestStatus"
|
||||
:fecth-stat="fecthStat"
|
||||
/>
|
||||
</q-tab-panel>
|
||||
|
||||
<!-- แทบคนที่ไม่ยื่นขอ -->
|
||||
<q-tab-panel name="reject" class="q-pa-none">
|
||||
<tab2
|
||||
:tab="tab"
|
||||
:round-id="round"
|
||||
:fecth-insignia-by-oc="fecthInsigniaByOc"
|
||||
/>
|
||||
</q-tab-panel>
|
||||
|
||||
<!-- แทบคนที่ถูกลบออก -->
|
||||
<q-tab-panel name="delete" class="q-pa-none">
|
||||
<tab3
|
||||
:tab="tab"
|
||||
:round-id="round"
|
||||
:fecth-insignia-by-oc="fecthInsigniaByOc"
|
||||
/>
|
||||
</q-tab-panel>
|
||||
|
||||
<!-- แทบหน่วยงานที่ยังไม่ได้ส่งรายชื่อ -->
|
||||
<q-tab-panel
|
||||
v-if="roleDataStore.adminRole"
|
||||
name="organization"
|
||||
class="q-pa-none"
|
||||
>
|
||||
<tab4 :tab="tab" :round-id="round" />
|
||||
</q-tab-panel>
|
||||
</q-tab-panels>
|
||||
</div>
|
||||
<q-separator />
|
||||
<q-tab-panels v-model="tab" animated>
|
||||
<!-- แทบคนที่ยื่นขอ -->
|
||||
<q-tab-panel name="pending" class="q-pa-none">
|
||||
<tab1
|
||||
:tab="tab"
|
||||
:round-id="round"
|
||||
:round-name="roundName"
|
||||
:fecth-insignia-by-oc="fecthInsigniaByOc"
|
||||
:request-status="requestStatus"
|
||||
:fecth-stat="fecthStat"
|
||||
/>
|
||||
</q-tab-panel>
|
||||
|
||||
<!-- แทบคนที่ไม่ยื่นขอ -->
|
||||
<q-tab-panel name="reject" class="q-pa-none">
|
||||
<tab2
|
||||
:tab="tab"
|
||||
:round-id="round"
|
||||
:fecth-insignia-by-oc="fecthInsigniaByOc"
|
||||
/>
|
||||
</q-tab-panel>
|
||||
|
||||
<!-- แทบคนที่ถูกลบออก -->
|
||||
<q-tab-panel name="delete" class="q-pa-none">
|
||||
<tab3
|
||||
:tab="tab"
|
||||
:round-id="round"
|
||||
:fecth-insignia-by-oc="fecthInsigniaByOc"
|
||||
/>
|
||||
</q-tab-panel>
|
||||
|
||||
<!-- แทบหน่วยงานที่ยังไม่ได้ส่งรายชื่อ -->
|
||||
<q-tab-panel
|
||||
v-if="roleDataStore.adminRole"
|
||||
name="organization"
|
||||
class="q-pa-none"
|
||||
>
|
||||
<tab4 :tab="tab" :round-id="round" />
|
||||
</q-tab-panel>
|
||||
</q-tab-panels>
|
||||
|
||||
<q-toolbar class="q-py-md text-right">
|
||||
<q-file
|
||||
|
|
@ -703,21 +709,21 @@ onMounted(async () => {
|
|||
@click="popupBackToInsignia2Role"
|
||||
/>
|
||||
</q-toolbar>
|
||||
|
||||
<!-- popup หมายเหตุ -->
|
||||
<DialogPopupReason
|
||||
v-model:modal="modalPopupBackToEdit"
|
||||
title="หมายเหตุการตีกลับ"
|
||||
label="หมายเหตุ"
|
||||
:savaForm="backToEdit"
|
||||
/>
|
||||
<DialogPopupReason
|
||||
v-model:modal="modalbackInsignia2Role"
|
||||
title="หมายเหตุการตีกลับ"
|
||||
label="หมายเหตุ"
|
||||
:savaForm="backToEditinsignia2Role"
|
||||
/>
|
||||
</q-card>
|
||||
|
||||
<!-- popup หมายเหตุ -->
|
||||
<DialogPopupReason
|
||||
v-model:modal="modalPopupBackToEdit"
|
||||
title="หมายเหตุการตีกลับ"
|
||||
label="หมายเหตุ"
|
||||
:savaForm="backToEdit"
|
||||
/>
|
||||
<DialogPopupReason
|
||||
v-model:modal="modalbackInsignia2Role"
|
||||
title="หมายเหตุการตีกลับ"
|
||||
label="หมายเหตุ"
|
||||
:savaForm="backToEditinsignia2Role"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scope>
|
||||
|
|
|
|||
|
|
@ -254,7 +254,6 @@ async function fecthRound() {
|
|||
id: e.id,
|
||||
}));
|
||||
selectRound.value = data[0].id;
|
||||
|
||||
await Promise.all([fecthInsignia(), fecthInsigniaType()]);
|
||||
} else {
|
||||
hideLoader();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue