new loader

This commit is contained in:
Thanit Konmek 2023-06-09 14:25:41 +07:00
parent fd7aae2f5d
commit fe6c712a18
95 changed files with 1189 additions and 950 deletions

View file

@ -339,6 +339,8 @@ import type {
} from "../../interface/index/Main";
import { log } from "console";
import { useDataStore } from "@/stores/data";
import { useCounterMixin } from "@/stores/mixin";
// import { organizationSet } from "../interface/index/Main";
const props = defineProps({
@ -348,6 +350,8 @@ const props = defineProps({
const emit = defineEmits(["update:organizprops", "update:formprops"]);
const mixin = useCounterMixin();
const {showLoader, hideLoader } = mixin;
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const $q = useQuasar(); // show dialog
@ -386,7 +390,7 @@ const organizationAgencyCode = ref<GovermentOption[]>([]);
const organizationAgencyCodeFilter = ref<GovermentOption[]>([]);
onMounted(async () => {
loaderPage(false);
hideLoader();
await fetchOrganizationOri();
await fetchOrganizationAgencyCode();
await fetchOrganizationGovernmentCode();
@ -405,7 +409,7 @@ onMounted(async () => {
* หนวยงาน
*/
const fetchOrganizationOri = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organization)
.then((res) => {
@ -421,14 +425,14 @@ const fetchOrganizationOri = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* รหสหนวยงาน
*/
const fetchOrganizationAgencyCode = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationCode)
.then((res) => {
@ -450,14 +454,14 @@ const fetchOrganizationAgencyCode = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* รหสสวนราชการ
*/
const fetchOrganizationGovernmentCode = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationShortName)
.then((res) => {
@ -479,14 +483,14 @@ const fetchOrganizationGovernmentCode = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
// /**
// *
// */
// const fetchOrganizationShortName = async () => {
// loaderPage(true);
// showLoader();
// await http
// .get(config.API.organizationShortName)
// .then((res) => {
@ -508,14 +512,14 @@ const fetchOrganizationGovernmentCode = async () => {
// console.log(e);
// })
// .finally(() => {
// loaderPage(false);
// hideLoader();
// });
// };
/**
* หนวยงานตนสงก
*/
const fetchOrganizationAgency = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.listOrganizationAgency("หน่วยงาน"))
.then((res) => {
@ -534,14 +538,14 @@ const fetchOrganizationAgency = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* วนราชการตนสงก
*/
const fetchOrganizationGovernmentAgency = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.listOrganizationAgency("ส่วนราชการ"))
.then((res) => {
@ -560,14 +564,14 @@ const fetchOrganizationGovernmentAgency = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* ประเภทหนวยงาน
*/
const fetchOrganizationType = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationType)
.then((res) => {
@ -583,14 +587,14 @@ const fetchOrganizationType = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* ระดบหนวยงาน
*/
const fetchOrganizationLevel = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationLevel)
.then((res) => {
@ -606,14 +610,14 @@ const fetchOrganizationLevel = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* เบอรดตอภายใน
*/
const fetchOrganizationTelInternal = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationTelInternal)
.then((res) => {
@ -629,14 +633,14 @@ const fetchOrganizationTelInternal = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* เบอรดตอภายนอก
*/
const fetchOrganizationTelExternal = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationTelExternal)
.then((res) => {
@ -652,14 +656,14 @@ const fetchOrganizationTelExternal = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
/**
* เบอรโทรสาร
*/
const fetchOrganizationFax = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationFax)
.then((res) => {
@ -675,7 +679,7 @@ const fetchOrganizationFax = async () => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -776,7 +780,7 @@ const addOrganizationItem = async () => {
const fetchAgencyCode = async (val: string, item: OrganizaOption) => {
let option: GovermentOption[] = [];
loaderPage(true);
showLoader();
await http
.get(config.API.organizationGovernmentCode(val))
.then((res) => {
@ -796,14 +800,14 @@ const fetchAgencyCode = async (val: string, item: OrganizaOption) => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
return option;
};
const fetchGovernmentCode = async (val: string, item: OrganizaOption) => {
let option: GovermentOption[] = [];
loaderPage(true);
showLoader();
await http
.get(config.API.organizationAgencyCode(val))
.then((res) => {
@ -823,7 +827,7 @@ const fetchGovernmentCode = async (val: string, item: OrganizaOption) => {
console.log(e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
return option;
};