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

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

@ -14,6 +14,7 @@ const { showLoader, hideLoader, messageError } = useCounterMixin();
export const useStructureTree = defineStore("structureTree", () => {
const activeId = ref<string>("");
const dataStore = ref<{ [key: string]: DataStructureTree[] }>({});
const dataStrategy = ref<any[]>([]);
/**
* 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,
};
});