UI - สืบสวนข้อเท็จจริง เพิ่ม type ให้ any เเล้ว ย้าย option ไป store

This commit is contained in:
setthawutttty 2023-10-18 11:46:28 +07:00
parent 074fc05412
commit 91fc7f7520
5 changed files with 111 additions and 144 deletions

View file

@ -0,0 +1,345 @@
<script setup lang="ts">
import router from "@/router";
import { onMounted, ref, watch } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import { useInvestigateFactStore } from "@/modules/11_discipline/stroes/InvestigateFactStore";
const investigateFactStore = useInvestigateFactStore();
const { filterFnOptionsType } = investigateFactStore;
const mixin = useCounterMixin();
const {
messageError,
showLoader,
hideLoader,
date2Thai,
dialogConfirm,
success,
} = mixin;
const complaint = ref<string>("");
const complaintdetail = ref<string>("");
const detail = ref<string>("");
const fault = ref<string>("");
const results = ref<string>("");
const other = ref<string>("");
const evidenceFiles = ref<File | null>(null);
const fileComplaint = ref<File | null>(null);
const clickTime = ref<boolean>(false);
const date = ref<Date>();
const dateEnd = ref<Date>();
const investigation = ref<string>("");
const daysExtend = ref<string>("");
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">
<q-btn
icon="mdi-arrow-left"
unelevated
round
dense
flat
color="primary"
class="q-mr-sm"
@click="router.go(-1)"
/>
เพมรายการสบสวนขอเทจจร
</div>
<q-card flat bordered class="col-12 q-mt-sm">
<div class="q-pa-md">
<q-form ref="myForm">
<div class="row col-12">
<div class="col-12 row bg-white q-col-gutter-md">
<div class="col-xs-12 row items-center">
<div class="col-12">
<q-input
class="full-width inputgreen cursor-pointer"
outlined
dense
lazy-rules
borderless
v-model="complaint"
:rules="[(val) => !!val || `${'กรุณากรอกเรื่องร้องเรียน'}`]"
hide-bottom-space
:label="`${'เรื่องร้องเรียน'}`"
type="textarea"
/>
</div>
<div class="row no-wrap col-12">
<div class="col-4 q-my-md q-mr-xs">
<q-select
outlined
dense
v-model="fault"
:options="investigateFactStore.faultOp"
label="ลักษณะความผิด"
emit-value
map-options
option-label="name"
option-value="id"
use-input
@filter="(inputValue: any,
doneFn: Function) => filterFnOptionsType(inputValue, doneFn, 'faultOp'
)"
><template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</q-select>
</div>
<div class="col-4 q-my-md q-mr-xs">
<q-select
outlined
dense
v-model="investigation"
:options="investigateFactStore.investigationOp"
label="ลักษณะการสืบสวน"
emit-value
map-options
option-label="name"
option-value="id"
use-input
@filter="(inputValue: any,
doneFn: Function) => filterFnOptionsType(inputValue, doneFn, 'investigationOp'
)"
><template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</q-select>
</div>
</div>
<div v-if="investigation === '003'" class="col-12 q-mb-md">
<q-input
class="full-width inputgreen cursor-pointer"
outlined
dense
borderless
v-model="other"
hide-bottom-space
:label="`${'รายการอื่นๆ(โปรดระบุ)'}`"
type="textarea"
/>
</div>
<div class="row items-start col-12">
<p
class="text-weight-medium q-ma-none text-center align-top q-pt-sm"
>
นทบสวน
</p>
<q-checkbox
size="md"
v-model="clickTime"
label="ขยายเวลา"
color="primary"
class="text-weight-medium q-ml-sm"
keep-color
/>
<div v-if="clickTime !== true" class="self-start row">
<div class="q-mx-xs">
<datepicker
menu-class-name="modalfix"
v-model="date"
:locale="'th'"
autoApply
:enableTimePicker="false"
week-start="0"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
class="full-width inputgreen cursor-pointer"
outlined
dense
lazy-rules
borderless
:model-value="date ? date2Thai(date) : null"
:rules="[
(val) =>
!!val || `${'กรุณาเลือกวันที่เริ่มการสอบสวน'}`,
]"
:label="`${'วันที่เริ่มการสอบสวน'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
color="primary"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="q-mx-xs q-">
<datepicker
menu-class-name="modalfix"
v-model="dateEnd"
:locale="'th'"
autoApply
:enableTimePicker="false"
week-start="0"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
class="full-width inputgreen cursor-pointer"
outlined
dense
lazy-rules
borderless
:model-value="dateEnd ? date2Thai(dateEnd) : null"
:rules="[
(val) =>
!!val || `${'กรุณาเลือกวันที่สิ้นสุดการสอบสวน'}`,
]"
:label="`${'วันที่สิ้นสุดการสอบสวน'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
color="primary"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
</div>
<div v-else class="q-mx-xs">
<q-select
outlined
dense
lazy-rules
v-model="daysExtend"
:options="investigateFactStore.daysExtendOp"
label="จำนวนวันที่ต้องการขยาย"
emit-value
map-options
:rules="[
(val) =>
clickTime === true
? !!val || 'กรุณาเลือกจำนวนวันที่ต้องการขยาย'
: true,
]"
option-label="name"
option-value="id"
use-input
@filter="(inputValue: any,
doneFn: Function) => filterFnOptionsType(inputValue, doneFn, 'daysExtendOp'
)"
><template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</q-select>
</div>
</div>
<div class="col-12 q-my-xs">
<q-input
class="full-width inputgreen cursor-pointer"
outlined
dense
lazy-rules
borderless
v-model="complaintdetail"
:rules="[
(val) => !!val || `${'กรุณากรอกรายละเอียดเรื่องร้องเรียน'}`,
]"
hide-bottom-space
:label="`${'รายละเอียดเรื่องร้องเรียน'}`"
type="textarea"
/>
</div>
<div class="col-12 q-my-sm">
<q-file
outlined
dense
v-model="fileComplaint"
label="ไฟล์เอกสารหลักฐานเรื่องร้องเรียน"
lazy-rules
:rules="[(val) => val || 'กรุณาเลือกไฟล์หลักฐานการรับ']"
hide-bottom-space
>
<template v-slot:prepend>
<q-icon name="attach_file" color="primary" />
</template>
</q-file>
</div>
<div class="col-12 q-my-sm">
<q-input
class="full-width inputgreen cursor-pointer"
outlined
dense
lazy-rules
borderless
v-model="detail"
:rules="[(val) => !!val || `${'กรุณากรอกรายละเอียด'}`]"
hide-bottom-space
:label="`${'รายละเอียด'}`"
type="textarea"
/>
</div>
<div class="col-12 q-my-xs">
<q-file
outlined
dense
v-model="evidenceFiles"
label="ไฟล์หลักฐานการรับ"
lazy-rules
:rules="[(val) => val || 'กรุณาเลือกไฟล์หลักฐานการรับ']"
hide-bottom-space
>
<template v-slot:prepend>
<q-icon name="attach_file" color="primary" />
</template>
</q-file>
</div>
<div class="col-4 q-mr-sm">
<q-input
standout
dense
v-model="results"
outlined
debounce="300"
placeholder="ผลการสืบสวน"
>
</q-input>
</div>
<div class="col-4">
<q-btn label="ยืนยันผลการสืบสวน" color="public">
<q-tooltip>นยนผลการสบสวน</q-tooltip>
</q-btn>
</div>
</div>
</div>
</div>
</q-form>
</div>
<q-separator />
<div class="row col-12 q-pa-sm">
<q-space />
<q-btn flat round color="secondary" icon="mdi-content-save-outline"
><q-tooltip>บทกขอม</q-tooltip></q-btn
>
</div>
</q-card>
</template>