api รายการสืบสวนข้อเท็จจริง
This commit is contained in:
parent
691a989c16
commit
3c5fcc029b
14 changed files with 1025 additions and 383 deletions
|
|
@ -8,63 +8,101 @@ import { useInvestigateFactStore } from "@/modules/11_discipline/store/Investiga
|
|||
import { useQuasar } from "quasar";
|
||||
import Popup from "@/modules/11_discipline/components/1_Complaint/Popup.vue";
|
||||
import type { FormData } from "@/modules/11_discipline/interface/request/investigateFact";
|
||||
import config from "@/app.config";
|
||||
import http from "@/plugins/http";
|
||||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const store = useInvestigateFactStore();
|
||||
const { dialogConfirm } = mixin;
|
||||
const { dialogConfirm, showLoader, success, hideLoader, messageError } = mixin;
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const id = ref<string>(route.params.id as string);
|
||||
|
||||
/** ข้อมูล v-model ของฟอร์ม */
|
||||
const data = reactive<FormData>({
|
||||
id: "",
|
||||
idComplaint: "",
|
||||
investigationDetail: "",
|
||||
complaint: "",
|
||||
complaintdetail: "",
|
||||
detail: "",
|
||||
investigationDescription: "",
|
||||
fault: "",
|
||||
other: "",
|
||||
investigationDetailOther: "",
|
||||
evidenceFiles: null,
|
||||
fileComplaint: null,
|
||||
clickTime: false,
|
||||
date: null,
|
||||
dateEnd: new Date(),
|
||||
investigation: "",
|
||||
investigationDateStart: null,
|
||||
investigationDateEnd: null,
|
||||
daysExtend: null,
|
||||
statusResult: "",
|
||||
causeText: "",
|
||||
investigationStatusResult: "",
|
||||
investigationCauseText: "",
|
||||
complaintStatus: "",
|
||||
reason: "",
|
||||
result: "",
|
||||
directors: [],
|
||||
disciplineInvestigateDocs: [],
|
||||
disciplineInvestigateRelevantDocs: [],
|
||||
status: "",
|
||||
documentFile: null,
|
||||
respondentType: "",
|
||||
organizationId: "",
|
||||
persons:[]
|
||||
});
|
||||
|
||||
/** จำลองข้อมูลจาก api */
|
||||
const fetchData = async () => {
|
||||
// ดึงค่าจาก api
|
||||
data.complaint = "เรื่องที่ 1";
|
||||
data.complaintdetail = "รายละเอียด";
|
||||
data.detail = "รายละเอียด";
|
||||
data.fault = "001";
|
||||
data.other = "";
|
||||
data.evidenceFiles = null;
|
||||
data.fileComplaint = null;
|
||||
data.clickTime = false;
|
||||
data.date = new Date("2023-11-07T14:58:00");
|
||||
data.dateEnd = new Date("2023-11-08T14:58:00");
|
||||
data.investigation = "appoint_directors";
|
||||
data.daysExtend = null;
|
||||
data.statusResult = "not_specified";
|
||||
data.causeText = "";
|
||||
data.complaintStatus = "NEW";
|
||||
};
|
||||
function getData() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.investigateById(id.value))
|
||||
.then((res) => {
|
||||
console.log(res.data.result);
|
||||
const dataList = res.data.result;
|
||||
data.id = dataList.id;
|
||||
data.idComplaint = dataList.idComplaint;
|
||||
data.respondentType = dataList.respondentType
|
||||
data.persons = dataList.persons
|
||||
data.investigationDetail = dataList.investigationDetail;
|
||||
data.investigationDetailOther = dataList.investigationDetailOther;
|
||||
data.investigationDateStart = dataList.investigationDateStart;
|
||||
data.investigationDateEnd = dataList.investigationDateEnd;
|
||||
data.investigationDescription = dataList.investigationDescription;
|
||||
data.investigationCauseText = dataList.investigationCauseText;
|
||||
data.status = dataList.status;
|
||||
data.result = dataList.result;
|
||||
data.directors = dataList.director;
|
||||
data.disciplineInvestigateDocs = dataList.disciplineInvestigateDocs;
|
||||
data.disciplineInvestigateRelevantDocs =
|
||||
dataList.disciplineInvestigateRelevantDocs;
|
||||
data.investigationStatusResult = dataList.investigationStatusResult;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* บันทึกข้อมูลที่เเก้ไข
|
||||
* @param id ระบุ บุคคล
|
||||
*/
|
||||
async function onSubmit(id: string) {
|
||||
async function onSubmit(data: any) {
|
||||
// put
|
||||
console.log("edit", id);
|
||||
router.push(`/discipline/investigatefacts`);
|
||||
console.log("edit", data);
|
||||
showLoader();
|
||||
http
|
||||
.put(config.API.investigateById(id.value), data)
|
||||
.then((res) => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
// router.push(`/discipline/complaints`);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
});
|
||||
// router.push(`/discipline/investigatefacts`);
|
||||
}
|
||||
|
||||
const modalPopup = ref<boolean>(false);
|
||||
|
|
@ -110,17 +148,40 @@ function confirmSentInvestigate() {
|
|||
|
||||
/** ฟังชั่น ยุติเรื่อง*/
|
||||
function confirmEndInvestigate() {
|
||||
console.log("sent");
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.investigateReject(id.value))
|
||||
.then((res) => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
await getData();
|
||||
});
|
||||
}
|
||||
|
||||
/** ฟังชั่น ยกเลิกการยุติเรื่อง*/
|
||||
function confirmCancelInvestigate() {
|
||||
console.log("sent");
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.investigateResume(id.value))
|
||||
.then((res) => {
|
||||
getData();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/** โหลดข้อมูลเมื่อเข้าหน้านี้ */
|
||||
onMounted(() => {
|
||||
fetchData();
|
||||
getData();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
@ -137,24 +198,24 @@ onMounted(() => {
|
|||
class="q-mr-sm"
|
||||
@click="$router.push(`/discipline/investigatefacts`)"
|
||||
/>
|
||||
<div class="q-ma-none">แก้ไขรายการสืบสวนข้อเท็จจริง {{ id }}#id</div>
|
||||
<div class="q-ma-none">แก้ไขรายการสืบสวนข้อเท็จจริง</div>
|
||||
<q-space />
|
||||
<div class="q-gutter-x-sm">
|
||||
<q-btn
|
||||
v-if="data.complaintStatus === 'NEW'"
|
||||
v-if="data.status === 'NEW'"
|
||||
label="ส่งไปสอบสวน"
|
||||
color="public"
|
||||
@click="sentInvestigate"
|
||||
/>
|
||||
|
||||
<q-btn
|
||||
v-if="data.complaintStatus === 'NEW'"
|
||||
v-if="data.status === 'NEW'"
|
||||
label="ยุติเรื่อง"
|
||||
color="red-7"
|
||||
@click="endInvestigate"
|
||||
/>
|
||||
<q-btn
|
||||
v-if="data.complaintStatus === 'STOP'"
|
||||
v-if="data.status === 'STOP'"
|
||||
label="ยกเลิกการยุติเรื่อง"
|
||||
color="red-7"
|
||||
@click="cancelInvestigate"
|
||||
|
|
@ -181,12 +242,16 @@ onMounted(() => {
|
|||
<FormComplaints :on-submit="onSubmit" />
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="investigatefacts">
|
||||
<FormInvestigatefacts :on-submit="onSubmit" :data="data" />
|
||||
<FormInvestigatefacts
|
||||
:on-submit="onSubmit"
|
||||
:data="data"
|
||||
:get-data="getData"
|
||||
/>
|
||||
</q-tab-panel>
|
||||
</q-tab-panels>
|
||||
</q-card>
|
||||
|
||||
<Popup :modal="modalPopup" :close="closePopup" title="ส่งไปสอบสวน"/>
|
||||
<Popup :modal="modalPopup" :close="closePopup" title="ส่งไปสอบสวน" />
|
||||
</div>
|
||||
</template>
|
||||
<style scoped>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue