แก้ดัก
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">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted } from "vue";
|
import { ref, reactive, onMounted, computed } from "vue";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
|
|
||||||
|
|
@ -8,6 +8,7 @@ import config from "@/app.config";
|
||||||
import genReport from "@/plugins/genreport";
|
import genReport from "@/plugins/genreport";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
|
import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
|
||||||
|
import { checkPermission } from "@/utils/permissions";
|
||||||
|
|
||||||
/** importType */
|
/** importType */
|
||||||
import type {
|
import type {
|
||||||
|
|
@ -48,10 +49,18 @@ const router = useRouter();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const paramsId = route.params.id.toString();
|
const paramsId = route.params.id.toString();
|
||||||
|
|
||||||
|
const keycloakId = ref<string>("");
|
||||||
const typeDocx = ref<string>("docx");
|
const typeDocx = ref<string>("docx");
|
||||||
const typePdf = ref<string>("pdf");
|
const typePdf = ref<string>("pdf");
|
||||||
const modalApprove = ref(false);
|
const modalApprove = ref(false);
|
||||||
const dialogTitle = ref<string>("อนุญาต");
|
const dialogTitle = ref<string>("อนุญาต");
|
||||||
|
const approveCheck = computed(() => {
|
||||||
|
return (
|
||||||
|
rows.value?.commanders?.every(
|
||||||
|
(commander) => commander.approveStatus === "APPROVE"
|
||||||
|
) ?? false
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
/** ฟังก์ชั่น อัปโหลด
|
/** ฟังก์ชั่น อัปโหลด
|
||||||
* consolelog ไว้ก่อน
|
* consolelog ไว้ก่อน
|
||||||
|
|
@ -164,6 +173,7 @@ onMounted(async () => {
|
||||||
showLoader();
|
showLoader();
|
||||||
Promise.all([
|
Promise.all([
|
||||||
await fetchDetailDeleteLeave(paramsId),
|
await fetchDetailDeleteLeave(paramsId),
|
||||||
|
await fetchKeycloakPosition(),
|
||||||
await fetchDetailLeave(paramsId),
|
await fetchDetailLeave(paramsId),
|
||||||
checkOfficer(),
|
checkOfficer(),
|
||||||
]).finally(() => {
|
]).finally(() => {
|
||||||
|
|
@ -458,6 +468,20 @@ async function checkOfficer() {
|
||||||
})
|
})
|
||||||
.finally(() => {});
|
.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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -804,10 +828,26 @@ async function checkOfficer() {
|
||||||
</div> -->
|
</div> -->
|
||||||
</div>
|
</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
|
<div
|
||||||
class="row q-pa-md q-gutter-sm justify-end"
|
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
|
<q-btn
|
||||||
unelevated
|
unelevated
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue