API แก้ไขปฏิทินวันทำงาน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-01-09 13:24:57 +07:00
parent 01b70ab7a0
commit c134530d5c
2 changed files with 38 additions and 7 deletions

View file

@ -13,6 +13,8 @@ export default {
leaveSearch: () => `${leave}/search`, leaveSearch: () => `${leave}/search`,
leaveRound: () => `${leave}/round`, leaveRound: () => `${leave}/round`,
leaveRoundById: (id: string) => `${leave}/round/${id}`, leaveRoundById: (id: string) => `${leave}/round/${id}`,
leaveWorkByid: (id: string) => `${leave}/admin/work/${id}`,
/**ลงเวลาพิเศษ */ /**ลงเวลาพิเศษ */
specialTime: () => `${leave}/admin/edit`, specialTime: () => `${leave}/admin/edit`,
specialTimeApprove: (id: string) => `${leave}/admin/edit/approve/${id}`, specialTimeApprove: (id: string) => `${leave}/admin/edit/approve/${id}`,

View file

@ -1,6 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, reactive } from "vue"; import { ref, onMounted, reactive } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
/** importType */ /** importType */
import type { dataPost } from "@/modules/09_leave/interface/request/changeRound"; import type { dataPost } from "@/modules/09_leave/interface/request/changeRound";
@ -14,14 +16,21 @@ import { useChangeRoundDataStore } from "@/modules/09_leave/stores/ChangeRoundSt
/** useStore */ /** useStore */
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { dialogMessageNotify } = mixin; const {
showLoader,
hideLoader,
success,
messageError,
dialogMessageNotify,
dialogConfirm,
} = mixin;
const dataStore = useChangeRoundDataStore(); const dataStore = useChangeRoundDataStore();
/** use */ /** use */
const $q = useQuasar(); const $q = useQuasar();
const modal = ref<boolean>(false); const modal = ref<boolean>(false);
const dateWork = ref<string>("5"); const dateWork = ref<string>("NORMAL");
const modalFix = ref<boolean>(false); const modalFix = ref<boolean>(false);
const editCheck = ref<string>(""); const editCheck = ref<string>("");
const DataRow = ref<any>(); const DataRow = ref<any>();
@ -47,7 +56,10 @@ function Openmodal(check: string, detail: any) {
} }
} }
const detailByid = ref();
function OpenmodalFix(detail: any) { function OpenmodalFix(detail: any) {
dateWork.value = "NORMAL";
detailByid.value = detail;
modalFix.value = true; modalFix.value = true;
} }
@ -58,8 +70,23 @@ function closeDialog() {
} }
function save() { function save() {
console.log("dateWork===>", dateWork.value); dialogConfirm($q, async () => {
closeDialog(); showLoader();
await http
.post(config.API.leaveWorkByid(detailByid.value.profileId), {
work: dateWork.value,
})
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
closeDialog();
});
});
} }
/** Function ค้นหาข้อมูล */ /** Function ค้นหาข้อมูล */
@ -212,7 +239,7 @@ function searchData() {
</div> </div>
</q-card> </q-card>
<!-- popup แกไขปฏนวนทำงาน --> <!-- popup เปลยนรอบการปฏงาน ,ประวการเปลยนรอบการปฏงาน -->
<Dialogform <Dialogform
:modal="modal" :modal="modal"
:closeDialog="closeDialog" :closeDialog="closeDialog"
@ -221,6 +248,8 @@ function searchData() {
:personId="DataRow == null ? '' : DataRow.profileId" :personId="DataRow == null ? '' : DataRow.profileId"
@update:change-page="dataStore.changePage" @update:change-page="dataStore.changePage"
/> />
<!-- แกไขปฏนวนทำงาน -->
<q-dialog v-model="modalFix" persistent> <q-dialog v-model="modalFix" persistent>
<q-card style="min-width: 800px" <q-card style="min-width: 800px"
><q-toolbar> ><q-toolbar>
@ -242,13 +271,13 @@ function searchData() {
<q-radio <q-radio
name="dateWork" name="dateWork"
v-model="dateWork" v-model="dateWork"
val="5" val="NORMAL"
label="ทำงาน 5 วัน" label="ทำงาน 5 วัน"
/> />
<q-radio <q-radio
name="dateWork" name="dateWork"
v-model="dateWork" v-model="dateWork"
val="6" val="6DAY"
label="ทำงาน 6 วัน" label="ทำงาน 6 วัน"
/> />
</div> </div>