API ทำเรืองลาออก
This commit is contained in:
parent
bd3f893908
commit
32d18eec3d
3 changed files with 265 additions and 133 deletions
|
|
@ -5,6 +5,9 @@ const retirementResign = `${env.API_URI}/retirement`
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
listUser: () => `${retirementResign}/resign/user`,
|
listUser: () => `${retirementResign}/resign/user`,
|
||||||
|
listResign: () => `${retirementResign}/resign`,
|
||||||
|
resingByid: (id: string) => `${retirementResign}/resign/${id}`,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,115 +1,240 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="col-12 row justify-center">
|
<div class="col-12 row justify-center">
|
||||||
<div class="col-xs-12 col-sm-12 col-md-11">
|
<div class="col-xs-12 col-sm-12 col-md-11">
|
||||||
<div class="toptitle text-white col-12 row items-center">
|
<div class="toptitle text-white col-12 row items-center">
|
||||||
<q-btn icon="mdi-arrow-left" unelevated round dense flat color="primary" class="q-mr-sm" @click="router.go(-1)" />
|
<q-btn
|
||||||
<div v-if="routeName == 'AddLeave'">เพิ่มเรื่องลาออก</div>
|
icon="mdi-arrow-left"
|
||||||
<div v-else>รายละเอียดเรื่องลาออก</div>
|
unelevated
|
||||||
</div>
|
round
|
||||||
<div class="col-12">
|
dense
|
||||||
<q-card bordered>
|
flat
|
||||||
<div class="col-12 row q-col-gutter-md q-pa-md">
|
color="primary"
|
||||||
<div class="col-xs-12 col-sm-12">
|
class="q-mr-sm"
|
||||||
<q-card bordered flat>
|
@click="router.go(-1)"
|
||||||
<div class="q-pa-xs bg-grey-2 row items-center q-py-sm q-px-md justify-center text-bold">ลาออก</div>
|
/>
|
||||||
<q-separator />
|
<div v-if="routeName == 'AddLeave'">เพิ่มเรื่องลาออก</div>
|
||||||
<div class="col-12 row q-pa-sm q-col-gutter-sm">
|
<div v-else>รายละเอียดเรื่องลาออก</div>
|
||||||
<q-input class="col-8" dense outlined v-model="tranferOrg" label="สถานที่ยื่นขอลาออกจากราชการ" :readonly="routeName != 'AddLeave'" />
|
</div>
|
||||||
<datepicker class="col-2" menu-class-name="modalfix" v-model="dateCommand" :locale="'th'" autoApply readonly borderless :enableTimePicker="false" week-start="0">
|
<div class="col-12">
|
||||||
<template #year="{ year }">
|
<q-card bordered>
|
||||||
{{ year + 543 }}
|
<div class="col-12 row q-col-gutter-md q-pa-md">
|
||||||
</template>
|
<div class="col-xs-12 col-sm-12">
|
||||||
<template #year-overlay-value="{ value }">
|
<q-card bordered flat>
|
||||||
{{ parseInt(value + 543) }}
|
<div
|
||||||
</template>
|
class="q-pa-xs bg-grey-2 row items-center q-py-sm q-px-md justify-center text-bold"
|
||||||
<template #trigger>
|
>
|
||||||
<q-input
|
ลาออก
|
||||||
outlined
|
</div>
|
||||||
readonly
|
<q-separator />
|
||||||
dense
|
<div class="col-12 row q-pa-sm q-col-gutter-sm">
|
||||||
class="full-width datepicker"
|
<q-input
|
||||||
:model-value="dateCommand != null ? date2Thai(dateCommand) : null"
|
class="col-8"
|
||||||
:label="`${'วันที่ยื่นขอลาออกจากราชการ'}`"
|
dense
|
||||||
:rules="[val => !!val || `${'กรุณาเลือกวันที่ยื่นขอลาออกจากราชการ'}`]"
|
outlined
|
||||||
>
|
v-model="tranferOrg"
|
||||||
<template v-slot:prepend>
|
label="สถานที่ยื่นขอลาออกจากราชการ"
|
||||||
<q-icon name="event" class="cursor-pointer" style="color: var(--q-primary)"> </q-icon>
|
:readonly="routeName != 'AddLeave'"
|
||||||
</template>
|
/>
|
||||||
</q-input>
|
<datepicker
|
||||||
</template>
|
class="col-2"
|
||||||
</datepicker>
|
menu-class-name="modalfix"
|
||||||
<datepicker
|
v-model="dateCommand"
|
||||||
class="col-2"
|
:locale="'th'"
|
||||||
menu-class-name="modalfix"
|
autoApply
|
||||||
v-model="dateLeave"
|
readonly
|
||||||
:locale="'th'"
|
borderless
|
||||||
autoApply
|
:enableTimePicker="false"
|
||||||
borderless
|
week-start="0"
|
||||||
:enableTimePicker="false"
|
>
|
||||||
week-start="0"
|
<template #year="{ year }">
|
||||||
:readonly="routeName != 'AddLeave'"
|
{{ year + 543 }}
|
||||||
>
|
</template>
|
||||||
<template #year="{ year }">
|
<template #year-overlay-value="{ value }">
|
||||||
{{ year + 543 }}
|
{{ parseInt(value + 543) }}
|
||||||
</template>
|
</template>
|
||||||
<template #year-overlay-value="{ value }">
|
<template #trigger>
|
||||||
{{ parseInt(value + 543) }}
|
<q-input
|
||||||
</template>
|
outlined
|
||||||
<template #trigger>
|
readonly
|
||||||
<q-input
|
dense
|
||||||
outlined
|
class="full-width datepicker"
|
||||||
dense
|
:model-value="
|
||||||
:readonly="routeName != 'AddLeave'"
|
dateCommand != null ? date2Thai(dateCommand) : null
|
||||||
class="full-width datepicker"
|
"
|
||||||
:model-value="dateLeave != null ? date2Thai(dateLeave) : null"
|
:label="`${'วันที่ยื่นขอลาออกจากราชการ'}`"
|
||||||
:label="`${'วันที่ขอลาออกจากราชการ'}`"
|
:rules="[
|
||||||
:rules="[val => !!val || `${'กรุณาเลือกวันที่ขอลาออกจากราชการ'}`]"
|
(val) =>
|
||||||
>
|
!!val ||
|
||||||
<template v-slot:prepend>
|
`${'กรุณาเลือกวันที่ยื่นขอลาออกจากราชการ'}`,
|
||||||
<q-icon name="event" class="cursor-pointer" style="color: var(--q-primary)"> </q-icon>
|
]"
|
||||||
</template>
|
>
|
||||||
</q-input>
|
<template v-slot:prepend>
|
||||||
</template>
|
<q-icon
|
||||||
</datepicker>
|
name="event"
|
||||||
<q-input class="col-12" dense outlined v-model="noteReason" label="เหตุผลที่ลาออกจากราชการ" type="textarea" :readonly="routeName != 'AddLeave'" />
|
class="cursor-pointer"
|
||||||
|
style="color: var(--q-primary)"
|
||||||
|
>
|
||||||
|
</q-icon>
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
</template>
|
||||||
|
</datepicker>
|
||||||
|
<datepicker
|
||||||
|
class="col-2"
|
||||||
|
menu-class-name="modalfix"
|
||||||
|
v-model="dateLeave"
|
||||||
|
:locale="'th'"
|
||||||
|
autoApply
|
||||||
|
borderless
|
||||||
|
:enableTimePicker="false"
|
||||||
|
week-start="0"
|
||||||
|
:readonly="routeName != 'AddLeave'"
|
||||||
|
>
|
||||||
|
<template #year="{ year }">
|
||||||
|
{{ year + 543 }}
|
||||||
|
</template>
|
||||||
|
<template #year-overlay-value="{ value }">
|
||||||
|
{{ parseInt(value + 543) }}
|
||||||
|
</template>
|
||||||
|
<template #trigger>
|
||||||
|
<q-input
|
||||||
|
outlined
|
||||||
|
dense
|
||||||
|
:readonly="routeName != 'AddLeave'"
|
||||||
|
class="full-width datepicker"
|
||||||
|
:model-value="
|
||||||
|
dateLeave != null ? date2Thai(dateLeave) : null
|
||||||
|
"
|
||||||
|
:label="`${'วันที่ขอลาออกจากราชการ'}`"
|
||||||
|
:rules="[
|
||||||
|
(val) =>
|
||||||
|
!!val || `${'กรุณาเลือกวันที่ขอลาออกจากราชการ'}`,
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
<template v-slot:prepend>
|
||||||
|
<q-icon
|
||||||
|
name="event"
|
||||||
|
class="cursor-pointer"
|
||||||
|
style="color: var(--q-primary)"
|
||||||
|
>
|
||||||
|
</q-icon>
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
</template>
|
||||||
|
</datepicker>
|
||||||
|
<q-input
|
||||||
|
class="col-12"
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
v-model="noteReason"
|
||||||
|
label="เหตุผลที่ลาออกจากราชการ"
|
||||||
|
type="textarea"
|
||||||
|
:readonly="routeName != 'AddLeave'"
|
||||||
|
/>
|
||||||
|
|
||||||
<q-separator />
|
<q-separator />
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row col-12 q-pa-sm" v-if="routeName == 'AddLeave'">
|
<div class="row col-12 q-pa-sm" v-if="routeName == 'AddLeave'">
|
||||||
<q-space />
|
<q-space />
|
||||||
<q-btn unelevated dense class="q-px-md items-center" color="primary" label="ยื่นเรื่องขอลาออก" @click="router.go(-1)" />
|
<q-btn
|
||||||
</div>
|
unelevated
|
||||||
</q-card>
|
dense
|
||||||
</div>
|
class="q-px-md items-center"
|
||||||
</div>
|
color="primary"
|
||||||
</div>
|
label="ยื่นเรื่องขอลาออก"
|
||||||
|
@click="saveResing"
|
||||||
|
:disable="tranferOrg == '' && noteReason == ''"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</q-card>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { QTableProps } from "quasar"
|
import type { QTableProps } from "quasar";
|
||||||
import { ref } from "vue"
|
import { ref, onMounted } from "vue";
|
||||||
import { useQuasar } from "quasar"
|
import { useQuasar } from "quasar";
|
||||||
import { useRouter } from "vue-router"
|
import { useRouter, useRoute } from "vue-router";
|
||||||
import { useCounterMixin } from "@/stores/mixin"
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
|
||||||
const mixin = useCounterMixin()
|
const mixin = useCounterMixin();
|
||||||
const { date2Thai } = mixin
|
const { date2Thai, dateToISO, success, messageError, showLoader, hideLoader } =
|
||||||
const router = useRouter()
|
mixin;
|
||||||
const $q = useQuasar()
|
const router = useRouter();
|
||||||
const dateCommand = ref<Date>(new Date())
|
const route = useRoute();
|
||||||
const dateLeave = ref<Date>(new Date())
|
const $q = useQuasar();
|
||||||
const file = ref(null)
|
const routeName = router.currentRoute.value.name;
|
||||||
const tranferOrg = ref("")
|
const id = ref<string>("");
|
||||||
const noteReason = ref("")
|
|
||||||
const noPos = ref("")
|
|
||||||
const level = ref("")
|
|
||||||
const salary = ref("")
|
|
||||||
const positionNew = ref("")
|
|
||||||
const salaryNew = ref("")
|
|
||||||
const transfer = ref("")
|
|
||||||
const note = ref("")
|
|
||||||
|
|
||||||
const routeName = router.currentRoute.value.name
|
const tranferOrg = ref("");
|
||||||
|
const dateCommand = ref<Date>(new Date());
|
||||||
|
const dateLeave = ref<Date>(new Date());
|
||||||
|
const noteReason = ref("");
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (route.params.id !== undefined) {
|
||||||
|
id.value = route.params.id.toString();
|
||||||
|
fectDataresign(id.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const saveResing = () => {
|
||||||
|
$q.dialog({
|
||||||
|
title: "ยืนยันการยื่นข้อมูลลาออก",
|
||||||
|
message: "ต้องการยื่นข้อมูลลาออกนี้ใช่หรือไม่?",
|
||||||
|
cancel: {
|
||||||
|
flat: true,
|
||||||
|
color: "negative",
|
||||||
|
},
|
||||||
|
persistent: true,
|
||||||
|
})
|
||||||
|
.onOk(async () => {
|
||||||
|
createFormresign();
|
||||||
|
})
|
||||||
|
.onCancel(() => {})
|
||||||
|
.onDismiss(() => {});
|
||||||
|
};
|
||||||
|
const createFormresign = async () => {
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append("Location", tranferOrg.value);
|
||||||
|
formData.append("SendDate", dateToISO(dateCommand.value));
|
||||||
|
formData.append("ActiveDate", dateToISO(dateLeave.value));
|
||||||
|
formData.append("Reason", noteReason.value);
|
||||||
|
await http
|
||||||
|
.post(config.API.listResign(), formData)
|
||||||
|
.then((res: any) => {
|
||||||
|
// console.log(res);
|
||||||
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
router.push(`/leave`);
|
||||||
|
})
|
||||||
|
.catch((e: any) => {
|
||||||
|
messageError($q, e);
|
||||||
|
console.log(e);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const fectDataresign = async (id: string) => {
|
||||||
|
showLoader();
|
||||||
|
await http
|
||||||
|
.get(config.API.resingByid(id))
|
||||||
|
.then((res: any) => {
|
||||||
|
let data = res.data.result;
|
||||||
|
// console.log(data);
|
||||||
|
(tranferOrg.value = data.location),
|
||||||
|
(dateCommand.value = data.sendDate),
|
||||||
|
(dateLeave.value = data.activeDate),
|
||||||
|
(noteReason.value = data.reason);
|
||||||
|
})
|
||||||
|
.catch((e: any) => {
|
||||||
|
console.log(e);
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import type { QTableProps } from "quasar";
|
||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
|
|
@ -10,6 +11,9 @@ import Table from "@/components/Table.vue";
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
const mixin = useCounterMixin();
|
||||||
|
const { date2Thai, dateToISO, success, messageError, showLoader, hideLoader } =
|
||||||
|
mixin;
|
||||||
|
|
||||||
const filter = ref<string>("");
|
const filter = ref<string>("");
|
||||||
const visibleColumns = ref<String[]>([
|
const visibleColumns = ref<String[]>([
|
||||||
|
|
@ -66,26 +70,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
style: "font-size: 14px; width:10%;",
|
style: "font-size: 14px; width:10%;",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const rows = ref<any>([
|
const rows = ref<any>([]);
|
||||||
{
|
|
||||||
placeLeave: "สํานักงานกรุงเทพมหานคร ",
|
|
||||||
dateStartLeave: "02/02/2566",
|
|
||||||
dateLeave: "10/03/2565",
|
|
||||||
status: "รอดำเนินการ",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
placeLeave: "สํานักงานกรุงเทพมหานคร ",
|
|
||||||
dateStartLeave: "02/02/2566",
|
|
||||||
dateLeave: "10/03/2565",
|
|
||||||
status: "เสร็จสิ้น",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
placeLeave: "สํานักงานกรุงเทพมหานคร ",
|
|
||||||
dateStartLeave: "02/02/2566",
|
|
||||||
dateLeave: "10/03/2565",
|
|
||||||
status: "เสร็จสิ้น",
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
const initialPagination = ref({
|
const initialPagination = ref({
|
||||||
rowsPerPage: 0,
|
rowsPerPage: 0,
|
||||||
});
|
});
|
||||||
|
|
@ -95,9 +80,28 @@ onMounted(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const fectListleave = async () => {
|
const fectListleave = async () => {
|
||||||
// console.log(config.API.listUser());
|
showLoader();
|
||||||
|
await http
|
||||||
await http.get(config.API.listUser()).then((res:any)=>{}).catch((e:any)=>{});
|
.get(config.API.listUser())
|
||||||
|
.then((res: any) => {
|
||||||
|
// console.log(res);
|
||||||
|
let data = res.data.result;
|
||||||
|
console.log(data);
|
||||||
|
rows.value = data.map((e: any) => ({
|
||||||
|
id: e.id,
|
||||||
|
placeLeave: e.location,
|
||||||
|
dateStartLeave: date2Thai(e.sendDate),
|
||||||
|
dateLeave: date2Thai(e.activeDate),
|
||||||
|
status: e.status,
|
||||||
|
}));
|
||||||
|
})
|
||||||
|
.catch((e: any) => {
|
||||||
|
console.log(e);
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const clickAdd = async () => {
|
const clickAdd = async () => {
|
||||||
|
|
@ -139,7 +143,7 @@ const clickAdd = async () => {
|
||||||
<q-tr
|
<q-tr
|
||||||
:props="props"
|
:props="props"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
@click="router.push(`/leave/1`)"
|
@click="router.push(`/leave/` + props.row.id)"
|
||||||
>
|
>
|
||||||
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
||||||
<div v-if="col.name == 'no'">
|
<div v-if="col.name == 'no'">
|
||||||
|
|
@ -148,7 +152,7 @@ const clickAdd = async () => {
|
||||||
<div v-else-if="col.name == 'status'">
|
<div v-else-if="col.name == 'status'">
|
||||||
<q-icon
|
<q-icon
|
||||||
size="20px"
|
size="20px"
|
||||||
v-if="props.row.status == 'รอดำเนินการ'"
|
v-if="props.row.status == 'PENDING'"
|
||||||
name="mdi-timer-sand"
|
name="mdi-timer-sand"
|
||||||
color="deep-orange"
|
color="deep-orange"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue