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

@ -71,7 +71,9 @@ const dataComplaints = reactive<FormDataComplaint>({
id: "",
respondentType: "",
organizationId: "",
organization: "",
consideredAgency: "",
consideredAgencyId: "",
title: "",
description: "",
dateReceived: null,
@ -115,6 +117,7 @@ const dataInvestigatefacts = reactive<FormInvestigateFact>({
documentFile: null,
respondentType: "",
organizationId: "",
organization: "",
persons: [],
investigationExtendHistory: [],
isDisciplinary: false,
@ -174,6 +177,8 @@ async function fetchDetailInvestigate() {
dataList.investigationExtendStatus;
dataInvestigatefacts.investigationDaysExtend =
dataList.investigationDaysExtend;
dataInvestigatefacts.organizationId = dataList.organizationId;
dataInvestigatefacts.organization = dataList.organization;
})
.catch((err) => {
messageError($q, err);
@ -193,7 +198,9 @@ async function fetchDetailComplaints() {
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;

View file

@ -36,6 +36,7 @@ import { useInvestigateDisStore } from "@/modules/11_discipline/store/Investigat
import { useDisciplineMainStore } from "@/modules/11_discipline/store/main";
import DialogDuty from "@/modules/11_discipline/components/DialogDuty.vue";
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
import type { OptionData } from "@/modules/07_insignia/interface/index/Main";
const modalPersonal = ref<boolean>(false);
const personId = ref<string>("");
@ -89,7 +90,8 @@ const countNum = ref<number>(1);
/** formData*/
const formData = reactive<FormData>({
respondentType: "",
organizationId: "",
organizationId: null,
organization: "",
consideredAgency: "",
disciplinaryDateAllegation: null, //*
disciplinaryDateEvident: null, //*
@ -233,6 +235,11 @@ async function fetchDatadetail() {
formData.respondentType = props.data.respondentType;
formData.organizationId = props.data.organizationId;
formData.organization = props.data.organization;
organization.value = {
id: props.data.organizationId,
name: props.data.organization,
};
formData.consideredAgency = props.data.consideredAgency;
formData.disciplinaryDateAllegation =
props.data.disciplinaryDateAllegation;
@ -405,18 +412,37 @@ watch(
);
/** function เรียกรายชื่อหน่วยงาน*/
async function fetchOrganization() {
/** ดึงข้อมูล active */
async function getActive() {
showLoader();
await http
.get(config.API.typeOc())
.get(config.API.activeOrganization)
.then((res) => {
const data = res.data.result;
organizationOption.value = data.map((e: DataOptionRes) => ({
id: e.organizationId,
name: e.organizationName,
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) => {
organizationOption.value = await res.data.result.map((item: any) => ({
id: item.orgTreeId,
name: item.orgName,
}));
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
@ -483,6 +509,8 @@ function returnDirector(data: any) {
clickClose();
}
const organization = ref<OptionData>();
async function selectComplainant(val: string) {
formData.organizationId = "";
formData.consideredAgency = "";
@ -499,6 +527,11 @@ function changeFormData() {
if (formData.disciplinaryFaultLevel !== "อื่นๆ") {
formData.disciplinaryFaultLevelOther = "";
}
if (organization.value) {
formData.organizationId = organization.value.id;
formData.organization = organization.value.name;
}
}
/** เช็ควันที่สิ้นสุดต้องมากกว่า หรือเท่ากับวันเริ่ม */
@ -568,7 +601,7 @@ function emitPerson(data: PersonsArray[]) {
Id: dataMapId,
})
.then((res) => {
fetchOrganization();
getActive();
})
.catch((e) => {
messageError($q, e);
@ -645,12 +678,13 @@ function deletePerson(id: string) {
/** Hook */
onMounted(async () => {
mainStore.rowsAdd = [];
await fetchOrganization();
getActive();
});
</script>
<template>
<div class="row col-12 bg-white">
<div v-if="isSave" class="q-pa-sm q-gutter-sm">
<div v-if="isSave" class="col-12 q-pa-sm q-gutter-sm">
<q-banner inline-actions bordered class="bg-red-1 text-red border-orange">
<q-icon name="mdi-information-outline" size="20px" /> แจงเตอน
งไมไดนทกขอม
@ -718,11 +752,10 @@ onMounted(async () => {
outlined
option-label="name"
option-value="id"
emit-value
map-options
v-model="formData.organizationId"
v-model="organization"
:options="organizationOption"
label="เลือกสำนักงาน"
label="หน่วยงานที่ถูกร้องเรียน"
@update:model-value="changeFormData()"
/>
</div>