เเก้ วัน เดือน ปี เป็น วัน/เดือน/ปี

This commit is contained in:
Net 2024-02-15 13:06:51 +07:00
parent c9e646b86c
commit 745461e737
5 changed files with 69 additions and 46 deletions

View file

@ -68,8 +68,8 @@
mask="##/##/####"
dense
:error="dayChecked"
error-message="กรุณากรอกวัน/เดือน/ปี"
:rules="[(val) => !!val || `${'กรุณากรอกวัน/เดือน/ปี'}`]"
error-message="กรุณากรอก วัน/เดือน/ปี"
:rules="[(val) => !!val || `${'กรุณากรอก วัน/เดือน/ปี'}`]"
/>
<datepicker
v-else
@ -94,9 +94,9 @@
lazy-rules
:borderless="!edit"
:model-value="date2Thai(date)"
:rules="[(val:string) => !!val || `${'กรุณาเลือกวัน เดือน ปี'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือก วัน/เดือน/ปี'}`]"
hide-bottom-space
:label="`${'วัน เดือน ปี'}`"
:label="`${'วัน/เดือน/ปี'}`"
>
<template v-slot:prepend>
<q-icon

View file

@ -26,14 +26,18 @@
<div v-if="col.name == 'startDate'" class="table_ellipsis">
{{
props.row.isDate == "true"
? (props.row.startDate2 ? date2Thai(props.row.startDate2):'-')
? props.row.startDate2
? date2Thai(props.row.startDate2)
: "-"
: col.value + 543
}}
</div>
<div v-else-if="col.name == 'endDate'" class="table_ellipsis">
{{
props.row.isDate == "true"
? (props.row.endDate2 ? date2Thai(props.row.endDate2):'-')
? props.row.endDate2
? date2Thai(props.row.endDate2)
: "-"
: col.value + 543
}}
</div>
@ -236,6 +240,7 @@
(val) =>
!!val ||
`${'กรุณาเลือก วัน/เดือน/ปี ที่เริ่มต้นศึกษา'}`,
`${'กรุณาเลือก วัน/เดือน/ปี ที่เริ่มต้นศึกษา'}`,
]"
hide-bottom-space
:label="`${'วัน/เดือน/ปี ที่เริ่มต้นศึกษา'}`"
@ -357,7 +362,7 @@
:rules="[
(val) =>
!!val ||
`${'กรุณาเลือก วัน/เดือน/ปี ที่จบการศึกษา'}`,
`${'กรุณาเลือกวัน เดือน ปี ที่จบการศึกษา'}`,
]"
hide-bottom-space
:label="`${'วัน/เดือน/ปี ที่จบการศึกษา'}`"
@ -735,9 +740,9 @@ const other = ref<string>();
const fundName = ref<string>();
const isDate = ref<string | null>("true");
const finishDate = ref<Date | null | string>(null);
const startDate = ref<Date | string | number|null>(new Date().getFullYear());
const startDate = ref<Date | string | number | null>(new Date().getFullYear());
const startDate2 = ref<Date | string | null>(null);
const endDate = ref<number | string | Date|null>(new Date().getFullYear());
const endDate = ref<number | string | Date | null>(new Date().getFullYear());
const endDate2 = ref<Date | string | null>(null);
const minDate = ref<Date>();
const myForm = ref<any>(); //form data input
@ -1238,18 +1243,16 @@ const fetchData = async () => {
fundName: e.fundName,
isDate: e.isDate == null ? null : e.isDate.toString(),
finishDate: e.finishDate ? new Date(e.finishDate) : null,
startDate:e.startDate ? new Date(e.startDate).getFullYear():null,
endDate:e.endDate ? new Date(e.endDate).getFullYear():null,
startDate2:e.startDate ? new Date(e.startDate):null,
endDate2:e.endDate ? new Date(e.endDate):null,
startDate: e.startDate ? new Date(e.startDate).getFullYear() : null,
endDate: e.endDate ? new Date(e.endDate).getFullYear() : null,
startDate2: e.startDate ? new Date(e.startDate) : null,
endDate2: e.endDate ? new Date(e.endDate) : null,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
}
);
console.log(data)
console.log(rows.value)
});
console.log(data);
console.log(rows.value);
})
.catch((e) => {
messageError($q, e);
@ -1302,10 +1305,18 @@ const getData = () => {
startDate.value = row.startDate;
endDate.value = row.endDate;
startDate2.value = row.startDate2;
inputStartDate.value = row.startDate ? (Number(row.startDate) + 543).toLocaleString():'';
inputEndDate.value = row.endDate ? (Number(row.endDate) + 543).toLocaleString():'';
inputStartDate2.value = row.startDate2 ? convertDateDisplay(row.startDate2 as Date):'';
inputEndDate2.value = row.endDate2 ? convertDateDisplay(row.endDate2 as Date):'';
inputStartDate.value = row.startDate
? (Number(row.startDate) + 543).toLocaleString()
: "";
inputEndDate.value = row.endDate
? (Number(row.endDate) + 543).toLocaleString()
: "";
inputStartDate2.value = row.startDate2
? convertDateDisplay(row.startDate2 as Date)
: "";
inputEndDate2.value = row.endDate2
? convertDateDisplay(row.endDate2 as Date)
: "";
finishDateInput.value = row.finishDate
? convertDateDisplay(row.finishDate)
: "-";
@ -1417,11 +1428,15 @@ const saveData = async () => {
: null,
startDate:
isDate.value == "true"
? (startDate2.value ? dateToISO(startDate2.value as Date):null)
? startDate2.value
? dateToISO(startDate2.value as Date)
: null
: new Date(`${startDate.value}-01-01`),
endDate:
isDate.value == "true"
? (endDate2.value ? dateToISO(endDate2.value as Date):null)
? endDate2.value
? dateToISO(endDate2.value as Date)
: null
: new Date(`${endDate.value}-01-01`),
})
.then((res) => {
@ -1569,10 +1584,18 @@ const selectData = async (_props: DataProps) => {
startDate2.value = _props.row.startDate2;
endDate2.value = _props.row.endDate2;
id.value = _props.row.id;
inputStartDate.value = _props.row.startDate ? (Number(_props.row.startDate) + 543).toLocaleString():'';
inputEndDate.value = _props.row.endDate ? (Number(_props.row.endDate) + 543).toLocaleString():'';
inputStartDate2.value = _props.row.startDate2 ? convertDateDisplay(_props.row.startDate2 as Date):'';
inputEndDate2.value = _props.row.endDate2 ? convertDateDisplay(_props.row.endDate2 as Date):'';
inputStartDate.value = _props.row.startDate
? (Number(_props.row.startDate) + 543).toLocaleString()
: "";
inputEndDate.value = _props.row.endDate
? (Number(_props.row.endDate) + 543).toLocaleString()
: "";
inputStartDate2.value = _props.row.startDate2
? convertDateDisplay(_props.row.startDate2 as Date)
: "";
inputEndDate2.value = _props.row.endDate2
? convertDateDisplay(_props.row.endDate2 as Date)
: "";
finishDateInput.value = _props.row.finishDate
? convertDateDisplay(_props.row.finishDate)
: "-";
@ -1727,8 +1750,8 @@ watch(
dayChecked2.value = true;
inputStartDate2.value = "";
}
} else{
startDate2.value = null
} else {
startDate2.value = null;
}
}
);
@ -1744,8 +1767,8 @@ watch(
dayEndChecked2.value = true;
inputEndDate2.value = "";
}
}else{
endDate2.value = null
} else {
endDate2.value = null;
}
}
);

