รีเซ็ต 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) => { (value: string) => {
if (value.length === 10) { if (value.length === 10) {
const dateVal = convertDate(value); const dateVal = convertDate(value);
if (dateVal.isValid) {
finishDate.value = dateVal.value; finishDate.value = dateVal.value;
} else {
finishDateInput.value = "";
}
} }
} }

View file

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

View file

@ -657,8 +657,16 @@ const store = useProfileDataStore();
const { profileData, changeProfileColumns } = store; const { profileData, changeProfileColumns } = store;
const isDate = ref<string | null>("true"); const isDate = ref<string | null>("true");
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader,convertDate,convertDateDisplay } = const {
mixin; date2Thai,
success,
dateToISO,
messageError,
showLoader,
hideLoader,
convertDate,
convertDateDisplay,
} = mixin;
const route = useRoute(); const route = useRoute();
const id = ref<string>(""); const id = ref<string>("");
const name = ref<string>(); const name = ref<string>();
@ -1064,7 +1072,7 @@ const getData = () => {
yearlyInput.value = (Number(row.yearly) + 543).toLocaleString(); yearlyInput.value = (Number(row.yearly) + 543).toLocaleString();
inputStartDate2.value = convertDateDisplay(row.startDate2); inputStartDate2.value = convertDateDisplay(row.startDate2);
inputEndDate2.value = convertDateDisplay(row.endDate2); inputEndDate2.value = convertDateDisplay(row.endDate2);
dateOrderInput.value = row.dateOrder ? convertDateDisplay(row.dateOrder):''; dateOrderInput.value = row.dateOrder ? convertDateDisplay(row.dateOrder) : "";
}; };
/** /**
@ -1283,7 +1291,7 @@ const selectData = async (props: DataProps) => {
name.value = props.row.name; name.value = props.row.name;
topic.value = props.row.topic; topic.value = props.row.topic;
yearly.value = props.row.yearly; yearly.value = props.row.yearly;
console.log(typeof yearly.value) console.log(typeof yearly.value);
place.value = props.row.place; place.value = props.row.place;
duration.value = props.row.duration; duration.value = props.row.duration;
department.value = props.row.department; department.value = props.row.department;
@ -1296,10 +1304,15 @@ const selectData = async (props: DataProps) => {
endDate2.value = props.row.endDate2; endDate2.value = props.row.endDate2;
inputStartDate.value = (Number(props.row.startDate) + 543).toLocaleString(); inputStartDate.value = (Number(props.row.startDate) + 543).toLocaleString();
inputEndDate.value = (Number(props.row.endDate) + 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); inputStartDate2.value = convertDateDisplay(props.row.startDate2);
inputEndDate2.value = convertDateDisplay(props.row.endDate2); 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; id.value = props.row.id;
await checkRowPage(); await checkRowPage();
}; };
@ -1461,8 +1474,11 @@ watch(
(value: string) => { (value: string) => {
if (value.length === 10) { if (value.length === 10) {
const dateVal = convertDate(value); const dateVal = convertDate(value);
if (dateVal.isValid) {
dateOrder.value = dateVal.value; dateOrder.value = dateVal.value;
} else {
dateOrderInput.value = "";
}
} }
} }
); );