การลา API
This commit is contained in:
parent
9f6f1afdd2
commit
4f93c38fc0
5 changed files with 252 additions and 171 deletions
|
|
@ -109,4 +109,17 @@ profileNewDutyByDutyId: (dutyId: string) =>
|
||||||
`${registryNew}duty/${dutyId}`,
|
`${registryNew}duty/${dutyId}`,
|
||||||
profileNewDutyHisByDutyId: (dutyId: string) =>
|
profileNewDutyHisByDutyId: (dutyId: string) =>
|
||||||
`${registryNew}duty/history/${dutyId}`,
|
`${registryNew}duty/history/${dutyId}`,
|
||||||
|
|
||||||
|
|
||||||
|
//ข้อมูลราชการ
|
||||||
|
profileNewGovernment:()=>`${registryNew}government`,
|
||||||
|
profileNewGovernmentById:(id:string)=>`${registryNew}government/${id}`,
|
||||||
|
profileNewGovernmentHistory:(id:string)=>`${registryNew}government/history/${id}`,
|
||||||
|
|
||||||
|
//การลา
|
||||||
|
profileNewLeave:()=>`${registryNew}leave`,
|
||||||
|
profileNewLeaveById:(id:string)=>`${registryNew}leave/${id}`,
|
||||||
|
profileNewLeaveHistory:(id:string)=>`${registryNew}leave/history/${id}`,
|
||||||
|
profileCheckDate:()=>`${env.API_URI}/leave/user/check`,
|
||||||
|
profileNewLeaveType:()=>`${env.API_URI}/leave/type`,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, watch } from "vue";
|
import { ref, reactive, watch,onMounted } from "vue";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import type {
|
import type {
|
||||||
MyObjectRef,
|
MyObjectRef,
|
||||||
|
|
@ -27,6 +27,7 @@ const {
|
||||||
hideLoader,
|
hideLoader,
|
||||||
} = mixin;
|
} = mixin;
|
||||||
|
|
||||||
|
const profileId = ref<string>(route.params.id.toString())
|
||||||
/** ตัวแปรข้อมูลหลัก */
|
/** ตัวแปรข้อมูลหลัก */
|
||||||
const formMain = reactive<FormMain>({
|
const formMain = reactive<FormMain>({
|
||||||
ocId: "สำนักงานคณะกรรมการข้าราชการกรุงเทพมหานคร/กองบริหารทั่วไป/กลุ่มงานช่วยนักบริหาร", //สังกัด
|
ocId: "สำนักงานคณะกรรมการข้าราชการกรุงเทพมหานคร/กองบริหารทั่วไป/กลุ่มงานช่วยนักบริหาร", //สังกัด
|
||||||
|
|
@ -68,6 +69,18 @@ const objectRef: MyObjectRef = {
|
||||||
reasonSameDate: reasonSameDateRef,
|
reasonSameDate: reasonSameDateRef,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const fieldLabels = {
|
||||||
|
ocId: "สังกัด",
|
||||||
|
positionId: "ตำแหน่ง",
|
||||||
|
numberId: "เลขที่ตำแหน่ง",
|
||||||
|
positionExecutive: "ตำแหน่งทางการบริหาร",
|
||||||
|
positionExecutiveSide: "ด้านทางการบริหาร",
|
||||||
|
positionLine: "สายงาน",
|
||||||
|
positionLevel: "ระดับ",
|
||||||
|
positionType: "ประเภท",
|
||||||
|
positionPathSide: "ด้าน/สาขา",
|
||||||
|
};
|
||||||
|
|
||||||
const visibleColumnsHistory = ref<String[]>([
|
const visibleColumnsHistory = ref<String[]>([
|
||||||
"oc",
|
"oc",
|
||||||
"position",
|
"position",
|
||||||
|
|
@ -297,6 +310,7 @@ function openDialogEdit() {
|
||||||
|
|
||||||
function openDialogHistory() {
|
function openDialogHistory() {
|
||||||
modalHistory.value = true;
|
modalHistory.value = true;
|
||||||
|
getDataHistory()
|
||||||
}
|
}
|
||||||
/** ปิด dialog */
|
/** ปิด dialog */
|
||||||
function closeDialog() {
|
function closeDialog() {
|
||||||
|
|
@ -325,59 +339,98 @@ function validateForm() {
|
||||||
|
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
dialogConfirm($q, () => {
|
dialogConfirm($q, () => {
|
||||||
// showLoader()
|
showLoader()
|
||||||
// http
|
http
|
||||||
// .put(config.API.???)
|
.patch(config.API.profileNewGovernmentById(profileId.value),{
|
||||||
// .then((res)=>{
|
dateAppoint:containDate.value,
|
||||||
// closeDialog()
|
dateStart:workDate.value,
|
||||||
// getData()
|
reasonSameDate:reasonSameDate.value
|
||||||
// }).catch((e)=>{
|
})
|
||||||
// messageError($q,e)
|
.then((res)=>{
|
||||||
// }).finally(()=>{
|
closeDialog()
|
||||||
// hideLoader()
|
getData()
|
||||||
// })
|
}).catch((e)=>{
|
||||||
|
messageError($q,e)
|
||||||
|
}).finally(()=>{
|
||||||
|
hideLoader()
|
||||||
|
})
|
||||||
|
|
||||||
closeDialog();
|
closeDialog();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** ดึงข้อมูลราชการ */
|
||||||
|
function getData(){
|
||||||
|
showLoader()
|
||||||
|
http
|
||||||
|
.get(config.API.profileNewGovernmentById(profileId.value))
|
||||||
|
.then((res)=>{
|
||||||
|
console.log(res.data.result)
|
||||||
|
const data = res.data.result
|
||||||
|
formMain.ocId = data.oc //สังกัด
|
||||||
|
formMain.positionId = data.position //ตำแหน่ง
|
||||||
|
formMain.positionLine = data.positionLine //สายงาน
|
||||||
|
formMain.positionLevel = data.positionLevel //ระดับ
|
||||||
|
formMain.numberId = data.posNo //เลขที่ตำแหน่ง
|
||||||
|
formMain.positionType = data.positionType //ประเภท
|
||||||
|
formMain.positionExecutive = data.positionExecutive //ตำแหน่งทางการ บริหาร
|
||||||
|
formMain.positionPathSide = data.positionPathSide //ด้านสาขา
|
||||||
|
formMain.positionExecutiveSide = data.positionExecutiveSide //ด้านทางการบริหาร
|
||||||
|
|
||||||
|
|
||||||
|
formMain.containDate = data.dateAppoint
|
||||||
|
formMain.workDate = data.dateStart
|
||||||
|
formMain.reasonSameDate = data.reasonSameDate
|
||||||
|
formMain.retireDate = data.retireDate
|
||||||
|
formMain.ageAll = data.govAge
|
||||||
|
formMain.absent = data.govAgeAbsent
|
||||||
|
formMain.age = data.govAgePlus
|
||||||
|
|
||||||
|
|
||||||
|
}).catch((e)=>{
|
||||||
|
messageError($q,e)
|
||||||
|
}).finally(()=>{
|
||||||
|
hideLoader()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/** ดึงข้อมูลประวัติ */
|
/** ดึงข้อมูลประวัติ */
|
||||||
function getDataHistory() {
|
function getDataHistory() {
|
||||||
// showLoader();
|
showLoader();
|
||||||
// http
|
http
|
||||||
// .get(config.API.profileGovHisId(route.params.id.toString()))
|
.get(config.API.profileNewGovernmentHistory(profileId.value))
|
||||||
// .then((res) => {
|
.then((res) => {
|
||||||
// let data = res.data.result;
|
let data = res.data.result;
|
||||||
// rowsHistory.value = [];
|
rowsHistory.value = [];
|
||||||
// data.map((e: RequestItemsHistoryObject) => {
|
data.map((e: RequestItemsHistoryObject) => {
|
||||||
// rowsHistory.value.push({
|
rowsHistory.value.push({
|
||||||
// oc: e.oc,
|
oc: e.oc,
|
||||||
// position: e.position,
|
position: e.position,
|
||||||
// positionPathSide: e.positionPathSide,
|
positionPathSide: e.positionPathSide,
|
||||||
// posNo: e.posNo,
|
posNo: e.posNo,
|
||||||
// positionLine: e.positionLine,
|
positionLine: e.positionLine,
|
||||||
// positionType: e.positionType,
|
positionType: e.positionType,
|
||||||
// positionLevel: e.positionLevel,
|
positionLevel: e.positionLevel,
|
||||||
// positionExecutive: e.positionExecutive,
|
positionExecutive: e.positionExecutive,
|
||||||
// positionExecutiveSide: e.positionExecutiveSide,
|
positionExecutiveSide: e.positionExecutiveSide,
|
||||||
// dateAppoint: new Date(e.dateAppoint),
|
dateAppoint: new Date(e.dateAppoint),
|
||||||
// dateStart: new Date(e.dateStart),
|
dateStart: new Date(e.dateStart),
|
||||||
// retireDate: e.retireDate,
|
retireDate: e.retireDate,
|
||||||
// govAge: e.govAge,
|
govAge: e.govAge,
|
||||||
// govAgeAbsent: e.govAgeAbsent,
|
govAgeAbsent: e.govAgeAbsent,
|
||||||
// govAgePlus: e.govAgePlus,
|
govAgePlus: e.govAgePlus,
|
||||||
// reasonSameDate: e.reasonSameDate,
|
reasonSameDate: e.reasonSameDate,
|
||||||
// createdFullName: e.createdFullName,
|
createdFullName: e.createdFullName,
|
||||||
// createdAt: new Date(e.createdAt),
|
createdAt: new Date(e.createdAt),
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
// })
|
})
|
||||||
// .catch((e) => {
|
.catch((e) => {
|
||||||
// messageError($q, e);
|
messageError($q, e);
|
||||||
// })
|
})
|
||||||
// .finally(() => {
|
.finally(() => {
|
||||||
// hideLoader();
|
hideLoader();
|
||||||
// });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|
@ -390,17 +443,9 @@ watch(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const fieldLabels = {
|
onMounted(()=>{
|
||||||
ocId: "สังกัด",
|
getData()
|
||||||
positionId: "ตำแหน่ง",
|
})
|
||||||
numberId: "เลขที่ตำแหน่ง",
|
|
||||||
positionExecutive: "ตำแหน่งทางการบริหาร",
|
|
||||||
positionExecutiveSide: "ด้านตำแหน่งทางการบริหาร",
|
|
||||||
positionLine: "สายงาน",
|
|
||||||
positionLevel: "ระดับ",
|
|
||||||
positionType: "ประเภท",
|
|
||||||
positionPathSide: "ด้าน/สาขา",
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
@ -439,7 +484,7 @@ const fieldLabels = {
|
||||||
}}</span>
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-sm-12 col-md-8">
|
<div class="col-12 col-sm-12 col-md-8">
|
||||||
<span>{{ formMain[field] !== "" ? formMain[field] : "-" }}</span>
|
<span>{{ formMain[field] ? formMain[field] : "-" }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -455,7 +500,7 @@ const fieldLabels = {
|
||||||
}}</span>
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-sm-12 col-md-8">
|
<div class="col-12 col-sm-12 col-md-8">
|
||||||
<span>{{ formMain[field] !== "" ? formMain[field] : "-" }}</span>
|
<span>{{ formMain[field] ? formMain[field] : "-" }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -772,7 +817,8 @@ const fieldLabels = {
|
||||||
v-if="
|
v-if="
|
||||||
col.name == 'dateStart' ||
|
col.name == 'dateStart' ||
|
||||||
col.name == 'dateAppoint' ||
|
col.name == 'dateAppoint' ||
|
||||||
col.name == 'createdAt'
|
col.name == 'createdAt' ||
|
||||||
|
col.name == 'retireDate'
|
||||||
"
|
"
|
||||||
class="table_ellipsis"
|
class="table_ellipsis"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -55,18 +55,6 @@ const formFilter = reactive<FormFilter>({
|
||||||
isProbation: false,
|
isProbation: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const formData = reactive<DetailData>({
|
|
||||||
id: "",
|
|
||||||
typeLeave: "",
|
|
||||||
dateStartLeave: null,
|
|
||||||
dateEndLeave: null,
|
|
||||||
numLeave: 0,
|
|
||||||
sumLeave: 0,
|
|
||||||
totalLeave: 0,
|
|
||||||
status: "",
|
|
||||||
reason: "",
|
|
||||||
typeLeaveId: "",
|
|
||||||
});
|
|
||||||
|
|
||||||
const modal = ref<boolean>(false);
|
const modal = ref<boolean>(false);
|
||||||
const edit = ref<boolean>(false);
|
const edit = ref<boolean>(false);
|
||||||
|
|
@ -76,7 +64,7 @@ const reason = ref<string>(""); //เหตุผล
|
||||||
const numLeave = ref<number>(0);
|
const numLeave = ref<number>(0);
|
||||||
const dateRange = ref<[Date, Date]>([new Date(), new Date()]);
|
const dateRange = ref<[Date, Date]>([new Date(), new Date()]);
|
||||||
const numUsedLeave = ref<number>(0);
|
const numUsedLeave = ref<number>(0);
|
||||||
const typeLeave = ref<string>("");
|
const typeLeave = ref<any>();
|
||||||
const typeLeaveOption = ref<DataOptionLeave[]>([]);
|
const typeLeaveOption = ref<DataOptionLeave[]>([]);
|
||||||
const typeLeaveOptionFilter = ref<DataOptionLeave[]>([]);
|
const typeLeaveOptionFilter = ref<DataOptionLeave[]>([]);
|
||||||
|
|
||||||
|
|
@ -235,23 +223,20 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
|
|
||||||
function openDialogAdd() {
|
function openDialogAdd() {
|
||||||
modal.value = true;
|
modal.value = true;
|
||||||
|
edit.value = false;
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.get(config.API.profileLeaveTotalId(profileId.value))
|
.get(config.API.profileNewLeaveType())
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
let data = res.data.result;
|
console.log(res.data.result);
|
||||||
typeLeaveOption.value = data;
|
const dataOp = res.data.result.map((item: any) => ({
|
||||||
typeLeaveOptionFilter.value = data;
|
id: item.id,
|
||||||
data.map((e: ResponseTotalObject) => {
|
name: item.name,
|
||||||
rowsTotal.value.push({
|
code: item.code,
|
||||||
typeLeaveId: e.typeLeaveId,
|
}));
|
||||||
totalLeave: e.totalLeave,
|
|
||||||
limitLeave: e.limitLeave,
|
typeLeaveOption.value = dataOp;
|
||||||
remainLeave: e.remainLeave,
|
typeLeaveOptionFilter.value = dataOp;
|
||||||
typeLeave: e.typeLeave,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -269,20 +254,15 @@ function clickTotal() {
|
||||||
rowsTotal.value = [];
|
rowsTotal.value = [];
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.get(config.API.profileLeaveTotalId(profileId.value))
|
.get(config.API.profileNewLeaveType())
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
let data = res.data.result;
|
const dataOp = res.data.result.map((item: DataOption) => ({
|
||||||
typeLeaveOption.value = data;
|
id: item.id,
|
||||||
typeLeaveOptionFilter.value = data;
|
name: item.name,
|
||||||
data.map((e: ResponseTotalObject) => {
|
}));
|
||||||
rowsTotal.value.push({
|
|
||||||
typeLeaveId: e.typeLeaveId,
|
typeLeaveOption.value = dataOp;
|
||||||
totalLeave: e.totalLeave,
|
typeLeaveOptionFilter.value = dataOp;
|
||||||
limitLeave: e.limitLeave,
|
|
||||||
remainLeave: e.remainLeave,
|
|
||||||
typeLeave: e.typeLeave,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -293,10 +273,10 @@ function clickTotal() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function openDialogEdit(props: DetailData) {
|
function openDialogEdit(props: DetailData) {
|
||||||
|
edit.value = true;
|
||||||
modal.value = true;
|
modal.value = true;
|
||||||
formData.id = props.id;
|
|
||||||
id.value = props.id;
|
id.value = props.id;
|
||||||
typeLeave.value = props.typeLeave;
|
typeLeave.value = {id:props.typeLeaveId,name:props.typeLeave,code:props.code};
|
||||||
statLeave.value = props.status;
|
statLeave.value = props.status;
|
||||||
reason.value = props.reason;
|
reason.value = props.reason;
|
||||||
dateRange.value = [
|
dateRange.value = [
|
||||||
|
|
@ -392,7 +372,7 @@ function validateForm() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hasError.every((result) => result === true)) {
|
if (hasError.every((result) => result === true)) {
|
||||||
if ((edit.value = false)) {
|
if (edit.value == false) {
|
||||||
saveData();
|
saveData();
|
||||||
} else {
|
} else {
|
||||||
editData();
|
editData();
|
||||||
|
|
@ -404,76 +384,113 @@ function validateForm() {
|
||||||
* บันทึกเพิ่มข้อมูล
|
* บันทึกเพิ่มข้อมูล
|
||||||
*/
|
*/
|
||||||
function saveData() {
|
function saveData() {
|
||||||
// showLoader();
|
showLoader();
|
||||||
// await http
|
http
|
||||||
// .post(config.API.profileLeaveId(profileId.value), {
|
.post(config.API.profileNewLeave(), {
|
||||||
// dateStartLeave: dateToISO(dateRange.value[0]),
|
profileId: profileId.value,
|
||||||
// dateEndLeave: dateToISO(dateRange.value[1]),
|
leaveTypeId: typeLeave.value.id,
|
||||||
// numLeave: numLeave.value,
|
dateLeave: dateRange.value[0],
|
||||||
// sumLeave: numUsedLeave.value,
|
// dateStartLeave: dateToISO(dateRange.value[0]),
|
||||||
// totalLeave: sum,
|
// dateEndLeave: dateToISO(dateRange.value[1]),
|
||||||
// status: statLeave.value,
|
leaveDays: numLeave.value,
|
||||||
// reason: reason.value,
|
leaveCount: 0,
|
||||||
// typeLeaveId: typeLeave.value,
|
totalLeave: 0,
|
||||||
// })
|
status: statLeave.value,
|
||||||
// .then((res) => {
|
reason: reason.value,
|
||||||
// success($q, "บันทึกข้อมูลสำเร็จ");
|
})
|
||||||
// modalAdd.value = false;
|
.then((res) => {
|
||||||
// })
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
// .catch((e) => {
|
closeDialog();
|
||||||
// messageError($q, e);
|
})
|
||||||
// })
|
.catch((e) => {
|
||||||
// .finally(async () => {
|
messageError($q, e);
|
||||||
// await fetchData();
|
})
|
||||||
// });
|
.finally(() => {
|
||||||
closeDialog();
|
getData();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* บันทึกแก้ไขข้อมูล
|
* บันทึกแก้ไขข้อมูล
|
||||||
*/
|
*/
|
||||||
const editData = async () => {
|
const editData = async () => {
|
||||||
// showLoader();
|
showLoader();
|
||||||
// await http
|
http
|
||||||
// .put(config.API.profileLeaveId(id.value), {
|
.patch(config.API.profileNewLeaveById(id.value), {
|
||||||
// dateStartLeave: dateToISO(dateRange.value[0]),
|
leaveTypeId: typeLeave.value.id,
|
||||||
// dateEndLeave: dateToISO(dateRange.value[1]),
|
dateLeave: dateRange.value[0],
|
||||||
// numLeave: numLeave.value,
|
// dateStartLeave: dateToISO(dateRange.value[0]),
|
||||||
// sumLeave: numUsedLeave.value,
|
// dateEndLeave: dateToISO(dateRange.value[1]),
|
||||||
// totalLeave: sum,
|
leaveDays: numLeave.value,
|
||||||
// status: statLeave.value,
|
leaveCount: 0,
|
||||||
// reason: reason.value,
|
totalLeave: 0,
|
||||||
// typeLeaveId: typeLeave.value,
|
status: statLeave.value,
|
||||||
// })
|
reason: reason.value,
|
||||||
// .then((res) => {
|
})
|
||||||
// success($q, "บันทึกข้อมูลสำเร็จ");
|
.then((res) => {
|
||||||
// modalAdd.value = false;
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
// })
|
closeDialog();
|
||||||
// .catch((e) => {
|
})
|
||||||
// messageError($q, e);
|
.catch((e) => {
|
||||||
// })
|
messageError($q, e);
|
||||||
// .finally(async () => {
|
})
|
||||||
// await fetchData();
|
.finally(() => {
|
||||||
// });
|
getData();
|
||||||
closeDialog();
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function getData() {
|
||||||
|
showLoader();
|
||||||
|
http
|
||||||
|
.get(config.API.profileNewLeaveById(profileId.value))
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res.data.result);
|
||||||
|
const data = res.data.result;
|
||||||
|
rows.value = data.map((item: any) => ({
|
||||||
|
id: item.id,
|
||||||
|
typeLeave: item.leaveType.name,
|
||||||
|
code: item.leaveType.refCommandDate,
|
||||||
|
dateStartLeave: item.dateStartLeave,
|
||||||
|
dateEndLeave: item.dateEndLeave,
|
||||||
|
numLeave: item.leaveDays,
|
||||||
|
sumLeave: item.leaveCount,
|
||||||
|
totalLeave: item.totalLeave,
|
||||||
|
status: item.status,
|
||||||
|
reason: item.reason,
|
||||||
|
typeLeaveId: item.leaveTypeId,
|
||||||
|
}));
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
// messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function dateCheck() {
|
||||||
|
http
|
||||||
|
.post(config.API.profileCheckDate(), {
|
||||||
|
type: typeLeave.value.id,
|
||||||
|
StartLeaveDate: dateRange.value[0],
|
||||||
|
EndLeaveDate: dateRange.value[1],
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
const day = res.data.result;
|
||||||
|
if (
|
||||||
|
typeLeave.value.code !== "LV-001" &&
|
||||||
|
typeLeave.value.code !== "LV-002" &&
|
||||||
|
typeLeave.value.code !== "LV-004" &&
|
||||||
|
typeLeave.value.code !== "LV-005"
|
||||||
|
) {
|
||||||
|
numLeave.value = day.totalDate;
|
||||||
|
} else {
|
||||||
|
numLeave.value = day.totalDate - day.sumDateHoliday;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const data = [
|
getData();
|
||||||
{
|
|
||||||
id: "test",
|
|
||||||
typeLeave: "ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล",
|
|
||||||
typeLeaveId: "08db52ec-d1c1-4ecc-868c-ff2a3bcdb32a",
|
|
||||||
dateStartLeave: new Date("2024-02-20T12:59:47.193103"),
|
|
||||||
dateEndLeave: new Date("2024-02-25T12:59:47.193103"),
|
|
||||||
numLeave: 0,
|
|
||||||
sumLeave: 0,
|
|
||||||
totalLeave: 0,
|
|
||||||
status: "reject",
|
|
||||||
reason: "test",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
rows.value = data;
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -748,7 +765,6 @@ onMounted(() => {
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
:label="`${'ประเภทการลา'}`"
|
:label="`${'ประเภทการลา'}`"
|
||||||
@update:modelValue="clickEditRowType"
|
@update:modelValue="clickEditRowType"
|
||||||
emit-value
|
|
||||||
map-options
|
map-options
|
||||||
option-label="name"
|
option-label="name"
|
||||||
:options="typeLeaveOption"
|
:options="typeLeaveOption"
|
||||||
|
|
@ -762,6 +778,7 @@ onMounted(() => {
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||||
<datepicker
|
<datepicker
|
||||||
|
:readonly="!typeLeave"
|
||||||
menu-class-name="modalfix"
|
menu-class-name="modalfix"
|
||||||
v-model="dateRange"
|
v-model="dateRange"
|
||||||
:locale="'th'"
|
:locale="'th'"
|
||||||
|
|
@ -769,6 +786,7 @@ onMounted(() => {
|
||||||
:enableTimePicker="false"
|
:enableTimePicker="false"
|
||||||
week-start="0"
|
week-start="0"
|
||||||
range
|
range
|
||||||
|
@update:modelValue="dateCheck"
|
||||||
>
|
>
|
||||||
<template #year="{ year }">{{ year + 543 }}</template>
|
<template #year="{ year }">{{ year + 543 }}</template>
|
||||||
<template #year-overlay-value="{ value }">{{
|
<template #year-overlay-value="{ value }">{{
|
||||||
|
|
@ -776,6 +794,7 @@ onMounted(() => {
|
||||||
}}</template>
|
}}</template>
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<q-input
|
<q-input
|
||||||
|
:readonly="!typeLeave"
|
||||||
class="full-width inputgreen cursor-pointer"
|
class="full-width inputgreen cursor-pointer"
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
|
|
@ -803,6 +822,7 @@ onMounted(() => {
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||||
<q-input
|
<q-input
|
||||||
|
readonly
|
||||||
ref="numLeaveRef"
|
ref="numLeaveRef"
|
||||||
class="full-width inputgreen cursor-pointer"
|
class="full-width inputgreen cursor-pointer"
|
||||||
outlined
|
outlined
|
||||||
|
|
|
||||||
|
|
@ -138,15 +138,16 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
]);
|
]);
|
||||||
function getHistory() {
|
function getHistory() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.get(config.API.profileLeaveHisId(id.value))
|
.get(config.API.profileNewLeaveHistory(id.value))
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
let data = res.data.result;
|
let data = res.data.result;
|
||||||
rows.value = [];
|
rows.value = [];
|
||||||
data.map((e: DetailData) => {
|
data.map((e: any) => {
|
||||||
rows.value.push({
|
rows.value.push({
|
||||||
id: e.id,
|
id: e.id,
|
||||||
typeLeave: e.typeLeave,
|
typeLeave: e.leaveType.name,
|
||||||
|
code: e.leaveType.refCommandDate,
|
||||||
dateStartLeave: new Date(e.dateStartLeave as Date),
|
dateStartLeave: new Date(e.dateStartLeave as Date),
|
||||||
dateEndLeave: new Date(e.dateEndLeave as Date),
|
dateEndLeave: new Date(e.dateEndLeave as Date),
|
||||||
numLeave: e.numLeave,
|
numLeave: e.numLeave,
|
||||||
|
|
@ -162,7 +163,7 @@ http
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
// messageError($q, e);
|
// messageError($q, e);
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ interface DetailData {
|
||||||
status: string;
|
status: string;
|
||||||
reason: string;
|
reason: string;
|
||||||
typeLeaveId: string;
|
typeLeaveId: string;
|
||||||
|
code: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FormFilter {
|
interface FormFilter {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue