ปรับ Code การลาลงเวลา
This commit is contained in:
parent
d150dedb81
commit
99419877c4
42 changed files with 123 additions and 148 deletions
|
|
@ -16,7 +16,7 @@ import DialogHeader from "@/components/DialogHeader.vue";
|
|||
const $q = useQuasar();
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { dialogConfirm, success, messageError } = mixin;
|
||||
const { dialogConfirm, success, messageError, showLoader, hideLoader } = mixin;
|
||||
const isRead = defineModel<boolean>("isRead", { required: true });
|
||||
/** propsData จาก RoundMain */
|
||||
const props = defineProps({
|
||||
|
|
@ -104,22 +104,25 @@ function onSubmit() {
|
|||
|
||||
/** Function สร้างรอบการปฏิบัติงาน*/
|
||||
async function postRoundDuty() {
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.roundDutytime(), formData)
|
||||
.then(() => {
|
||||
.then(async () => {
|
||||
await props.fetchData?.();
|
||||
await props.closeDialog?.();
|
||||
success($q, "บันทึกข้อมูล");
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
props.fetchData?.();
|
||||
props.closeDialog?.();
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/** Functiom แก้ไข้รอบการปฏิบัติงาน*/
|
||||
async function putRoundDuty(id: string) {
|
||||
showLoader();
|
||||
const data = {
|
||||
description: formData.description,
|
||||
isDefault: formData.isDefault,
|
||||
|
|
@ -127,15 +130,16 @@ async function putRoundDuty(id: string) {
|
|||
};
|
||||
await http
|
||||
.put(config.API.roundDutytimeByid(id), data)
|
||||
.then(() => {
|
||||
.then(async () => {
|
||||
await props.fetchData?.();
|
||||
await props.closeDialog?.();
|
||||
success($q, "บันทึกข้อมูล");
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
props.fetchData?.();
|
||||
props.closeDialog?.();
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -8,7 +8,7 @@ import { useQuasar } from "quasar";
|
|||
import type { FormDetail } from "@/modules/09_leave/interface/response/work";
|
||||
|
||||
/** importComponents*/
|
||||
import Map from "@/modules/09_leave/components/1_Work/DialogMap.vue";
|
||||
import Map from "@/modules/09_leave/components/02_WorkList/DialogMap.vue";
|
||||
|
||||
/** importStores */
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
|
@ -65,7 +65,9 @@ async function onClickSave() {
|
|||
showLoader();
|
||||
await http
|
||||
.put(config.API.leaveEditCheckin(props.detail?.id), body)
|
||||
.then(() => {
|
||||
.then(async () => {
|
||||
await props.fetchData?.();
|
||||
await props.close?.();
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -73,14 +75,12 @@ async function onClickSave() {
|
|||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
props.fetchData?.();
|
||||
props.close?.();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function filterFnOptions(val: any, update: Function) {
|
||||
function filterFnOptions(val: string, update: Function) {
|
||||
update(() => {
|
||||
options.value = optionsMain.value.filter(
|
||||
(v: DataOption) => v.name.indexOf(val) > -1
|
||||
|
|
@ -143,7 +143,7 @@ watch(
|
|||
:rules="[(val:string) => !!val || `${'กรุณาเลือกสถานะ'}`]"
|
||||
hide-bottom-space
|
||||
use-input
|
||||
@filter="(inputValue: any,doneFn: Function) => filterFnOptions(inputValue, doneFn)"
|
||||
@filter="(inputValue: string,doneFn: Function) => filterFnOptions(inputValue, doneFn)"
|
||||
><template v-slot:no-option>
|
||||
<q-item>
|
||||
<q-item-section class="text-grey">
|
||||
|
|
@ -178,7 +178,7 @@ watch(
|
|||
:rules="[(val:string) => !!val || `${'กรุณาเลือกสถานะ'}`]"
|
||||
hide-bottom-space
|
||||
use-input
|
||||
@filter="(inputValue: any,doneFn: Function) => filterFnOptions(inputValue, doneFn)"
|
||||
@filter="(inputValue: string,doneFn: Function) => filterFnOptions(inputValue, doneFn)"
|
||||
><template v-slot:no-option>
|
||||
<q-item>
|
||||
<q-item-section class="text-grey">
|
||||
|
|
@ -21,8 +21,8 @@ const mixin = useCounterMixin();
|
|||
const $q = useQuasar();
|
||||
const { date2Thai, monthYear2Thai, dateToISO, messageError } = mixin;
|
||||
|
||||
const apiGenReport =
|
||||
"https://report-server.frappet.synology.me/api/v1/report-template/xlsx";
|
||||
// const apiGenReport =
|
||||
// "https://report-server.frappet.synology.me/api/v1/report-template/xlsx";
|
||||
|
||||
const props = defineProps({
|
||||
modal: {
|
||||
|
|
@ -126,7 +126,7 @@ function filterFnOptions(val: any, update: Function) {
|
|||
*/
|
||||
async function genReportXLSX(data: any) {
|
||||
await axios
|
||||
.post(apiGenReport, data, {
|
||||
.post(`${config.API.reportTemplate}/xlsx`, data, {
|
||||
headers: {
|
||||
accept:
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
|
|
@ -134,9 +134,9 @@ async function genReportXLSX(data: any) {
|
|||
},
|
||||
responseType: "blob",
|
||||
})
|
||||
.then((res) => {
|
||||
.then(async (res) => {
|
||||
const blob = new Blob([res.data]);
|
||||
downloadReport(blob, "xlsx");
|
||||
await downloadReport(blob, "xlsx");
|
||||
})
|
||||
.catch(async (e) => {
|
||||
messageError($q, JSON.parse(await e.response.data.text()));
|
||||
|
|
@ -12,8 +12,8 @@ import type {
|
|||
} from "@/modules/09_leave/interface/response/work";
|
||||
|
||||
/** importComponents */
|
||||
import ToolBar from "@/modules/09_leave/components/1_Work/ToolBar.vue";
|
||||
import TableList from "@/modules/09_leave/components/1_Work/TableList.vue";
|
||||
import ToolBar from "@/modules/09_leave/components/02_WorkList/ToolBar.vue";
|
||||
import TableList from "@/modules/09_leave/components/02_WorkList/TableList.vue";
|
||||
|
||||
/** importStores */
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
|
@ -121,6 +121,7 @@ const rows = ref<TableRowsTime[]>([]);
|
|||
|
||||
/** function เรียกข้อมูล รายการลงเวลาที่ประมวลผลแล้ว*/
|
||||
async function fetchListTimeRecord() {
|
||||
rows.value = [];
|
||||
const date = new Date(workStore.selectDate as string | Date);
|
||||
const querySting = {
|
||||
startDate: dateToISO(date), //*วันที่เริ่ม
|
||||
|
|
@ -12,8 +12,8 @@ import type {
|
|||
} from "@/modules/09_leave/interface/response/work";
|
||||
|
||||
/** importComponents */
|
||||
import ToolBarDate from "@/modules/09_leave/components/1_Work/ToolBarDate.vue";
|
||||
import TableList from "@/modules/09_leave/components/1_Work/TableList.vue";
|
||||
import ToolBarDate from "@/modules/09_leave/components/02_WorkList/ToolBarDate.vue";
|
||||
import TableList from "@/modules/09_leave/components/02_WorkList/TableList.vue";
|
||||
|
||||
/** importStores */
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
|
@ -102,6 +102,7 @@ const maxPage = ref<number>(1);
|
|||
|
||||
/** function เรียกข้อมูลรายการลงเวลาปฏิบัติงาน (รายการลงเวลา) */
|
||||
async function fetchListLogRecord() {
|
||||
rows.value = [];
|
||||
showLoader();
|
||||
const date = new Date(workStore.selectDate as string | Date);
|
||||
await http
|
||||
|
|
@ -132,7 +133,6 @@ async function fetchListLogRecord() {
|
|||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
rows.value = [];
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
|
|
@ -5,8 +5,8 @@ import { checkPermission } from "@/utils/permissions";
|
|||
import { useWorklistDataStore } from "@/modules/09_leave/stores/WorkStore";
|
||||
|
||||
/** importComponents */
|
||||
import DialogDetail from "@/modules/09_leave/components/1_Work/DialogDetail.vue";
|
||||
import DialogEdit from "@/modules/09_leave/components/1_Work/DialogEdit.vue";
|
||||
import DialogDetail from "@/modules/09_leave/components/02_WorkList/DialogDetail.vue";
|
||||
import DialogEdit from "@/modules/09_leave/components/02_WorkList/DialogEdit.vue";
|
||||
|
||||
const workStore = useWorklistDataStore();
|
||||
const props = defineProps({
|
||||
|
|
@ -44,7 +44,7 @@ const emit = defineEmits(["update:pagination"]);
|
|||
|
||||
/** ข้อมูล popup */
|
||||
const modal = ref<boolean>(false);
|
||||
const dataDetail = ref<any>([]);
|
||||
const dataDetail = ref<any>();
|
||||
const modalEdit = ref<boolean>(false);
|
||||
|
||||
/** pagination */
|
||||
|
|
@ -16,18 +16,18 @@ import type { LeaveType } from "@/modules/09_leave/interface/response/leave";
|
|||
|
||||
/** importForm*/
|
||||
import DialogReason from "@/components/Dialogs/PopupReason.vue";
|
||||
import FormMain from "@/modules/09_leave/components/2_Leave/formDetail/formMain.vue"; // from ซ้าย
|
||||
import FormLeave from "@/modules/09_leave/components/2_Leave/formDetail/formLeave.vue"; // ลาป่วย ลาคลอดบุตร และลากิจส่วนตัว
|
||||
import FormChildbirth from "@/modules/09_leave/components/2_Leave/formDetail/formChildbirth.vue"; // ลาไปช่วยเหลือภริยาที่คลอดบุตร
|
||||
import FormHoliday from "@/modules/09_leave/components/2_Leave/formDetail/formHoliday.vue"; //ลาพักผ่อน
|
||||
import FormUpasom from "@/modules/09_leave/components/2_Leave/formDetail/formUpasom.vue"; // ลาอุปสมบท
|
||||
import FormHajj from "@/modules/09_leave/components/2_Leave/formDetail/formHajj.vue"; //ลาประกอบพิธีฮัจญ์
|
||||
import FormCheckSelect from "@/modules/09_leave/components/2_Leave/formDetail/formCheckSelect.vue"; //ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล
|
||||
import FormStudy from "@/modules/09_leave/components/2_Leave/formDetail/formStudy.vue"; //ลาไปศึกษา
|
||||
import FormLeaveToTraining from "@/modules/09_leave/components/2_Leave/formDetail/formLeaveToTraining.vue"; // ลาไปฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน
|
||||
import FormLeaveToWorkInternational from "@/modules/09_leave/components/2_Leave/formDetail/formLeaveToWorkInternational.vue"; // ลาไปปฏิบัติงานในองค์การระหว่างประเทศ
|
||||
import FormSpouse from "@/modules/09_leave/components/2_Leave/formDetail/formSpouse.vue"; // ลาติดตามคู่สมรส
|
||||
import FormVocationalRehabilitation from "@/modules/09_leave/components/2_Leave/formDetail/formVocationalRehabilitation.vue"; //ลาไปฟื้นฟูสมรรถภาพด้านอาชีพ
|
||||
import FormMain from "@/modules/09_leave/components/05_Leave/formDetail/formMain.vue"; // from ซ้าย
|
||||
import FormLeave from "@/modules/09_leave/components/05_Leave/formDetail/formLeave.vue"; // ลาป่วย ลาคลอดบุตร และลากิจส่วนตัว
|
||||
import FormChildbirth from "@/modules/09_leave/components/05_Leave/formDetail/formChildbirth.vue"; // ลาไปช่วยเหลือภริยาที่คลอดบุตร
|
||||
import FormHoliday from "@/modules/09_leave/components/05_Leave/formDetail/formHoliday.vue"; //ลาพักผ่อน
|
||||
import FormUpasom from "@/modules/09_leave/components/05_Leave/formDetail/formUpasom.vue"; // ลาอุปสมบท
|
||||
import FormHajj from "@/modules/09_leave/components/05_Leave/formDetail/formHajj.vue"; //ลาประกอบพิธีฮัจญ์
|
||||
import FormCheckSelect from "@/modules/09_leave/components/05_Leave/formDetail/formCheckSelect.vue"; //ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล
|
||||
import FormStudy from "@/modules/09_leave/components/05_Leave/formDetail/formStudy.vue"; //ลาไปศึกษา
|
||||
import FormLeaveToTraining from "@/modules/09_leave/components/05_Leave/formDetail/formLeaveToTraining.vue"; // ลาไปฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน
|
||||
import FormLeaveToWorkInternational from "@/modules/09_leave/components/05_Leave/formDetail/formLeaveToWorkInternational.vue"; // ลาไปปฏิบัติงานในองค์การระหว่างประเทศ
|
||||
import FormSpouse from "@/modules/09_leave/components/05_Leave/formDetail/formSpouse.vue"; // ลาติดตามคู่สมรส
|
||||
import FormVocationalRehabilitation from "@/modules/09_leave/components/05_Leave/formDetail/formVocationalRehabilitation.vue"; //ลาไปฟื้นฟูสมรรถภาพด้านอาชีพ
|
||||
import WorkFlow from "@/components/Workflow/Main.vue";
|
||||
|
||||
/** use */
|
||||
|
|
@ -19,18 +19,18 @@ import type { FremData } from "@/modules/09_leave/interface/request/leave";
|
|||
|
||||
/** importForm*/
|
||||
import DialogReason from "@/components/Dialogs/PopupReason.vue";
|
||||
import FormMain from "@/modules/09_leave/components/2_Leave/formDetail/formMain.vue"; // from ซ้าย
|
||||
import FormLeave from "@/modules/09_leave/components/2_Leave/formDetail/formLeave.vue"; // ลาป่วย ลาคลอดบุตร และลากิจส่วนตัว
|
||||
import FormChildbirth from "@/modules/09_leave/components/2_Leave/formDetail/formChildbirth.vue"; // ลาไปช่วยเหลือภริยาที่คลอดบุตร
|
||||
import FormHoliday from "@/modules/09_leave/components/2_Leave/formDetail/formHoliday.vue"; //ลาพักผ่อน
|
||||
import FormUpasom from "@/modules/09_leave/components/2_Leave/formDetail/formUpasom.vue"; // ลาอุปสมบท
|
||||
import FormHajj from "@/modules/09_leave/components/2_Leave/formDetail/formHajj.vue"; //ลาประกอบพิธีฮัจญ์
|
||||
import FormCheckSelect from "@/modules/09_leave/components/2_Leave/formDetail/formCheckSelect.vue"; //ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล
|
||||
import FormStudy from "@/modules/09_leave/components/2_Leave/formDetail/formStudy.vue"; //ลาไปศึกษา
|
||||
import FormLeaveToTraining from "@/modules/09_leave/components/2_Leave/formDetail/formLeaveToTraining.vue"; // ลาไปฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน
|
||||
import FormLeaveToWorkInternational from "@/modules/09_leave/components/2_Leave/formDetail/formLeaveToWorkInternational.vue"; // ลาไปปฏิบัติงานในองค์การระหว่างประเทศ
|
||||
import FormSpouse from "@/modules/09_leave/components/2_Leave/formDetail/formSpouse.vue"; // ลาติดตามคู่สมรส
|
||||
import FormVocationalRehabilitation from "@/modules/09_leave/components/2_Leave/formDetail/formVocationalRehabilitation.vue"; //ลาไปฟื้นฟูสมรรถภาพด้านอาชีพ
|
||||
import FormMain from "@/modules/09_leave/components/05_Leave/formDetail/formMain.vue"; // from ซ้าย
|
||||
import FormLeave from "@/modules/09_leave/components/05_Leave/formDetail/formLeave.vue"; // ลาป่วย ลาคลอดบุตร และลากิจส่วนตัว
|
||||
import FormChildbirth from "@/modules/09_leave/components/05_Leave/formDetail/formChildbirth.vue"; // ลาไปช่วยเหลือภริยาที่คลอดบุตร
|
||||
import FormHoliday from "@/modules/09_leave/components/05_Leave/formDetail/formHoliday.vue"; //ลาพักผ่อน
|
||||
import FormUpasom from "@/modules/09_leave/components/05_Leave/formDetail/formUpasom.vue"; // ลาอุปสมบท
|
||||
import FormHajj from "@/modules/09_leave/components/05_Leave/formDetail/formHajj.vue"; //ลาประกอบพิธีฮัจญ์
|
||||
import FormCheckSelect from "@/modules/09_leave/components/05_Leave/formDetail/formCheckSelect.vue"; //ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล
|
||||
import FormStudy from "@/modules/09_leave/components/05_Leave/formDetail/formStudy.vue"; //ลาไปศึกษา
|
||||
import FormLeaveToTraining from "@/modules/09_leave/components/05_Leave/formDetail/formLeaveToTraining.vue"; // ลาไปฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน
|
||||
import FormLeaveToWorkInternational from "@/modules/09_leave/components/05_Leave/formDetail/formLeaveToWorkInternational.vue"; // ลาไปปฏิบัติงานในองค์การระหว่างประเทศ
|
||||
import FormSpouse from "@/modules/09_leave/components/05_Leave/formDetail/formSpouse.vue"; // ลาติดตามคู่สมรส
|
||||
import FormVocationalRehabilitation from "@/modules/09_leave/components/05_Leave/formDetail/formVocationalRehabilitation.vue"; //ลาไปฟื้นฟูสมรรถภาพด้านอาชีพ
|
||||
import WorkFlow from "@/components/Workflow/Main.vue";
|
||||
|
||||
/** use */
|
||||
|
|
@ -8,14 +8,11 @@ import { useCounterMixin } from "@/stores/mixin";
|
|||
import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
|
||||
|
||||
/**importType*/
|
||||
import type {
|
||||
QuerySting,
|
||||
DateFilter,
|
||||
} from "@/modules/09_leave/interface/request/leave";
|
||||
import type { QuerySting } from "@/modules/09_leave/interface/request/leave";
|
||||
|
||||
import TableList from "@/modules/09_leave/components/2_Leave/TableList.vue";
|
||||
import ToolBar from "@/modules/09_leave/components/2_Leave/ToolBarLeave.vue";
|
||||
import CalendarView from "@/modules/09_leave/components/2_Leave/Calendar.vue";
|
||||
import TableList from "@/modules/09_leave/components/05_Leave/TableList.vue";
|
||||
import ToolBar from "@/modules/09_leave/components/05_Leave/ToolBarLeave.vue";
|
||||
import CalendarView from "@/modules/09_leave/components/05_Leave/Calendar.vue";
|
||||
|
||||
const $q = useQuasar(); //ใช้ noti quasar
|
||||
const mixin = useCounterMixin();
|
||||
|
|
@ -49,13 +46,13 @@ async function fecthLeaveList() {
|
|||
showLoader();
|
||||
await http
|
||||
.post(config.API.leaveList(), querySting)
|
||||
.then((res) => {
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
totalList.value = Math.ceil(
|
||||
res.data.result.total / querySting.pageSize
|
||||
);
|
||||
total.value = res.data.result.total;
|
||||
leaveStore.fetchListLeave(data.data); /** ส่งข้อมูลไป stores*/
|
||||
await leaveStore.fetchListLeave(data.data); /** ส่งข้อมูลไป stores*/
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -75,8 +72,7 @@ async function fetchOption() {
|
|||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {});
|
||||
});
|
||||
}
|
||||
|
||||
function getSearch() {
|
||||
|
|
@ -95,13 +91,12 @@ watch(
|
|||
() => leaveStore.tabView,
|
||||
async () => {
|
||||
leaveStore.tabView === "list" &&
|
||||
(await fecthLeaveList(), await fetchOption());
|
||||
(await Promise.all([fetchOption(), fecthLeaveList()]));
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchOption();
|
||||
await fecthLeaveList();
|
||||
await Promise.all([fetchOption(), fecthLeaveList()]);
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
|
|
@ -144,7 +139,12 @@ onMounted(async () => {
|
|||
</q-tabs>
|
||||
</q-toolbar>
|
||||
<div v-if="leaveStore.tabView === 'list'">
|
||||
<ToolBar :dataToobar="dataToobar" v-model:query-sting="querySting" :get-list="fecthLeaveList" :get-search="getSearch"/>
|
||||
<ToolBar
|
||||
:dataToobar="dataToobar"
|
||||
v-model:query-sting="querySting"
|
||||
:get-list="fecthLeaveList"
|
||||
:get-search="getSearch"
|
||||
/>
|
||||
<TableList
|
||||
v-model:total="total"
|
||||
v-model:total-list="totalList"
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted,watch } from "vue";
|
||||
import { ref, reactive, onMounted, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
|
|
@ -13,8 +13,8 @@ import type {
|
|||
DateFilter,
|
||||
} from "@/modules/09_leave/interface/request/leave";
|
||||
|
||||
import TableList from "@/modules/09_leave/components/2_Leave/TableList.vue";
|
||||
import ToolBar from "@/modules/09_leave/components/2_Leave/ToolBarLeave.vue";
|
||||
import TableList from "@/modules/09_leave/components/05_Leave/TableList.vue";
|
||||
import ToolBar from "@/modules/09_leave/components/05_Leave/ToolBarLeave.vue";
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const leaveStore = useLeavelistDataStore();
|
||||
|
|
@ -63,28 +63,6 @@ async function fecthLeaveList() {
|
|||
hideLoader();
|
||||
});
|
||||
}
|
||||
// const data = APIDATA.data;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param newPage หน้า
|
||||
* @param pageSize จำนวนต่อแถว
|
||||
* @param dateFilter ข้อมูลค้นหา
|
||||
*/
|
||||
async function updatePaging(
|
||||
newPage: number,
|
||||
pageSize: number,
|
||||
dateFilter: DateFilter
|
||||
) {
|
||||
querySting.year = dateFilter ? dateFilter.year : querySting.year;
|
||||
querySting.type = dateFilter ? dateFilter.type : querySting.type;
|
||||
querySting.status = dateFilter ? dateFilter.status : querySting.status;
|
||||
querySting.page = newPage;
|
||||
querySting.pageSize = pageSize ? pageSize : querySting.pageSize;
|
||||
querySting.keyword = dateFilter ? dateFilter.keyword : querySting.keyword;
|
||||
|
||||
await fecthLeaveList();
|
||||
}
|
||||
|
||||
/** function เรียกข้อมูลสถานะ*/
|
||||
|
|
@ -96,8 +74,7 @@ async function fetchOption() {
|
|||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {});
|
||||
});
|
||||
}
|
||||
|
||||
function getSearch() {
|
||||
|
|
@ -113,8 +90,7 @@ watch(
|
|||
);
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchOption();
|
||||
await fecthLeaveList();
|
||||
await Promise.all([fetchOption(), fecthLeaveList()]);
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
|
|
@ -261,7 +261,7 @@ onMounted(() => {
|
|||
dense
|
||||
class="custom-header-table"
|
||||
:visible-columns="leaveStore.visibleColumns"
|
||||
:rows-per-page-options="[1, 25, 50, 100]"
|
||||
:rows-per-page-options="[10, 25, 50, 100]"
|
||||
@update:pagination="updatePagination"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
|
|
@ -290,9 +290,7 @@ onMounted(() => {
|
|||
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<div v-if="col.name == 'no'">
|
||||
{{
|
||||
(pagination.page - 1) * pagination.pageSize +
|
||||
props.rowIndex +
|
||||
1
|
||||
(pagination.page - 1) * pagination.pageSize + props.rowIndex + 1
|
||||
}}
|
||||
</div>
|
||||
<div v-else-if="col.name == 'leaveTypeName'">
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
interface dataPost {
|
||||
interface DataPost {
|
||||
cardId: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
|
|
@ -28,7 +28,7 @@ interface MyObjectRoundChangeMainRef {
|
|||
[key: string]: any;
|
||||
}
|
||||
export type {
|
||||
dataPost,
|
||||
DataPost,
|
||||
changeRoundEdit,
|
||||
MyObjectRoundChangeRef,
|
||||
MyObjectRoundChangeMainRef,
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
const workMain = () => import("@/modules/09_leave/views/WorkingMain.vue");
|
||||
const leaveMain = () => import("@/modules/09_leave/views/LeaveListMain.vue");
|
||||
const workMain = () => import("@/modules/09_leave/views/02_WorkingMain.vue");
|
||||
const leaveMain = () => import("@/modules/09_leave/views/05_LeaveListMain.vue");
|
||||
const leaveDetail = () =>
|
||||
import("@/modules/09_leave/components/2_Leave/DetailLeave.vue");
|
||||
import("@/modules/09_leave/components/05_Leave/DetailLeave.vue");
|
||||
const leaveDetailReject = () =>
|
||||
import("@/modules/09_leave/components/2_Leave/DetailLeaveReject.vue");
|
||||
const RoundMain = () => import("@/modules/09_leave/views/RoundMain.vue");
|
||||
import("@/modules/09_leave/components/05_Leave/DetailLeaveReject.vue");
|
||||
const RoundMain = () => import("@/modules/09_leave/views/01_RoundMain.vue");
|
||||
const ChangeRoundMain = () =>
|
||||
import("@/modules/09_leave/views/ChangeRoundMain.vue");
|
||||
import("@/modules/09_leave/views/03_ChangeRoundMain.vue");
|
||||
const SpecialTimeMain = () =>
|
||||
import("@/modules/09_leave/views/SpecialTimeMain.vue");
|
||||
const leaveReport = () =>
|
||||
import("@/modules/09_leave/components/3_Report/LeaveReport.vue");
|
||||
import("@/modules/09_leave/views/04_SpecialTimeMain.vue");
|
||||
const leaveReport = () => import("@/modules/09_leave/views/06_ReportMain.vue");
|
||||
export default [
|
||||
{
|
||||
path: "/round-time",
|
||||
|
|
|
|||
|
|
@ -116,7 +116,6 @@ export const useChangeRoundDataStore = defineStore(
|
|||
|
||||
// ข้อมูลในตาราง
|
||||
function setProfileId(id: string) {
|
||||
console.log(profileId);
|
||||
profileId.value = id;
|
||||
}
|
||||
|
||||
|
|
@ -125,6 +124,7 @@ export const useChangeRoundDataStore = defineStore(
|
|||
|
||||
function fetchDataForCardId(dataDetail: any) {
|
||||
if (dataDetail) {
|
||||
rows.value = [];
|
||||
showLoader();
|
||||
http
|
||||
.post(config.API.leaveSearch(), {
|
||||
|
|
@ -152,8 +152,6 @@ export const useChangeRoundDataStore = defineStore(
|
|||
currentRound: `${e.startTimeMorning}-${e.leaveTimeAfterNoon}`,
|
||||
effectiveDate: date2Thai(e.effectiveDate) ?? "-",
|
||||
}));
|
||||
console.log(profileId.value);
|
||||
console.log(apiData.length);
|
||||
} else {
|
||||
rows.value = [];
|
||||
checkCilck.value = true;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ export const useRoundDataStore = defineStore("roundWorkStore", () => {
|
|||
* Function รับข้อมูลจาก API map
|
||||
* @param data รับข้อมูลจาก API
|
||||
*/
|
||||
function fetchData(data: dataRowRound[]) {
|
||||
async function fetchData(data: dataRowRound[]) {
|
||||
let datalist: roundShow[] = data.map((e: dataRowRound) => {
|
||||
return {
|
||||
id: e.id,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { useRoundDataStore } from "@/modules/09_leave/stores/RoundStores";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
/** ImportComponents*/
|
||||
import DialogForm from "@/modules/09_leave/components/3_WorkTime/DialogForm.vue";
|
||||
import DialogForm from "@/modules/09_leave/components/01_RoundTime/DialogForm.vue";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
|
||||
const $q = useQuasar(); //ใช้ noti quasar
|
||||
|
|
@ -35,13 +35,13 @@ const resetFilter = () => {
|
|||
};
|
||||
|
||||
/** Function get ข้อมูลรายการรอบการปฏิบัติงาน */
|
||||
async function fetchListRoind() {
|
||||
async function fetchListRound() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.roundDutytime())
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
fetchData(data);
|
||||
.then(async (res) => {
|
||||
const data = await res.data.result;
|
||||
await fetchData(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -57,16 +57,18 @@ async function fetchListRoind() {
|
|||
*/
|
||||
function onClickDelete(id: string) {
|
||||
dialogRemove($q, async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.delete(config.API.roundDutytimeByid(id))
|
||||
.then(() => {
|
||||
.then(async () => {
|
||||
await fetchListRound();
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(async () => {
|
||||
await fetchListRoind();
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
@ -112,8 +114,8 @@ const pagination = ref({
|
|||
});
|
||||
|
||||
/** Hook*/
|
||||
onMounted(() => {
|
||||
fetchListRoind();
|
||||
onMounted(async () => {
|
||||
await fetchListRound();
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
|
|
@ -172,7 +174,6 @@ onMounted(() => {
|
|||
map-options
|
||||
:options="dataStore.columns"
|
||||
option-value="name"
|
||||
|
||||
style="min-width: 140px"
|
||||
class="col-xs-12 col-sm-3 col-md-2"
|
||||
/>
|
||||
|
|
@ -285,7 +286,7 @@ onMounted(() => {
|
|||
:closeDialog="closeDialog"
|
||||
:editCheck="editCheck"
|
||||
:detailData="detailData"
|
||||
:fetchData="fetchListRoind"
|
||||
:fetchData="fetchListRound"
|
||||
v-model:isRead="isRead"
|
||||
/>
|
||||
</template>
|
||||
|
|
@ -2,9 +2,9 @@
|
|||
import { ref } from "vue";
|
||||
|
||||
/** import Components */
|
||||
import Tab1 from "@/modules/09_leave/components/1_Work/Tab1.vue";
|
||||
import Tab2 from "@/modules/09_leave/components/1_Work/Tab2.vue";
|
||||
import DialogReport from "@/modules/09_leave/components/1_Work/DialogReport.vue";
|
||||
import Tab1 from "@/modules/09_leave/components/02_WorkList/Tab1.vue";
|
||||
import Tab2 from "@/modules/09_leave/components/02_WorkList/Tab2.vue";
|
||||
import DialogReport from "@/modules/09_leave/components/02_WorkList/DialogReport.vue";
|
||||
|
||||
const tab = ref("1");
|
||||
|
||||
|
|
@ -8,9 +8,9 @@ import { useCounterMixin } from "@/stores/mixin";
|
|||
import { useChangeRoundDataStore } from "@/modules/09_leave/stores/ChangeRoundStore";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
|
||||
import type { dataPost } from "@/modules/09_leave/interface/request/changeRound";
|
||||
import type { DataPost } from "@/modules/09_leave/interface/request/changeRound";
|
||||
|
||||
import Dialogform from "@/modules/09_leave/components/4_ChangeRound/DialogForm.vue";
|
||||
import Dialogform from "@/modules/09_leave/components/03_ChangeRound/DialogForm.vue";
|
||||
|
||||
/** useStore */
|
||||
const mixin = useCounterMixin();
|
||||
|
|
@ -32,7 +32,7 @@ const dateWork = ref<string>("NORMAL");
|
|||
const modalFix = ref<boolean>(false);
|
||||
const editCheck = ref<string>("");
|
||||
const DataRow = ref<any>();
|
||||
const formData = reactive<dataPost>({
|
||||
const formData = reactive<DataPost>({
|
||||
cardId: "",
|
||||
firstName: "",
|
||||
lastName: "",
|
||||
|
|
@ -97,12 +97,12 @@ function save() {
|
|||
})
|
||||
.then(() => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
closeDialog();
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
closeDialog();
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
|
|
@ -16,7 +16,7 @@ import type {
|
|||
} from "@/modules/09_leave/interface/request/specialTime";
|
||||
|
||||
import DialogReason from "@/components/Dialogs/PopupReason.vue";
|
||||
import DialogApprove from "@/modules/09_leave/components/4_specialTime/DialogApprove.vue";
|
||||
import DialogApprove from "@/modules/09_leave/components/04_SpecialTime/DialogApprove.vue";
|
||||
|
||||
const $q = useQuasar(); // show dialog
|
||||
const mixin = useCounterMixin();
|
||||
|
|
@ -86,7 +86,6 @@ const visibleColumns = ref<String[]>([
|
|||
"timeAfternoon",
|
||||
"description",
|
||||
]);
|
||||
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "no",
|
||||
|
|
@ -199,14 +198,14 @@ async function clickSave(reason: string) {
|
|||
};
|
||||
await http
|
||||
.put(config.API.specialTimeReject(id.value), body)
|
||||
.then(() => {
|
||||
.then(async () => {
|
||||
await fetchData();
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
await fetchData();
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
|
@ -396,7 +395,6 @@ onMounted(async () => {
|
|||
map-options
|
||||
:options="columns"
|
||||
option-value="name"
|
||||
|
||||
style="min-width: 140px"
|
||||
class="col-xs-12 col-sm-3 col-md-2"
|
||||
/>
|
||||
|
|
@ -3,8 +3,8 @@
|
|||
import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
|
||||
|
||||
/**importComponets*/
|
||||
import Tab1 from "@/modules/09_leave/components/2_Leave/Tab1.vue";
|
||||
import Tab2 from "@/modules/09_leave/components/2_Leave/Tab2.vue";
|
||||
import Tab1 from "@/modules/09_leave/components/05_Leave/Tab1.vue";
|
||||
import Tab2 from "@/modules/09_leave/components/05_Leave/Tab2.vue";
|
||||
|
||||
const leaveStore = useLeavelistDataStore();
|
||||
</script>
|
||||
|
|
@ -82,17 +82,17 @@ async function fetchLeaveday(
|
|||
|
||||
await http
|
||||
.post(config.API.leaveReportLeaveday(type), body)
|
||||
.then((res) => {
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
data && genReport(data);
|
||||
!data && hideLoader();
|
||||
data && (await genReport(data));
|
||||
detailReport.value = data;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
hideLoader();
|
||||
})
|
||||
.finally(() => {});
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -101,7 +101,7 @@ async function fetchLeaveday(
|
|||
*/
|
||||
async function genReport(data: any) {
|
||||
await axios
|
||||
.post(apiGenReport, data, {
|
||||
.post(`${config.API.reportTemplate}/xlsx`, data, {
|
||||
headers: {
|
||||
accept: "application/pdf",
|
||||
"content-Type": "application/json",
|
||||
|
|
@ -135,7 +135,7 @@ async function genReport(data: any) {
|
|||
*/
|
||||
async function genReportXLSX(data: any) {
|
||||
await axios
|
||||
.post(apiGenReport, data, {
|
||||
.post(`${config.API.reportTemplate}/xlsx`, data, {
|
||||
headers: {
|
||||
accept:
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
Loading…
Add table
Add a link
Reference in a new issue