This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-11-19 10:06:05 +07:00
parent a7da9da799
commit 491651bb79

View file

@ -107,7 +107,7 @@ const stat = ref({
/** /**
* funcion เรยกขอม stat * funcion เรยกขอม stat
*/ */
async function fecthDashboard() { async function fetchDashboard() {
await http await http
.get(config.API.insigniaManageOrgDashboard(id.value)) .get(config.API.insigniaManageOrgDashboard(id.value))
.then((res) => { .then((res) => {
@ -125,8 +125,8 @@ async function fecthDashboard() {
/** /**
* funcion เรยกขอมลรายช หนวยงานจดสรรเครองราชอสรยาภรณ ตรตาภรณมงกฎไทย () * funcion เรยกขอมลรายช หนวยงานจดสรรเครองราชอสรยาภรณ ตรตาภรณมงกฎไทย ()
*/ */
async function fecthListData() { async function fetchListData() {
showLoader(); // showLoader();
await http await http
.get(config.API.insigniaManageOrg(id.value)) .get(config.API.insigniaManageOrg(id.value))
.then((res) => { .then((res) => {
@ -142,7 +142,7 @@ async function fecthListData() {
messageError($q, err); messageError($q, err);
}) })
.finally(() => { .finally(() => {
hideLoader(); // hideLoader();
}); });
} }
@ -202,10 +202,9 @@ async function save(organizationId: string, total: string) {
total: total, total: total,
}) })
.then(async () => { .then(async () => {
await fecthListData(); await Promise.all([fetchListData(), fetchDashboard()]);
await fecthDashboard(); close();
await success($q, "บันทึกมูลสำเร็จ"); success($q, "บันทึกมูลสำเร็จ");
await close();
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -227,13 +226,14 @@ async function saveEdit(organizationId: string, amount: number) {
total: Number(amount), total: Number(amount),
}) })
.then(async () => { .then(async () => {
await fecthDashboard(); await Promise.all([fetchListData(), fetchDashboard()]);
await fecthListData(); close();
await close(); success($q, "แก้ไขมูลสำเร็จ");
await success($q, "แก้ไขมูลสำเร็จ");
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
})
.finally(() => {
hideLoader(); hideLoader();
}); });
} }
@ -259,8 +259,7 @@ async function clickDelete(insigniaId: string) {
await http await http
.delete(config.API.insigniaManageOrg(insigniaId)) .delete(config.API.insigniaManageOrg(insigniaId))
.then(async () => { .then(async () => {
await fecthDashboard(); await Promise.all([fetchDashboard(), fetchListData()]);
await fecthListData();
await success($q, "ลบข้อมูลสำเร็จ"); await success($q, "ลบข้อมูลสำเร็จ");
}) })
.catch((err) => { .catch((err) => {
@ -286,8 +285,13 @@ const resetFilter = () => {
/** Hook*/ /** Hook*/
onMounted(async () => { onMounted(async () => {
showLoader();
name.value = DataStore.insigniaName; name.value = DataStore.insigniaName;
await Promise.all([fecthDashboard(), fecthListData(), fetchOrgList()]); await Promise.all([
fetchDashboard(),
fetchListData(),
fetchOrgList(),
]).finally(() => hideLoader());
}); });
</script> </script>
@ -377,7 +381,6 @@ onMounted(async () => {
map-options map-options
:options="columns" :options="columns"
option-value="name" option-value="name"
style="min-width: 140px" style="min-width: 140px"
class="col-xs-12 col-sm-3 col-md-2" class="col-xs-12 col-sm-3 col-md-2"
/> />