View file

@ -72,7 +72,7 @@
label="วัน/เดือน/ปี"
mask="##/##/####"
dense
:rules="[(val) => !!val || `${'กรุณาเลือกวัน เดือน ปี'}`]"
:rules="[(val) => !!val || `${'กรุณาเลือก วัน/เดือน/ปี'}`]"
/>
<datepicker
@ -99,9 +99,9 @@
lazy-rules
:borderless="!edit"
:model-value="date2Thai(date)"
:rules="[(val) => !!val || `${'กรุณาเลือกวัน เดือน ปี'}`]"
:rules="[(val) => !!val || `${'กรุณาเลือก วัน/เดือน/ปี'}`]"
hide-bottom-space
:label="`${'วัน เดือน ปี'}`"
:label="`${'วัน/เดือน/ปี'}`"
>
<template v-slot:prepend>
<q-icon

View file

@ -124,9 +124,9 @@
mask="##/##/####"
dense
:error="dayChecked"
error-message="กรุณากรอกวัน/เดือน/ปี"
error-message="กรุณากรอก วัน/เดือน/ปี"
:rules="[
(val) => !!val || `${'กรุณากรอกวัน/เดือน/ปี'}`,
(val) => !!val || `${'กรุณากรอก วัน/เดือน/ปี'}`,
]"
/>
<datepicker
@ -156,9 +156,9 @@
:rules="[
(val: string) =>
!!val ||
`${'กรุณาเลือกวัน เดือน ปี'}`,
`${'กรุณาเลือก วัน/เดือน/ปี'}`,
]"
:label="`${'วัน เดือน ปี'}`"
:label="`${'วัน/เดือน/ปี'}`"
hide-bottom-space
>
<template v-slot:prepend>

View file

@ -148,9 +148,9 @@
:rules="[
(val:string) =>
!!val ||
`${'กรุณาเลือกวัน เดือน ปี จ้างและแต่งตั้ง'}`,
`${'กรุณาเลือก วัน/เดือน/ปี จ้างและแต่งตั้ง'}`,
]"
:label="`${'วัน เดือน ปี จ้างและแต่งตั้ง'}`"
:label="`${'วัน/เดือน/ปี จ้างและแต่งตั้ง'}`"
hide-bottom-space
>
<template v-slot:prepend>
@ -506,7 +506,7 @@
</q-form>
</q-card>
</q-dialog>
<HistoryTable
:rows="rowsHistory"
:columns="columnsHistory"
@ -1446,7 +1446,7 @@ const nodeTree = async () => {
messageError($q, e);
})
.finally(() => {
store.isLoad++
store.isLoad++;
});
};
@ -1568,7 +1568,7 @@ const fetchData = async () => {
refCommandNo: e.refCommandNo,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
salaryStatus: null
salaryStatus: null,
});
});
})
@ -1576,7 +1576,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
store.isLoad++
store.isLoad++;
});
}
};
@ -2067,7 +2067,7 @@ const clickHistory = async (row: RequestItemsEmployee) => {
refCommandNo: e.refCommandNo,
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
salaryStatus: null
salaryStatus: null,
});
});
})