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