+
{{ col.value ? col.value : "-" }}
diff --git a/src/modules/01_masterdata/views/indicatorByRole.vue b/src/modules/01_masterdata/views/indicatorByRole.vue
index feb8f1ab0..67099d2e4 100644
--- a/src/modules/01_masterdata/views/indicatorByRole.vue
+++ b/src/modules/01_masterdata/views/indicatorByRole.vue
@@ -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()]);
});
diff --git a/src/stores/structureTree.ts b/src/stores/structureTree.ts
index 5a7d78bd6..d4d93ccd7 100644
--- a/src/stores/structureTree.ts
+++ b/src/stores/structureTree.ts
@@ -14,6 +14,7 @@ const { showLoader, hideLoader, messageError } = useCounterMixin();
export const useStructureTree = defineStore("structureTree", () => {
const activeId = ref
("");
const dataStore = ref<{ [key: string]: DataStructureTree[] }>({});
+ const dataStrategy = ref([]);
/**
* fetch ข้อมูลโครงสร้างตามคีย์ของระบบ
@@ -71,7 +72,27 @@ export const useStructureTree = defineStore("structureTree", () => {
}
}
+ /** function fetchTree ยุทธศาสตร์ / แผน*/
+ async function fetchTreeStrategy() {
+ dataStrategy.value;
+ if (dataStrategy.value.length > 0) {
+ return dataStrategy.value;
+ } else {
+ try {
+ const res = await http.get(config.API.devStrategy + `/edit/indicator`);
+ const data = res.data.result;
+ dataStrategy.value = data;
+ return data;
+ } catch (err) {
+ messageError($q, err);
+ } finally {
+ hideLoader();
+ }
+ }
+ }
+
return {
fetchStructureTree,
+ fetchTreeStrategy,
};
});