From ee9442702fc2c5bee3721f991266337d09be54a8 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Tue, 28 May 2024 17:01:29 +0700 Subject: [PATCH] updated --- .../2_InvestigateFacts/EditPage.vue | 3 + .../components/2_InvestigateFacts/Form.vue | 69 ++++++++++++++--- .../3_InvestigateDisciplinary/EditPage.vue | 7 ++ .../3_InvestigateDisciplinary/Form.vue | 59 ++++++++++---- .../components/4_Result/EditPage.vue | 12 ++- .../components/4_Result/Form.vue | 77 +++++++++++-------- .../components/7_ListSuspend/ListsPage.vue | 21 +++-- .../interface/request/disciplinary.ts | 9 ++- .../interface/request/investigateFact.ts | 9 ++- .../interface/response/suspend.ts | 2 + .../11_discipline/store/SuspendStore.ts | 32 +++++--- 11 files changed, 212 insertions(+), 88 deletions(-) diff --git a/src/modules/11_discipline/components/2_InvestigateFacts/EditPage.vue b/src/modules/11_discipline/components/2_InvestigateFacts/EditPage.vue index e576eb8b9..4fed4f6cb 100644 --- a/src/modules/11_discipline/components/2_InvestigateFacts/EditPage.vue +++ b/src/modules/11_discipline/components/2_InvestigateFacts/EditPage.vue @@ -115,7 +115,9 @@ async function getDataComplaint() { dataComplaints.id = dataList.id; dataComplaints.respondentType = dataList.respondentType; dataComplaints.organizationId = dataList.organizationId; + dataComplaints.organization = dataList.organization; dataComplaints.consideredAgency = dataList.consideredAgency; + dataComplaints.consideredAgencyId = dataList.consideredAgencyId; dataComplaints.title = dataList.title; dataComplaints.description = dataList.description; dataComplaints.dateReceived = dataList.dateReceived; @@ -148,6 +150,7 @@ function getData() { data.idComplaint = dataList.idComplaint; data.respondentType = dataList.respondentType; data.organizationId = dataList.organizationId; + data.organization = dataList.organization; data.persons = dataList.persons; data.investigationDetail = dataList.investigationDetail; data.investigationDetailOther = dataList.investigationDetailOther; diff --git a/src/modules/11_discipline/components/2_InvestigateFacts/Form.vue b/src/modules/11_discipline/components/2_InvestigateFacts/Form.vue index cc4e6acd8..d6862dca7 100644 --- a/src/modules/11_discipline/components/2_InvestigateFacts/Form.vue +++ b/src/modules/11_discipline/components/2_InvestigateFacts/Form.vue @@ -20,6 +20,7 @@ import type { FormData } from "@/modules/11_discipline/interface/request/investi import config from "@/app.config"; import http from "@/plugins/http"; +import type { OptionData } from "@/modules/07_insignia/interface/index/Main"; const modalPersonal = ref(false); const personId = ref(""); @@ -113,6 +114,7 @@ const formData = reactive({ documentFile: null, respondentType: "", organizationId: "", + organization: "", persons: [], investigationExtendHistory: [], isDisciplinary: false, @@ -168,12 +170,14 @@ function onSubmit() { if (mainStore.rowsAdd) { formData.persons = mainStore.rowsAdd; } + props.onSubmit(formData); isSave.value = false; investigationExtendStatus.value = false; }); } +const organization = ref(); /** * ฟังชั้นคำนวณเวลาวันที่สิ้นสุดจาก วันที่สิ้นสุดการสืบสวน * @param val จำนวนวันที่ต้องการขยาย @@ -216,6 +220,11 @@ watch(props.data, async () => { formData.id = props.data.id; formData.complaint = props.data.complaint; formData.organizationId = props.data.organizationId; + formData.organization = props.data.organization; + organization.value = { + id: props.data.organizationId, + name: props.data.organization, + }; formData.respondentType = props.data.respondentType; formData.complaintdetail = props.data.complaintdetail; formData.investigationDescription = props.data.investigationDescription; @@ -429,11 +438,45 @@ function handleSave(returnData: any) { toggleModal(); } -function getOc() { - http.get(config.API.typeOc()).then((res) => { - const data = res.data.result; - investigateFactStore.ocListFn(data); - }); +/** ดึงข้อมูล active */ +async function getActive() { + showLoader(); + await http + .get(config.API.activeOrganization) + .then((res) => { + getOc(res.data.result.activeId); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); +} + +async function getOc(activeId: string) { + showLoader(); + await http + .get(config.API.orgByid(activeId)) + .then(async (res) => { + const data = await res.data.result.map((item: any) => ({ + organizationId: item.orgTreeId, + organizationName: item.orgName, + })); + + investigateFactStore.ocListFn(data); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); + + // http.get(config.API.typeOc()).then((res) => { + // const data = res.data.result; + // investigateFactStore.ocListFn(data); + // }); } async function updatePagingProp(rowPerpage: number, pageCurrent: number) { @@ -495,6 +538,11 @@ function deleteDirector(id: string) { /** ฟังก์ชั่นเช็คการแก้ไขฟอร์มแล้วไม่ได้กดบันทึก */ function changeFormData() { isSave.value = true; + + if (organization.value) { + formData.organizationId = organization.value.id; + formData.organization = organization.value.name; + } } /** เช็ควันที่สิ้นสุดต้องมากกว่า หรือเท่ากับวันเริ่ม */ @@ -559,7 +607,7 @@ function emitPerson(data: FormData[]) { Id: dataMapId, }) .then((res) => { - getOc(); + getActive(); }) .catch((e) => { messageError($q, e); @@ -637,9 +685,10 @@ watch( onMounted(async () => { mainStore.rowsAdd = []; - getOc(); + getActive(); }); +