check permission get data detail registry
This commit is contained in:
parent
b598f761c4
commit
ec8ff08b40
2 changed files with 209 additions and 167 deletions
16
src/components/CardNotPermission.vue
Normal file
16
src/components/CardNotPermission.vue
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
<script lang="ts" setup>
|
||||||
|
defineProps({
|
||||||
|
message: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<q-card>
|
||||||
|
<q-card-section align="center">
|
||||||
|
<q-icon name="warning" color="red" size="sm" /> {{ message }}
|
||||||
|
</q-card-section>
|
||||||
|
</q-card>
|
||||||
|
</template>
|
||||||
|
|
@ -30,6 +30,7 @@ import TabMain from "@/modules/04_registryPerson/components/detail/TabMain.vue";
|
||||||
*/
|
*/
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import avatar from "@/assets/avatar_user.jpg";
|
import avatar from "@/assets/avatar_user.jpg";
|
||||||
|
import CardNotPermission from "@/components/CardNotPermission.vue";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* use
|
* use
|
||||||
|
|
@ -50,6 +51,9 @@ const {
|
||||||
pathRegistryEmp,
|
pathRegistryEmp,
|
||||||
} = useCounterMixin();
|
} = useCounterMixin();
|
||||||
|
|
||||||
|
const isPermission = ref<boolean | null>(null);
|
||||||
|
const notPermissionMsg = ref<string>("");
|
||||||
|
|
||||||
/** ถึงเเก่กรรม */
|
/** ถึงเเก่กรรม */
|
||||||
const dialogPassaway = ref<boolean>(false);
|
const dialogPassaway = ref<boolean>(false);
|
||||||
const placeDeathCertificate = ref("");
|
const placeDeathCertificate = ref("");
|
||||||
|
|
@ -275,9 +279,16 @@ async function fetchDataPersonal() {
|
||||||
} else {
|
} else {
|
||||||
profilePicture.value = avatar;
|
profilePicture.value = avatar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isPermission.value = true;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
if (err.response.data.status == 403) {
|
||||||
|
isPermission.value = false;
|
||||||
|
notPermissionMsg.value = err.response.data.message;
|
||||||
|
} else {
|
||||||
|
messageError($q, err);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
|
|
@ -654,190 +665,205 @@ onMounted(async () => {
|
||||||
</div>
|
</div>
|
||||||
<q-space />
|
<q-space />
|
||||||
|
|
||||||
<!-- list menu ของข้าราชการฯ -->
|
<div v-if="isPermission">
|
||||||
<q-btn-dropdown
|
<!-- list menu ของข้าราชการฯ -->
|
||||||
v-if="
|
<q-btn-dropdown
|
||||||
empType === '' &&
|
v-if="
|
||||||
checkPermissionList([
|
empType === '' &&
|
||||||
'SYS_TEMPDUTY',
|
checkPermissionList([
|
||||||
'SYS_TEMPDUTY2',
|
'SYS_TEMPDUTY',
|
||||||
'SYS_PROMOTION_OFFICER',
|
'SYS_TEMPDUTY2',
|
||||||
'SYS_PASSAWAY',
|
'SYS_PROMOTION_OFFICER',
|
||||||
'SYS_DISMISS',
|
'SYS_PASSAWAY',
|
||||||
'SYS_PLACEMENT_OTHER',
|
'SYS_DISMISS',
|
||||||
])
|
'SYS_PLACEMENT_OTHER',
|
||||||
"
|
])
|
||||||
size="md"
|
"
|
||||||
rounded
|
size="md"
|
||||||
unelevated
|
rounded
|
||||||
color="grey-4"
|
unelevated
|
||||||
text-color="red"
|
color="grey-4"
|
||||||
icon="mdi-home-export-outline"
|
text-color="red"
|
||||||
dropdown-icon="mdi-chevron-down"
|
icon="mdi-home-export-outline"
|
||||||
>
|
dropdown-icon="mdi-chevron-down"
|
||||||
<q-list v-for="(item, index) in itemsMenu" :key="index">
|
>
|
||||||
<q-item
|
<q-list v-for="(item, index) in itemsMenu" :key="index">
|
||||||
v-if="checkPermissionCreate(item.system)"
|
<q-item
|
||||||
clickable
|
v-if="checkPermissionCreate(item.system)"
|
||||||
@click="
|
clickable
|
||||||
item.name == 'ช่วยราชการ'
|
@click="
|
||||||
? helpPost()
|
item.name == 'ช่วยราชการ'
|
||||||
: item.name == 'ส่งตัวกลับ'
|
? helpPost()
|
||||||
? repatriationPost()
|
: item.name == 'ส่งตัวกลับ'
|
||||||
: item.name == 'แต่งตั้ง-เลื่อน-ย้าย'
|
? repatriationPost()
|
||||||
? appointPost()
|
: item.name == 'แต่งตั้ง-เลื่อน-ย้าย'
|
||||||
: item.name == 'ถึงแก่กรรม'
|
? appointPost()
|
||||||
? clickPassaway()
|
: item.name == 'ถึงแก่กรรม'
|
||||||
: item.name == 'ให้ออกจากราชการ'
|
? clickPassaway()
|
||||||
? outPost()
|
: item.name == 'ให้ออกจากราชการ'
|
||||||
: item.name == 'อื่นๆ'
|
? outPost()
|
||||||
? otherPost()
|
: item.name == 'อื่นๆ'
|
||||||
: null
|
? otherPost()
|
||||||
"
|
: null
|
||||||
v-close-popup
|
"
|
||||||
>
|
v-close-popup
|
||||||
<q-item-section>{{ item.name }}</q-item-section>
|
>
|
||||||
</q-item>
|
<q-item-section>{{ item.name }}</q-item-section>
|
||||||
</q-list>
|
|
||||||
</q-btn-dropdown>
|
|
||||||
|
|
||||||
<!-- list menu ของลูกจ้างประจำ -->
|
|
||||||
<q-btn-dropdown
|
|
||||||
v-if="
|
|
||||||
empType === '-employee' &&
|
|
||||||
checkPermissionList(['SYS_PROMOTION_EMP', 'SYS_PASSAWAY'])
|
|
||||||
"
|
|
||||||
size="md"
|
|
||||||
rounded
|
|
||||||
unelevated
|
|
||||||
color="grey-4"
|
|
||||||
text-color="red"
|
|
||||||
icon="mdi-home-export-outline"
|
|
||||||
dropdown-icon="mdi-chevron-down"
|
|
||||||
>
|
|
||||||
<q-list v-for="item in itemsMenuEmployee" :key="item.id">
|
|
||||||
<q-item
|
|
||||||
v-if="checkPermissionCreate(item.system)"
|
|
||||||
clickable
|
|
||||||
@click="
|
|
||||||
item.name == 'ปรับระดับชั้นงาน - ย้าย'
|
|
||||||
? appointEmployeePost()
|
|
||||||
: item.name == 'ถึงแก่กรรม'
|
|
||||||
? clickPassaway()
|
|
||||||
: null
|
|
||||||
"
|
|
||||||
v-close-popup
|
|
||||||
>
|
|
||||||
<q-item-section>{{ item.name }}</q-item-section>
|
|
||||||
</q-item>
|
|
||||||
</q-list>
|
|
||||||
</q-btn-dropdown>
|
|
||||||
|
|
||||||
<q-btn
|
|
||||||
unelevated
|
|
||||||
round
|
|
||||||
color="grey-4"
|
|
||||||
text-color="primary"
|
|
||||||
icon="mdi-file-eye-outline"
|
|
||||||
size="md"
|
|
||||||
>
|
|
||||||
<q-tooltip>ดาวน์โหลดไฟล์</q-tooltip>
|
|
||||||
<q-menu>
|
|
||||||
<q-list style="min-width: 130px">
|
|
||||||
<q-item clickable v-close-popup @click="onClickDownloadKp7('FULL')">
|
|
||||||
<q-item-section class="text-blue">ก.พ.7/ก.ก.1</q-item-section>
|
|
||||||
</q-item>
|
|
||||||
<q-item clickable v-close-popup @click="onClickDownloadKp7('SHORT')">
|
|
||||||
<q-item-section class="text-primary">ประวัติแบบย่อ</q-item-section>
|
|
||||||
</q-item>
|
</q-item>
|
||||||
</q-list>
|
</q-list>
|
||||||
</q-menu>
|
</q-btn-dropdown>
|
||||||
</q-btn>
|
|
||||||
|
<!-- list menu ของลูกจ้างประจำ -->
|
||||||
|
<q-btn-dropdown
|
||||||
|
v-if="
|
||||||
|
empType === '-employee' &&
|
||||||
|
checkPermissionList(['SYS_PROMOTION_EMP', 'SYS_PASSAWAY'])
|
||||||
|
"
|
||||||
|
size="md"
|
||||||
|
rounded
|
||||||
|
unelevated
|
||||||
|
color="grey-4"
|
||||||
|
text-color="red"
|
||||||
|
icon="mdi-home-export-outline"
|
||||||
|
dropdown-icon="mdi-chevron-down"
|
||||||
|
>
|
||||||
|
<q-list v-for="item in itemsMenuEmployee" :key="item.id">
|
||||||
|
<q-item
|
||||||
|
v-if="checkPermissionCreate(item.system)"
|
||||||
|
clickable
|
||||||
|
@click="
|
||||||
|
item.name == 'ปรับระดับชั้นงาน - ย้าย'
|
||||||
|
? appointEmployeePost()
|
||||||
|
: item.name == 'ถึงแก่กรรม'
|
||||||
|
? clickPassaway()
|
||||||
|
: null
|
||||||
|
"
|
||||||
|
v-close-popup
|
||||||
|
>
|
||||||
|
<q-item-section>{{ item.name }}</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</q-list>
|
||||||
|
</q-btn-dropdown>
|
||||||
|
|
||||||
|
<q-btn
|
||||||
|
unelevated
|
||||||
|
round
|
||||||
|
color="grey-4"
|
||||||
|
text-color="primary"
|
||||||
|
icon="mdi-file-eye-outline"
|
||||||
|
size="md"
|
||||||
|
>
|
||||||
|
<q-tooltip>ดาวน์โหลดไฟล์</q-tooltip>
|
||||||
|
<q-menu>
|
||||||
|
<q-list style="min-width: 130px">
|
||||||
|
<q-item clickable v-close-popup @click="onClickDownloadKp7('FULL')">
|
||||||
|
<q-item-section class="text-blue">ก.พ.7/ก.ก.1</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item
|
||||||
|
clickable
|
||||||
|
v-close-popup
|
||||||
|
@click="onClickDownloadKp7('SHORT')"
|
||||||
|
>
|
||||||
|
<q-item-section class="text-primary"
|
||||||
|
>ประวัติแบบย่อ</q-item-section
|
||||||
|
>
|
||||||
|
</q-item>
|
||||||
|
</q-list>
|
||||||
|
</q-menu>
|
||||||
|
</q-btn>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-card class="my-card" flat bordered>
|
<div v-if="isPermission">
|
||||||
<q-card-section>
|
<q-card class="my-card" flat bordered>
|
||||||
<div class="col row items-center">
|
<q-card-section>
|
||||||
<div class="row col-12">
|
<div class="col row items-center">
|
||||||
<div class="col" style="padding-left: 13%">
|
<div class="row col-12">
|
||||||
<div class="col-12 text-primary">
|
<div class="col" style="padding-left: 13%">
|
||||||
<h2
|
<div class="col-12 text-primary">
|
||||||
class="title q-ma-none q-pa-none"
|
<h2
|
||||||
v-if="formDetail && formDetail.firstName && formDetail.lastName"
|
class="title q-ma-none q-pa-none"
|
||||||
>
|
v-if="
|
||||||
{{
|
formDetail && formDetail.firstName && formDetail.lastName
|
||||||
`${formDetail?.prefix ? formDetail?.prefix : ""}${
|
"
|
||||||
formDetail?.firstName
|
>
|
||||||
} ${formDetail?.lastName} ${leaveReason}`
|
{{
|
||||||
}}
|
`${formDetail?.prefix ? formDetail?.prefix : ""}${
|
||||||
</h2>
|
formDetail?.firstName
|
||||||
|
} ${formDetail?.lastName} ${leaveReason}`
|
||||||
|
}}
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</q-card-section>
|
||||||
</q-card-section>
|
<q-card-section style="padding: 0px">
|
||||||
<q-card-section style="padding: 0px">
|
<div
|
||||||
<div
|
class="absolute"
|
||||||
class="absolute"
|
style="top: 0; left: 12px; transform: translateY(-50%)"
|
||||||
style="top: 0; left: 12px; transform: translateY(-50%)"
|
|
||||||
>
|
|
||||||
<q-avatar size="90px" class="bg-grey-2">
|
|
||||||
<q-img :src="profilePicture" />
|
|
||||||
</q-avatar>
|
|
||||||
<q-btn
|
|
||||||
v-if="checkPermission($route)?.attrIsUpdate"
|
|
||||||
round
|
|
||||||
text-color="edit"
|
|
||||||
icon="mdi-pencil"
|
|
||||||
@click="openDialogImg"
|
|
||||||
size="sm"
|
|
||||||
unelevated
|
|
||||||
class="bg-white btnEditImg"
|
|
||||||
>
|
>
|
||||||
<q-tooltip>แก้ไขรูปโปรไฟล์</q-tooltip>
|
<q-avatar size="90px" class="bg-grey-2">
|
||||||
</q-btn>
|
<q-img :src="profilePicture" />
|
||||||
</div>
|
</q-avatar>
|
||||||
|
<q-btn
|
||||||
|
v-if="checkPermission($route)?.attrIsUpdate"
|
||||||
|
round
|
||||||
|
text-color="edit"
|
||||||
|
icon="mdi-pencil"
|
||||||
|
@click="openDialogImg"
|
||||||
|
size="sm"
|
||||||
|
unelevated
|
||||||
|
class="bg-white btnEditImg"
|
||||||
|
>
|
||||||
|
<q-tooltip>แก้ไขรูปโปรไฟล์</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row items-center bg-toolbar">
|
<div class="row items-center bg-toolbar">
|
||||||
<div class="row col-12" style="padding-left: 14%">
|
<div class="row col-12" style="padding-left: 14%">
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<div class="col-sm-3 col-md-3">
|
<div class="col-sm-3 col-md-3">
|
||||||
<div class="col text-grey-6 text-caption">
|
<div class="col text-grey-6 text-caption">
|
||||||
{{ empType === "" ? "ตำแหน่งในสายงาน" : "ตำแหน่ง" }}
|
{{ empType === "" ? "ตำแหน่งในสายงาน" : "ตำแหน่ง" }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col">{{ formDetail?.position || "-" }}</div>
|
<div class="col">{{ formDetail?.position || "-" }}</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-4">
|
|
||||||
<div class="col-sm-3 col-md-3">
|
|
||||||
<div class="col text-grey-6 text-caption">
|
|
||||||
{{ empType === "" ? "ตำแหน่งประเภท" : "กลุ่มงาน" }}
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
{{ formDetail?.posType?.posTypeName || "-" }}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col-4">
|
||||||
<div class="col-4">
|
<div class="col-sm-3 col-md-3">
|
||||||
<div class="col-sm-3 col-md-3">
|
<div class="col text-grey-6 text-caption">
|
||||||
<div class="col text-grey-6 text-caption">
|
{{ empType === "" ? "ตำแหน่งประเภท" : "กลุ่มงาน" }}
|
||||||
{{ empType === "" ? "ระดับ" : "ระดับชั้นงาน" }}
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
{{ formDetail?.posType?.posTypeName || "-" }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
</div>
|
||||||
{{ formDetail?.posLevel?.posLevelName || "-" }}
|
<div class="col-4">
|
||||||
|
<div class="col-sm-3 col-md-3">
|
||||||
|
<div class="col text-grey-6 text-caption">
|
||||||
|
{{ empType === "" ? "ระดับ" : "ระดับชั้นงาน" }}
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
{{ formDetail?.posLevel?.posLevelName || "-" }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</q-card-section>
|
||||||
</q-card-section>
|
|
||||||
|
|
||||||
<q-separator />
|
<q-separator />
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|
||||||
<q-card bordered class="q-mt-md rounded">
|
<q-card bordered class="q-mt-md rounded">
|
||||||
<TabMain :fetchDataPersonal="fetchDataPersonal" />
|
<TabMain :fetchDataPersonal="fetchDataPersonal" />
|
||||||
</q-card>
|
</q-card>
|
||||||
|
</div>
|
||||||
|
<div v-else-if="isPermission !== null && !isPermission">
|
||||||
|
<CardNotPermission :message="notPermissionMsg" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Dialog แนบใบมรณบัตร -->
|
<!-- Dialog แนบใบมรณบัตร -->
|
||||||
<q-dialog v-model="dialogPassaway" persistent>
|
<q-dialog v-model="dialogPassaway" persistent>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue