ผูก API สอบสวน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-11-27 16:30:14 +07:00
parent d3ec604478
commit b161f17a98
11 changed files with 708 additions and 882 deletions

View file

@ -1,13 +1,13 @@
<script setup lang="ts">
import { ref, computed, watchEffect, watch, onMounted } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar";
import type { directorType } from "@/modules/11_discipline/interface/index/Main";
import DialogHeader from "@/modules/05_placement/components/PersonalList/DialogHeader.vue";
import http from "@/plugins/http";
import config from "@/app.config";
const $q = useQuasar();
const selected = ref<directorType[]>([]);
@ -60,17 +60,7 @@ const columns2 = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "duty",
align: "left",
label: "หน้าที่",
sortable: true,
field: "duty",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "email",
align: "left",
@ -93,17 +83,6 @@ const columns2 = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "role",
align: "left",
label: "จำนวนเรื่องสืบสวน",
sortable: true,
field: "role",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
/** รับ props มาจากหน้าหลัก */
@ -139,7 +118,6 @@ const checkSelected = computed(() => {
if (selected.value.length === 0) {
return true;
}
console.log(checkSelected.value);
});
/** popup ยืนยันส่งัว */
@ -154,14 +132,14 @@ function saveDirector() {
/** ส่งไปออกคำสั่ง */
async function DirectorSave() {
emit('returnDirector',selected.value);
emit("returnDirector", selected.value);
}
const emit = defineEmits([
"update:filterKeyword2",
"update:selected",
"update:pagination",
"returnDirector"
"returnDirector",
]);
function updateInput(value: any) {
@ -244,7 +222,17 @@ watch(
:visible-columns="visibleColumns2"
selection="multiple"
v-model:selected="selected"
:rows-per-page-options="[10, 25, 50, 100]"
v-model:pagination="pagination"
>
<template v-slot:header-selection="scope">
<q-checkbox
keep-color
color="primary"
dense
v-model="scope.selected"
/>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td>

View file

@ -13,49 +13,53 @@ import { useQuasar } from "quasar";
const $q = useQuasar();
const mixin = useCounterMixin();
const store = useInvestigateDisStore();
const { dialogConfirm } = mixin;
const { dialogConfirm, success } = 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 = 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() {
await http
.get(config.API.disciplineDisciplinaryById(id.value))
.then((res) => {
console.log(res);
data.value = res.data.result;
})
.catch((err) => {
console.log(err);
});
}
/** function fetchData สืบสวนข้อเท็จจริง*/
async function fetchDetailInvestigate() {
await http
.get(config.API.disciplineInvestigateById(id.value))
@ -67,6 +71,7 @@ async function fetchDetailInvestigate() {
});
}
/** function fetchData เรื่องร้องเรียน*/
async function fetchDetailComplaints() {
await http
.get(config.API.disciplineComplaintsById(id.value))
@ -78,28 +83,19 @@ async function fetchDetailComplaints() {
});
}
/** จำลองข้อมูลจาก api */
const fetchData = async () => {
data.complaint = "test1";
data.dateInvestigate = new Date("2023-11-08T14:58:00");
data.dateAllegation = new Date("2023-11-08T14:58:00");
data.dateEvident = new Date("2023-11-08T14:58:00");
data.casefault = "test1";
data.typefault = "2";
data.faultLevel = "2";
data.refLaw = "test";
data.detailComplaint = "รายละเอียด";
data.whereInvestigate = "ที่ไหน";
data.trueDetail = "รายละเอียด";
data.evidence = "รายละเอียด";
data.recordAccuser = "รายละเอียด";
data.witnesses = "รายละเอียด";
data.InvestResults = "รายละเอียด";
data.filesEvidence = null;
data.filesRecordAccuser = null;
data.filesWitnesses = null;
data.filesEtc = null;
};
async function onSubmitDisciplinary(data: any) {
console.log(data);
await http
.put(config.API.disciplineDisciplinaryById(id.value), data)
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {})
.finally(async () => {
await fetchDetailDisciplinary();
});
}
/**
* นทกขอมลทเเกไข
@ -157,7 +153,7 @@ function confirmCancelInvestigate() {
/** โหลดข้อมูลเมื่อเข้าหน้านี้ */
onMounted(async () => {
store.tabMenu = 'disciplinary'
store.tabMenu = "disciplinary";
await fetchDetailDisciplinary();
});
@ -200,7 +196,7 @@ watch(
<div class="q-ma-none">แกไขการสอบสวนความผดทางว</div>
<q-space />
<div class="q-gutter-x-sm">
<q-btn
<!-- <q-btn
v-if="data.complaintStatus === 'NEW'"
label="ส่งไปสรุปผลการพิจารณา"
color="public"
@ -217,7 +213,7 @@ watch(
label="ยกเลิกการยุติเรื่อง"
color="red-7"
@click="cancelInvestigate"
/>
/> -->
</div>
</div>
<q-card flat class="col-12">
@ -244,7 +240,11 @@ watch(
<FormInvestigatefacts :on-submit="onSubmit" :data="data" />
</q-tab-panel>
<q-tab-panel name="disciplinary">
<FormDisciplinary :on-submit="onSubmit" :data="data" />
<FormDisciplinary
:on-submit="onSubmit"
:data="data"
@submit:disciplinary="onSubmitDisciplinary"
/>
</q-tab-panel>
</q-tab-panels>
</q-card>

View file

@ -40,7 +40,6 @@ async function fetchListDisciplinary() {
res.data.result.total / initialPagination.value.rowsPerPage
);
fetchList(data);
console.log(data);
})
.catch((err) => {
console.log(err);

View file

@ -34,6 +34,8 @@ const props = defineProps({
* ปโหลดหลกฐานสนบสนนขอกลาวหา
*/
function uploadFile() {
console.log("test");
// const Data = new FormData();
// Data.append("file", file.value);
// showLoader();
@ -96,7 +98,7 @@ function removeFile(id: string) {
</div>
</div>
<div class="col-xs-12 q-pa-sm row">
<div class="col-xs-12 q-pa-sm row" v-if="props.files">
<q-list
v-if="props.files.length > 0"
bordered