ปรับปฎิทิน

This commit is contained in:
setthawutttty 2023-12-07 15:14:58 +07:00
parent bc6c78c0a6
commit 8500d25a5a
5 changed files with 374 additions and 343 deletions

View file

@ -18,6 +18,7 @@ import type {
responseType,
directorType,
} from "@/modules/11_discipline/interface/index/Main";
import type { FormDataList } from "@/modules/11_discipline/interface/request/investigate";
import type { DataOptionRes } from "@/modules/11_discipline/interface/response/Main";
/** import components*/
@ -89,6 +90,7 @@ const formData = reactive<FormData>({
disciplinaryStatusResult: "",
disciplinaryCauseText: "",
disciplinaryResult: "",
disciplinaryExtendHistory: [],
});
const disciplineDisciplinary_DocRelevants = ref<FileLists[]>([]); // api
const disciplineDisciplinary_DocSummaryEvidences = ref<FileLists[]>([]);
@ -188,6 +190,7 @@ function validateForm() {
if (hasError.every((result) => result === true)) {
onSubmit();
isSave.value = false;
formData.extendStatus = false;
}
}
@ -195,13 +198,12 @@ function validateForm() {
* งชนคำนวณเวลาวนทนสดจาก นทนสดการสอบสวน
* @param val จำนวนวนทองการขยาย
*/
function calEndDate(val: string) {
const date = new Date(props.data.disciplinaryDateEnd);
const dateNew = new Date();
formData.disciplinaryDateEnd = new Date(
dateNew.setDate(date.getDate() + Number(val))
);
async function calEndDate(val: string) {
changeFormData();
const date = await new Date(props.data.disciplinaryDateEnd);
formData.disciplinaryDateEnd = await new Date(
date.setDate(date.getDate() + Number(val))
);
}
/**
@ -279,6 +281,7 @@ async function fetchDatadetail() {
formData.disciplinaryStatusResult = props.data.disciplinaryStatusResult;
formData.disciplinaryCauseText = props.data.disciplinaryCauseText;
formData.disciplinaryResult = props.data.disciplinaryResult;
formData.disciplinaryExtendHistory = props.data.disciplinaryExtendHistory;
mainStore.rowsAdd = props.data.persons;
@ -439,6 +442,11 @@ function calendarOpen() {
calendarModal.value = true;
}
function resetExtend() {
formData.disciplinaryDateEnd = props.data.disciplinaryDateEnd;
formData.daysExtend = 0;
}
/** Hook */
onMounted(async () => {
mainStore.rowsAdd = [];
@ -778,23 +786,21 @@ onMounted(async () => {
</template>
</datepicker>
</div>
<div class="row col-12">
<q-card
bordered
class="col-12"
style="border: 1px solid #d6dee1"
<q-card
bordered
class="col-12"
style="border: 1px solid #d6dee1"
>
<div
class="row col-xs-12 col-sm-12 text-weight-medium bg-grey-1 q-py-sm q-px-md"
>
<div
class="row col-xs-12 col-sm-12 text-weight-medium bg-grey-1 q-py-sm q-px-md"
>
นทสอบสวน
<div>
นทบสวน
<q-checkbox
v-if="
formData.disciplinaryDateStart != null &&
formData.disciplinaryDateEnd != null &&
((isReadonly && formData.extendStatus) || !isReadonly)
formData.disciplinaryExtendHistory.length > 0 &&
!isReadonly
"
:disable="isReadonly"
for="#extendStatus"
@ -805,88 +811,36 @@ onMounted(async () => {
dense
class="text-weight-medium q-ml-sm"
keep-color
@update:model-value="changeFormData()"
@update:model-value="
changeFormData();
resetExtend();
"
/>
<q-space style="height: 1px" />
<div>
<q-btn
name="calendar"
round
size="12px"
flat
dense
icon="mdi-calendar-month"
class="self-center items-center"
color="primary"
@click="calendarOpen"
>
<q-tooltip>ปฏ</q-tooltip>
</q-btn>
</div>
</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.extendStatus">
<datepicker
menu-class-name="modalfix"
:readonly="isReadonly"
v-model="formData.disciplinaryDateStart"
: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"
:readonly="isReadonly"
outlined
:input-style="
isReadonly
? { color: 'black' }
: { color: 'teal' }
"
dense
lazy-rules
borderless
hide-bottom-space
:model-value="
formData.disciplinaryDateStart
? date2Thai(formData.disciplinaryDateStart)
: 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" v-if="formData.extendStatus">
<q-select
<q-space style="height: 1px" />
<div>
<q-btn
name="calendar"
round
size="12px"
flat
dense
icon="mdi-calendar-month"
class="self-center items-center"
color="primary"
@click="calendarOpen"
>
<q-tooltip>ปฏ</q-tooltip>
</q-btn>
</div>
</div>
<div class="col-12"><q-separator /></div>
<div class="q-pa-sm">
<div class="q-col-gutter-sm row col-12">
<div class="col-12">
<div class="row q-col-gutter-sm">
<div v-if="formData.extendStatus" class="col-3">
<q-select
:readonly="isReadonly"
for="#daysExtend"
outlined
@ -917,69 +871,173 @@ onMounted(async () => {
</q-item>
</template>
</q-select>
</div>
</div>
<div class="col-3">
<datepicker
menu-class-name="modalfix"
v-model="formData.disciplinaryDateEnd"
: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"
ref="dateEndRef"
class="full-width cursor-pointer"
:readonly="isReadonly"
outlined
dense
lazy-rules
:input-style="
isReadonly
? { color: 'black' }
: { color: 'teal' }
"
hide-bottom-space
borderless
:model-value="
formData.disciplinaryDateEnd
? date2Thai(formData.disciplinaryDateEnd)
: 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 v-if="!formData.extendStatus" class="col-3">
<datepicker
menu-class-name="modalfix"
:readonly="
isReadonly ||
formData.disciplinaryExtendHistory.length > 0
"
v-model="formData.disciplinaryDateStart"
: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.disciplinaryExtendHistory.length >
0
? { color: 'black' }
: { color: 'teal' }
"
:readonly="
isReadonly ||
formData.disciplinaryExtendHistory.length >
0
"
outlined
dense
lazy-rules
borderless
hide-bottom-space
:model-value="
formData.disciplinaryDateStart
? date2Thai(
formData.disciplinaryDateStart
)
: 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.disciplinaryDateEnd"
:readonly="
isReadonly ||
formData.disciplinaryExtendHistory.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.disciplinaryExtendHistory.length >
0
? { color: 'black' }
: { color: 'teal' }
"
ref="dateEndRef"
class="full-width cursor-pointer"
:readonly="
isReadonly ||
formData.disciplinaryExtendHistory.length >
0
"
outlined
dense
lazy-rules
hide-bottom-space
borderless
:model-value="
formData.disciplinaryDateEnd
? date2Thai(formData.disciplinaryDateEnd)
: 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
v-if="
formData.disciplinaryExtendHistory !== null &&
formData.disciplinaryExtendHistory.length > 1
"
class="col-12 fixed-height-history"
>
<q-list bordered separator>
<q-item
v-for="(
e, key
) in formData.disciplinaryExtendHistory.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>
</q-card>
</div>
</div>
</q-card>
</div>
<datepicker
:readonly="isReadonly"
@ -1506,5 +1564,12 @@ onMounted(async () => {
@returnDirector="returnDirector"
/>
<CalandarDialog :modal="calendarModal" :close="calendarModalclose" />
<CalandarDialog :modal="calendarModal" :close="calendarModalclose" :lists="formData.disciplinaryExtendHistory"/>
</template>
<style scoped>
.fixed-height-history {
overflow-y: auto;
max-height: 150px;
}
</style>