permission => โครงสร้างอัตรากำลัง,อัตรากำลังลูกจ้างประจำ,ทะเบียนประวัติ, ทะเบียนประวัติลูกจ้าง,ตั้งค่าเว็บสรรหา, สอบแข่งขัน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-08-01 18:03:39 +07:00
parent a59a9d5ee7
commit c8fef97125
34 changed files with 606 additions and 1904 deletions

View file

@ -1,6 +1,7 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions";
import http from "@/plugins/http";
import config from "@/app.config";
@ -175,6 +176,7 @@ onMounted(async () => {
<strong>{{ date2Thai(store.orgPublishDate) }}</strong>
</div>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
dense
class="q-px-md"
color="indigo-9"
@ -208,6 +210,7 @@ onMounted(async () => {
>
<div>
<q-btn
v-if="checkPermission($route)?.attrIsCreate"
flat
style="background-color: #d8f5f2"
round
@ -242,6 +245,7 @@ onMounted(async () => {
/>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
dense
class="q-px-md"
:outline="store.typeOrganizational === 'draft' ? false : true"
@ -280,6 +284,7 @@ onMounted(async () => {
</q-btn-group>
<q-btn-dropdown
v-if="checkPermission($route)?.attrIsCreate"
dense
unelevated
class="q-px-md"

View file

@ -1,7 +1,10 @@
<template>
<div class="q-pb-sm row q-col-gutter-sm">
<!-- -->
<div class="q-gutter-sm" v-if="nornmalData == true">
<div
class="q-gutter-sm"
v-if="nornmalData == true && checkPermission($route)?.attrIsCreate"
>
<q-btn
size="12px"
flat
@ -123,6 +126,7 @@
</q-table>
</template>
<script setup lang="ts">
import { checkPermission } from "@/utils/permissions";
import { ref, useAttrs } from "vue";
import type { Pagination } from "@/modules/04_registry/interface/index/Main";

View file

@ -19,7 +19,7 @@
<div class="q-gutter-sm q-mx-sm" v-if="addData == false">
<q-btn
size="12px"
v-if="!edit"
v-if="!edit && checkPermission($route)?.attrIsUpdate"
flat
round
:disabled="disable"
@ -33,7 +33,7 @@
size="12px"
flat
round
v-if="edit"
v-if="edit && checkPermission($route)?.attrIsUpdate"
:color="!edit ? 'grey-7' : 'public'"
@click="save"
icon="mdi-content-save-outline"
@ -44,7 +44,7 @@
size="12px"
flat
round
v-if="edit && !addEmployee"
v-if="edit && !addEmployee && checkPermission($route)?.attrIsUpdate"
:color="!edit ? 'grey-7' : 'red'"
@click="ClickCancel"
icon="mdi-undo"
@ -52,7 +52,14 @@
<q-tooltip>ยกเล</q-tooltip>
</q-btn>
</div>
<div class="q-pl-sm" v-else-if="iconAdd != '' && iconAdd != null">
<div
class="q-pl-sm"
v-else-if="
iconAdd != '' &&
iconAdd != null &&
checkPermission($route)?.attrIsUpdate
"
>
<q-btn
size="12px"
flat
@ -70,6 +77,7 @@
<div class="q-pl-sm" v-else>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
size="12px"
flat
round
@ -99,6 +107,7 @@
</div>
</template>
<script setup lang="ts">
import { checkPermission } from "@/utils/permissions";
const props = defineProps({
header: {
type: String,

View file

@ -23,6 +23,7 @@
<q-tr :props="props" class="cursor-pointer">
<q-td>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
dense
size="12px"
flat
@ -34,6 +35,7 @@
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
v-if="checkPermission($route)?.attrIsDelete"
dense
size="12px"
flat
@ -61,9 +63,12 @@
v-for="col in props.cols"
:key="col.name"
:props="props"
@click="clickDetail(props.row.id)"
@click="
checkPermission($route)?.attrIsGet
? clickDetail(props.row.id)
: undefined
"
>
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
@ -81,7 +86,9 @@
round
color="green"
@click.stop.prevent="clickEdit(props.row.id)"
v-if="col.value == null"
v-if="
col.value == null && checkPermission($route)?.attrIsUpdate
"
>
<q-icon name="mdi-file-excel-outline" size="20px" />
<!-- นำเขาไฟลผลคะแนนสอบ -->
@ -90,6 +97,7 @@
<div v-else>
{{ col.value }}
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
dense
size="12px"
flat
@ -102,6 +110,7 @@
</q-btn>
<q-btn
v-if="checkPermission($route)?.attrIsGet"
dense
size="12px"
flat
@ -122,7 +131,10 @@
color="green"
round
@click.stop.prevent="clickUpload(props.row.id)"
v-if="col.value == null || col.value == '0'"
v-if="
(col.value == null || col.value == '0') &&
checkPermission($route)?.attrIsUpdate
"
>
<q-icon name="mdi-file-excel-outline" size="20px" />
<q-tooltip>นำเขาไฟลสมครสอบ</q-tooltip>
@ -131,6 +143,7 @@
{{ col.value }}
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
dense
size="12px"
flat
@ -143,6 +156,7 @@
</q-btn>
<q-btn
v-if="checkPermission($route)?.attrIsGet"
dense
size="12px"
flat
@ -159,7 +173,6 @@
{{ col.value }}
</div>
</q-td>
</q-tr>
</template>
</Table>
@ -361,6 +374,7 @@
</q-dialog>
</template>
<script setup lang="ts">
import { checkPermission } from "@/utils/permissions";
import type { QTableProps } from "quasar";
import { onMounted, ref } from "vue";
import { useRouter } from "vue-router";

View file

@ -1,5 +1,6 @@
<script setup lang="ts">
import type { QTableProps } from "quasar";
import { checkPermission } from "@/utils/permissions";
import { ref, onMounted } from "vue";
import type {
WebType,
@ -709,6 +710,7 @@ const getClass = (val: boolean) => {
</q-img>
</q-card>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
unelevated
color="primary"
size="md"
@ -744,6 +746,7 @@ const getClass = (val: boolean) => {
</q-img>
</q-card>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
unelevated
color="blue"
size="md"
@ -1036,7 +1039,11 @@ const getClass = (val: boolean) => {
v-for="col in props.cols"
:key="col.name"
:props="props"
@click="selectData(props.row.id, false)"
@click="
checkPermission($route)?.attrIsUpdate
? selectData(props.row.id, false)
: undefined
"
class="cursor-pointer"
>
<div v-if="col.name == 'createdAt'" class="">
@ -1075,7 +1082,11 @@ const getClass = (val: boolean) => {
v-for="col in props.cols"
:key="col.name"
:props="props"
@click="selectData(props.row.id, true)"
@click="
checkPermission($route)?.attrIsUpdate
? selectData(props.row.id, true)
: undefined
"
class="cursor-pointer"
>
<div v-if="col.name == 'createdAt'" class="">

View file

@ -343,10 +343,20 @@ watch(
</q-item-section>
<q-item-section>
<div
class="text-weight-medium text-primary cursor-pointer"
@click="onClickViewDetail(props.row.id)"
:class="
checkPermission($route)?.attrIsGet
? 'text-weight-medium text-primary cursor-pointer'
: 'cursor-pointer text-weight-medium'
"
@click="
checkPermission($route)?.attrIsGet
? onClickViewDetail(props.row.id)
: undefined
"
>
<q-tooltip>ทะเบยนประว</q-tooltip>
<q-tooltip v-if="checkPermission($route)?.attrIsGet"
>ทะเบยนประว</q-tooltip
>
{{
`${props.row.prefix ? props.row.prefix : ""}${
props.row.firstName
@ -421,8 +431,9 @@ watch(
</q-card-section>
</q-card>
</q-card-section>
<q-separator inset />
<q-separator inset v-if="checkPermission($route)?.attrIsGet" />
<q-btn
v-if="checkPermission($route)?.attrIsGet"
flat
color="black"
label="ดูเพิ่มเติม"

View file

@ -1,5 +1,6 @@
<script setup lang="ts">
import { ref, reactive, watch, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import dialogHeader from "@/components/DialogHeader.vue";
import type { QTableProps } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
@ -348,6 +349,7 @@ onMounted(async () => {
<template>
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
round
flat
color="primary"
@ -443,6 +445,7 @@ onMounted(async () => {
<q-tr :props="props" class="cursor-pointer">
<q-td auto-width>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
color="primary"
flat
dense
@ -500,6 +503,7 @@ onMounted(async () => {
<q-card bordered>
<q-card-actions align="right" class="bg-grey-3">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
round
color="primary"

View file

@ -1,5 +1,6 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import dialogHeader from "@/components/DialogHeader.vue";
import type { QTableProps } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
@ -503,6 +504,7 @@ onMounted(async () => {
<template>
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
round
dense
flat
@ -601,6 +603,7 @@ onMounted(async () => {
<q-tr :props="props" class="cursor-pointer">
<q-td auto-width>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
color="primary"
flat
dense
@ -645,6 +648,7 @@ onMounted(async () => {
<q-card bordered>
<q-card-actions align="right" class="bg-grey-3">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
round
size="14px"

View file

@ -1,5 +1,6 @@
<script setup lang="ts">
import { onMounted, ref, watch, reactive } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
@ -608,6 +609,7 @@ onMounted(async () => {
<template>
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
dense
color="primary"
icon="add"
@ -716,6 +718,7 @@ onMounted(async () => {
<q-tr :props="props" class="cursor-pointer">
<q-td auto-width>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
dense
round
@ -757,6 +760,7 @@ onMounted(async () => {
<q-card bordered>
<q-card-actions class="bg-grey-3" align="right">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
round
color="primary"
@ -779,7 +783,7 @@ onMounted(async () => {
<div>
<q-item
v-for="(col, index) in props.cols.filter(
(col) => col.name !== 'desc'
(col:any) => col.name !== 'desc'
)"
:key="col.name"
:class="index % 2 !== 0 ? 'bg-grey-1' : ''"

View file

@ -1,5 +1,6 @@
<script setup lang="ts">
import { ref, onMounted, reactive, watch } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
@ -338,6 +339,7 @@ onMounted(async () => {
<template>
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
dense
color="primary"
icon="add"
@ -446,6 +448,7 @@ onMounted(async () => {
<q-tr :props="props">
<q-td auto-width>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
dense
round
@ -487,6 +490,7 @@ onMounted(async () => {
<q-card bordered>
<q-card-actions class="bg-grey-3" align="right">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
round
color="primary"
@ -509,7 +513,7 @@ onMounted(async () => {
<div>
<q-item
v-for="(col, index) in props.cols.filter(
(col) => col.name !== 'desc'
(col:any) => col.name !== 'desc'
)"
:key="col.name"
:class="index % 2 !== 0 ? 'bg-grey-1' : ''"

View file

@ -1,5 +1,6 @@
<script setup lang="ts">
import { onMounted, ref, watch, reactive } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
@ -410,6 +411,7 @@ onMounted(async () => {
<template>
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
dense
color="primary"
icon="add"
@ -518,6 +520,7 @@ onMounted(async () => {
<q-tr :props="props">
<q-td auto-width>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
dense
round
@ -559,6 +562,7 @@ onMounted(async () => {
<q-card bordered>
<q-card-actions class="bg-grey-3" align="right">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
round
color="primary"
@ -581,7 +585,7 @@ onMounted(async () => {
<div>
<q-item
v-for="(col, index) in props.cols.filter(
(col) => col.name !== 'desc'
(col:any) => col.name !== 'desc'
)"
:key="col.name"
:class="index % 2 !== 0 ? 'bg-grey-1' : ''"

View file

@ -1,5 +1,6 @@
<script setup lang="ts">
import { onMounted, watch, ref, reactive } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
@ -298,6 +299,7 @@ onMounted(() => {
<div class="row q-gutter-sm items-center">
<div class="toptitle col text-right q-gutter-x-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
round
dense

View file

@ -1,5 +1,6 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
@ -226,6 +227,7 @@ onMounted(() => {
<div class="flex items-center">
<div class="q-gutter-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
size="12px"
flat
round
@ -288,9 +290,9 @@ onMounted(() => {
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width></q-th>
<q-th auto-width></q-th>
<q-th auto-width></q-th>
<q-th auto-width v-if="checkPermission($route)?.attrIsUpdate" />
<q-th auto-width v-if="checkPermission($route)?.attrIsDelete" />
<q-th auto-width />
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
@ -298,7 +300,7 @@ onMounted(() => {
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer" style="height: 40px">
<q-td>
<q-td v-if="checkPermission($route)?.attrIsUpdate">
<q-btn
dense
flat
@ -310,7 +312,7 @@ onMounted(() => {
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
</q-td>
<q-td>
<q-td v-if="checkPermission($route)?.attrIsDelete">
<q-btn
dense
flat

View file

@ -1,5 +1,7 @@
<script setup lang="ts">
import { ref, reactive, watch, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import type {
RequestItemsHistoryObject,
@ -435,6 +437,7 @@ onMounted(() => {
<q-space />
<div class="q-gutter-x-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
color="primary"
icon="mdi-pencil-outline"
flat

View file

@ -1,5 +1,7 @@
<script setup lang="ts">
import { ref, onMounted, reactive } from "vue";
import { checkPermission } from "@/utils/permissions";
import type { QTableProps } from "quasar";
import type {
RequestItemsObject,
@ -344,7 +346,14 @@ onMounted(async () => {
</script>
<template>
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-btn dense color="primary" icon="add" flat round @click="openDialogAdd()"
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
dense
color="primary"
icon="add"
flat
round
@click="openDialogAdd()"
><q-tooltip>เพมขอม</q-tooltip></q-btn
>
@ -449,6 +458,7 @@ onMounted(async () => {
<q-tr :props="props" class="cursor-pointer">
<q-td auto-width>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
color="primary"
flat
dense
@ -472,19 +482,6 @@ onMounted(async () => {
>
<q-tooltip>ประวแกไขว</q-tooltip>
</q-btn>
<!-- <q-btn
color="red"
flat
dense
round
size="14px"
icon="mdi-delete"
clickable
@click.stop="deleteData(props.row.id)"
v-close-popup
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn> -->
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div v-if="col.name === 'no'">
@ -505,6 +502,7 @@ onMounted(async () => {
<q-space />
<div class="q-gutter-x-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
color="primary"
icon="mdi-pencil-outline"
flat

View file

@ -1,5 +1,7 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import { useQuasar, type QTableProps } from "quasar";
@ -457,7 +459,14 @@ onMounted(() => {
</script>
<template>
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-btn dense color="primary" icon="add" flat round @click="openDialogAdd()"
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
dense
color="primary"
icon="add"
flat
round
@click="openDialogAdd()"
><q-tooltip>เพมขอม</q-tooltip></q-btn
>
@ -560,6 +569,7 @@ onMounted(() => {
<q-tr :props="props" class="cursor-pointer">
<q-td auto-width>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
color="primary"
flat
dense
@ -611,6 +621,7 @@ onMounted(() => {
<q-space />
<div class="q-gutter-x-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
color="primary"
icon="mdi-pencil-outline"
flat

View file

@ -1,5 +1,7 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useQuasar, type QTableProps } from "quasar";
import type {
FormFilter,
@ -301,7 +303,14 @@ onMounted(async () => {
</script>
<template>
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-btn dense color="primary" icon="add" flat round @click="openDialogAdd()"
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
dense
color="primary"
icon="add"
flat
round
@click="openDialogAdd()"
><q-tooltip>เพมขอม</q-tooltip></q-btn
>
@ -405,6 +414,7 @@ onMounted(async () => {
<q-tr :props="props" class="cursor-pointer">
<q-td auto-width>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
color="primary"
flat
dense
@ -428,19 +438,6 @@ onMounted(async () => {
>
<q-tooltip>ประวแกไขปฏราชการพเศษ</q-tooltip>
</q-btn>
<!-- <q-btn
color="red"
flat
dense
round
size="14px"
icon="mdi-delete"
clickable
@click.stop="deleteData(props.row.id)"
v-close-popup
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn> -->
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div v-if="col.name === 'no'">
@ -462,6 +459,7 @@ onMounted(async () => {
<q-space />
<div class="q-gutter-x-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
color="primary"
icon="mdi-pencil-outline"
flat

View file

@ -1,5 +1,6 @@
<script setup lang="ts">
import { useQuasar, type QTableProps } from "quasar";
import { checkPermission } from "@/utils/permissions";
import { ref, onMounted, reactive } from "vue";
import type {
RowList,
@ -214,7 +215,14 @@ onMounted(() => {
</script>
<template>
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-btn dense color="primary" icon="add" flat round @click="openDialogAdd()"
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
dense
color="primary"
icon="add"
flat
round
@click="openDialogAdd()"
><q-tooltip>เพมขอม</q-tooltip></q-btn
>
@ -316,6 +324,7 @@ onMounted(() => {
<q-tr :props="props" class="cursor-pointer">
<q-td auto-width>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
dense
round
@ -353,6 +362,7 @@ onMounted(() => {
<q-space />
<div class="q-gutter-x-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
color="primary"
icon="mdi-pencil-outline"
flat
@ -374,7 +384,7 @@ onMounted(() => {
<q-card-section class="q-pa-none">
<q-item
v-for="(col, index) in props.cols.filter(
(col) => col.name !== 'desc'
(col:any) => col.name !== 'desc'
)"
:key="col.name"
:class="index % 2 !== 0 ? 'bg-grey-1' : ''"

View file

@ -1,5 +1,7 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
@ -179,6 +181,7 @@ onMounted(() => {
<div class="row col-12 q-col-gutter-y-sm q-pa-sm">
<div class="col-12 row">
<q-file
v-if="checkPermission($route)?.attrIsUpdate"
for="inputFiles"
class="col-12"
outlined

View file

@ -1,21 +1,36 @@
<script setup lang="ts">
import { onMounted, watch, ref, reactive } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar";
import type { QTableColumn, QForm } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile";
import DialogHeader from "@/components/DialogHeader.vue";
/**
* importType
*/
import type { QTableColumn, QForm } from "quasar";
import type { RequestObject } from "@/modules/04_registryPerson/interface/request/Profile";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Profile";
/**
* importComponents
*/
import DialogHeader from "@/components/DialogHeader.vue";
/**
* importStore
*/
import { useCounterMixin } from "@/stores/mixin";
import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile";
/**
* use
*/
const $q = useQuasar();
const route = useRoute();
const mixin = useCounterMixin();
const store = useProfileDataStore();
const { calculateAge, fetchPerson, filterSelector } = store;
const {
success,
showLoader,
@ -24,8 +39,11 @@ const {
messageError,
dialogConfirm,
dialogMessageNotify,
} = mixin;
const { calculateAge, fetchPerson, filterSelector } = store;
} = useCounterMixin();
/**
* props
*/
const props = defineProps({
fetchDataPersonal: { type: Function, require: true },
});
@ -37,23 +55,16 @@ const empType = ref<string>(
route.name === "registryNewByid" ? "" : "-employee"
);
const currentPage = ref<number>(1);
const maxPage = ref<number>(1);
const modal = ref<boolean>(false);
const informaData = ref<ResponseObject>();
const rowsHistory = ref<ResponseObject[]>([]);
const filterHistory = ref<string>("");
const modalHistory = ref<boolean>(false);
const id = ref<string>("");
const age = ref<string | null>("");
const formData = reactive<RequestObject>(store.defaultProfile);
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
/** ข้อมูล Label*/
const dataLabel = {
citizenId: "เลขประจำตัวประชาชน",
name: "ชื่อ - สกุล",
@ -73,6 +84,7 @@ const dataLabel = {
lastName: "นามสกุล",
};
/** ข้อมูล Table ประวัติแการก้ไขข้อมูลส่วนตัว*/
const columnsHistory = ref<QTableColumn[]>([
{
name: "citizenId",
@ -244,7 +256,6 @@ const columnsHistory = ref<QTableColumn[]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumnsHistory = ref<String[]>([
"citizenId",
"prefix",
@ -262,8 +273,17 @@ const visibleColumnsHistory = ref<String[]>([
"createdFullName",
"createdAt",
]);
const pagination = ref({
page: 1,
rowsPerPage: 10,
sortBy: "createdAt",
descending: true,
});
async function getData() {
/**
* function เรยกขอมลขอมลสวนต
*/
function getData() {
showLoader();
http
.get(config.API.registryNewByProfileId(profileId.value, empType.value))
@ -272,10 +292,7 @@ async function getData() {
id.value = res.data.result.id;
if (res.data.result.birthDate) {
console.log("birthDate===>", res.data.result.birthDate);
age.value = calculateAge(res.data.result.birthDate);
console.log("age===>", age.value);
}
})
.catch((e) => {
@ -286,37 +303,12 @@ async function getData() {
});
}
const calculateMaxDate = () => {
const today = new Date();
today.setFullYear(today.getFullYear() - 18);
return today;
};
async function editData() {
showLoader();
await http
.put(config.API.profileNewProfileById(id.value, empType.value), {
...formData,
employeeClass: route.name === "registry-employeeId" ? "TEMP" : undefined,
})
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
getData(), (modal.value = false);
props.fetchDataPersonal?.();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**
* function แกไขขอมลประววนต
*/
function onClickOpenDialog() {
if (!informaData.value) return;
modal.value = true;
console.log("onClickOpenDialog birthDate===>", informaData.value.birthDate);
id.value = informaData.value.id;
age.value = calculateAge(informaData.value.birthDate);
formData.citizenId = informaData.value.citizenId;
@ -334,21 +326,45 @@ function onClickOpenDialog() {
formData.phone = informaData.value.phone;
}
/**
* function นยนการบนทกขอม
*/
function onSubmit() {
dialogConfirm(
$q,
async () => {
editData();
modal.value = false;
showLoader();
http
.put(config.API.profileNewProfileById(id.value, empType.value), {
...formData,
employeeClass:
route.name === "registry-employeeId" ? "TEMP" : undefined,
})
.then(async () => {
await getData();
await props.fetchDataPersonal?.();
modal.value = false;
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
);
}
async function clickHistory() {
/**
* function อมลประวแกไขขอมลสวนต
*/
function clickHistory() {
modalHistory.value = true;
await http
filterHistory.value = "";
http
.get(config.API.profileNewProfileHisById(id.value, empType.value))
.then((res) => {
rowsHistory.value = res.data.result;
@ -361,6 +377,10 @@ async function clickHistory() {
});
}
/**
* function เชคเลขประจำตวประชาชนช
* @param citizenId เลขประจำตวประชาชน
*/
function changeCardID(citizenId: string | number | null) {
if (citizenId != null && typeof citizenId == "string") {
if (citizenId.length == 13 && citizenId) {
@ -380,29 +400,29 @@ function changeCardID(citizenId: string | number | null) {
}
}
/**
* function เชคอายไมเก 18
*/
function calculateMaxDate() {
const today = new Date();
today.setFullYear(today.getFullYear() - 18);
return today;
}
watch(
() => formData.birthDate,
(v) => {
console.log("v===>", v);
if (v) {
age.value = calculateAge(v);
}
}
);
onMounted(async () => {
await getData();
onMounted(() => {
getData();
if (store.Ops && store.Ops.prefixOps && store.Ops.prefixOps.length === 0) {
fetchPerson();
}
// store.Ops.prefixOps.length === 0 ||
// store.Ops.genderOps.length === 0 ||
// store.Ops.bloodOps.length === 0 ||
// store.Ops.statusOps.length === 0 ||
// store.Ops.religionOps.length === 0
});
</script>
@ -410,6 +430,7 @@ onMounted(async () => {
<div class="row q-gutter-sm items-center">
<div class="toptitle col text-right q-gutter-x-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
round
dense
@ -552,7 +573,7 @@ onMounted(async () => {
:options="store.Ops.prefixOps"
:label="dataLabel.prefix"
:rules="[(val: string) => !!val || `${'กรุณาเลือก คำนำหน้าชื่อ'}`]"
@filter="(inputValue: any,
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'prefixOps'
)"
/>
@ -574,7 +595,7 @@ onMounted(async () => {
class="inputgreen"
:options="store.Ops.rankOps"
:label="dataLabel.rank"
@filter="(inputValue: any,
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'rankOps'
)"
/>
@ -676,7 +697,7 @@ onMounted(async () => {
class="inputgreen"
:options="store.Ops.genderOps"
:label="dataLabel.gender"
@filter="(inputValue: any,
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'genderOps'
)"
/>
@ -698,7 +719,7 @@ onMounted(async () => {
v-model="formData.relationship"
:options="store.Ops.statusOps"
:label="dataLabel.relationship"
@filter="(inputValue: any,
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'statusOps'
)"
/>
@ -742,7 +763,7 @@ onMounted(async () => {
class="inputgreen"
:options="store.Ops.religionOps"
:label="dataLabel.religion"
@filter="(inputValue: any,
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'religionOps'
)"
/>
@ -764,7 +785,7 @@ onMounted(async () => {
class="inputgreen"
:options="store.Ops.bloodOps"
:label="dataLabel.bloodGroup"
@filter="(inputValue: any,
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'bloodOps'
)"
/>
@ -820,6 +841,7 @@ onMounted(async () => {
outlined
placeholder="ค้นหา"
debounce="300"
clearable
>
<template v-slot:append>
<q-icon
@ -828,12 +850,6 @@ onMounted(async () => {
@click.stop.prevent="filterHistory = ''"
class="cursor-pointer"
/>
<q-icon
v-if="filterHistory"
name="cancel"
@click.stop.prevent="filterHistory = ''"
class="cursor-pointer"
/>
</template>
</q-input>
<q-select

View file

@ -1,23 +1,37 @@
<script setup lang="ts">
import { onMounted, ref, useAttrs, reactive, watch } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar";
import axios from "axios";
import type { QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import dialogHeader from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin";
import type { ResponseObject } from "@/components/information/interface/response/OldName";
import type { Pagination } from "@/modules/04_registryPerson/interface/index/Main";
import type { RequestItemsObject } from "@/components/information/interface/request/OldName";
import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile";
/**
* importType
*/
import type { QTableProps } from "quasar";
import type { ResponseObject } from "@/components/information/interface/response/OldName";
/**
* importComponents
*/
import dialogHeader from "@/components/DialogHeader.vue";
/**
* importStore
*/
import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile";
import { useCounterMixin } from "@/stores/mixin";
/**
* use
*/
const $q = useQuasar();
const route = useRoute();
const mixin = useCounterMixin();
const store = useProfileDataStore();
const attrs = ref<any>(useAttrs());
const { fetchPerson } = store;
const {
date2Thai,
success,
@ -25,27 +39,29 @@ const {
messageError,
showLoader,
hideLoader,
dialogRemove,
} = mixin;
const submitDisable = ref<boolean>(true);
const { fetchPerson } = store;
const profileId = ref<string>(route.params.id.toString());
const empType = ref<string>(
route.name === "registryNewByid" ? "" : "-employee"
);
} = useCounterMixin();
/**
* props
*/
const props = defineProps({
fetchDataPersonal: { type: Function, require: true },
});
const submitDisable = ref<boolean>(true);
const profileId = ref<string>(route.params.id.toString());
const empType = ref<string>(
route.name === "registryNewByid" ? "" : "-employee"
);
const editId = ref<string>("");
const dialog = ref<boolean>(false);
const dialogStatus = ref<string>("create");
const filterSearch = ref("");
const filterHistory = ref<string>("");
const historyDialog = ref<boolean>(false);
const historyKeyword = ref<string>("");
const rowsHistory = ref<RequestItemsObject[]>([]);
const changeNameData = reactive<any>({
const changeNameData = reactive({
profileId: profileId.value,
prefixId: "",
prefix: "",
@ -79,7 +95,6 @@ const statusOptionFilter = ref([
"เปลี่ยนคำนำหน้าชื่อ และชื่อ-นามสกุล",
]);
const alertUpload = ref<boolean>(false);
const tittleHistory = ref<string>("ประวัติการเปลี่ยนชื่อ-นามสกุล");
const visibleColumns = ref<string[]>([
"prefix",
"firstName",
@ -213,9 +228,7 @@ const historyColumns = ref<QTableProps["columns"]>([
},
]);
const uploadUrl = ref<string>("");
const initialPagination = ref<Pagination>({
rowsPerPage: 0,
});
const subId = ref<string>("");
const fileUpload = ref<File>();
const pagination = ref({
@ -248,18 +261,16 @@ function closeDialog() {
dialog.value = false;
}
async function onSubmit() {
function onSubmit() {
if (!!fileUpload.value || dialogStatus.value === "edit") {
await dialogConfirm(
dialogConfirm(
$q,
async () => {
() => {
showLoader();
dialogStatus.value === "create"
? await addData()
: await editData(editId.value);
dialogStatus.value === "create" ? addData() : editData(editId.value);
closeDialog();
if (!!fileUpload.value) {
await uploadProfile(fileUpload.value);
uploadProfile(fileUpload.value);
}
},
"ยืนยันการบันทึกข้อมูล",
@ -307,8 +318,6 @@ async function uploadFileURL(uploadUrl: string, file: any) {
},
})
.then(() => {
// fetchProfile(profileId.value);
// success($q, "");
fileUpload.value = undefined;
})
.catch((err) => {
@ -407,44 +416,6 @@ function editData(idData: string) {
});
}
// function deleteData(idData: string) {
// dialogRemove($q, () =>
// http
// .delete(config.API.profileNewChangeNameByChangeNameId(idData))
// .then(() => {
// fetchData(profileId.value);
// success($q, "");
// })
// .catch((err) => {
// messageError($q, err);
// })
// .finally(() => {
// hideLoader();
// })
// );
// }
function deleteFileData(idData: string) {
http
.delete(
config.API.subFile(
"ทะเบียนประวัติ",
"ประวัติการเปลี่ยนชื่อ-นามสกุล",
profileId.value,
idData
)
)
.then(() => {
fetchData(profileId.value);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
async function fetchHistoryData(id: string) {
showLoader();
await http
@ -460,14 +431,6 @@ async function fetchHistoryData(id: string) {
});
}
const paginationLabel = (start: string, end: string, total: string) => {
return start + "-" + end + " ใน " + total;
};
async function openFile(val: string | null) {
if (val != null) window.open(val);
}
function closeHistoryDialog() {
historyDialog.value = false;
}
@ -487,26 +450,12 @@ async function fetchData(id: string) {
});
}
onMounted(async () => {
if (
store.Ops.prefixOps.length === 0 ||
store.Ops.genderOps.length === 0 ||
store.Ops.bloodOps.length === 0 ||
store.Ops.statusOps.length === 0 ||
store.Ops.religionOps.length === 0
) {
await fetchPerson();
}
fetchData(profileId.value);
fetchDataPersonal();
});
function filterSelector(val: string, update: Function, refData: string) {
switch (refData) {
case "statusOptions":
update(() => {
statusOption.value = statusOptionFilter.value.filter(
(v: any) => v.indexOf(val) > -1
(v: string) => v.indexOf(val) > -1
);
});
break;
@ -522,6 +471,21 @@ function filterSelector(val: string, update: Function, refData: string) {
}
}
onMounted(async () => {
if (
store.Ops.prefixOps.length === 0 ||
store.Ops.genderOps.length === 0 ||
store.Ops.bloodOps.length === 0 ||
store.Ops.statusOps.length === 0 ||
store.Ops.religionOps.length === 0
) {
await fetchPerson();
}
fetchData(profileId.value);
fetchDataPersonal();
});
watch(
() => changeNameData.prefix,
() => {
@ -559,6 +523,7 @@ watch(
<template>
<div class="text-primary row q-mb-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
round
flat
color="primary"
@ -650,6 +615,7 @@ watch(
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
color="primary"
flat
dense

View file

@ -1,5 +1,7 @@
<script setup lang="ts">
import { onMounted, ref, reactive, watch } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar";
import type { QTableProps } from "quasar";
@ -485,6 +487,7 @@ onMounted(async () => {
<div class="row q-gutter-sm items-center">
<div class="toptitle col text-right q-gutter-x-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
round
dense

View file

@ -1,5 +1,7 @@
<script setup lang="ts">
import { reactive, ref, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
@ -438,6 +440,7 @@ onMounted(() => {
</q-toolbar-title>
<div class="row q-col-gutter-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
round
flat
color="primary"
@ -513,6 +516,7 @@ onMounted(() => {
</q-toolbar-title>
<div class="row q-col-gutter-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
round
flat
color="primary"
@ -588,6 +592,7 @@ onMounted(() => {
สมรส
</div>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
round
flat
dense
@ -688,6 +693,7 @@ onMounted(() => {
<div class="row q-col-gutter-sm">
<div class="text-weight-bold text-primary text-subtitle1"> ตร</div>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
round
flat
dense
@ -711,6 +717,7 @@ onMounted(() => {
<q-space />
<div class="row q-col-gutter-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
round
flat
color="primary"

View file

@ -1,5 +1,7 @@
<script setup lang="ts">
import { ref, reactive, watch, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import dialogHeader from "@/components/DialogHeader.vue";
import type { QTableProps } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
@ -709,6 +711,7 @@ onMounted(async () => {
<template>
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
round
flat
dense
@ -807,6 +810,7 @@ onMounted(async () => {
<q-tr :props="props" class="cursor-pointer">
<q-td auto-width>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
color="primary"
flat
dense

View file

@ -1,5 +1,6 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import { QForm, useQuasar } from "quasar";
import dialogHeader from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin";
@ -320,6 +321,7 @@ onMounted(async () => {
<template>
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
round
color="primary"
@ -410,6 +412,7 @@ onMounted(async () => {
<q-tr :props="props" class="cursor-pointer">
<q-td auto-width>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
color="primary"
flat
dense
@ -571,91 +574,79 @@ onMounted(async () => {
</q-card>
</q-dialog>
<q-dialog v-model="historyDialog" class="dialog" persistent>
<q-layout
view="lHh lpr lFf"
container
style="height: 500px; min-width: 80%"
class="bg-white"
>
<q-header>
<q-toolbar>
<dialog-header
tittle="ประวัติแก้ไขความสามารถพิเศษ"
:close="closeHistoryDialog"
<q-dialog v-model="historyDialog" persistent>
<q-card style="width: 900px; max-width: 80vw">
<dialog-header
tittle="ประวัติแก้ไขความสามารถพิเศษ"
:close="closeHistoryDialog"
/>
<q-separator />
<q-card-section>
<q-toolbar style="padding: 0px" class="text-primary q-mb-sm">
<q-space />
<q-input
dense
outlined
bg-color="white"
v-model="historyKeyword"
label="ค้นหา"
class="q-mr-sm"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="historyVisibleColumns"
multiple
outlined
dense
bg-color="white"
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="historyColumns"
option-value="name"
options-cover
style="min-width: 150px"
/>
</q-toolbar>
<q-separator color="grey-4" />
</q-header>
<q-page-container>
<q-page class="q-pa-md">
<q-toolbar style="padding: 0px" class="text-primary q-mb-sm">
<q-space />
<q-input
dense
outlined
bg-color="white"
v-model="historyKeyword"
label="ค้นหา"
class="q-mr-sm"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="historyVisibleColumns"
multiple
outlined
dense
bg-color="white"
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="historyColumns"
option-value="name"
options-cover
style="min-width: 150px"
/>
</q-toolbar>
<d-table
ref="table"
:columns="historyColumns"
:rows="historyRows"
row-key="name"
flat
bordered
:paging="true"
dense
:filter="historyKeyword"
v-model:pagination="historyPagination"
:rows-per-page-options="[20, 50, 100]"
class="custom-header-table"
:visible-columns="historyVisibleColumns"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th auto-width />
</q-tr>
</template>
<template v-slot:body="props" v-if="mode === 'table'">
<q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.id">
<div>{{ col.value ? col.value : "-" }}</div>
</q-td>
<q-td auto-width> </q-td>
</q-tr>
</template>
</d-table>
</q-page>
</q-page-container>
</q-layout>
<d-table
ref="table"
:columns="historyColumns"
:rows="historyRows"
row-key="name"
flat
bordered
:paging="true"
dense
:filter="historyKeyword"
v-model:pagination="historyPagination"
:rows-per-page-options="[20, 50, 100]"
class="custom-header-table"
:visible-columns="historyVisibleColumns"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th auto-width />
</q-tr>
</template>
<template v-slot:body="props" v-if="mode === 'table'">
<q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.id">
<div>{{ col.value ? col.value : "-" }}</div>
</q-td>
<q-td auto-width> </q-td>
</q-tr>
</template>
</d-table>
</q-card-section>
</q-card>
</q-dialog>
</template>

View file

@ -1,5 +1,7 @@
<script setup lang="ts">
import { ref, reactive, onMounted, computed } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
@ -540,6 +542,7 @@ onMounted(() => {
<template>
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
color="primary"
round
@ -599,8 +602,8 @@ onMounted(() => {
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width />
<q-th auto-width />
<q-th auto-width v-if="checkPermission($route)?.attrIsUpdate" />
<q-th auto-width v-if="checkPermission($route)?.attrIsUpdate" />
<q-th auto-width />
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
@ -609,7 +612,7 @@ onMounted(() => {
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td auto-width>
<q-td auto-width v-if="checkPermission($route)?.attrIsUpdate">
<q-btn
dense
size="12px"
@ -620,10 +623,9 @@ onMounted(() => {
icon="mdi-arrow-up-bold"
@click="onSwapUp(props.row.id)"
>
<!-- <q-tooltip>เลอนลำดบข</q-tooltip> -->
</q-btn>
</q-td>
<q-td auto-width>
<q-td auto-width v-if="checkPermission($route)?.attrIsUpdate">
<q-btn
dense
size="12px"
@ -634,11 +636,11 @@ onMounted(() => {
icon="mdi-arrow-down-bold"
@click="onSwapDown(props.row.id)"
>
<!-- <q-tooltip>เลอนลำดบลง</q-tooltip> -->
</q-btn>
</q-td>
<q-td auto-width>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
color="primary"
flat
dense

View file

@ -1,5 +1,6 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
@ -229,6 +230,7 @@ onMounted(() => {
<template>
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
dense
color="teal-5"
icon="add"
@ -337,6 +339,7 @@ onMounted(() => {
<q-tr :props="props" class="cursor-pointer">
<q-td auto-width>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
dense
round
@ -359,19 +362,6 @@ onMounted(() => {
>
<q-tooltip>ประวนทกวนทไมไดบเงนเดอนฯ</q-tooltip>
</q-btn>
<!-- <q-btn
flat
dense
round
size="14px"
color="red"
icon="mdi-delete"
@click="
dialogRemove($q, async () => await deleteData(props.row.id))
"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn> -->
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div>{{ col.value ? col.value : "-" }}</div>
@ -385,6 +375,7 @@ onMounted(() => {
<q-card bordered>
<q-card-actions class="bg-grey-3" align="right">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
round
color="primary"
@ -407,7 +398,7 @@ onMounted(() => {
<q-list>
<q-item
v-for="(col, index) in props.cols.filter(
(col) => col.name !== 'desc'
(col:any) => col.name !== 'desc'
)"
:key="col.name"
:class="index % 2 !== 0 ? 'bg-grey-1' : ''"

View file

@ -28,7 +28,7 @@ const itemsTab = ref<any>([
name: "2",
icon: "mdi-account-tie",
label:
route.name === "registry-employeeId"
route.name === "registryNewEmployeeByid"
? "ข้อมูลลูกจ้างชั่วคราว"
: "ข้อมูลราชการ",
},
@ -96,7 +96,9 @@ const splitterModel = ref<number>(12);
:fetchDataPersonal="props.fetchDataPersonal"
/>
<EmployeeMain
v-if="store.tabMain === '2' && route.name === 'registry-employeeId'"
v-if="
store.tabMain === '2' && route.name === 'registryNewEmployeeByid'
"
/>
<GovernmentInformationMain v-else-if="store.tabMain === '2'" />

View file

@ -1,29 +1,32 @@
<script setup lang="ts">
import { ref, onMounted, reactive } from "vue";
import axios from "axios";
import { ref, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
import axios from "axios";
/**
* importType
*/
import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Profile";
import avatar from "@/assets/avatar_user.jpg";
/**
* importComponents
*/
import DialogHeader from "@/components/DialogHeader.vue";
import TabMain from "@/modules/04_registryPerson/components/detail/TabMain.vue";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Profile";
import DialogHeader from "@/components/DialogHeader.vue";
/** ถึงเเก่กรรม */
const dialogPassaway = ref<boolean>(false);
const placeDeathCertificate = ref("");
const deathCertificateNo = ref("");
const dateDeath = ref<Date>(new Date());
const filePassaway = ref<any>(null);
const reasonDeath = ref("");
/**
* importStore
*/
import { useCounterMixin } from "@/stores/mixin";
import avatar from "@/assets/avatar_user.jpg";
const dialogImage = ref<boolean>(false);
const mixin = useCounterMixin();
/**
* use
*/
const $q = useQuasar();
const router = useRouter();
const route = useRoute();
@ -37,7 +40,17 @@ const {
date2Thai,
dateToISO,
dialogMessageNotify,
} = mixin;
} = useCounterMixin();
/** ถึงเเก่กรรม */
const dialogPassaway = ref<boolean>(false);
const placeDeathCertificate = ref("");
const deathCertificateNo = ref("");
const dateDeath = ref<Date>(new Date());
const filePassaway = ref<any>(null);
const reasonDeath = ref("");
const dialogImage = ref<boolean>(false);
const profileId = ref<string>(route.params.id.toString());
const empType = ref<string>(
@ -115,7 +128,6 @@ function uploadImg() {
profileId: profileId.value,
})
.then((res) => {
console.log(res.data);
fileName.value = res.data.result.avatarName;
uploadProfile(res.data.result.avatar);
})
@ -125,8 +137,8 @@ function uploadImg() {
.finally(() => {});
}
async function uploadProfile(path: string) {
await http
function uploadProfile(path: string) {
http
.post(config.API.fileByPath(path), {
replace: true,
fileList: [
@ -135,7 +147,7 @@ async function uploadProfile(path: string) {
},
],
})
.then(async (res) => {
.then((res) => {
uploadUrl.value = res.data[fileName.value].uploadUrl;
uploadFileURL(uploadUrl.value, profileFile.value);
closeImage();
@ -148,9 +160,9 @@ async function uploadProfile(path: string) {
});
}
async function uploadFileURL(uploadUrl: string, file: any) {
function uploadFileURL(uploadUrl: string, file: any) {
showLoader();
await axios
axios
.put(uploadUrl, file, {
headers: {
"Content-Type": file.type,
@ -168,9 +180,9 @@ async function uploadFileURL(uploadUrl: string, file: any) {
});
}
async function fetchProfile(id: string) {
function fetchProfile(id: string) {
showLoader();
await http
http
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, fileName.value))
.then(async (res) => {
profilePicture.value = res.data.downloadUrl;
@ -287,140 +299,155 @@ function onClickDownloadKp7(type: string) {
});
}
/** ช่วยราชการ */
async function helpPost() {
/**
* วยราชการ
*/
function helpPost() {
const formData = new FormData();
formData.append("id", profileId.value);
dialogConfirm($q, async () => {
showLoader();
await http
.post(config.API.placemenHelpGov, formData)
.then(() => {
success($q, "ดำเนินการสำเร็จ");
.then(async () => {
await router.push("/help-government");
await success($q, "ดำเนินการสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
router.push("/help-government");
});
});
}
/** ส่งตัวกลับ */
async function repatriationPost() {
/**
* งตวกล
*/
function repatriationPost() {
const formData = new FormData();
formData.append("id", profileId.value);
dialogConfirm($q, async () => {
showLoader();
await http
.post(config.API.placemenRepatriation, formData)
.then(() => {
success($q, "ดำเนินการสำเร็จ");
.then(async () => {
await router.push("/repatriate");
await success($q, "ดำเนินการสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
router.push("/repatriate");
});
});
}
/** แต่งตังเลื่อน */
async function appointPost() {
/**
* แตงตงเลอน
*/
function appointPost() {
const formData = new FormData();
formData.append("id", profileId.value);
dialogConfirm($q, async () => {
showLoader();
await http
.post(config.API.placemenAppointment, formData)
.then(() => {
success($q, "ดำเนินการสำเร็จ");
.then(async () => {
await router.push("/appoint-promote");
await success($q, "ดำเนินการสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
router.push("/appoint-promote");
});
});
}
/** ถึงเเก่กรรม */
async function clickPassaway() {
/**
* งเเกกรรม
*/
function clickPassaway() {
dialogPassaway.value = true;
}
/** ให้ออกจากราชการ */
async function outPost() {
/**
* ใหออกจากราชการ
*/
function outPost() {
const formData = new FormData();
formData.append("id", profileId.value);
dialogConfirm($q, async () => {
showLoader();
await http
.post(config.API.retirementOut, formData)
.then(() => {
success($q, "ดำเนินการสำเร็จ");
.then(async () => {
await router.push("/dismiss-order");
await success($q, "ดำเนินการสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
router.push("/dismiss-order");
});
});
}
/** อื่นๆ */
async function otherPost() {
/**
* นๆ
*/
function otherPost() {
const formData = new FormData();
formData.append("id", profileId.value);
dialogConfirm($q, async () => {
showLoader();
await http
.post(config.API.placemenOther, formData)
.then(() => {
success($q, "ดำเนินการสำเร็จ");
.then(async () => {
await router.push("/other");
await success($q, "ดำเนินการสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
router.push("/other");
});
});
}
const appointEmployeePost = async () => {
function appointEmployeePost() {
const formData = new FormData();
formData.append("id", profileId.value);
dialogConfirm($q, async () => {
showLoader();
await http
.post(config.API.appointEmployee(), formData)
.then(() => {
success($q, "ดำเนินการสำเร็จ");
.then(async () => {
await router.push("/appoint-employee");
await success($q, "ดำเนินการสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
router.push("/appoint-employee");
});
});
};
}
function closePassaway() {
dialogPassaway.value = false;
}
/**
* function นยนบนทกขอมลถงแกกรรม
*/
function clickSaveDeceased() {
dialogConfirm($q, async () => {
showLoader();
@ -433,9 +460,9 @@ function clickSaveDeceased() {
formData.append("ProfileId", profileId.value);
await http
.post(config.API.listDeceased(), formData)
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
router.push("/deceased");
.then(async () => {
await success($q, "บันทึกข้อมูลสำเร็จ");
await router.push("/deceased");
})
.catch((e) => {
messageError($q, e);
@ -446,10 +473,17 @@ function clickSaveDeceased() {
});
}
/**
* function เป popup เลอกรปภาพ
*/
function openDialogImg() {
dialogImage.value = true;
getImage();
}
/**
* function เรยกขอมลร
*/
function getImage() {
showLoader();
http
@ -470,6 +504,10 @@ function getImage() {
});
}
/**
* function เรยกขอมลร
* @param dataList
*/
function getImg(dataList: any) {
http
.get(config.API.fileByPath(`${dataList.avatar}/${dataList.avatarName}`))
@ -481,21 +519,26 @@ function getImg(dataList: any) {
...data,
};
images.value = [...images.value, newData];
console.log(images.value);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
});
}
/**
* funciton Popup เลอกรปภาพ
*/
function closeImage() {
dialogImage.value = false;
images.value = [];
imagesAlldata.value = [];
}
async function deletePhoto(id: string) {
/**
* funciotn นยนการลบร
* @param id ปภาพ
*/
function deletePhoto(id: string) {
dialogRemove(
$q,
() => {
@ -518,35 +561,20 @@ async function deletePhoto(id: string) {
);
}
function imageClass(n: any) {
const val = n == activeImage.value;
return {
"rounded-borders bg-grey-2 image-size-default": val,
"rounded-borders bg-grey-2 image-size-full": !val,
};
}
function getClass(n: any) {
const val = n == activeImage.value;
return {
"rounded-borders border-green shadow-1": val,
"rounded-borders shadow-1": !val,
};
}
async function selectAvatarHistory() {
console.log(activeImage.value);
/**
* function นยนการเลอกร
*/
function selectAvatarHistory() {
if (activeImage.value == null) {
dialogMessageNotify($q, "กรุณาเลือกรูปที่ต้องการเปลี่ยน");
return;
}
const data = activeImage.value;
showLoader();
await http
http
.get(config.API.orgProfileAvatar + `/select/${profileId.value}/${data.id}`)
.then(async (res) => {
.then(async () => {
closeImage();
await fetchDataPersonal();
await fetchProfile(profileId.value);
})
@ -558,10 +586,32 @@ async function selectAvatarHistory() {
});
}
/**
* class
* @param n
*/
function imageClass(n: any) {
const val = n == activeImage.value;
return {
"rounded-borders bg-grey-2 image-size-default": val,
"rounded-borders bg-grey-2 image-size-full": !val,
};
}
/**
* class input
* @param n
*/
function getClass(n: any) {
const val = n == activeImage.value;
return {
"rounded-borders border-green shadow-1": val,
"rounded-borders shadow-1": !val,
};
}
onMounted(async () => {
// fileName.value = `profile-${profileId.value}`;
await fetchDataPersonal();
// await fetchProfile(profileId.value);
});
</script>
@ -677,7 +727,6 @@ onMounted(async () => {
}}
</h2>
</div>
<!-- <div class="col-12 subtitle">{{ formDetail?.position }}</div> -->
</div>
</div>
</div>
@ -691,6 +740,7 @@ onMounted(async () => {
<q-img :src="profilePicture" />
</q-avatar>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
round
text-color="primary"
icon="mdi-pencil-outline"
@ -739,78 +789,6 @@ onMounted(async () => {
<q-separator />
</q-card>
<!-- <q-card>
<div class="column" style="height: 120px">
<div class="col row items-center">
<div class="row col-12">
<div class="col" style="padding-left: 14%">
<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 class="absolute-center-left q-ml-lg">
<q-avatar size="90px" class="bg-grey-2">
<q-img :src="profilePicture" />
</q-avatar>
<q-btn
round
text-color="primary"
icon="mdi-pencil-outline"
@click="openDialogImg"
size="sm"
unelevated
class="bg-white btnEditImg"
>
</q-btn>
</div>
<div class="col row items-center bg-toolbar">
<div class="row col-12" style="padding-left: 14%">
<div class="col-2">
<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-2">
<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 class="col-2">
<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> -->
<q-card bordered class="q-mt-md rounded">
<TabMain :fetchDataPersonal="fetchDataPersonal" />
</q-card>
@ -1034,6 +1012,7 @@ h2.title {
.bg-toolbar {
background-color: #f2fbfa;
height: 60px;
}
.btnEditImg {
position: absolute;

View file

@ -1,5 +1,6 @@
<script setup lang="ts">
import { ref, onMounted, reactive, watch } from "vue";
import { checkPermission } from "@/utils/permissions";
import { date, useQuasar } from "quasar";
import { useRouter } from "vue-router";
import http from "@/plugins/http";
@ -288,6 +289,7 @@ onMounted(() => {
<q-card flat bordered class="q-pa-md">
<div class="col-12 row items-center">
<q-btn
v-if="checkPermission($route)?.attrIsCreate"
flat
round
color="primary"
@ -297,6 +299,7 @@ onMounted(() => {
<q-tooltip>เพมขอม</q-tooltip>
</q-btn>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
round
color="primary"
@ -380,7 +383,13 @@ onMounted(() => {
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td auto-width>
<q-td
auto-width
v-if="
checkPermission($route)?.attrIsDelete ||
checkPermission($route)?.attrIsUpdate
"
>
<q-btn
icon="mdi-dots-vertical"
size="12px"
@ -395,9 +404,10 @@ onMounted(() => {
clickable
v-close-popup
v-if="
props.row.draftOrgEmployeeStatus === null ||
props.row.draftOrgEmployeeStatus === 'WAITTING' ||
props.row.draftOrgEmployeeStatus === 'PENDING'
(props.row.draftOrgEmployeeStatus === null ||
props.row.draftOrgEmployeeStatus === 'WAITTING' ||
props.row.draftOrgEmployeeStatus === 'PENDING') &&
checkPermission($route)?.attrIsUpdate
"
@click.pervent="onClickSelectPos(props.row)"
>
@ -415,6 +425,7 @@ onMounted(() => {
<q-item-section>กำหนดตำแหน</q-item-section>
</q-item>
<q-item
v-if="checkPermission($route)?.attrIsUpdate"
clickable
v-close-popup
@click.pervent="redirectToPageDetail(props.row.id)"
@ -430,6 +441,7 @@ onMounted(() => {
</q-item>
<q-separator />
<q-item
v-if="checkPermission($route)?.attrIsDelete"
clickable
v-close-popup
@click.pervent="onClickDelete(props.row.id)"

View file

@ -3,7 +3,7 @@ import { ref, watch } from "vue";
import { useQuasar } from "quasar";
import config from "@/app.config";
import http from "@/plugins/http";
import genreport from "@/plugins/genreportxlsx";
import { checkPermission } from "@/utils/permissions";
/**
* importType
@ -348,6 +348,7 @@ watch(
<q-toolbar style="padding: 0">
<div>
<q-btn
v-if="checkPermission($route)?.attrIsCreate"
flat
round
dense
@ -359,6 +360,7 @@ watch(
</q-btn>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
round
dense
@ -370,6 +372,7 @@ watch(
</q-btn>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
round
dense
@ -381,32 +384,6 @@ watch(
</q-btn>
</div>
<!-- <q-btn
v-if="store.typeOrganizational === 'draft'"
flat
round
dense
color="deep-purple"
icon="save_alt"
>
<q-menu>
<q-list
dense
style="min-width: 100px"
v-for="(item, index) in document"
:key="index"
>
<q-item
clickable
v-close-popup
@click.stop="onClickDownloadReport(item.val, item.name)"
>
<q-item-section>{{ item.name }}</q-item-section>
</q-item>
</q-list>
</q-menu>
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn> -->
<q-space />
<div class="row q-gutter-md">
<div>
@ -466,6 +443,10 @@ watch(
<q-tr :props="props" class="cursor-pointer">
<q-td>
<q-btn
v-if="
checkPermission($route)?.attrIsUpdate ||
checkPermission($route)?.attrIsDelete
"
flat
dense
icon="mdi-dots-vertical"
@ -477,7 +458,10 @@ watch(
<q-list dense style="min-width: 150px">
<!-- เลอกคนครอง -->
<q-item
v-if="props.row.positionIsSelected == 'ว่าง'"
v-if="
props.row.positionIsSelected == 'ว่าง' &&
checkPermission($route)?.attrIsUpdate
"
clickable
v-close-popup
@click="openSelectPerson(props.row)"
@ -494,7 +478,10 @@ watch(
</q-item-section>
</q-item>
<q-item
v-else-if="props.row.positionIsSelected != 'ว่าง'"
v-else-if="
props.row.positionIsSelected != 'ว่าง' &&
checkPermission($route)?.attrIsUpdate
"
clickable
v-close-popup
@click="removePerson(props.row.id)"
@ -511,7 +498,13 @@ watch(
</q-item-section>
</q-item>
<q-item
v-for="(item, index) in listMenu"
v-for="(item, index) in checkPermission($route)
?.attrIsUpdate && !checkPermission($route)?.attrIsDelete
? listMenu.filter((e) => e.type !== 'DEL')
: checkPermission($route)?.attrIsDelete &&
!checkPermission($route)?.attrIsUpdate
? listMenu.filter((e) => e.type === 'DEL')
: listMenu"
:key="index"
clickable
v-close-popup

View file

@ -116,21 +116,23 @@ export const useMenuDataStore = defineStore("menuUse", () => {
* @param data
*/
function fetchListMenu(data: ListMenu[]) {
data.forEach((item) => {
if (item.children && item.children.length !== 0) {
item.children.forEach((q: ListMenu) => {
const config: any = childLevelTree.value[q.id];
if (config) {
if (!q.children) {
q.children = [];
if (data) {
data.forEach((item) => {
if (item.children && item.children.length !== 0) {
item.children.forEach((q: ListMenu) => {
const config: any = childLevelTree.value[q.id];
if (config) {
if (!q.children) {
q.children = [];
}
// เพิ่มเมนูเลเวล 3
q.children.push(...config);
}
// เพิ่มเมนูเลเวล 3
q.children.push(...config);
}
});
}
});
menuList.value.push(...data);
});
}
});
menuList.value.push(...data);
}
}
/****************** สิทธิ์ **************************/

View file

@ -7,15 +7,11 @@ import type { RoleData } from "@/interface/main";
const storeMenu = useMenuDataStore();
export function checkPermission(route: any): RoleData | null {
console.log("storeMenu.permissions", storeMenu.permissions);
if (storeMenu.permissions && route.meta.Key) {
const role =
storeMenu.permissions.roles.find(
(item) => item.authSysId === route.meta.Key
) ?? null;
return role;
} else {