ปรับวันที่สืบสวน
This commit is contained in:
parent
c50e00968c
commit
fabc55134c
6 changed files with 348 additions and 323 deletions
|
|
@ -64,6 +64,7 @@ const daysExtendRef = ref<Object | null>(null);
|
|||
const investigationStatusResultRef = ref<Object | null>(null);
|
||||
const investigationCauseTextRef = ref<Object | null>(null);
|
||||
const resultRef = ref<Object | null>(null);
|
||||
const investigationExtendStatus = ref<boolean>(false);
|
||||
|
||||
const isSave = ref<boolean>(false); // มีการแก้ไขรอบันทึก
|
||||
const isReadonly = ref<boolean>(false); // อ่านได้อย่างเดียว
|
||||
|
|
@ -114,6 +115,7 @@ const formData = reactive<FormData>({
|
|||
respondentType: "",
|
||||
organizationId: "",
|
||||
persons: [],
|
||||
investigationExtendHistory: [],
|
||||
});
|
||||
|
||||
/** maping ref เข้าตัวแปรเพื่อเตรียมตรวจสอบ */
|
||||
|
|
@ -142,7 +144,7 @@ const initialPagination = ref<any>({
|
|||
});
|
||||
|
||||
const calendarModal = ref<boolean>(false);
|
||||
const calendarModalclose = () =>(calendarModal.value = !calendarModal.value)
|
||||
const calendarModalclose = () => (calendarModal.value = !calendarModal.value);
|
||||
|
||||
/*** ฟังก์ชั่นสำหรับ validate ฟอร์ม */
|
||||
function validateForm() {
|
||||
|
|
@ -161,7 +163,7 @@ function validateForm() {
|
|||
onSubmit();
|
||||
} else {
|
||||
console.log("ไม่ผ่าน ");
|
||||
console.log(hasError);
|
||||
// console.log(hasError);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -179,6 +181,7 @@ function onSubmit() {
|
|||
}
|
||||
props.onSubmit(formData);
|
||||
isSave.value = false;
|
||||
investigationExtendStatus.value = false;
|
||||
},
|
||||
"ยืนยันการบันทึกข้อมูล",
|
||||
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
|
||||
|
|
@ -189,15 +192,19 @@ function onSubmit() {
|
|||
* ฟังชั้นคำนวณเวลาวันที่สิ้นสุดจาก วันที่สิ้นสุดการสืบสวน
|
||||
* @param val จำนวนวันที่ต้องการขยาย
|
||||
*/
|
||||
function calEndDate(val: string) {
|
||||
async function calEndDate(val: string) {
|
||||
changeFormData();
|
||||
const date = new Date(props.data.investigationDateEnd);
|
||||
const dateNew = new Date();
|
||||
formData.investigationDateEnd = new Date(
|
||||
dateNew.setDate(date.getDate() + Number(val))
|
||||
const date = await new Date(props.data.investigationDateEnd);
|
||||
formData.investigationDateEnd = await new Date(
|
||||
date.setDate(date.getDate() + Number(val))
|
||||
);
|
||||
}
|
||||
|
||||
function resetExtend() {
|
||||
formData.investigationDateEnd = props.data.investigationDateEnd;
|
||||
formData.investigationDaysExtend = 0;
|
||||
}
|
||||
|
||||
const modal = ref<boolean>(false);
|
||||
const filterKeyword2 = ref<string>("");
|
||||
const type = ref<string>("");
|
||||
|
|
@ -243,6 +250,7 @@ watch(props.data, async () => {
|
|||
formData.disciplineInvestigateRelevantDocs =
|
||||
props.data.disciplineInvestigateRelevantDocs;
|
||||
formData.status = props.data.status;
|
||||
formData.investigationExtendHistory = props.data.investigationExtendHistory;
|
||||
|
||||
mainStore.rowsAdd = props.data.persons;
|
||||
|
||||
|
|
@ -730,27 +738,27 @@ onMounted(async () => {
|
|||
>
|
||||
<div>
|
||||
วันที่สืบสวน
|
||||
|
||||
<q-checkbox
|
||||
v-if="
|
||||
formData.investigationDateStart != null &&
|
||||
formData.investigationDateEnd != null &&
|
||||
((isReadonly && formData.investigationExtendStatus) ||
|
||||
!isReadonly)
|
||||
props.data.investigationExtendHistory.length > 0 &&
|
||||
!isReadonly
|
||||
"
|
||||
:disable="isReadonly"
|
||||
for="#extendStatus"
|
||||
size="md"
|
||||
v-model="formData.investigationExtendStatus"
|
||||
v-model="investigationExtendStatus"
|
||||
label="ขยายเวลา"
|
||||
color="primary"
|
||||
dense
|
||||
class="text-weight-medium q-ml-sm"
|
||||
keep-color
|
||||
@update:model-value="changeFormData()"
|
||||
@update:model-value="
|
||||
changeFormData();
|
||||
resetExtend();
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
<q-space style="height: 1px;"/>
|
||||
<q-space style="height: 1px" />
|
||||
<div>
|
||||
<q-btn
|
||||
name="calendar"
|
||||
|
|
@ -769,157 +777,204 @@ onMounted(async () => {
|
|||
</div>
|
||||
<div class="col-12"><q-separator /></div>
|
||||
<div class="q-pa-sm">
|
||||
<div class="q-col-gutter-sm row">
|
||||
<div
|
||||
class="col-3"
|
||||
v-if="!formData.investigationExtendStatus"
|
||||
>
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
:readonly="isReadonly"
|
||||
v-model="formData.investigationDateStart"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
@update:model-value="changeFormData()"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
for="#date"
|
||||
class="full-width cursor-pointer"
|
||||
ref="dateRef"
|
||||
:input-style="
|
||||
isReadonly
|
||||
? { color: 'black' }
|
||||
: { color: 'teal' }
|
||||
"
|
||||
<div class="q-col-gutter-sm row col-12">
|
||||
<div class="col-12">
|
||||
<div class="row q-col-gutter-sm">
|
||||
<div v-if="investigationExtendStatus" class="col-3">
|
||||
<q-select
|
||||
:readonly="isReadonly"
|
||||
for="#daysExtend"
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
borderless
|
||||
ref="daysExtendRef"
|
||||
v-model="formData.investigationDaysExtend"
|
||||
:options="investigateFactStore.daysExtendOp"
|
||||
label="จำนวนวันที่ต้องการขยาย"
|
||||
emit-value
|
||||
hide-bottom-space
|
||||
:model-value="
|
||||
formData.investigationDateStart
|
||||
? date2Thai(formData.investigationDateStart)
|
||||
: null
|
||||
"
|
||||
map-options
|
||||
:rules="[
|
||||
(val) =>
|
||||
!!val ||
|
||||
`${'กรุณาเลือกวันที่เริ่มการสืบสวน'}`,
|
||||
formData.investigationExtendStatus
|
||||
? !!val ||
|
||||
'กรุณาเลือกจำนวนวันที่ต้องการขยาย'
|
||||
: true,
|
||||
]"
|
||||
:label="`${'วันที่เริ่มการสืบสวน'}`"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
>
|
||||
</q-icon>
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
use-input
|
||||
@update:model-value="calEndDate"
|
||||
><template v-slot:no-option>
|
||||
<q-item>
|
||||
<q-item-section class="text-grey">
|
||||
ไม่มีข้อมูล
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</q-select>
|
||||
</div>
|
||||
|
||||
<div v-if="!investigationExtendStatus" class="col-3">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
:readonly="
|
||||
isReadonly ||
|
||||
formData.investigationExtendHistory.length > 0
|
||||
"
|
||||
v-model="formData.investigationDateStart"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
@update:model-value="changeFormData()"
|
||||
>
|
||||
<template #year="{ year }">{{
|
||||
year + 543
|
||||
}}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
for="#date"
|
||||
class="full-width cursor-pointer"
|
||||
ref="dateRef"
|
||||
:input-style="
|
||||
isReadonly ||
|
||||
formData.investigationExtendHistory.length >
|
||||
0
|
||||
? { color: 'black' }
|
||||
: { color: 'teal' }
|
||||
"
|
||||
:readonly="
|
||||
isReadonly ||
|
||||
formData.investigationExtendHistory.length >
|
||||
0
|
||||
"
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
borderless
|
||||
hide-bottom-space
|
||||
:model-value="
|
||||
formData.investigationDateStart
|
||||
? date2Thai(
|
||||
formData.investigationDateStart
|
||||
)
|
||||
: 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="col-3">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="formData.investigationDateEnd"
|
||||
:readonly="
|
||||
isReadonly ||
|
||||
formData.investigationExtendHistory.length > 0
|
||||
"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
@update:model-value="changeFormData()"
|
||||
>
|
||||
<template #year="{ year }">{{
|
||||
year + 543
|
||||
}}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
for="#dateEnd"
|
||||
:input-style="
|
||||
isReadonly ||
|
||||
formData.investigationExtendHistory.length >
|
||||
0
|
||||
? { color: 'black' }
|
||||
: { color: 'teal' }
|
||||
"
|
||||
ref="dateEndRef"
|
||||
class="full-width cursor-pointer"
|
||||
:readonly="
|
||||
isReadonly ||
|
||||
formData.investigationExtendHistory.length >
|
||||
0
|
||||
"
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
borderless
|
||||
:model-value="
|
||||
formData.investigationDateEnd
|
||||
? date2Thai(formData.investigationDateEnd)
|
||||
: 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>
|
||||
|
||||
<!-- วันที่สืบสวน (List Log) -->
|
||||
<div
|
||||
class="col-3"
|
||||
v-if="formData.investigationExtendStatus"
|
||||
v-if="
|
||||
formData.investigationExtendHistory !== null &&
|
||||
formData.investigationExtendHistory.length > 1
|
||||
"
|
||||
class="col-12 fixed-height-history"
|
||||
>
|
||||
<q-select
|
||||
:readonly="isReadonly"
|
||||
for="#daysExtend"
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
ref="daysExtendRef"
|
||||
v-model="formData.investigationDaysExtend"
|
||||
:options="investigateFactStore.daysExtendOp"
|
||||
label="จำนวนวันที่ต้องการขยาย"
|
||||
emit-value
|
||||
hide-bottom-space
|
||||
map-options
|
||||
:rules="[
|
||||
(val) =>
|
||||
formData.investigationExtendStatus
|
||||
? !!val || 'กรุณาเลือกจำนวนวันที่ต้องการขยาย'
|
||||
: true,
|
||||
]"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
use-input
|
||||
@update:model-value="calEndDate"
|
||||
><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-3">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="formData.investigationDateEnd"
|
||||
:readonly="isReadonly"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
@update:model-value="changeFormData()"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
for="#dateEnd"
|
||||
:input-style="
|
||||
isReadonly
|
||||
? { color: 'black' }
|
||||
: { color: 'teal' }
|
||||
"
|
||||
ref="dateEndRef"
|
||||
class="full-width cursor-pointer"
|
||||
:readonly="isReadonly"
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
borderless
|
||||
:model-value="
|
||||
formData.investigationDateEnd
|
||||
? date2Thai(formData.investigationDateEnd)
|
||||
: 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>
|
||||
<q-list bordered separator>
|
||||
<q-item
|
||||
v-for="(
|
||||
e, key
|
||||
) in formData.investigationExtendHistory.slice(1)"
|
||||
>
|
||||
<q-item-section :key="key">
|
||||
{{ e.name }} ({{ e.daysExtend }} วัน)
|
||||
<p class="q-mb-none">
|
||||
{{ date2Thai(e.dateStart) }} -
|
||||
{{ date2Thai(e.dateEnd) }}
|
||||
</p>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1367,9 +1422,10 @@ onMounted(async () => {
|
|||
@returnDirector="returnDirector"
|
||||
/>
|
||||
|
||||
<CalandarDialog
|
||||
:modal="calendarModal"
|
||||
:close="calendarModalclose"
|
||||
<CalandarDialog
|
||||
:modal="calendarModal"
|
||||
:close="calendarModalclose"
|
||||
:lists="props.data.investigationExtendHistory"
|
||||
/>
|
||||
</template>
|
||||
|
||||
|
|
@ -1377,5 +1433,8 @@ onMounted(async () => {
|
|||
.q-banner {
|
||||
min-height: 25px;
|
||||
}
|
||||
.fixed-height-history {
|
||||
overflow-y: auto;
|
||||
height: 150px;
|
||||
}
|
||||
</style>
|
||||
@/modules/11_discipline/store/store
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue