2023-11-06 17:50:19 +07:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { onMounted, reactive, ref } from "vue";
|
|
|
|
|
import Form from "@/modules/11_discipline/components/1_Complaint/Form.vue";
|
|
|
|
|
import { useRouter, useRoute } from "vue-router";
|
2023-11-10 13:12:34 +07:00
|
|
|
import type { FormData } from "@/modules/11_discipline/interface/request/complaint";
|
2023-11-06 17:50:19 +07:00
|
|
|
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
const id = ref<string>(route.params.id as string);
|
|
|
|
|
|
2023-11-10 13:12:34 +07:00
|
|
|
/** ข้อมูล v-model ของฟอร์ม */
|
2023-11-06 17:50:19 +07:00
|
|
|
const data = reactive<FormData>({
|
|
|
|
|
complainantType: "",
|
|
|
|
|
complainant: "",
|
|
|
|
|
office: "",
|
|
|
|
|
agency: "",
|
|
|
|
|
topicComplaint: "",
|
|
|
|
|
detail: "",
|
|
|
|
|
datereceive: null,
|
|
|
|
|
dateconsideration: null,
|
|
|
|
|
offenseDescription: "",
|
|
|
|
|
considerationLevel: "",
|
|
|
|
|
datewarn: null,
|
|
|
|
|
receivecomplaints: "",
|
|
|
|
|
petitioner: "",
|
|
|
|
|
files: null,
|
|
|
|
|
});
|
2023-11-10 13:12:34 +07:00
|
|
|
|
|
|
|
|
/** ดึงค่าจาก api */
|
2023-11-06 17:50:19 +07:00
|
|
|
const fetchData = async () => {
|
|
|
|
|
data.complainantType = "2"
|
|
|
|
|
data.complainant = "1"
|
|
|
|
|
data.office = "0"
|
|
|
|
|
data.agency = "2"
|
|
|
|
|
data.topicComplaint = "test"
|
|
|
|
|
data.detail = "test"
|
|
|
|
|
data.datereceive = new Date("2023-11-07T14:58:00")
|
|
|
|
|
data.dateconsideration = new Date("2023-11-07T14:58:00")
|
|
|
|
|
data.offenseDescription = "0"
|
|
|
|
|
data.considerationLevel = "0"
|
|
|
|
|
data.datewarn = new Date("2023-11-07T14:58:00")
|
|
|
|
|
data.receivecomplaints = "0"
|
|
|
|
|
data.petitioner = "test"
|
|
|
|
|
data.files = ""
|
|
|
|
|
};
|
|
|
|
|
|
2023-11-10 13:12:34 +07:00
|
|
|
/** ฟังชั่น แก้ไข */
|
|
|
|
|
async function onSubmit() {
|
2023-11-06 17:50:19 +07:00
|
|
|
console.log("edit");
|
|
|
|
|
router.push(`/discipline/complaints`);
|
|
|
|
|
};
|
2023-11-10 13:12:34 +07:00
|
|
|
|
|
|
|
|
/** เรียกใช้งาน ฟังชั่น ตอนเริ่มโหลดหน้า */
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
fetchData();
|
|
|
|
|
});
|
2023-11-06 17:50:19 +07:00
|
|
|
</script>
|
|
|
|
|
<template>
|
|
|
|
|
<div class="col-xs-12 col-sm-12 col-md-11">
|
|
|
|
|
<div class="toptitle col-12 row items-center">
|
|
|
|
|
<q-btn
|
|
|
|
|
icon="mdi-arrow-left"
|
|
|
|
|
unelevated
|
|
|
|
|
round
|
|
|
|
|
dense
|
|
|
|
|
flat
|
|
|
|
|
color="primary"
|
|
|
|
|
class="q-mr-sm"
|
|
|
|
|
@click="$router.push(`/discipline/complaints`)"
|
|
|
|
|
/>
|
|
|
|
|
แก้ไขเรื่องร้องเรียน {{ id }}#id
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<Form :on-submit="onSubmit" :data="data" />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|