diff --git a/src/modules/07_insignia/components/4_Allocate/Main.vue b/src/modules/07_insignia/components/4_Allocate/Main.vue index 5467d22ae..74cbea46c 100644 --- a/src/modules/07_insignia/components/4_Allocate/Main.vue +++ b/src/modules/07_insignia/components/4_Allocate/Main.vue @@ -12,7 +12,8 @@ import DialogEdit from "@/modules/07_insignia/components/4_Allocate/DialogEdit.v import type { OptionDataYear } from "@/modules/07_insignia/interface/index/Main"; import type { QTableProps, QInput } from "quasar"; -import { useQuasar } from "quasar"; +import { Loading, useQuasar } from "quasar"; +import type { load } from "@/router/loader"; const DataStore = useAllocateDataStore(); const mixin = useCounterMixin(); @@ -45,24 +46,28 @@ const profileType = ref(""); const filterKeyword = ref(""); const roundYear = ref(); const insigniaOp = ref([]); +const loadView = ref(false); onMounted(async () => { await fecthRound(); - await fecthInsigniaType(); + // await fecthInsigniaType(); }); const fecthRound = async () => { await http .get(config.API.noteround()) - .then((res) => { + .then(async (res) => { let data = res.data.result; - selectRoundOption.value = data.map((e: any) => ({ - id: e.id, - name: "รอบการเสนอขอพระราชทานเครื่องราชปี" + " " + (e.year + 543), - year: e.year, - })); - selectRound.value = data[0].id; - roundYear.value = data[0].year; + if (data.length !== 0) { + selectRoundOption.value = data.map((e: any) => ({ + id: e.id, + name: "รอบการเสนอขอพระราชทานเครื่องราชปี" + " " + (e.year + 543), + year: e.year, + })); + selectRound.value = data[0].id; + roundYear.value = data[0].year; + await fecthInsigniaType(); + } }) .catch((err) => { messageError($q, err); @@ -92,6 +97,7 @@ const fecthInsigniaType = async () => { let data = res.data.result; DataStore.fetchDatainsigniaType(data); tab.value = DataStore.insigniaType[0].name; + loadView.value = true; fecthInsignia(); }) .catch((err) => { @@ -281,7 +287,12 @@ const resetFilter = () => {
จัดสรรเครื่องราชอิสริยาภรณ์
- +
รอบ
{ + +
+ + ไม่มีข้อมูลรอบการเสนอขอพระราชทานเครื่องราชอิสริยาภรณ์ + +
+
+ { :actionType="actionType" /> - + diff --git a/src/modules/07_insignia/components/5_Borrow/Main.vue b/src/modules/07_insignia/components/5_Borrow/Main.vue index 26ff0092e..d97b20c90 100644 --- a/src/modules/07_insignia/components/5_Borrow/Main.vue +++ b/src/modules/07_insignia/components/5_Borrow/Main.vue @@ -26,42 +26,50 @@ const action = ref(""); const profileId = ref(""); const roundYear = ref(); const insigniaList = ref([]); +const loadView = ref(false); onMounted(async () => { await fecthRound(); - await fecthInsigniaType(); + // await fecthInsigniaType(); }); const fecthRound = async () => { + showLoader(); await http .get(config.API.noteround()) - .then((res) => { + .then(async (res) => { let data = res.data.result; - selectRoundAllOption.value = [ - { - name: "ทั้งหมด", - id: "0", - year: 0, - }, - ]; - data.map((e: any) => { - selectRoundOption.value.push({ - name: "รอบการเสนอขอพระราชทานเครื่องราชปี" + " " + (e.year + 543), - id: e.id, - year: e.year, + if (data.length !== 0) { + await fecthInsigniaType(); + selectRoundAllOption.value = [ + { + name: "ทั้งหมด", + id: "0", + year: 0, + }, + ]; + data.map((e: any) => { + selectRoundOption.value.push({ + name: "รอบการเสนอขอพระราชทานเครื่องราชปี" + " " + (e.year + 543), + id: e.id, + year: e.year, + }); + selectRoundAllOption.value.push({ + name: "รอบการเสนอขอพระราชทานเครื่องราชปี" + " " + (e.year + 543), + id: e.id, + year: e.year, + }); }); - selectRoundAllOption.value.push({ - name: "รอบการเสนอขอพระราชทานเครื่องราชปี" + " " + (e.year + 543), - id: e.id, - year: e.year, - }); - }); - selectRound.value = data[0].id; - yearRound.value = data[0].year; - roundYear.value = data[0].year; + selectRound.value = data[0].id; + yearRound.value = data[0].year; + roundYear.value = data[0].year; + } }) .catch((err) => { messageError($q, err); + }) + .finally(() => { + hideLoader(); }); }; @@ -73,7 +81,7 @@ const fecthInsignia = async () => { DataStore.fetchDataInsignia(data); }) .catch((err) => { - console.log(err); + messageError($q, err); }) .finally(async () => { insigniaList.value = await DataStore.insigniaOp.filter( @@ -88,11 +96,13 @@ const fecthInsigniaType = async () => { let data = res.data.result; DataStore.fetchDatainsigniaType(data); tab.value = DataStore.insigniaType[0].name; + loadView.value = true; await fecthInsignia(); }) .catch((err) => { - console.log(err); - }); + messageError($q, err); + }) + .finally(() => {}); }; const visibleColumns = ref([ @@ -367,7 +377,12 @@ const paginationLabel = (start: number, end: number, total: number) => {
ยืม-คืนเครื่องราชฯ
- + { :type-id="tab" /> + +
+ + ไม่มีข้อมูลรอบการเสนอขอพระราชทานเครื่องราชอิสริยาภรณ์ + +
+