75 lines
1.9 KiB
Vue
75 lines
1.9 KiB
Vue
|
|
<script setup lang="ts">
|
||
|
|
import { onMounted, reactive, ref } from "vue";
|
||
|
|
import Form from "@/modules/11_discipline/components/1_Complaint/Form.vue";
|
||
|
|
import type { FormData } from "@/modules/11_discipline/interface/request/complaint";
|
||
|
|
import { useRouter, useRoute } from "vue-router";
|
||
|
|
|
||
|
|
const router = useRouter();
|
||
|
|
const route = useRoute();
|
||
|
|
const id = ref<string>(route.params.id as string);
|
||
|
|
onMounted(() => {
|
||
|
|
fetchData();
|
||
|
|
});
|
||
|
|
|
||
|
|
// get ข้อมูลเก่ากรณีแก้ไขข้อมูล
|
||
|
|
const data = reactive<FormData>({
|
||
|
|
complainantType: "",
|
||
|
|
complainant: "",
|
||
|
|
office: "",
|
||
|
|
agency: "",
|
||
|
|
topicComplaint: "",
|
||
|
|
detail: "",
|
||
|
|
datereceive: null,
|
||
|
|
dateconsideration: null,
|
||
|
|
offenseDescription: "",
|
||
|
|
considerationLevel: "",
|
||
|
|
datewarn: null,
|
||
|
|
receivecomplaints: "",
|
||
|
|
petitioner: "",
|
||
|
|
files: null,
|
||
|
|
});
|
||
|
|
const fetchData = async () => {
|
||
|
|
// ดึงค่าจาก api
|
||
|
|
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 = ""
|
||
|
|
};
|
||
|
|
|
||
|
|
// แก้ไขข้อมูล
|
||
|
|
const onSubmit = async () => {
|
||
|
|
// put
|
||
|
|
console.log("edit");
|
||
|
|
router.push(`/discipline/complaints`);
|
||
|
|
};
|
||
|
|
</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>
|