โครงสร้างตัวชี้วัด

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-13 17:59:36 +07:00
parent 5664b31fe4
commit 3ad54cf99f
5 changed files with 112 additions and 155 deletions

View file

@ -114,18 +114,18 @@ async function fetchList() {
pageSize: formFilter.pageSize,
page: formFilter.page,
})
.then((res) => {
const data = res.data.result.data;
.then(async (res) => {
const data = await res.data.result.data;
total.value = res.data.result.total;
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
rows.value = data;
hideLoader();
})
.catch((err) => {
messageError($q, err);
hideLoader();
})
.finally(() => {});
.finally(() => {
hideLoader();
});
}
function onClickAddOrView(status: boolean = false, id: string = "") {
@ -192,8 +192,8 @@ async function getOptions() {
showLoader();
await http
.get(config.API.orgSalaryPosition)
.then((res) => {
const dataOp = res.data.result;
.then(async (res) => {
const dataOp = await res.data.result;
const uniqueNames = new Set();
const filteredData = dataOp
@ -211,13 +211,13 @@ async function getOptions() {
positionMainOp.value.push(...filteredData);
positionOp.value.push(...filteredData);
hideLoader();
})
.catch((err) => {
messageError($q, err);
hideLoader();
})
.finally(() => {});
.finally(() => {
hideLoader();
});
}
function setModel(val: string) {
@ -246,10 +246,11 @@ function onClickHistory(id: string) {
}
async function getTotal() {
showLoader();
await http
.post(config.API.indicatorSummary)
.then((res) => {
const data = res.data.result;
.then(async (res) => {
const data = await res.data.result;
indicatorTotal.value = indicatorTotal.value.map((indicator) => {
return {
...indicator,
@ -260,13 +261,13 @@ async function getTotal() {
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
.finally(() => {
hideLoader();
});
}
onMounted(async () => {
await getTotal();
await getOptions();
await fetchList();
await Promise.all([getTotal(), getOptions(), fetchList()]);
});
</script>