แก้ไข loader
This commit is contained in:
parent
f072224851
commit
b663eedb09
147 changed files with 3095 additions and 3256 deletions
|
|
@ -806,15 +806,14 @@ import type {
|
|||
} from "@/modules/02_organizational/interface/index/Main";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useDataStore } from "@/stores/data";
|
||||
|
||||
const dataStore = useDataStore();
|
||||
const { loaderPage } = dataStore;
|
||||
|
||||
|
||||
const $q = useQuasar(); // show dialog
|
||||
const mixin = useCounterMixin();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const { date2Thai, success, dateToISO, notifyError } = mixin;
|
||||
const { date2Thai, success, dateToISO, notifyError, showLoader, hideLoader } = mixin;
|
||||
const myForm = ref<QForm | null>(null); //form data input
|
||||
const name = ref<string>("");
|
||||
const note = ref<string>("");
|
||||
|
|
@ -925,7 +924,7 @@ watch(organizationName, (count: DataOption, prevCount: DataOption) => {
|
|||
});
|
||||
|
||||
onMounted(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
if (route.params.id != undefined) {
|
||||
edit.value = true;
|
||||
id.value = route.params.id.toString();
|
||||
|
|
@ -940,7 +939,7 @@ const clickBack = () => {
|
|||
};
|
||||
|
||||
const fetchData = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.getPeriodById(id.value))
|
||||
.then((res) => {
|
||||
|
|
@ -992,7 +991,7 @@ const fetchData = async () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -1019,7 +1018,7 @@ const uploadDocData = async () => {
|
|||
fileDocDataUpload.value.forEach((file: any) => {
|
||||
formData.append("", file);
|
||||
});
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.periodRecruitDoc(id.value), formData)
|
||||
.then((res) => {})
|
||||
|
|
@ -1027,7 +1026,7 @@ const uploadDocData = async () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
clickBack();
|
||||
});
|
||||
|
|
@ -1043,7 +1042,7 @@ const uploadImgData = async () => {
|
|||
fileImgDataUpload.value.forEach((file: any) => {
|
||||
formData.append("", file);
|
||||
});
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.periodRecruitImg(id.value), formData)
|
||||
.then((res) => {})
|
||||
|
|
@ -1051,7 +1050,7 @@ const uploadImgData = async () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -1132,7 +1131,7 @@ const sendData = () => {
|
|||
};
|
||||
|
||||
const deleteDocData = async (docId: string) => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.delete(config.API.periodDeleteDoc(docId))
|
||||
.then(async () => {
|
||||
|
|
@ -1142,12 +1141,12 @@ const deleteDocData = async (docId: string) => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const deleteImgData = async (docId: string) => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.delete(config.API.periodDeleteImg(docId))
|
||||
.then(async () => {
|
||||
|
|
@ -1157,12 +1156,12 @@ const deleteImgData = async (docId: string) => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const addData = async () => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.savePeriod, sendData())
|
||||
.then(async (res) => {
|
||||
|
|
@ -1175,12 +1174,12 @@ const addData = async () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const editData = async (id: string) => {
|
||||
loaderPage(true);
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.editPeriod(id), sendData())
|
||||
.then(async () => {
|
||||
|
|
@ -1191,7 +1190,7 @@ const editData = async (id: string) => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
loaderPage(false);
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue