แยกการลา
This commit is contained in:
parent
5c84afa6a8
commit
13eb56f214
8 changed files with 106 additions and 38 deletions
|
|
@ -581,7 +581,7 @@ function formattedNumber(x: number) {
|
||||||
<div class="col-12 row">
|
<div class="col-12 row">
|
||||||
<div class="col-xs-5 col-sm-3 text-grey-8">ประเภทการลา</div>
|
<div class="col-xs-5 col-sm-3 text-grey-8">ประเภทการลา</div>
|
||||||
<div class="col text-primary">
|
<div class="col text-primary">
|
||||||
{{ formData.leaveTypeName }}
|
{{ checkForm !== 'FormUpasom' && checkForm !== 'FormHajj' ? formData.leaveTypeName:(formData.hajjDayStatus ? 'ลาประกอบพิธีฮัจญ์':'ลาอุปสมบท') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 row">
|
<div class="col-12 row">
|
||||||
|
|
@ -640,7 +640,7 @@ function formattedNumber(x: number) {
|
||||||
<div class="col-xs-12 col-sm-5 row">
|
<div class="col-xs-12 col-sm-5 row">
|
||||||
<!-- card ซ้าย -->
|
<!-- card ซ้าย -->
|
||||||
<q-card flat bordered class="col-12">
|
<q-card flat bordered class="col-12">
|
||||||
<FormMain :data="formData" />
|
<FormMain :data="formData" :checkForm="checkForm"/>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-7 row">
|
<div class="col-xs-12 col-sm-7 row">
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
|
||||||
const $q = useQuasar(); //ใช้ noti quasar
|
const $q = useQuasar(); //ใช้ noti quasar
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const leaveStore = useLeavelistDataStore();
|
const leaveStore = useLeavelistDataStore();
|
||||||
|
const dataToobar = ref<any[]>([]);
|
||||||
const { showLoader, hideLoader, messageError } = mixin;
|
const { showLoader, hideLoader, messageError } = mixin;
|
||||||
|
|
||||||
const querySting = reactive<QuerySting>({
|
const querySting = reactive<QuerySting>({
|
||||||
|
|
@ -86,7 +86,23 @@ async function updatePaging(
|
||||||
await fecthLeaveList();
|
await fecthLeaveList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** function เรียกข้อมูลสถานะ*/
|
||||||
|
async function fetchOption() {
|
||||||
|
await http
|
||||||
|
.get(config.API.leaveType())
|
||||||
|
.then((res) => {
|
||||||
|
dataToobar.value = res.data.result;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
await fetchOption();
|
||||||
await fecthLeaveList();
|
await fecthLeaveList();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -140,6 +156,7 @@ watch(
|
||||||
<ToolBar
|
<ToolBar
|
||||||
:rowsPerPage="querySting.pageSize"
|
:rowsPerPage="querySting.pageSize"
|
||||||
@update:querySting="updatePaging"
|
@update:querySting="updatePaging"
|
||||||
|
:dataToobar="dataToobar"
|
||||||
/>
|
/>
|
||||||
<TableList
|
<TableList
|
||||||
:page="querySting.page"
|
:page="querySting.page"
|
||||||
|
|
@ -147,6 +164,7 @@ watch(
|
||||||
:maxPage="maxPage"
|
:maxPage="maxPage"
|
||||||
:totalList="totalList"
|
:totalList="totalList"
|
||||||
@update:querySting="updatePaging"
|
@update:querySting="updatePaging"
|
||||||
|
:dataToobar="dataToobar"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="leaveStore.tabView === 'calendar'"><CalendarView /></div>
|
<div v-if="leaveStore.tabView === 'calendar'"><CalendarView /></div>
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ const mixin = useCounterMixin();
|
||||||
const leaveStore = useLeavelistDataStore();
|
const leaveStore = useLeavelistDataStore();
|
||||||
const { showLoader, hideLoader, messageError } = mixin;
|
const { showLoader, hideLoader, messageError } = mixin;
|
||||||
const { fetchListLeaveReject } = leaveStore;
|
const { fetchListLeaveReject } = leaveStore;
|
||||||
|
const dataToobar = ref<any[]>([]);
|
||||||
const $q = useQuasar(); //ใช้ noti quasar
|
const $q = useQuasar(); //ใช้ noti quasar
|
||||||
|
|
||||||
const querySting = reactive<QuerySting>({
|
const querySting = reactive<QuerySting>({
|
||||||
|
|
@ -85,7 +85,21 @@ async function updatePaging(
|
||||||
await fecthLeaveList();
|
await fecthLeaveList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** function เรียกข้อมูลสถานะ*/
|
||||||
|
async function fetchOption() {
|
||||||
|
await http
|
||||||
|
.get(config.API.leaveType())
|
||||||
|
.then((res) => {
|
||||||
|
dataToobar.value = res.data.result;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
await fetchOption();
|
||||||
await fecthLeaveList();
|
await fecthLeaveList();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -93,6 +107,7 @@ onMounted(async () => {
|
||||||
<ToolBar
|
<ToolBar
|
||||||
:rowsPerPage="querySting.pageSize"
|
:rowsPerPage="querySting.pageSize"
|
||||||
@update:querySting="updatePaging"
|
@update:querySting="updatePaging"
|
||||||
|
:dataToobar="dataToobar"
|
||||||
/>
|
/>
|
||||||
<TableList
|
<TableList
|
||||||
:page="querySting.page"
|
:page="querySting.page"
|
||||||
|
|
@ -100,6 +115,7 @@ onMounted(async () => {
|
||||||
:maxPage="maxPage"
|
:maxPage="maxPage"
|
||||||
:totalList="totalList"
|
:totalList="totalList"
|
||||||
@update:querySting="updatePaging"
|
@update:querySting="updatePaging"
|
||||||
|
:dataToobar="dataToobar"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
|
import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const leaveStore = useLeavelistDataStore();
|
const leaveStore = useLeavelistDataStore();
|
||||||
|
const checkForm = ref<string>("");
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
/** เรียน funtion จาก stores*/
|
/** เรียน funtion จาก stores*/
|
||||||
|
|
@ -206,6 +206,7 @@ const props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
require: true,
|
require: true,
|
||||||
},
|
},
|
||||||
|
dataToobar: Object,
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(["update:querySting"]);
|
const emit = defineEmits(["update:querySting"]);
|
||||||
|
|
@ -237,8 +238,22 @@ watch([() => currentPage.value, () => pagination.value.rowsPerPage], () => {
|
||||||
updateQuerySting(currentPage.value, pagination.value.rowsPerPage);
|
updateQuerySting(currentPage.value, pagination.value.rowsPerPage);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function convert(val: any) {
|
||||||
|
const filtertype = props.dataToobar?.find(
|
||||||
|
(e: any) => e.id === val.leaveTypeId
|
||||||
|
);
|
||||||
|
const type = filtertype?.code;
|
||||||
|
if(type == 'LV-006'&&val.hajjDayStatus == false){
|
||||||
|
return 'ลาอุปสมบท'
|
||||||
|
}else if(type == 'LV-006'&&val.hajjDayStatus == true){
|
||||||
|
return 'ลาประกอบพิธีฮัจญ์'
|
||||||
|
}else{
|
||||||
|
return val.leaveTypeName
|
||||||
|
}
|
||||||
|
}
|
||||||
/** Hook*/
|
/** Hook*/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
||||||
if (leaveStore.tabMenu === "1") {
|
if (leaveStore.tabMenu === "1") {
|
||||||
leaveStore.visibleColumns = visibleColumnsLeave.value;
|
leaveStore.visibleColumns = visibleColumnsLeave.value;
|
||||||
leaveStore.columns = columnsLeave.value;
|
leaveStore.columns = columnsLeave.value;
|
||||||
|
|
@ -287,6 +302,9 @@ onMounted(() => {
|
||||||
1
|
1
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else-if="col.name == 'leaveTypeName'">
|
||||||
|
{{ convert(props.row) }}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div v-else class="table_ellipsis">
|
<div v-else class="table_ellipsis">
|
||||||
{{ col.value }}
|
{{ col.value }}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted, watch } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
@ -22,6 +22,7 @@ const props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
require: true,
|
require: true,
|
||||||
},
|
},
|
||||||
|
dataToobar: Array,
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(["update:querySting"]);
|
const emit = defineEmits(["update:querySting"]);
|
||||||
|
|
@ -102,28 +103,6 @@ const optionStatusMain = ref<DataOption[]>(
|
||||||
leaveStore.tabMenu == "1" ? optionStatus.value : optionStatus2.value
|
leaveStore.tabMenu == "1" ? optionStatus.value : optionStatus2.value
|
||||||
);
|
);
|
||||||
|
|
||||||
/** function เรียกข้อมูลสถานะ*/
|
|
||||||
async function fetchOption() {
|
|
||||||
await http
|
|
||||||
.get(config.API.leaveType())
|
|
||||||
.then((res) => {
|
|
||||||
const data = res.data.result;
|
|
||||||
leaveStore.leaveType = data;
|
|
||||||
optionTypeMain.value = [
|
|
||||||
{ id: "00000000-0000-0000-0000-000000000000", name: "ทั้งหมด" },
|
|
||||||
];
|
|
||||||
const option = data.map((e: DataOption) => ({
|
|
||||||
id: e.id,
|
|
||||||
name: e.name,
|
|
||||||
}));
|
|
||||||
optionTypeMain.value.push(...option);
|
|
||||||
optionType.value = optionTypeMain.value;
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
messageError($q, err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ฟังก์ชั่นค้นหาข้อมูลของ Option Filter
|
* ฟังก์ชั่นค้นหาข้อมูลของ Option Filter
|
||||||
* @param val คำที่ค้นหา
|
* @param val คำที่ค้นหา
|
||||||
|
|
@ -145,9 +124,26 @@ function filterOption(val: string, update: any, name: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
watch(
|
||||||
await fetchOption();
|
async () => props.dataToobar,
|
||||||
});
|
() => {
|
||||||
|
if (props.dataToobar) {
|
||||||
|
const data = props.dataToobar;
|
||||||
|
leaveStore.leaveType = data;
|
||||||
|
optionTypeMain.value = [
|
||||||
|
{ id: "00000000-0000-0000-0000-000000000000", name: "ทั้งหมด" },
|
||||||
|
];
|
||||||
|
|
||||||
|
const option = data.map((e: any) => ({
|
||||||
|
id: e.id,
|
||||||
|
name: e.name,
|
||||||
|
}));
|
||||||
|
|
||||||
|
optionTypeMain.value.push(...option);
|
||||||
|
optionType.value = optionTypeMain.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -210,11 +206,19 @@ onMounted(async () => {
|
||||||
<q-item-section class="text-grey"> ไม่มีข้อมูล </q-item-section>
|
<q-item-section class="text-grey"> ไม่มีข้อมูล </q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="leaveStore.filter.type !== '00000000-0000-0000-0000-000000000000'" v-slot:append>
|
<template
|
||||||
|
v-if="
|
||||||
|
leaveStore.filter.type !== '00000000-0000-0000-0000-000000000000'
|
||||||
|
"
|
||||||
|
v-slot:append
|
||||||
|
>
|
||||||
<q-icon
|
<q-icon
|
||||||
name="cancel"
|
name="cancel"
|
||||||
@click.stop.prevent="
|
@click.stop.prevent="
|
||||||
(optionType = optionTypeMain), (leaveStore.filter.type = '00000000-0000-0000-0000-000000000000'), filterListLeave()
|
(optionType = optionTypeMain),
|
||||||
|
(leaveStore.filter.type =
|
||||||
|
'00000000-0000-0000-0000-000000000000'),
|
||||||
|
filterListLeave()
|
||||||
"
|
"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
/>
|
/>
|
||||||
|
|
@ -249,13 +253,14 @@ onMounted(async () => {
|
||||||
<q-icon
|
<q-icon
|
||||||
name="cancel"
|
name="cancel"
|
||||||
@click.stop.prevent="
|
@click.stop.prevent="
|
||||||
(optionStatus = optionStatusMain), (leaveStore.filter.status = 'ALL'), filterListLeave()
|
(optionStatus = optionStatusMain),
|
||||||
|
(leaveStore.filter.status = 'ALL'),
|
||||||
|
filterListLeave()
|
||||||
"
|
"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</q-select
|
</q-select>
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
<q-space />
|
<q-space />
|
||||||
<div class="col-xs-12 col-sm-3 col-md-2">
|
<div class="col-xs-12 col-sm-3 col-md-2">
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ const props = defineProps({
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
checkForm: String,
|
||||||
});
|
});
|
||||||
console.log(props.data);
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
|
|
@ -16,7 +16,16 @@ console.log(props.data);
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4 text-grey-8">เรื่อง</div>
|
<div class="col-4 text-grey-8">เรื่อง</div>
|
||||||
<div class="col">{{ props.data.leaveTypeName }}</div>
|
|
||||||
|
<div class="col">
|
||||||
|
{{
|
||||||
|
props.checkForm !== "FormUpasom" && props.checkForm !== "FormHajj"
|
||||||
|
? props.data.leaveTypeName
|
||||||
|
: props.data.hajjDayStatus
|
||||||
|
? "ลาประกอบพิธีฮัจญ์"
|
||||||
|
: "ลาอุปสมบท"
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4 text-grey-8">เรียน</div>
|
<div class="col-4 text-grey-8">เรียน</div>
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ interface ListLeave {
|
||||||
org?: string;
|
org?: string;
|
||||||
position?: string;
|
position?: string;
|
||||||
level?: string;
|
level?: string;
|
||||||
|
hajjDayStatus?: boolean;
|
||||||
}
|
}
|
||||||
interface FormData {
|
interface FormData {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ export const useLeavelistDataStore = defineStore("leave", () => {
|
||||||
org: e.org !== undefined && e.org !== null && e.org !== "" ? e.org : "-",
|
org: e.org !== undefined && e.org !== null && e.org !== "" ? e.org : "-",
|
||||||
position: e.position ?? "-",
|
position: e.position ?? "-",
|
||||||
level: e.level ?? "-",
|
level: e.level ?? "-",
|
||||||
|
hajjDayStatus: e.hajjDayStatus ,
|
||||||
dateSendLeave: e.dateSendLeave && date2Thai(e.dateSendLeave),
|
dateSendLeave: e.dateSendLeave && date2Thai(e.dateSendLeave),
|
||||||
dateLeave:
|
dateLeave:
|
||||||
e.leaveStartDate && e.leaveEndDate
|
e.leaveStartDate && e.leaveEndDate
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue