Merge branch 'develop' into devTee
# Conflicts: # src/modules/04_registry/components/Discipline.vue
This commit is contained in:
commit
a0c1ec7e6e
9 changed files with 347 additions and 74 deletions
|
|
@ -60,7 +60,19 @@
|
|||
<q-card-section class="q-p-sm">
|
||||
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<q-input
|
||||
v-if="edit"
|
||||
outlined
|
||||
v-model="inputDate"
|
||||
label="วัน/เดือน/ปี"
|
||||
mask="##/##/####"
|
||||
dense
|
||||
:error="dayChecked"
|
||||
error-message="กรุณากรอกวัน/เดือน/ปี"
|
||||
:rules="[(val) => !!val || `${'กรุณากรอกวัน/เดือน/ปี'}`]"
|
||||
/>
|
||||
<datepicker
|
||||
v-else
|
||||
menu-class-name="modalfix"
|
||||
:readonly="!edit"
|
||||
v-model="date"
|
||||
|
|
@ -180,7 +192,16 @@
|
|||
</q-input>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<q-input
|
||||
v-if="edit"
|
||||
outlined
|
||||
v-model="inputRefCommandDate"
|
||||
label="เอกสารอ้างอิง (ลงวันที่)"
|
||||
mask="##/##/####"
|
||||
dense
|
||||
/>
|
||||
<datepicker
|
||||
v-else
|
||||
menu-class-name="modalfix"
|
||||
:readonly="!edit"
|
||||
v-model="refCommandDate"
|
||||
|
|
@ -202,7 +223,7 @@
|
|||
lazy-rules
|
||||
:borderless="!edit"
|
||||
:model-value="
|
||||
refCommandDate == null ? null : date2Thai(refCommandDate as Date)
|
||||
(refCommandDate && date2Thai(refCommandDate as Date)) || null
|
||||
"
|
||||
hide-bottom-space
|
||||
:label="`${'เอกสารอ้างอิง (ลงวันที่)'}`"
|
||||
|
|
@ -316,8 +337,16 @@ const store = useProfileDataStore();
|
|||
const { profileData, changeProfileColumns } = store;
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } =
|
||||
mixin;
|
||||
const {
|
||||
date2Thai,
|
||||
success,
|
||||
dateToISO,
|
||||
messageError,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
convertDate,
|
||||
convertDateDisplay,
|
||||
} = mixin;
|
||||
const route = useRoute();
|
||||
const id = ref<string>("");
|
||||
const level = ref<string>();
|
||||
|
|
@ -573,8 +602,54 @@ const visibleColumnsHistory = ref<String[]>([
|
|||
"createdAt",
|
||||
]);
|
||||
|
||||
const inputDate = ref<string>("");
|
||||
const dayChecked = ref<boolean>(false);
|
||||
|
||||
const inputRefCommandDate = ref<string>("");
|
||||
const dayCheckedRef = ref<boolean>(false);
|
||||
|
||||
watch(
|
||||
() => inputRefCommandDate.value,
|
||||
(value: string) => {
|
||||
console.log(value);
|
||||
if (value.length === 10) {
|
||||
const dateVal = convertDate(value);
|
||||
|
||||
if (dateVal.isValid) {
|
||||
dayCheckedRef.value = false;
|
||||
if (!!dateVal.value) {
|
||||
refCommandDate.value = new Date(dateVal.value);
|
||||
} else {
|
||||
refCommandDate.value = null;
|
||||
}
|
||||
} else {
|
||||
dayCheckedRef.value = true;
|
||||
inputRefCommandDate.value = "";
|
||||
}
|
||||
} else {
|
||||
refCommandDate.value = null;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => inputDate.value,
|
||||
(value: string) => {
|
||||
if (value.length === 10) {
|
||||
const dateVal = convertDate(value);
|
||||
if (dateVal.isValid) {
|
||||
dayChecked.value = false;
|
||||
date.value = new Date(dateVal.value);
|
||||
} else {
|
||||
dayChecked.value = true;
|
||||
inputDate.value = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
watch(visibleColumns, async (count: String[], prevCount: String[]) => {
|
||||
await changeProfileColumns("discipline", count);
|
||||
changeProfileColumns("discipline", count);
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
|
|
@ -728,6 +803,8 @@ const saveData = async () => {
|
|||
})
|
||||
.then((res) => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
inputDate.value = "";
|
||||
inputRefCommandDate.value = "";
|
||||
modal.value = false;
|
||||
})
|
||||
.catch((e) => {
|
||||
|
|
@ -838,13 +915,19 @@ const selectData = async (props: DataProps) => {
|
|||
refCommandDate.value = props.row.refCommandDate == '-' ? '':props.row.refCommandDate;
|
||||
date.value = props.row.date;
|
||||
id.value = props.row.id;
|
||||
await checkRowPage();
|
||||
inputDate.value = convertDateDisplay(props.row.date);
|
||||
inputRefCommandDate.value = props.row.refCommandDate
|
||||
? convertDateDisplay(props.row.refCommandDate as Date)
|
||||
: "";
|
||||
checkRowPage();
|
||||
};
|
||||
|
||||
/**
|
||||
* กดปุ่มเพิ่มบน table
|
||||
*/
|
||||
const addData = () => {
|
||||
inputDate.value = "";
|
||||
inputRefCommandDate.value = "";
|
||||
modalEdit.value = false;
|
||||
modal.value = true;
|
||||
edit.value = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue