วินัย => fix bug

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-07-04 13:44:29 +07:00
parent 7a483649d4
commit 17b801eede
15 changed files with 197 additions and 90 deletions

View file

@ -109,7 +109,11 @@ const dataComplaints = reactive<FormDataComplaint>({
async function getDataComplaint() {
showLoader();
await http
.get(config.API.complaintbyId(data.idComplaint))
.get(
config.API.complaintbyId(
data.idComplaint ? data.idComplaint : store.complaintId
)
)
.then((res) => {
const dataList = res.data.result;
dataComplaints.id = dataList.id;
@ -148,6 +152,7 @@ function getData() {
const dataList = res.data.result;
data.id = dataList.id;
data.idComplaint = dataList.idComplaint;
store.complaintId = dataList.idComplaint;
data.respondentType = dataList.respondentType;
data.organizationId = dataList.organizationId;
data.organization = dataList.organization;
@ -191,15 +196,15 @@ async function onSubmit(data: any) {
showLoader();
http
.put(config.API.investigateById(id.value), data)
.then((res) => {
getData();
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async (res) => {
await getData();
await success($q, "บันทึกข้อมูลสำเร็จ");
// router.push(`/discipline/complaints`);
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
.finally(() => {
hideLoader();
});
// router.push(`/discipline/investigatefacts`);
@ -225,14 +230,15 @@ function sentConfirmNoPerson() {
.put(config.API.investigateApprove(id.value), {
persons: [],
})
.then((res) => {})
.then((res) => {
getData();
router.push(`/discipline/investigatefacts`);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
getData();
router.push(`/discipline/investigatefacts`);
});
}
@ -265,14 +271,13 @@ function confirmEndInvestigate() {
showLoader();
http
.get(config.API.investigateReject(id.value))
.then((res) => {
success($q, "ยุติเรื่องสำเร็จ");
.then(async () => {
await getData();
await success($q, "ยุติเรื่องสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await getData();
hideLoader();
});
}
@ -281,15 +286,15 @@ function confirmCancelInvestigate() {
showLoader();
http
.get(config.API.investigateResume(id.value))
.then((res) => {
getData();
.then(async () => {
await getData();
await success($q, "ยกเลิกยุติเรื่องสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
success($q, "ยกเลิกยุติเรื่องสำเร็จ");
});
}
@ -300,8 +305,7 @@ function emitPerson(data: FormData[]) {
.put(config.API.investigateApprove(id.value), {
persons: dataMapId,
})
.then((res) => {
.then(() => {
router.push(`/discipline/investigatefacts`);
})
.catch((e) => {
@ -315,6 +319,9 @@ function emitPerson(data: FormData[]) {
/** โหลดข้อมูลเมื่อเข้าหน้านี้ */
onMounted(() => {
getData();
if (store.tabMenu == "complaints") {
getDataComplaint();
}
});
watch(