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