check permission get data detail registry
This commit is contained in:
parent
b598f761c4
commit
ec8ff08b40
2 changed files with 209 additions and 167 deletions
|
|
@ -30,6 +30,7 @@ import TabMain from "@/modules/04_registryPerson/components/detail/TabMain.vue";
|
|||
*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import avatar from "@/assets/avatar_user.jpg";
|
||||
import CardNotPermission from "@/components/CardNotPermission.vue";
|
||||
|
||||
/**
|
||||
* use
|
||||
|
|
@ -50,6 +51,9 @@ const {
|
|||
pathRegistryEmp,
|
||||
} = useCounterMixin();
|
||||
|
||||
const isPermission = ref<boolean | null>(null);
|
||||
const notPermissionMsg = ref<string>("");
|
||||
|
||||
/** ถึงเเก่กรรม */
|
||||
const dialogPassaway = ref<boolean>(false);
|
||||
const placeDeathCertificate = ref("");
|
||||
|
|
@ -275,9 +279,16 @@ async function fetchDataPersonal() {
|
|||
} else {
|
||||
profilePicture.value = avatar;
|
||||
}
|
||||
|
||||
isPermission.value = true;
|
||||
})
|
||||
.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(() => {
|
||||
hideLoader();
|
||||
|
|
@ -654,190 +665,205 @@ onMounted(async () => {
|
|||
</div>
|
||||
<q-space />
|
||||
|
||||
<!-- list menu ของข้าราชการฯ -->
|
||||
<q-btn-dropdown
|
||||
v-if="
|
||||
empType === '' &&
|
||||
checkPermissionList([
|
||||
'SYS_TEMPDUTY',
|
||||
'SYS_TEMPDUTY2',
|
||||
'SYS_PROMOTION_OFFICER',
|
||||
'SYS_PASSAWAY',
|
||||
'SYS_DISMISS',
|
||||
'SYS_PLACEMENT_OTHER',
|
||||
])
|
||||
"
|
||||
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, index) in itemsMenu" :key="index">
|
||||
<q-item
|
||||
v-if="checkPermissionCreate(item.system)"
|
||||
clickable
|
||||
@click="
|
||||
item.name == 'ช่วยราชการ'
|
||||
? helpPost()
|
||||
: item.name == 'ส่งตัวกลับ'
|
||||
? repatriationPost()
|
||||
: item.name == 'แต่งตั้ง-เลื่อน-ย้าย'
|
||||
? appointPost()
|
||||
: item.name == 'ถึงแก่กรรม'
|
||||
? clickPassaway()
|
||||
: item.name == 'ให้ออกจากราชการ'
|
||||
? outPost()
|
||||
: item.name == 'อื่นๆ'
|
||||
? otherPost()
|
||||
: null
|
||||
"
|
||||
v-close-popup
|
||||
>
|
||||
<q-item-section>{{ item.name }}</q-item-section>
|
||||
</q-item>
|
||||
</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>
|
||||
<div v-if="isPermission">
|
||||
<!-- list menu ของข้าราชการฯ -->
|
||||
<q-btn-dropdown
|
||||
v-if="
|
||||
empType === '' &&
|
||||
checkPermissionList([
|
||||
'SYS_TEMPDUTY',
|
||||
'SYS_TEMPDUTY2',
|
||||
'SYS_PROMOTION_OFFICER',
|
||||
'SYS_PASSAWAY',
|
||||
'SYS_DISMISS',
|
||||
'SYS_PLACEMENT_OTHER',
|
||||
])
|
||||
"
|
||||
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, index) in itemsMenu" :key="index">
|
||||
<q-item
|
||||
v-if="checkPermissionCreate(item.system)"
|
||||
clickable
|
||||
@click="
|
||||
item.name == 'ช่วยราชการ'
|
||||
? helpPost()
|
||||
: item.name == 'ส่งตัวกลับ'
|
||||
? repatriationPost()
|
||||
: item.name == 'แต่งตั้ง-เลื่อน-ย้าย'
|
||||
? appointPost()
|
||||
: item.name == 'ถึงแก่กรรม'
|
||||
? clickPassaway()
|
||||
: item.name == 'ให้ออกจากราชการ'
|
||||
? outPost()
|
||||
: item.name == 'อื่นๆ'
|
||||
? otherPost()
|
||||
: null
|
||||
"
|
||||
v-close-popup
|
||||
>
|
||||
<q-item-section>{{ item.name }}</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
</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-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<q-card class="my-card" flat bordered>
|
||||
<q-card-section>
|
||||
<div class="col row items-center">
|
||||
<div class="row col-12">
|
||||
<div class="col" style="padding-left: 13%">
|
||||
<div class="col-12 text-primary">
|
||||
<h2
|
||||
class="title q-ma-none q-pa-none"
|
||||
v-if="formDetail && formDetail.firstName && formDetail.lastName"
|
||||
>
|
||||
{{
|
||||
`${formDetail?.prefix ? formDetail?.prefix : ""}${
|
||||
formDetail?.firstName
|
||||
} ${formDetail?.lastName} ${leaveReason}`
|
||||
}}
|
||||
</h2>
|
||||
<div v-if="isPermission">
|
||||
<q-card class="my-card" flat bordered>
|
||||
<q-card-section>
|
||||
<div class="col row items-center">
|
||||
<div class="row col-12">
|
||||
<div class="col" style="padding-left: 13%">
|
||||
<div class="col-12 text-primary">
|
||||
<h2
|
||||
class="title q-ma-none q-pa-none"
|
||||
v-if="
|
||||
formDetail && formDetail.firstName && formDetail.lastName
|
||||
"
|
||||
>
|
||||
{{
|
||||
`${formDetail?.prefix ? formDetail?.prefix : ""}${
|
||||
formDetail?.firstName
|
||||
} ${formDetail?.lastName} ${leaveReason}`
|
||||
}}
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-card-section style="padding: 0px">
|
||||
<div
|
||||
class="absolute"
|
||||
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-card-section>
|
||||
<q-card-section style="padding: 0px">
|
||||
<div
|
||||
class="absolute"
|
||||
style="top: 0; left: 12px; transform: translateY(-50%)"
|
||||
>
|
||||
<q-tooltip>แก้ไขรูปโปรไฟล์</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
<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-btn>
|
||||
</div>
|
||||
|
||||
<div class="row items-center bg-toolbar">
|
||||
<div class="row col-12" style="padding-left: 14%">
|
||||
<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?.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 class="row items-center bg-toolbar">
|
||||
<div class="row col-12" style="padding-left: 14%">
|
||||
<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?.position || "-" }}</div>
|
||||
</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 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 class="col">
|
||||
{{ formDetail?.posLevel?.posLevelName || "-" }}
|
||||
</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?.posLevel?.posLevelName || "-" }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
</q-card-section>
|
||||
|
||||
<q-separator />
|
||||
</q-card>
|
||||
<q-separator />
|
||||
</q-card>
|
||||
|
||||
<q-card bordered class="q-mt-md rounded">
|
||||
<TabMain :fetchDataPersonal="fetchDataPersonal" />
|
||||
</q-card>
|
||||
<q-card bordered class="q-mt-md rounded">
|
||||
<TabMain :fetchDataPersonal="fetchDataPersonal" />
|
||||
</q-card>
|
||||
</div>
|
||||
<div v-else-if="isPermission !== null && !isPermission">
|
||||
<CardNotPermission :message="notPermissionMsg" />
|
||||
</div>
|
||||
|
||||
<!-- Dialog แนบใบมรณบัตร -->
|
||||
<q-dialog v-model="dialogPassaway" persistent>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue