Refactor Code ระบบลา
This commit is contained in:
parent
75dfc3b004
commit
9498748c94
16 changed files with 202 additions and 349 deletions
|
|
@ -4,6 +4,7 @@ import http from "@/plugins/http";
|
|||
import config from "@/app.config";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
/** import Type*/
|
||||
import type { FormDetail } from "@/modules/09_leave/interface/response/work";
|
||||
|
||||
/** importStores */
|
||||
|
|
|
|||
|
|
@ -85,6 +85,10 @@ watch([() => currentPage.value, () => pagination.value.rowsPerPage], () => {
|
|||
updateProp(pagination.value, currentPage.value);
|
||||
});
|
||||
|
||||
/**
|
||||
* function updatePageSize
|
||||
* @param newPagination PageSize
|
||||
*/
|
||||
function updateRowsPerPagen(newPagination: any) {
|
||||
pagination.value.rowsPerPage = newPagination.rowsPerPage;
|
||||
currentPage.value = 1;
|
||||
|
|
@ -122,8 +126,6 @@ function updateRowsPerPagen(newPagination: any) {
|
|||
@click.prevent="clickDetail(props.row)"
|
||||
>
|
||||
<div v-if="col.name == 'no'">
|
||||
<!-- {{ props.rowIndex + 1 }} -->
|
||||
|
||||
{{
|
||||
(currentPage - 1) * Number(pagination.rowsPerPage) +
|
||||
props.rowIndex +
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import type { DataOption } from "@/modules/09_leave/interface/index/Main";
|
|||
/** importStores */
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useWorklistDataStore } from "@/modules/09_leave/stores/WorkStore";
|
||||
|
||||
/** useStore */
|
||||
const workStore = useWorklistDataStore();
|
||||
const mixin = useCounterMixin();
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { ref } from "vue";
|
|||
/** importStores */
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useWorklistDataStore } from "@/modules/09_leave/stores/WorkStore";
|
||||
|
||||
/** useStore */
|
||||
const workStore = useWorklistDataStore();
|
||||
const mixin = useCounterMixin();
|
||||
|
|
|
|||
|
|
@ -11,8 +11,7 @@ import { useCounterMixin } from "@/stores/mixin";
|
|||
const route = useRoute();
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { messageError, showLoader, hideLoader, date2Thai, monthYear2Thai } =
|
||||
mixin;
|
||||
const { date2Thai, monthYear2Thai } = mixin;
|
||||
|
||||
const typeReport = route.params.type.toString();
|
||||
const titleReport = computed(() => {
|
||||
|
|
@ -59,6 +58,12 @@ const employeeClassOption = ref<DataOption[]>(employeeClassMain.value);
|
|||
const yearTypeOptionOption = ref<DataOption[]>(yearTypeOptionMain.value);
|
||||
const filterTypeOption = ref<DataOption[]>(filterTypeMain.value);
|
||||
|
||||
/**
|
||||
* function ค้นหาข้อมูล Option
|
||||
* @param val คำค้นหา
|
||||
* @param update function
|
||||
* @param type ประเภท option
|
||||
*/
|
||||
function filterFnOptions(val: any, update: Function, type: string) {
|
||||
switch (type) {
|
||||
case "filterType":
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
import { ref, reactive, watch } from "vue";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
/** ImportType */
|
||||
import type {
|
||||
|
|
@ -11,10 +12,12 @@ import type {
|
|||
|
||||
/** ImportComponents */
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
/** importstore*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
const $q = useQuasar();
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { dialogConfirm, success, messageError } = mixin;
|
||||
|
||||
|
|
@ -142,7 +145,7 @@ function close() {
|
|||
/***/
|
||||
watch(
|
||||
() => props.modal,
|
||||
(newDetailData, oldDetailData) => {
|
||||
() => {
|
||||
if (props.editCheck === "add") {
|
||||
formData.startTimeMorning = "";
|
||||
formData.endTimeMorning = "";
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import { ref, reactive, watch, onMounted } from "vue";
|
|||
import { date, useQuasar } from "quasar";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
/** importType */
|
||||
import type {
|
||||
|
|
@ -15,6 +14,7 @@ import type {
|
|||
/** importStore */
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useChangeRoundDataStore } from "@/modules/09_leave/stores/ChangeRoundStore";
|
||||
|
||||
/** useStore */
|
||||
const dataStore = useChangeRoundDataStore();
|
||||
const mixin = useCounterMixin();
|
||||
|
|
@ -27,9 +27,7 @@ const {
|
|||
success,
|
||||
} = mixin;
|
||||
|
||||
const route = useRoute();
|
||||
const $q = useQuasar();
|
||||
const roundOp = ref<any>([]);
|
||||
|
||||
/**Hook */
|
||||
onMounted(async () => {
|
||||
|
|
@ -78,7 +76,7 @@ const dataToday = ref<Date>(new Date());
|
|||
function onSubmit() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
() => {
|
||||
changeRound();
|
||||
props.closeDialog?.();
|
||||
},
|
||||
|
|
@ -107,6 +105,7 @@ async function changeRound() {
|
|||
});
|
||||
}
|
||||
|
||||
const roundOp = ref<any>([]);
|
||||
/**
|
||||
*ประวัติการเปลี่ยนรอบการปฏิบัติงาน"
|
||||
*
|
||||
|
|
@ -138,9 +137,8 @@ async function fetchDataOption() {
|
|||
}
|
||||
|
||||
// paging
|
||||
const page = ref<number>(1);
|
||||
const pageSize = ref<number>(10);
|
||||
const filter = ref<string>(""); //search data table
|
||||
|
||||
/**
|
||||
* ฟังก์ชั่น api เปลี่ยนหน้า
|
||||
* @param pageVal page
|
||||
|
|
@ -169,7 +167,6 @@ watch(
|
|||
}
|
||||
);
|
||||
const emit = defineEmits(["update:change-page"]);
|
||||
// Pagination - update rowsPerPage
|
||||
async function updatePagination(newPagination: any) {
|
||||
initialPagination.value = newPagination;
|
||||
currentPage.value = 1; // set current page เป็น 1 เสมอเมื่อเปลี่ยน per row
|
||||
|
|
@ -192,7 +189,7 @@ function close() {
|
|||
}
|
||||
watch(
|
||||
() => props.modal,
|
||||
async (newDetailData, oldDetailData) => {
|
||||
async () => {
|
||||
if (props.editCheck === "edit") {
|
||||
formData.round = "";
|
||||
formData.reson = "";
|
||||
|
|
|
|||
|
|
@ -1,28 +1,38 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, watchEffect, watch } from "vue";
|
||||
import { ref, reactive, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
/** importType*/
|
||||
import type {
|
||||
dataRowRound,
|
||||
MyObjectRoundRef,
|
||||
} from "@/modules/09_leave/interface/response/specialTime";
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useSpecialTimeStore } from "@/modules/09_leave/stores/SpecialTimeStore";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
/** importStores*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useSpecialTimeStore } from "@/modules/09_leave/stores/SpecialTimeStore";
|
||||
|
||||
/** useStore*/
|
||||
const SpecialTimeStore = useSpecialTimeStore();
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
dialogConfirm,
|
||||
date2Thai,
|
||||
showLoader,
|
||||
success,
|
||||
messageError,
|
||||
hideLoader,
|
||||
} = mixin;
|
||||
const currentDate = ref<Date | null>(new Date());
|
||||
const { dialogConfirm, showLoader, success, messageError, hideLoader } = mixin;
|
||||
|
||||
const $q = useQuasar();
|
||||
|
||||
/** props*/
|
||||
const props = defineProps({
|
||||
modal: { type: Boolean, default: "" },
|
||||
editCheck: { type: String, default: "" },
|
||||
date: { type: String, default: "" },
|
||||
dateFix: { type: String, default: "" },
|
||||
id: { type: String, default: "" },
|
||||
closeDialog: { type: Function, default: () => {} },
|
||||
detailData: Object,
|
||||
});
|
||||
|
||||
const checkInRef = ref<Object | null>(null);
|
||||
const checkOutRef = ref<Object | null>(null);
|
||||
const checkInStatusRef = ref<Object | null>(null);
|
||||
|
|
@ -35,8 +45,8 @@ const formData = reactive<dataRowRound>({
|
|||
note: "",
|
||||
checkInStatus: "",
|
||||
checkOutStatus: "",
|
||||
checkInEdit:false,
|
||||
checkOutEdit:false
|
||||
checkInEdit: false,
|
||||
checkOutEdit: false,
|
||||
});
|
||||
|
||||
const objectRound: MyObjectRoundRef = {
|
||||
|
|
@ -47,6 +57,7 @@ const objectRound: MyObjectRoundRef = {
|
|||
note: reasonRef,
|
||||
};
|
||||
|
||||
/** function validateFom*/
|
||||
function validateForm() {
|
||||
const hasError = [];
|
||||
for (const key in objectRound) {
|
||||
|
|
@ -60,37 +71,26 @@ function validateForm() {
|
|||
}
|
||||
if (hasError.every((result) => result === true)) {
|
||||
onSubmit();
|
||||
console.log(hasError);
|
||||
} else {
|
||||
console.log(hasError);
|
||||
}
|
||||
}
|
||||
|
||||
const props = defineProps({
|
||||
modal: { type: Boolean, default: "" },
|
||||
editCheck: { type: String, default: "" },
|
||||
date: { type: String, default: "" },
|
||||
dateFix: { type: String, default: "" },
|
||||
id: { type: String, default: "" },
|
||||
closeDialog: { type: Function, default: () => {} },
|
||||
detailData: Object,
|
||||
});
|
||||
|
||||
/** function confrim*/
|
||||
function onSubmit() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
props.closeDialog?.();
|
||||
await approveData();
|
||||
props.closeDialog?.();
|
||||
},
|
||||
"ยืนยันการบันทึกข้อมูล",
|
||||
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
|
||||
);
|
||||
console.log(props.dateFix);
|
||||
console.log(props.id);
|
||||
}
|
||||
|
||||
const approveData = async () => {
|
||||
/** function บันทึกข้อมูล*/
|
||||
async function approveData() {
|
||||
showLoader();
|
||||
const body = {
|
||||
checkInTime: formData.checkIn,
|
||||
|
|
@ -101,27 +101,28 @@ const approveData = async () => {
|
|||
};
|
||||
await http
|
||||
.put(config.API.specialTimeApprove(props.id), body)
|
||||
.then((res) => {
|
||||
.then(() => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
hideLoader();
|
||||
})
|
||||
.finally(async () => {
|
||||
SpecialTimeStore.fetchData();
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
/** function closeDialog*/
|
||||
function close() {
|
||||
if (props.closeDialog) {
|
||||
props.closeDialog();
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.modal,
|
||||
(newDetailData, oldDetailData) => {
|
||||
() => {
|
||||
if (props.editCheck === "APPROVE") {
|
||||
formData.checkIn = "";
|
||||
formData.checkOut = "";
|
||||
|
|
@ -202,8 +203,16 @@ watch(
|
|||
</template>
|
||||
</datepicker>
|
||||
<div class="column">
|
||||
<q-checkbox disabled :model-value="formData.checkInEdit" label="ขอแก้ไขเวลาช่วงเช้า" />
|
||||
<q-checkbox disabled :model-value="formData.checkOutEdit" label="ขอแก้ไขเวลาช่วงบ่าย" />
|
||||
<q-checkbox
|
||||
disabled
|
||||
:model-value="formData.checkInEdit"
|
||||
label="ขอแก้ไขเวลาช่วงเช้า"
|
||||
/>
|
||||
<q-checkbox
|
||||
disabled
|
||||
:model-value="formData.checkOutEdit"
|
||||
label="ขอแก้ไขเวลาช่วงบ่าย"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -1,3 +1,94 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, useAttrs } from "vue";
|
||||
|
||||
/** import Type*/
|
||||
import type { Pagination } from "@/modules/04_registry/interface/index/Main";
|
||||
|
||||
/** import Stoer*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useSpecialTimeStore } from "@/modules/09_leave/stores/SpecialTimeStore";
|
||||
|
||||
const attrs = ref<any>(useAttrs());
|
||||
const SpecialTimeStore = useSpecialTimeStore();
|
||||
const mixin = useCounterMixin();
|
||||
|
||||
const { date2Thai } = mixin;
|
||||
const { searchFilterTable } = SpecialTimeStore;
|
||||
|
||||
/** props*/
|
||||
const props = defineProps({
|
||||
count: Number,
|
||||
pass: Number,
|
||||
notpass: Number,
|
||||
|
||||
inputfilter: String,
|
||||
name: String,
|
||||
icon: String,
|
||||
inputvisible: Array,
|
||||
editvisible: Boolean,
|
||||
add: {
|
||||
type: Function,
|
||||
default: () => console.log("not function"),
|
||||
},
|
||||
validate: {
|
||||
type: Function,
|
||||
default: () => console.log("not function"),
|
||||
},
|
||||
nornmalData: {
|
||||
type: Boolean,
|
||||
defualt: true,
|
||||
},
|
||||
conclude: {
|
||||
type: Boolean,
|
||||
defualt: false,
|
||||
},
|
||||
});
|
||||
|
||||
/**emit Function*/
|
||||
const emit = defineEmits([
|
||||
"update:inputfilter",
|
||||
"update:inputvisible",
|
||||
"update:editvisible",
|
||||
]);
|
||||
|
||||
const table = ref<any>(null);
|
||||
const filterRef = ref<any>(null);
|
||||
|
||||
/** pagination*/
|
||||
const paging = ref<boolean>(true);
|
||||
const pagination = ref({
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
|
||||
function paginationLabel(start: string, end: string, total: string) {
|
||||
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
|
||||
else return start + "-" + end + " ใน " + total;
|
||||
}
|
||||
|
||||
/**
|
||||
* function update filter
|
||||
* @param value คำค้นหา
|
||||
*/
|
||||
function updateInput(value: string | number | null) {
|
||||
emit("update:inputfilter", value);
|
||||
}
|
||||
|
||||
/**
|
||||
* function updateVisible
|
||||
* @param value ค่า Visible
|
||||
*/
|
||||
function updateVisible(value: []) {
|
||||
emit("update:inputvisible", value);
|
||||
}
|
||||
|
||||
function resetFilter() {
|
||||
// reset ค่าที่ค้นหาเมื่อกดปุ่ม X ในกล่องค้นหา
|
||||
emit("update:inputfilter", "");
|
||||
filterRef.value.focus();
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<div class="q-pb-sm row q-col-gutter-sm">
|
||||
<!-- -->
|
||||
|
|
@ -104,83 +195,7 @@
|
|||
</template>
|
||||
</d-table>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, useAttrs } from "vue";
|
||||
import type { Pagination } from "@/modules/04_registry/interface/index/Main";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useSpecialTimeStore } from "@/modules/09_leave/stores/SpecialTimeStore";
|
||||
|
||||
const SpecialTimeStore = useSpecialTimeStore();
|
||||
const { searchFilterTable } = SpecialTimeStore;
|
||||
const mixin = useCounterMixin();
|
||||
const { hideLoader, monthYear2Thai, date2Thai } = mixin;
|
||||
const attrs = ref<any>(useAttrs());
|
||||
const paging = ref<boolean>(true);
|
||||
const pagination = ref({
|
||||
// sortBy: "desc",
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
const paginationLabel = (start: string, end: string, total: string) => {
|
||||
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
|
||||
else return start + "-" + end + " ใน " + total;
|
||||
};
|
||||
const table = ref<any>(null);
|
||||
const filterRef = ref<any>(null);
|
||||
const initialPagination = ref<Pagination>({
|
||||
rowsPerPage: 0,
|
||||
});
|
||||
|
||||
const props = defineProps({
|
||||
count: Number,
|
||||
pass: Number,
|
||||
notpass: Number,
|
||||
|
||||
inputfilter: String,
|
||||
name: String,
|
||||
icon: String,
|
||||
inputvisible: Array,
|
||||
editvisible: Boolean,
|
||||
add: {
|
||||
type: Function,
|
||||
default: () => console.log("not function"),
|
||||
},
|
||||
validate: {
|
||||
type: Function,
|
||||
default: () => console.log("not function"),
|
||||
},
|
||||
nornmalData: {
|
||||
type: Boolean,
|
||||
defualt: true,
|
||||
},
|
||||
conclude: {
|
||||
type: Boolean,
|
||||
defualt: false,
|
||||
},
|
||||
});
|
||||
const emit = defineEmits([
|
||||
"update:inputfilter",
|
||||
"update:inputvisible",
|
||||
"update:editvisible",
|
||||
]);
|
||||
const updateInput = (value: string | number | null) => {
|
||||
emit("update:inputfilter", value);
|
||||
};
|
||||
const updateVisible = (value: []) => {
|
||||
emit("update:inputvisible", value);
|
||||
};
|
||||
|
||||
const checkAdd = () => {
|
||||
props.add();
|
||||
};
|
||||
|
||||
const resetFilter = () => {
|
||||
// reset ค่าที่ค้นหาเมื่อกดปุ่ม X ในกล่องค้นหา
|
||||
emit("update:inputfilter", "");
|
||||
filterRef.value.focus();
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.icon-color {
|
||||
color: #4154b3;
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@ import type { dataPost } from "@/modules/09_leave/interface/request/changeRound"
|
|||
|
||||
/** importComponents */
|
||||
import Dialogform from "@/modules/09_leave/components/4_ChangeRound/DialogForm.vue";
|
||||
import Modal from "@/modules/05_placement/components/AppointEmployee/Modal.vue";
|
||||
|
||||
/** importStore */
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useChangeRoundDataStore } from "@/modules/09_leave/stores/ChangeRoundStore";
|
||||
|
||||
/** useStore */
|
||||
const mixin = useCounterMixin();
|
||||
const { dialogConfirm, date2Thai, dialogMessageNotify } = mixin;
|
||||
const { dialogMessageNotify } = mixin;
|
||||
const dataStore = useChangeRoundDataStore();
|
||||
|
||||
/** use */
|
||||
|
|
@ -43,8 +43,6 @@ function Openmodal(check: string, detail: any) {
|
|||
modal.value = true;
|
||||
dataStore.fetchDatainHistory();
|
||||
}
|
||||
|
||||
console.log(detail);
|
||||
}
|
||||
|
||||
/** Function closePopup */
|
||||
|
|
|
|||
|
|
@ -31,13 +31,6 @@ const leaveStore = useLeavelistDataStore();
|
|||
|
||||
<q-tab-panel name="2"> <Tab2 /> </q-tab-panel>
|
||||
</q-tab-panels>
|
||||
<!-- <ToolBar @update:querySting="updatePaging" />
|
||||
<TableList
|
||||
:page="querySting.page"
|
||||
:rowsPerPage="querySting.pageSize"
|
||||
:maxPage="maxPage"
|
||||
@update:querySting="updatePaging"
|
||||
/> -->
|
||||
</q-card>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ const mixin = useCounterMixin();
|
|||
const dataStore = useRoundDataStore();
|
||||
const { fetchData } = dataStore;
|
||||
const { showLoader, hideLoader, messageError, dialogRemove, success } = mixin;
|
||||
const $q = useQuasar(); //ใช้ noti quasar
|
||||
|
||||
const $q = useQuasar(); //ใช้ noti quasar
|
||||
const attrs = ref<any>(useAttrs());
|
||||
|
||||
const modal = ref<boolean>(false);
|
||||
|
|
@ -91,7 +91,6 @@ function closeDialog() {
|
|||
|
||||
/** pagination */
|
||||
const pagination = ref({
|
||||
// sortBy: "desc",
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
|
|
|
|||
|
|
@ -1,23 +1,29 @@
|
|||
<script setup lang="ts">
|
||||
import { onMounted, ref, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import type { Pagination } from "@/modules/03_recruiting/interface/index/Main";
|
||||
import { useSpecialTimeStore } from "@/modules/09_leave/stores/SpecialTimeStore";
|
||||
import DialogReason from "@/components/Dialogs/PopupReason.vue";
|
||||
import DialogApprove from "@/modules/09_leave/components/4_specialTime/DialogApprove.vue";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import type { DataDateMonthObject } from "@/modules/09_leave/interface/request/specialTime";
|
||||
import { useRouter } from "vue-router";
|
||||
import { identity } from "@fullcalendar/core/internal";
|
||||
|
||||
/**ตัวแปรที่ใช้ */
|
||||
/** importType*/
|
||||
import type { DataDateMonthObject } from "@/modules/09_leave/interface/request/specialTime";
|
||||
|
||||
/** importComponents*/
|
||||
import DialogReason from "@/components/Dialogs/PopupReason.vue";
|
||||
import DialogApprove from "@/modules/09_leave/components/4_specialTime/DialogApprove.vue";
|
||||
|
||||
/** importStore*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useSpecialTimeStore } from "@/modules/09_leave/stores/SpecialTimeStore";
|
||||
|
||||
const dataSpecialTime = useSpecialTimeStore();
|
||||
const $q = useQuasar(); // show dialog
|
||||
const mixin = useCounterMixin();
|
||||
const router = useRouter();
|
||||
|
||||
const { hideLoader, monthYear2Thai, messageError, showLoader, success } = mixin;
|
||||
|
||||
const emit = defineEmits(["update:change-page"]);
|
||||
|
||||
/**ตัวแปรที่ใช้ */
|
||||
const modalUnapprove = ref(false);
|
||||
const modalApprove = ref(false);
|
||||
const detailData = ref<any>();
|
||||
|
|
@ -30,18 +36,19 @@ const dateDialog = ref<string>("");
|
|||
const dateFixDialog = ref<string>("");
|
||||
const dateYear = ref<number>(new Date().getFullYear());
|
||||
|
||||
/**ฟังก์ชั่นไม่อนุมัติ */
|
||||
const unapprove = async (fullname: string, personId: string) => {
|
||||
/**
|
||||
* ฟังก์ชั่นไม่อนุมัติ
|
||||
* @param fullname ชื่อ
|
||||
* @param personId personId
|
||||
*/
|
||||
async function unapprove(fullname: string, personId: string) {
|
||||
id.value = personId;
|
||||
dialogTitle.value = " ไม่อนุมัติคำขอ"// + fullname;
|
||||
dialogTitle.value = " ไม่อนุมัติคำขอ"; // + fullname;
|
||||
name.value = fullname;
|
||||
modalUnapprove.value = true;
|
||||
}
|
||||
|
||||
// rejectData();
|
||||
};
|
||||
|
||||
/** function Model */
|
||||
//เปิด
|
||||
/** function openDialog */
|
||||
function openModal(
|
||||
data: any,
|
||||
check: string,
|
||||
|
|
@ -58,9 +65,9 @@ function openModal(
|
|||
if (check === "PENDING") {
|
||||
detailData.value = data;
|
||||
}
|
||||
console.log(data);
|
||||
}
|
||||
//ปิด
|
||||
|
||||
/** function closeDialog */
|
||||
const closeDialog = () => {
|
||||
modalUnapprove.value = false;
|
||||
modalApprove.value = false;
|
||||
|
|
@ -69,32 +76,28 @@ const closeDialog = () => {
|
|||
|
||||
/** API reject */
|
||||
const clickSave = async (reason: string) => {
|
||||
showLoader();
|
||||
modalUnapprove.value = false;
|
||||
const body = {
|
||||
reason: reason,
|
||||
};
|
||||
await http
|
||||
.put(config.API.specialTimeReject(id.value), body)
|
||||
.then((res) => {
|
||||
.then(() => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
dataSpecialTime.fetchData();
|
||||
await dataSpecialTime.fetchData();
|
||||
hideLoader();
|
||||
});
|
||||
|
||||
console.log(reason);
|
||||
};
|
||||
|
||||
// paging
|
||||
const pageSize = ref<number>(10);
|
||||
/**
|
||||
* ฟังก์ชั่น api เปลี่ยนหน้า
|
||||
* @param pageVal page
|
||||
* @param pageSizeVal pagesize
|
||||
*/
|
||||
|
||||
// Pagination - initial pagination
|
||||
const initialPagination = ref<any>({
|
||||
sortBy: null,
|
||||
|
|
@ -102,7 +105,7 @@ const initialPagination = ref<any>({
|
|||
page: 1,
|
||||
rowsPerPage: pageSize, // set ตาม page หลักส่งมา
|
||||
});
|
||||
const emit = defineEmits(["update:change-page"]);
|
||||
|
||||
// Pagination - page & change page & get new data
|
||||
const currentPage = ref<number>(1);
|
||||
watch(
|
||||
|
|
@ -131,6 +134,7 @@ const resetFilter = () => {
|
|||
filterRef.value.focus();
|
||||
}
|
||||
};
|
||||
|
||||
/** function ค้นหาข้อมูลแล้วอัปเดท*/
|
||||
function filterFn() {
|
||||
updatePagination(filterKeyword.value);
|
||||
|
|
|
|||
|
|
@ -1,22 +1,10 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, watch } from "vue";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
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";
|
||||
|
||||
// /** importStores */
|
||||
// import { useCounterMixin } from "@/stores/mixin";
|
||||
// import { useWorklistDataStore } from "@/modules/09_leave/stores/WorkStore";
|
||||
|
||||
/** use Store */
|
||||
// const mixin = useCounterMixin();
|
||||
// const workStore = useWorklistDataStore();
|
||||
// const { dateToISO, date2Thai, showLoader, hideLoader } = mixin;
|
||||
// const { fetchListLog, fetchListTime } = workStore;
|
||||
|
||||
const tab = ref("1");
|
||||
</script>
|
||||
<template>
|
||||
|
|
@ -41,22 +29,15 @@ const tab = ref("1");
|
|||
|
||||
<q-separator />
|
||||
|
||||
<q-tab-panels v-model="tab" animated >
|
||||
<q-tab-panels v-model="tab" animated>
|
||||
<q-tab-panel name="1">
|
||||
<!-- <TableList1 /> -->
|
||||
<!-- <ToolBar /> -->
|
||||
<Tab1 />
|
||||
<!-- <TableList /> -->
|
||||
</q-tab-panel>
|
||||
|
||||
<q-tab-panel name="2">
|
||||
<!-- <TabList2Vue /> -->
|
||||
<!-- <ToolBarDate /> -->
|
||||
<Tab2 />
|
||||
<!-- <TableList /> -->
|
||||
</q-tab-panel>
|
||||
</q-tab-panels>
|
||||
<!-- </q-card> -->
|
||||
</q-card>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
<script setup lang="ts"></script>
|
||||
|
||||
<template>
|
||||
<div>ข้อมูลคุณสมบัติ</div>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
@ -1,149 +0,0 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { ref } from "vue";
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { DataOption } from "@/modules/12_Evaluate/interface/index/Main";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { date2Thai } = mixin;
|
||||
export const useEvalutuonStore = defineStore("EvalutuonStore", () => {
|
||||
/** function สถานะ*/
|
||||
function convertStatus(val: string) {
|
||||
switch (val) {
|
||||
case "CHECK_SPEC":
|
||||
return "ตรวจสอบคุณสมบัติด้วยตนเอง";
|
||||
case "PREPARE_DOC_V1":
|
||||
return "จัดเตรียมเอกสารเล่ม";
|
||||
case "CHECK_DOC_V1":
|
||||
return "ตรวจสอบความถูกต้องของเอกสารเล่ม";
|
||||
case "WAIT_CHECK_DOC_V1":
|
||||
return "รอตรวจสอบคุณสมบัติ";
|
||||
case "ANNOUNCE_WEB":
|
||||
return "ประกาศบนเว็บไซต์";
|
||||
case "PREPARE_DOC_V2":
|
||||
return "จัดเตรียมเอกสารเล่ม";
|
||||
case "WAIT_CHECK_DOC_V2":
|
||||
return "รอพิจารณาผลการประเมิน";
|
||||
case "CHECK_DOC_V2":
|
||||
return "ตรวจสอบความถูกต้องของเอกสารเล่ม";
|
||||
case "DONE":
|
||||
return "เสร็จสิ้น";
|
||||
}
|
||||
}
|
||||
|
||||
// ตรวจสอบคุณสมบัติด้วยตนเอง -> CHECK_SPEC
|
||||
// จัดเตรียมเอกสารเล่ม 1-> PREPARE_DOC_V1
|
||||
// ตรวจสอบความถูกต้องของเอกสารเล่ม 1 -> CHECK_DOC_V1
|
||||
// รอตรวจสอบคุณสมบัติ -> WAIT_CHECK_DOC_V1
|
||||
// ประกาศบนเว็บไซต์ -> ANNOUNCE_WEB
|
||||
// จัดเตรียมเอกสารเล่ม 2 -> PREPARE_DOC_V2
|
||||
// ตรวจสอบความถูกต้องของเอกสารเล่ม 2 -> CHECK_DOC_V2
|
||||
// รอพิจารณาผลการประเมิน -> WAIT_CHECK_DOC_V2
|
||||
// เสร็จสิ้น -> DONE
|
||||
|
||||
const visibleColumns = ref<String[]>([
|
||||
"citizanId",
|
||||
"fullName",
|
||||
"position",
|
||||
"level",
|
||||
"positionNumber",
|
||||
"agency",
|
||||
"status",
|
||||
]);
|
||||
const rows = ref<any[]>([]);
|
||||
function fetchData(data: any[]) {
|
||||
const dataList: any[] = data.map((data: any) => ({
|
||||
citizanId: data.citizanId,
|
||||
fullName: data.fullName,
|
||||
position: data.position,
|
||||
level: data.level,
|
||||
positionNumber: data.positionNumber,
|
||||
agency: data.agency,
|
||||
status: convertStatus(data.status),
|
||||
}));
|
||||
rows.value = dataList;
|
||||
console.log(dataList);
|
||||
}
|
||||
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "citizanId",
|
||||
align: "center",
|
||||
label: "เลขประจำตัวประชาชน",
|
||||
sortable: false,
|
||||
field: "citizanId",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "fullName",
|
||||
align: "left",
|
||||
label: "ชื่อ-นามสกุล",
|
||||
sortable: true,
|
||||
field: "fullName",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "position",
|
||||
align: "left",
|
||||
label: "ตำแหน่ง",
|
||||
sortable: true,
|
||||
field: "position",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "level",
|
||||
align: "left",
|
||||
label: "ระดับ",
|
||||
sortable: true,
|
||||
field: "level",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "positionNumber",
|
||||
align: "left",
|
||||
label: "ตำแหน่งเลขที่",
|
||||
sortable: true,
|
||||
field: "positionNumber",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "agency",
|
||||
align: "left",
|
||||
label: "สังกัด",
|
||||
sortable: true,
|
||||
field: "agency",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "status",
|
||||
align: "left",
|
||||
label: "สถานะ(ตรวจสอบคุณสมบัติ)",
|
||||
sortable: true,
|
||||
field: "status",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
]);
|
||||
|
||||
return {
|
||||
visibleColumns,
|
||||
columns,
|
||||
rows,
|
||||
convertStatus,
|
||||
fetchData,
|
||||
};
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue