ปิด input หน่วยงานที่พิจารณา

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-11-28 09:27:11 +07:00
parent 2598fda26a
commit 9f82a3b2ef
2 changed files with 43 additions and 45 deletions

View file

@ -1,91 +1,83 @@
<script setup lang="ts">
import { onMounted, reactive, ref, watch } from "vue";
import { onMounted, ref, watch } from "vue";
import { useQuasar } from "quasar";
import { useRouter, useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
/**import component*/
import FormComplaints from "@/modules/11_discipline/components/1_Complaint/Form.vue"; //
import FormInvestigatefacts from "@/modules/11_discipline/components/2_InvestigateFacts/Form.vue"; //
import FormDisciplinary from "@/modules/11_discipline/components/3_InvestigateDisciplinary/Form.vue"; //
import type { FormData } from "@/modules/11_discipline/interface/request/disciplinary";
import { useRouter, useRoute } from "vue-router";
/**import store*/
import { useCounterMixin } from "@/stores/mixin";
import { useInvestigateDisStore } from "@/modules/11_discipline/store/InvestigateDisStore";
import { useQuasar } from "quasar";
const $q = useQuasar();
const mixin = useCounterMixin();
const store = useInvestigateDisStore();
const { dialogConfirm, success } = mixin;
const { dialogConfirm, success, messageError, showLoader, hideLoader } = mixin;
const router = useRouter();
const route = useRoute();
const id = ref<string>(route.params.id as string);
/** ข้อมูล v-model ของฟอร์ม */
// const data = reactive<FormData>({
// complaint: "",
// respondentType: "",
// dateInvestigate: null,
// dateAllegation: null,
// dateEvident: null,
// casefault: "",
// typefault: "",
// faultLevel: "",
// refLaw: "",
// detailComplaint: "",
// whereInvestigate: "",
// trueDetail: "",
// evidence: "",
// recordAccuser: "",
// witnesses: "",
// InvestResults: "",
// filesEvidence: null,
// filesRecordAccuser: null,
// filesWitnesses: null,
// filesEtc: null,
// complaintStatus: "NEW",
// organizationId: "",
// consideredAgency: "",
// });
const data = ref<object>();
/** function fetchData สอบสวนคาวมผิดทางวินัย*/
async function fetchDetailDisciplinary() {
showLoader();
await http
.get(config.API.disciplineDisciplinaryById(id.value))
.then((res) => {
data.value = res.data.result;
})
.catch((err) => {
console.log(err);
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/** function fetchData สืบสวนข้อเท็จจริง*/
async function fetchDetailInvestigate() {
showLoader();
await http
.get(config.API.disciplineInvestigateById(id.value))
.then((res) => {
data.value = res.data.result;
})
.catch((err) => {
console.log(err);
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/** function fetchData เรื่องร้องเรียน*/
async function fetchDetailComplaints() {
showLoader();
await http
.get(config.API.disciplineComplaintsById(id.value))
.then((res) => {
data.value = res.data.result;
})
.catch((err) => {
console.log(err);
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/**
* function นทกขอม
* @param data อม ใน form
*/
async function onSubmitDisciplinary(data: any) {
console.log(data);
await http
.put(config.API.disciplineDisciplinaryById(id.value), data)
.then(() => {
@ -93,7 +85,18 @@ async function onSubmitDisciplinary(data: any) {
})
.catch((err) => {})
.finally(async () => {
await fetchDetailDisciplinary();
const fetchFunction =
store.tabMenu === "disciplinary"
? fetchDetailDisciplinary
: store.tabMenu === "investigatefacts"
? fetchDetailInvestigate
: store.tabMenu === "complaints"
? fetchDetailComplaints
: null;
if (fetchFunction) {
await fetchFunction();
}
});
}
@ -172,11 +175,6 @@ watch(
if (fetchFunction) {
await fetchFunction();
}
// if (store.tabMenu === "disciplinary") {
// await fetchDetailDisciplinary();
// } else if (store.tabMenu === "investigatefacts") {
// await fetchDetailInvestigate();
// } else if (store.tabMenu === "complaints") await fetchDetailComplaints();
}
);
</script>

View file

@ -571,7 +571,7 @@ onMounted(async () => {
lazy-rules
/>
</div>
<div class="col-xs-12 col-sm-3" id="consideredAgency">
<!-- <div class="col-xs-12 col-sm-3" id="consideredAgency">
<q-select
ref="consideredAgencyRef"
for="selectAgency"
@ -600,7 +600,7 @@ onMounted(async () => {
</q-item>
</template>
</q-select>
</div>
</div> -->
<div
v-if="formData.respondentType !== 'ORGANIZATION'"