fix
This commit is contained in:
parent
3736aa7e80
commit
cedcbb0eaa
8 changed files with 102 additions and 111 deletions
|
|
@ -13,7 +13,7 @@ import type {
|
|||
FormData,
|
||||
ArrayPerson,
|
||||
ArrayFileList,
|
||||
} from "@/modules/11_discipline/interface/request/Complaint";
|
||||
} from "@/modules/11_discipline/interface/request/complaint";
|
||||
|
||||
import Form from "@/modules/11_discipline/components/1_Complaint/Form.vue";
|
||||
import PopupSendToNext from "@/modules/11_discipline/components/PopupSendToNext.vue";
|
||||
|
|
@ -163,16 +163,17 @@ const visibleColumns = ref<string[]>([
|
|||
"organization",
|
||||
]);
|
||||
|
||||
|
||||
|
||||
/** ดึงข้อมูล */
|
||||
async function getData() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(
|
||||
config.API.complaintbyGetId(id.value, mainStore.pathComplaints(route.name as string))
|
||||
config.API.complaintbyGetId(
|
||||
id.value,
|
||||
mainStore.pathComplaints(route.name as string)
|
||||
)
|
||||
)
|
||||
.then((res) => {
|
||||
.then(async (res) => {
|
||||
const dataList = res.data.result;
|
||||
data.id = dataList.id;
|
||||
data.respondentType = dataList.respondentType;
|
||||
|
|
@ -194,8 +195,7 @@ async function getData() {
|
|||
data.result = dataList.result;
|
||||
data.disciplineComplaintDocs = dataList.disciplineComplaintDocs;
|
||||
data.activeId = dataList.activeId;
|
||||
|
||||
mainStore.fetchDataRowsSend(dataList.persons);
|
||||
await mainStore.fetchDataRowsSend(dataList.persons);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -214,8 +214,8 @@ async function onSubmit(data: any) {
|
|||
|
||||
http
|
||||
.put(config.API.complaintbyId(id.value), data)
|
||||
.then((res) => {
|
||||
getData();
|
||||
.then(async () => {
|
||||
await getData();
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
|
|
@ -233,31 +233,28 @@ function sentInvestigate() {
|
|||
} else {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
() => sentConfirmNoPerson(),
|
||||
() => {
|
||||
showLoader();
|
||||
http
|
||||
.put(config.API.complaintApprove(id.value), {
|
||||
persons: [],
|
||||
})
|
||||
.then(() => {
|
||||
router.push(`/discipline/complaints`);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
},
|
||||
"ยืนยันส่งไปสืบสวน",
|
||||
"ต้องการยืนยันยืนยันส่งไปสืบสวนใช่หรือไม่?"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/** ส่งไปสืบสวน */
|
||||
function sentConfirmNoPerson() {
|
||||
showLoader();
|
||||
http
|
||||
.put(config.API.complaintApprove(id.value), {
|
||||
persons: [],
|
||||
})
|
||||
.then((res) => {
|
||||
router.push(`/discipline/complaints`);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/** ปิด dialog */
|
||||
function closePopup() {
|
||||
modalPopup.value = false;
|
||||
|
|
@ -267,7 +264,21 @@ function closePopup() {
|
|||
function endInvestigate() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
() => confirmEndInvestigate(),
|
||||
() => {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.complaintReject(id.value))
|
||||
.then(async () => {
|
||||
await getData();
|
||||
success($q, "ยุติเรื่องสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
});
|
||||
},
|
||||
"ยืนยันยุติเรื่อง",
|
||||
"ต้องการยืนยันยุติเรื่องใช่หรือไม่?"
|
||||
);
|
||||
|
|
@ -277,58 +288,38 @@ function endInvestigate() {
|
|||
function cancelInvestigate() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
() => confirmCancelInvestigate(),
|
||||
() => {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.complaintResume(id.value))
|
||||
.then(async () => {
|
||||
await getData();
|
||||
success($q, "ยกเลิกยุติเรื่องสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
},
|
||||
"ยืนยันยกเลิกการยุติเรื่อง",
|
||||
"ต้องการยืนยันยกเลิกการยุติเรื่องใช่หรือไม่?"
|
||||
);
|
||||
}
|
||||
|
||||
/** ฟังชั่น ยุติเรื่อง*/
|
||||
function confirmEndInvestigate() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.complaintReject(id.value))
|
||||
.then((res) => {
|
||||
success($q, "ยุติเรื่องสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
await getData();
|
||||
});
|
||||
}
|
||||
|
||||
/** ฟังชั่น ยกเลิกการยุติเรื่อง*/
|
||||
function confirmCancelInvestigate() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.complaintResume(id.value))
|
||||
.then((res) => {
|
||||
getData();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
success($q, "ยกเลิกยุติเรื่องสำเร็จ");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ดึงข้อมูล จาก component เเล้ว update
|
||||
* @param data person data
|
||||
*/
|
||||
function sendPersonToNext(data: ArrayPerson[]) {
|
||||
const dataMapId = data.map((item: ArrayPerson) => item.id);
|
||||
|
||||
showLoader();
|
||||
http
|
||||
.put(config.API.complaintApprove(id.value), {
|
||||
persons: dataMapId,
|
||||
})
|
||||
.then((res) => {
|
||||
.then(() => {
|
||||
router.push(`/discipline/complaints`);
|
||||
})
|
||||
.catch((e) => {
|
||||
|
|
@ -340,8 +331,8 @@ function sendPersonToNext(data: ArrayPerson[]) {
|
|||
}
|
||||
|
||||
/** เรียกใช้งาน ฟังชั่น ตอนเริ่มโหลดหน้า */
|
||||
onMounted(() => {
|
||||
getData();
|
||||
onMounted(async () => {
|
||||
await getData();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import type { DataOption } from "@/modules/11_discipline/interface/index/Main";
|
|||
import type {
|
||||
FormData,
|
||||
ArrayFileList,
|
||||
} from "@/modules/11_discipline/interface/request/Complaint";
|
||||
} from "@/modules/11_discipline/interface/request/complaint";
|
||||
|
||||
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
|
||||
import DialogAddPersonal from "@/components/Dialogs/AddPersonal.vue";
|
||||
|
|
@ -133,8 +133,6 @@ function onSubmit() {
|
|||
if (mainStore.rowsAdd) {
|
||||
formData.persons = await mainStore.rowsAdd;
|
||||
}
|
||||
console.log("formData===>", formData);
|
||||
|
||||
await props.onSubmit(formData);
|
||||
isSave.value = false;
|
||||
});
|
||||
|
|
@ -156,9 +154,9 @@ function confirmDelete(id: string) {
|
|||
showLoader();
|
||||
http
|
||||
.delete(config.API.complaintFileDelete(formData.id, id))
|
||||
.then((res) => {
|
||||
.then(async (res) => {
|
||||
await props.getData();
|
||||
success($q, `ลบไฟล์สำเร็จ`);
|
||||
props.getData();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -184,18 +182,19 @@ function upLoadFileDoc() {
|
|||
showLoader();
|
||||
http
|
||||
.put(config.API.complaintFileUpload(formData.id), Data)
|
||||
.then((res) => {
|
||||
.then(async (res) => {
|
||||
await props.getData();
|
||||
countNum.value = 2;
|
||||
formData.documentFile = null;
|
||||
hideLoader();
|
||||
|
||||
success($q, "อัพโหลดไฟล์สำเร็จ");
|
||||
props.getData();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
hideLoader();
|
||||
})
|
||||
.finally(async () => {});
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -216,8 +215,8 @@ async function getActive() {
|
|||
.get(config.API.activeOrganization)
|
||||
.then(async (res) => {
|
||||
const data = await res.data.result;
|
||||
await getOc(data.activeId);
|
||||
formData.activeId = data.activeId;
|
||||
getOc(data.activeId);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -226,7 +225,7 @@ async function getActive() {
|
|||
hideLoader();
|
||||
});
|
||||
} else {
|
||||
getOc(formData.activeId);
|
||||
await getOc(formData.activeId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -382,9 +381,9 @@ watch(props.data, async () => {
|
|||
/** โหลดข้อมูลเมื่อเข้าหน้านี้ */
|
||||
onMounted(() => {
|
||||
mainStore.rowsAdd = [];
|
||||
getListChannel();
|
||||
|
||||
getActive();
|
||||
getListChannel();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue