แก้ดัก
This commit is contained in:
parent
56e37f8602
commit
c02e440ff9
1 changed files with 43 additions and 3 deletions
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from "vue";
|
||||
import { ref, reactive, onMounted, computed } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
|
|
@ -8,6 +8,7 @@ import config from "@/app.config";
|
|||
import genReport from "@/plugins/genreport";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
|
||||
/** importType */
|
||||
import type {
|
||||
|
|
@ -48,10 +49,18 @@ const router = useRouter();
|
|||
const route = useRoute();
|
||||
const paramsId = route.params.id.toString();
|
||||
|
||||
const keycloakId = ref<string>("");
|
||||
const typeDocx = ref<string>("docx");
|
||||
const typePdf = ref<string>("pdf");
|
||||
const modalApprove = ref(false);
|
||||
const dialogTitle = ref<string>("อนุญาต");
|
||||
const approveCheck = computed(() => {
|
||||
return (
|
||||
rows.value?.commanders?.every(
|
||||
(commander) => commander.approveStatus === "APPROVE"
|
||||
) ?? false
|
||||
);
|
||||
});
|
||||
|
||||
/** ฟังก์ชั่น อัปโหลด
|
||||
* consolelog ไว้ก่อน
|
||||
|
|
@ -164,6 +173,7 @@ onMounted(async () => {
|
|||
showLoader();
|
||||
Promise.all([
|
||||
await fetchDetailDeleteLeave(paramsId),
|
||||
await fetchKeycloakPosition(),
|
||||
await fetchDetailLeave(paramsId),
|
||||
checkOfficer(),
|
||||
]).finally(() => {
|
||||
|
|
@ -458,6 +468,20 @@ async function checkOfficer() {
|
|||
})
|
||||
.finally(() => {});
|
||||
}
|
||||
|
||||
async function fetchKeycloakPosition() {
|
||||
if (keycloakId.value == "") {
|
||||
await http
|
||||
.get(config.API.keycloakPosition())
|
||||
.then(async (res) => {
|
||||
const data = await res.data.result;
|
||||
keycloakId.value = data.profileId;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -804,10 +828,26 @@ async function checkOfficer() {
|
|||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<q-separator v-if="formDataReject.status == 'NEW'" />
|
||||
<q-separator
|
||||
v-if="
|
||||
checkPermission($route)?.attrIsUpdate &&
|
||||
formData.reasonOligarch === '-' &&
|
||||
rows &&
|
||||
rows.approvers[0]?.profileId == keycloakId &&
|
||||
rows.approvers[0]?.approveStatus == 'PENDING' &&
|
||||
approveCheck
|
||||
"
|
||||
/>
|
||||
<div
|
||||
class="row q-pa-md q-gutter-sm justify-end"
|
||||
v-if="formDataReject.status == 'NEW'"
|
||||
v-if="
|
||||
checkPermission($route)?.attrIsUpdate &&
|
||||
formData.reasonOligarch === '-' &&
|
||||
rows &&
|
||||
rows.approvers[0]?.profileId == keycloakId &&
|
||||
rows.approvers[0]?.approveStatus == 'PENDING' &&
|
||||
approveCheck
|
||||
"
|
||||
>
|
||||
<q-btn
|
||||
unelevated
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue