รีเซ็ต date

This commit is contained in:
setthawutttty 2024-02-14 11:51:00 +07:00
parent 9814c9f01a
commit 92aaccc791
3 changed files with 43 additions and 15 deletions

View file

@ -1755,7 +1755,11 @@ watch(
(value: string) => {
if (value.length === 10) {
const dateVal = convertDate(value);
finishDate.value = dateVal.value;
if (dateVal.isValid) {
finishDate.value = dateVal.value;
} else {
finishDateInput.value = "";
}
}
}

View file

@ -1457,9 +1457,13 @@ watch(
() => dateAnnounceInput.value,
(value: string) => {
if (value.length === 10) {
const dateVal = convertDate(value);
dateAnnounce.value = dateVal.value;
console.log(dateAnnounce.value);
if (dateVal.isValid) {
dateAnnounce.value = dateVal.value;
} else {
dateAnnounceInput.value = "";
}
}
}
);
@ -1468,7 +1472,11 @@ watch(
(value: string) => {
if (value.length === 10) {
const dateVal = convertDate(value);
refCommandDate.value = dateVal.value;
if (dateVal.isValid) {
refCommandDate.value = dateVal.value;
} else {
refCommandDateInput.value = "";
}
}
}
);

View file

@ -389,7 +389,7 @@
dense
/>
<datepicker
v-else
v-else
menu-class-name="modalfix"
v-model="yearly"
:locale="'th'"
@ -505,7 +505,7 @@
dense
/>
<datepicker
v-else
v-else
menu-class-name="modalfix"
v-model="dateOrder"
:locale="'th'"
@ -657,8 +657,16 @@ const store = useProfileDataStore();
const { profileData, changeProfileColumns } = store;
const isDate = ref<string | null>("true");
const mixin = useCounterMixin();
const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader,convertDate,convertDateDisplay } =
mixin;
const {
date2Thai,
success,
dateToISO,
messageError,
showLoader,
hideLoader,
convertDate,
convertDateDisplay,
} = mixin;
const route = useRoute();
const id = ref<string>("");
const name = ref<string>();
@ -668,7 +676,7 @@ const place = ref<string>();
const duration = ref<string>();
const department = ref<string>();
const numberOrder = ref<string>();
const dateOrder = ref<Date | null|string>(new Date());
const dateOrder = ref<Date | null | string>(new Date());
const startDate = ref<Date | string | number>(new Date().getFullYear());
const startDate2 = ref<Date | string | null>(new Date());
const endDate = ref<Date | string | number>(new Date().getFullYear());
@ -1064,7 +1072,7 @@ const getData = () => {
yearlyInput.value = (Number(row.yearly) + 543).toLocaleString();
inputStartDate2.value = convertDateDisplay(row.startDate2);
inputEndDate2.value = convertDateDisplay(row.endDate2);
dateOrderInput.value = row.dateOrder ? convertDateDisplay(row.dateOrder):'';
dateOrderInput.value = row.dateOrder ? convertDateDisplay(row.dateOrder) : "";
};
/**
@ -1102,7 +1110,7 @@ const clickAdd = async () => {
/**
* กดบนทกใน dialog
*/
const clickSave = async () => {
const clickSave = async () => {
myForm.value.validate().then(async (result: boolean) => {
if (result) {
if (isDate.value == "false") {
@ -1283,7 +1291,7 @@ const selectData = async (props: DataProps) => {
name.value = props.row.name;
topic.value = props.row.topic;
yearly.value = props.row.yearly;
console.log(typeof yearly.value)
console.log(typeof yearly.value);
place.value = props.row.place;
duration.value = props.row.duration;
department.value = props.row.department;
@ -1296,10 +1304,15 @@ const selectData = async (props: DataProps) => {
endDate2.value = props.row.endDate2;
inputStartDate.value = (Number(props.row.startDate) + 543).toLocaleString();
inputEndDate.value = (Number(props.row.endDate) + 543).toLocaleString();
yearlyInput.value = props.row.yearly !== 0 ? (Number(props.row.yearly) + 543).toLocaleString():'';
yearlyInput.value =
props.row.yearly !== 0
? (Number(props.row.yearly) + 543).toLocaleString()
: "";
inputStartDate2.value = convertDateDisplay(props.row.startDate2);
inputEndDate2.value = convertDateDisplay(props.row.endDate2);
dateOrderInput.value = props.row.dateOrder ? convertDateDisplay(props.row.dateOrder):'';
dateOrderInput.value = props.row.dateOrder
? convertDateDisplay(props.row.dateOrder)
: "";
id.value = props.row.id;
await checkRowPage();
};
@ -1461,8 +1474,11 @@ watch(
(value: string) => {
if (value.length === 10) {
const dateVal = convertDate(value);
if (dateVal.isValid) {
dateOrder.value = dateVal.value;
} else {
dateOrderInput.value = "";
}
}
}
);