hrms-mgt/src/modules/11_discipline/components/2_InvestigateFacts/investigatefactsAdd.vue

358 lines
14 KiB
Vue
Raw Normal View History

<script setup lang="ts">
import router from "@/router";
import { onMounted, ref } from "vue";
import { useCounterMixin } from "@/stores/mixin";
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 evidenceFiles = ref<any>(null);
const fileComplaint = ref<any>(null);
const clickTime = ref<boolean>(false);
const date = ref<Date | null>(null);
const dateEnd = ref<Date | null>(null);
const investigation = ref<string>("");
const faultOps = ref<any>([
{ id: "000-000", value: "test1" },
{ id: "000-001", value: "test2" },
]);
const faultOp = ref<any>();
const investigationOps = ref<any>([
{ id: "000-000", value: "test1" },
{ id: "000-001", value: "test2" },
]);
const daysExtend = ref<string>("");
const daysExtendOp = ref<any>();
const daysExtendOps = ref<any>([
{ id: "000-000", value: "test1" },
{ id: "000-001", value: "test2" },
]);
const investigationOp = ref<any>();
function filterFnOptionsType(val: string, update: any, type: string) {
update(() => {
const needle = val.toLowerCase();
if (type === "faultOp") {
faultOp.value = faultOps.value.filter(
(v: any) => v.value.toLowerCase().indexOf(needle) > -1
);
} else if (type === "investigationOp") {
investigationOp.value = investigationOps.value.filter(
(v: any) => v.value.toLowerCase().indexOf(needle) > -1
);
} else if (type === "daysExtendOp") {
daysExtendOp.value = daysExtendOps.value.filter(
(v: any) => v.value.toLowerCase().indexOf(needle) > -1
);
}
});
}
</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="col-4 q-my-md q-mr-xs">
<q-select
outlined
dense
v-model="fault"
:options="faultOp"
label="ลักษณะความผิด"
emit-value
map-options
option-label="value"
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-ml-xs">
<q-select
outlined
dense
v-model="investigation"
:options="investigationOp"
label="ลักษณะการสืบสวน"
emit-value
map-options
option-label="value"
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 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 !== null ? 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 !== null ? 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="daysExtendOp"
label="จำนวนวันที่ต้องการขยาย"
emit-value
map-options
:rules="[
(val) => !!val || `${'กรุณาเลือกจำนวนวันที่ต้องการขยาย'}`,
]"
option-label="value"
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>