แก้ API

This commit is contained in:
STW_TTTY\stwtt 2024-09-02 16:04:53 +07:00
parent d78b7db124
commit 459428979b
12 changed files with 37 additions and 33 deletions

View file

@ -100,8 +100,8 @@ const roundOp = ref<DataOption[]>([
{ id: "OCT", name: "รอบตุลาคม" },
]);
function fetchList() {
http
async function fetchList() {
await http
.post(config.API.kpiRoleMainList + `/search-edit`, {
// ?page=${formFilter.page}&pageSize=${formFilter.pageSize}&period=${formFilter.round}&position=${formFilter.position}&keyword=${formFilter.keyword}&year=${formFilter.year}
keyword: formFilter.keyword,
@ -118,13 +118,13 @@ function fetchList() {
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);
})
.finally(() => {
hideLoader();
});
})
.finally(() => {});
}
function onClickAddOrView(status: boolean = false, id: string = "") {
@ -141,7 +141,7 @@ function onClickDelete(id: number) {
dialogRemove($q, () => {
showLoader();
http
.delete(config.API.kpiRoleMainEdit + `/${id}`)
.delete(config.API.kpiRoleMainList + `/${id}`)
.then(() => {
success($q, "ลบข้อมูลสำเร็จ");
fetchList();
@ -187,9 +187,9 @@ function filterOption(val: any, update: Function) {
}
/** ดึงข้อมูลตำแหน่ง */
function getOptions() {
async function getOptions() {
showLoader();
http
await http
.get(config.API.orgSalaryPosition)
.then((res) => {
const dataOp = res.data.result;
@ -210,13 +210,13 @@ function getOptions() {
positionMainOp.value.push(...filteredData);
positionOp.value.push(...filteredData);
hideLoader();
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
})
.finally(() => {});
}
function setModel(val: string) {
@ -244,8 +244,8 @@ function onClickHistory(id: string) {
});
}
function getTotal() {
http
async function getTotal() {
await http
.post(config.API.indicatorSummary)
.then((res) => {
const data = res.data.result;