This commit is contained in:
Warunee Tamkoo 2024-05-28 17:01:29 +07:00
parent ba728ea000
commit ee9442702f
11 changed files with 212 additions and 88 deletions

View file

@ -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;

View file

@ -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<boolean>(false);
const personId = ref<string>("");
@ -113,6 +114,7 @@ const formData = reactive<FormData>({
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<OptionData>();
/**
* งชนคำนวณเวลาวนทนสดจาก นทนสดการสบสวน
* @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();
});
</script>
<template>
<div class="row col-12 bg-white">
<div v-if="isSave" class="col-12">
@ -712,11 +761,9 @@ onMounted(async () => {
outlined
option-label="name"
option-value="id"
emit-value
map-options
v-model="formData.organizationId"
v-model="organization"
:options="investigateFactStore.organizationIdOp"
label="เลือกสำนักงาน"
label="หน่วยงานที่ถูกร้องเรียน"
clearable
@update:model-value="changeFormData()"
/>