no message

This commit is contained in:
setthawutttty 2024-02-12 17:49:54 +07:00
parent c3c27e9f8c
commit 1d6e86c918
3 changed files with 90 additions and 11 deletions

View file

@ -68,11 +68,76 @@
<q-separator />
<q-card-section class="q-p-sm">
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="row col-12 q-gutter-md q-py-sm text-grey-7">
<q-radio
v-model="isDate"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="false"
label="ปี"
dense
:disable="!edit"
/>
<q-radio
v-model="isDate"
checked-icon="task_alt"
unchecked-icon="panorama_fish_eye"
val="true"
label="วัน/เดือน/ปี"
dense
:disable="!edit"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
v-if="isDate === 'false'"
menu-class-name="modalfix"
v-model="issueDate"
:locale="'th'"
autoApply
year-picker
:enableTimePicker="false"
:readonly="!edit"
@update:modelValue="clickEditRow"
week-start="0"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:borderless="!edit"
:model-value="issueDate + 543"
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่ได้รับ'}`]"
hide-bottom-space
:label="`${'วันที่ได้รับ'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
:style="
edit
? 'color: var(--q-primary)'
: 'color: var(--q-grey)'
"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
<datepicker
v-else
menu-class-name="modalfix"
:readonly="!edit"
v-model="issueDate"
v-model="issueDate2"
:locale="'th'"
autoApply
:enableTimePicker="false"
@ -90,7 +155,7 @@
dense
lazy-rules
:borderless="!edit"
:model-value="date2Thai(issueDate)"
:model-value="date2Thai(issueDate2)"
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่ได้รับ'}`]"
hide-bottom-space
:label="`${'วันที่ได้รับ'}`"
@ -296,6 +361,7 @@ const props = defineProps({
},
});
const isDate = ref<string | null>("true");
const $q = useQuasar();
const store = useProfileDataStore();
const { profileData, changeProfileColumns } = store;
@ -307,7 +373,8 @@ const route = useRoute();
const id = ref<string>("");
const issuer = ref<string>();
const detail = ref<string>();
const issueDate = ref<Date>(new Date());
const issueDate = ref<number>(new Date().getFullYear());
const issueDate2 = ref<Date>(new Date());
const refCommandNo = ref<string>();
const refCommandDate = ref<Date | null | string>(new Date());
const myForm = ref<any>(); //form data input
@ -506,7 +573,8 @@ const fetchData = async () => {
id: e.id,
issuer: e.issuer,
detail: e.detail,
issueDate: new Date(e.issueDate),
issueDate: new Date(e.issueDate).getFullYear(),
issueDate2: new Date(e.issueDate),
refCommandNo: e.refCommandNo == "" ? "-" : e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? "-" : new Date(e.refCommandDate),
@ -552,6 +620,7 @@ const getData = () => {
issuer.value = row.issuer;
detail.value = row.detail;
issueDate.value = row.issueDate;
issueDate2.value = row.issueDate2;
refCommandNo.value = row.refCommandNo;
refCommandDate.value = row.refCommandDate;
id.value = row.id;
@ -615,7 +684,10 @@ const saveData = async () => {
id: id.value,
issuer: issuer.value,
detail: detail.value,
issueDate: dateToISO(issueDate.value),
issueDate:
isDate.value == "true"
? dateToISO(issueDate2.value)
: new Date(`${issueDate.value}-01-01`),
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null
@ -645,7 +717,10 @@ const editData = async () => {
id: id.value,
issuer: issuer.value,
detail: detail.value,
issueDate: dateToISO(issueDate.value),
issueDate:
isDate.value == "true"
? dateToISO(issueDate2.value)
: new Date(`${issueDate.value}-01-01`),
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null
@ -732,7 +807,7 @@ const selectData = async (props: DataProps) => {
detail.value = props.row.detail;
issueDate.value = props.row.issueDate;
refCommandNo.value = props.row.refCommandNo;
refCommandDate.value = props.row.refCommandDate;
refCommandDate.value = props.row.refCommandDate == '-' ? null:props.row.refCommandDate;
id.value = props.row.id;
await checkRowPage();
};
@ -746,7 +821,8 @@ const addData = () => {
edit.value = true;
issuer.value = "";
detail.value = "";
issueDate.value = new Date();
issueDate.value = new Date().getFullYear();
issueDate2.value = new Date();
refCommandNo.value = "";
refCommandDate.value = null;
};
@ -802,7 +878,8 @@ const clickHistory = async (row: RequestItemsObject) => {
id: e.id,
issuer: e.issuer,
detail: e.detail,
issueDate: new Date(e.issueDate),
issueDate: new Date(e.issueDate).getFullYear(),
issueDate2: new Date(e.issueDate),
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),

View file

@ -8,7 +8,8 @@ interface RequestItemsObject {
id: string;
issuer: string;
detail: string;
issueDate: Date;
issueDate: number;
issueDate2: Date;
refCommandNo: string;
refCommandDate: Date | null | string;
createdFullName: string;

View file

@ -3,7 +3,8 @@ interface ResponseObject {
id: string;
issuer: string;
detail: string;
issueDate: Date;
issueDate: number;
issueDate2: Date;
refCommandNo: string;
refCommandDate: Date | null;
createdFullName: string;