Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2024-02-13 16:56:29 +07:00
commit ea91acf18a
16 changed files with 1113 additions and 413 deletions

View file

@ -44,6 +44,8 @@
>
<q-tooltip>ไฟลเอกสารหลกฐาน</q-tooltip>
</q-btn>
</q-td>
<q-td auto-width>
<q-btn
color="info"
flat
@ -692,47 +694,52 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
if (fileUpload.value.length > 0) {
const blob = fileUpload.value.slice(0, fileUpload.value[0].size);
const newFile = new File(blob, nameFile.value, {
type: fileUpload.value[0].type,
// if (fileUpload.value.length > 0) {
const blob =
fileUpload.value.length > 0
? fileUpload.value.slice(0, fileUpload.value[0].size)
: null;
const newFile: any = blob
? new File(blob, nameFile.value, {
type: fileUpload.value[0].type,
})
: null;
const formData = new FormData();
newFile && formData.append("", newFile);
if (prefixId.value != undefined) formData.append("prefixId", prefixId.value);
if (firstName.value != undefined)
formData.append("firstName", firstName.value);
if (lastName.value != undefined) formData.append("lastName", lastName.value);
if (status.value != undefined) formData.append("status", status.value);
showLoader();
await http
.post(config.API.profileChangeNameId(profileId.value), formData)
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
await props.fetchDataInformation();
});
const formData = new FormData();
formData.append("", newFile);
if (prefixId.value != undefined)
formData.append("prefixId", prefixId.value);
if (firstName.value != undefined)
formData.append("firstName", firstName.value);
if (lastName.value != undefined)
formData.append("lastName", lastName.value);
if (status.value != undefined) formData.append("status", status.value);
showLoader();
await http
.post(config.API.profileChangeNameId(profileId.value), formData)
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
await props.fetchDataInformation();
});
} else {
dialogMessage(
$q,
"ไม่สามารถบันทึกข้อมูลได้",
"กรุณาอัปโหลดเอกสารหลักฐาน",
"warning",
undefined,
"orange",
undefined,
undefined,
true
);
}
// }
// else {
// dialogMessage(
// $q,
// "",
// "",
// "warning",
// undefined,
// "orange",
// undefined,
// undefined,
// true
// );
// }
};
/**

View file

@ -212,7 +212,21 @@
</div> -->
<div class="row q-col-gutter-sm">
<div class="col-6">
<q-input
v-if="edit"
outlined
v-model="inputDateLaeaveYear"
:label="`${'ปี'}`"
mask="####"
dense
:rules="[(val:string) => !!val || `${'กรุณาเลือกปี'}`]"
:class="getClass(edit)"
:readonly="!edit"
:borderless="!edit"
/>
<datepicker
v-else
menu-class-name="modalfix"
v-model="formData.leaveYear"
class="col-2"
@ -470,6 +484,7 @@ import HistoryTable from "@/components/TableHistory.vue";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar";
import moment from "moment";
const props = defineProps({
statusEdit: {
@ -503,6 +518,8 @@ const {
showLoader,
hideLoader,
dialogConfirm,
convertDate,
convertDateDisplay,
} = mixin;
const route = useRoute();
@ -566,6 +583,16 @@ const filterTotal = ref<string>("");
const rowsTotal = ref<RequestItemsTotalObject[]>([]); //select data history
const filter = ref<string>(""); //search data table
const inputDateLaeaveYear = ref<string>("");
/** ตรวจเวลา */
watch(
() => inputDateLaeaveYear.value,
(value: string) => {
if (value.length === 4) {
formData.leaveYear = parseInt(value) - 543;
}
}
);
/**old */
// const visibleColumns = ref<String[]>([]);
// profileData.leave.columns.length == 0
@ -1051,11 +1078,11 @@ const getData = () => {
// coupleDay.value = row.coupleDay;
// therapyDay.value = row.therapyDay;
formData.id = row.id;
formData.sumSick = row.sumSick =='-' ? '':row.sumSick;
formData.sumRest = row.sumRest =='-' ? '':row.sumRest;
formData.sumLate = row.sumLate =='-' ? '':row.sumLate;
formData.sumAbsent = row.sumAbsent =='-' ? '':row.sumAbsent;
formData.sumEducation = row.sumEducation =='-' ? '':row.sumEducation;
formData.sumSick = row.sumSick == "-" ? "" : row.sumSick;
formData.sumRest = row.sumRest == "-" ? "" : row.sumRest;
formData.sumLate = row.sumLate == "-" ? "" : row.sumLate;
formData.sumAbsent = row.sumAbsent == "-" ? "" : row.sumAbsent;
formData.sumEducation = row.sumEducation == "-" ? "" : row.sumEducation;
formData.leaveYear = row.leaveYear == "-" ? 0 : Number(row.leaveYear) - 543;
// id.value = row.id;
@ -1101,6 +1128,7 @@ const clickAdd = async () => {
const clickAddLeave = async () => {
clearForm();
inputDateLaeaveYear.value = (moment().year() + 543).toString();
editRow.value = false;
edit.value = true;
modalAdd.value = true;
@ -1158,11 +1186,11 @@ const clickSave = async () => {
if (result) {
if (modalEdit.value) {
// await dialogConfirm($q, () => {
editData();
editData();
// });
} else {
// await dialogConfirm($q, () => {
saveData();
saveData();
// });
}
}
@ -1173,7 +1201,9 @@ const clickSave = async () => {
// *
// */
const saveData = async () => {
formData.leaveYear = (await Number(inputDateLaeaveYear.value)) - 543;
const sum = Number(numLeave.value) + Number(numUsedLeave.value);
console.log(formData.leaveYear);
if (profileId.value) {
showLoader();
@ -1188,6 +1218,7 @@ const saveData = async () => {
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modalAdd.value = false;
})
.catch((e) => {
@ -1324,12 +1355,19 @@ const selectData = async (props: DataProps) => {
rowIndex.value = props.rowIndex;
formData.id = props.row.id;
formData.sumSick = props.row.sumSick == '-' ? '':props.row.sumSick;
formData.sumRest = props.row.sumRest == '-' ? '':props.row.sumRest;
formData.sumLate = props.row.sumLate == '-' ? '':props.row.sumLate;
formData.sumAbsent = props.row.sumAbsent == '-' ? '':props.row.sumAbsent;
formData.sumEducation = props.row.sumEducation == '-' ? '':props.row.sumEducation;
formData.leaveYear = props.row.leaveYear == "-" ? 0 : Number(props.row.leaveYear) - 543;
formData.sumSick = props.row.sumSick == "-" ? "" : props.row.sumSick;
formData.sumRest = props.row.sumRest == "-" ? "" : props.row.sumRest;
formData.sumLate = props.row.sumLate == "-" ? "" : props.row.sumLate;
formData.sumAbsent = props.row.sumAbsent == "-" ? "" : props.row.sumAbsent;
formData.sumEducation =
props.row.sumEducation == "-" ? "" : props.row.sumEducation;
formData.leaveYear =
props.row.leaveYear == "-" ? 0 : Number(props.row.leaveYear) - 543;
console.log("เเก้ไข");
inputDateLaeaveYear.value = ((formData.leaveYear as number) + 543).toString();
console.log(inputDateLaeaveYear.value);
// id.value = props.row.id;
// typeLeave.value = props.row.typeLeaveId;
@ -1361,10 +1399,9 @@ const selectData = async (props: DataProps) => {
* กดปมเพมบน table
*/
const addData = async () => {
// modalEdit.value = false;
//modalEdit.value = false;
modal.value = true;
// edit.value = true;
//edit.value = true;
await clickTotal();
};

View file

@ -57,7 +57,18 @@
<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
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่'}`]"
/>
<datepicker
v-else
menu-class-name="modalfix"
:readonly="!edit"
v-model="date"
@ -73,6 +84,7 @@
}}</template>
<template #trigger>
<q-input
readonly
:class="getClass(edit)"
:outlined="edit"
dense
@ -193,7 +205,15 @@ const store = useProfileDataStore();
const { profileData, changeProfileColumns } = store;
const mixin = useCounterMixin();
const { date2Thai, success, messageError, showLoader, hideLoader } = mixin;
const {
convertDateDisplay,
convertDate,
date2Thai,
success,
messageError,
showLoader,
hideLoader,
} = mixin;
const route = useRoute();
const id = ref<string>("");
const date = ref<Date>(new Date());
@ -218,6 +238,26 @@ const profileId = ref<string>(
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
const inputDate = ref<string>("");
const dayChecked = ref<boolean>(false);
/** ตรวจเวลา */
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 = "";
}
}
}
);
profileData.other.columns.length == 0
? (visibleColumns.value = ["date", "detail"])
: (visibleColumns.value = profileData.other.columns);
@ -387,6 +427,7 @@ const clickEdit = () => {
* กดปมเพมดานบน table
*/
const clickAdd = async () => {
inputDate.value = "";
editRow.value = false;
await addData();
};
@ -521,6 +562,8 @@ const selectData = async (props: DataProps) => {
date.value = props.row.date;
detail.value = props.row.detail;
id.value = props.row.id;
inputDate.value = convertDateDisplay(date.value);
await checkRowPage();
};

View file

@ -989,8 +989,8 @@ function onClickUnlock() {
hideLoader();
});
},
"ยืนยันการปลดให้แก้ไขข้อมูล",
"ต้องการยืนยันการปลดให้แก้ไขข้อมูลนี้หรือไม่?"
"ยืนยันการปลดล็อคให้แก้ไขข้อมูล",
"ต้องการยืนยันการปลดล็อคให้แก้ไขข้อมูลนี้หรือไม่?"
);
}
onMounted(async () => {

View file

@ -65,7 +65,18 @@
<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
:rules="[(val) => !!val || `${'กรุณาเลือกวัน เดือน ปี'}`]"
/>
<datepicker
v-else
menu-class-name="modalfix"
:readonly="!edit"
v-model="date"
@ -81,6 +92,7 @@
}}</template>
<template #trigger>
<q-input
readonly
:class="getClass(edit)"
:outlined="edit"
dense
@ -162,7 +174,17 @@
</q-input>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
v-if="edit"
outlined
v-model="inputDateRefCommandDate"
:label="`${'เอกสารอ้างอิง (ลงวันที่)'}`"
mask="##/##/####"
dense
/>
<datepicker
v-else
menu-class-name="modalfix"
:readonly="!edit"
v-model="refCommandDate"
@ -178,6 +200,7 @@
}}</template>
<template #trigger>
<q-input
readonly
:class="getClass(edit)"
:outlined="edit"
dense
@ -294,8 +317,16 @@ const store = useProfileDataStore();
const { profileData, changeProfileColumns } = store;
const mixin = useCounterMixin();
const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } =
mixin;
const {
convertDateDisplay,
convertDate,
date2Thai,
success,
dateToISO,
messageError,
showLoader,
hideLoader,
} = mixin;
const route = useRoute();
const id = ref<string>("");
const date = ref<Date>(new Date());
@ -325,6 +356,47 @@ const checkValidate = ref<boolean>(false); //validate data ผ่านหรื
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
const inputDate = ref<string>("");
const inputDateRefCommandDate = ref<string>(
refCommandDate.value ? convertDateDisplay(refCommandDate.value) : ""
);
const dayChecked = ref<boolean>(false);
const dayCheckedRefCommandDate = ref<boolean>(false);
/** ตรวจเวลา */
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(
() => inputDateRefCommandDate.value,
(value: string) => {
if (value.length === 10) {
const dateVal = convertDate(value);
if (dateVal.isValid) {
dayChecked.value = false;
refCommandDate.value = new Date(dateVal.value);
} else {
dayChecked.value = true;
inputDateRefCommandDate.value = "";
}
} else {
refCommandDate.value = null;
}
}
);
profileData.record.columns.length == 0
? (visibleColumns.value = [
"date",
@ -725,6 +797,11 @@ const selectData = async (props: DataProps) => {
refCommandNo.value = props.row.refCommandNo;
refCommandDate.value = props.row.refCommandDate;
id.value = props.row.id;
inputDate.value = convertDateDisplay(date.value);
inputDateRefCommandDate.value = refCommandDate.value
? convertDateDisplay(refCommandDate.value)
: "";
await checkRowPage();
};
@ -740,6 +817,8 @@ const addData = () => {
reference.value = "";
refCommandNo.value = "";
refCommandDate.value = null;
inputDate.value = convertDateDisplay(date.value);
inputDateRefCommandDate.value = "";
};
/**

View file

@ -74,7 +74,8 @@
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th auto-width v-if="name !== 'การลา'"/>
<q-th auto-width v-if="name !== 'การลา'" />
<q-th auto-width v-if="name === 'ประวัติการเปลี่ยนชื่อ-นามสกุล'" />
</q-tr>
</template>
<template #body="props">

View file

@ -64,7 +64,20 @@
<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="inputDateStart"
label="วันที่เริ่มต้น"
mask="##/##/####"
dense
:error="dayCheckedStart"
error-message="กรุณากรอกวัน/เดือน/ปี เริ่มต้น"
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่เริ่มต้น'}`]"
/>
<datepicker
v-else
menu-class-name="modalfix"
:readonly="!edit"
v-model="dateStart"
@ -80,6 +93,7 @@
}}</template>
<template #trigger>
<q-input
readonly
:class="getClass(edit)"
:outlined="edit"
dense
@ -107,7 +121,19 @@
</datepicker>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
v-if="edit"
outlined
v-model="inputDateEnd"
label="วันที่สิ้นสุด"
mask="##/##/####"
dense
:error="dayCheckedEnd"
error-message="กรุณากรอกวัน/เดือน/ปี สิ้นสุด"
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่สิ้นสุด'}`]"
/>
<datepicker
v-else
menu-class-name="modalfix"
v-model="dateEnd"
:locale="'th'"
@ -124,6 +150,7 @@
}}</template>
<template #trigger>
<q-input
readonly
:class="getClass(edit)"
:outlined="edit"
dense
@ -205,7 +232,17 @@
</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"
@ -221,6 +258,7 @@
}}</template>
<template #trigger>
<q-input
readonly
:class="getClass(edit)"
:outlined="edit"
dense
@ -252,9 +290,7 @@
/>
</template>
</q-input>
</template>
</datepicker>
</div>
</div>
@ -311,6 +347,7 @@
<script setup lang="ts">
import { onMounted, ref, watch } from "vue";
import { useRoute } from "vue-router";
import moment from "moment";
import { useProfileDataStore } from "@/modules/04_registry/store";
import { useCounterMixin } from "@/stores/mixin";
@ -340,8 +377,16 @@ const store = useProfileDataStore();
const { profileData, changeProfileColumns } = store;
const mixin = useCounterMixin();
const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } =
mixin;
const {
convertDateDisplay,
convertDate,
date2Thai,
success,
dateToISO,
messageError,
showLoader,
hideLoader,
} = mixin;
const route = useRoute();
const id = ref<string>("");
const dateStart = ref<Date>(new Date());
@ -371,6 +416,63 @@ const profileId = ref<string>(
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
console.log(dateStart.value);
const inputDateStart = ref<string>(convertDateDisplay(dateStart.value));
const inputDateEnd = ref<string>(convertDateDisplay(dateEnd.value));
const inputRefCommandDate = ref<string>("");
const dayCheckedStart = ref<boolean>(false);
const dayCheckedEnd = ref<boolean>(false);
/** ตรวจเวลา */
watch(
() => inputDateStart.value,
(value: string) => {
if (value.length === 10) {
const dateVal = convertDate(value);
if (dateVal.isValid) {
dayCheckedStart.value = false;
dateStart.value = new Date(dateVal.value);
} else {
dayCheckedStart.value = true;
inputDateStart.value = "";
}
}
}
);
watch(
() => inputRefCommandDate.value,
(value: string) => {
if (value.length === 10) {
const dateVal = convertDate(value);
if (dateVal.isValid) {
dayCheckedEnd.value = false;
refCommandDate.value = new Date(dateVal.value);
} else {
dayCheckedEnd.value = true;
inputRefCommandDate.value = "";
}
} else {
refCommandDate.value = null;
}
}
);
watch(
() => inputDateEnd.value,
(value: string) => {
if (value.length === 10) {
const dateVal = convertDate(value);
if (dateVal.isValid) {
dayCheckedEnd.value = false;
dateEnd.value = new Date(dateVal.value);
} else {
dayCheckedEnd.value = true;
inputDateEnd.value = "";
}
}
}
);
profileData.work.columns.length == 0
? (visibleColumns.value = [
"dateStart",
@ -804,6 +906,12 @@ const selectData = async (props: DataProps) => {
refCommandNo.value = props.row.refCommandNo;
refCommandDate.value = props.row.refCommandDate;
id.value = props.row.id;
inputDateStart.value = convertDateDisplay(dateStart.value);
inputDateEnd.value = convertDateDisplay(dateEnd.value);
inputRefCommandDate.value = refCommandDate.value
? convertDateDisplay(refCommandDate.value)
: "";
await checkRowPage();
};
@ -820,6 +928,10 @@ const addData = () => {
reference.value = "";
refCommandNo.value = "";
refCommandDate.value = null;
inputDateStart.value = convertDateDisplay(dateStart.value);
inputDateEnd.value = convertDateDisplay(dateEnd.value);
inputRefCommandDate.value = "";
};
/**