ปรับทะเบียนประวัติ และ แก้ไขการเพิ่มตำแหน่ง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-02-07 13:32:21 +07:00
parent 954f90a81a
commit d2cf75cb3b
7 changed files with 279 additions and 182 deletions

View file

@ -410,7 +410,10 @@ function onSubmitSelectEdit() {
posDictField: formPositionSelect.positionField, // posDictField: formPositionSelect.positionField, //
posTypeId: formPositionSelect.positionType, //* posTypeId: formPositionSelect.positionType, //*
posLevelId: formPositionSelect.positionLevel, //* posLevelId: formPositionSelect.positionLevel, //*
posExecutiveId: formPositionSelect.positionExecutive, // posExecutiveId:
formPositionSelect.positionExecutive !== ""
? formPositionSelect.positionExecutive
: null, //
posDictExecutiveField: formPositionSelect.positionExecutiveField, // posDictExecutiveField: formPositionSelect.positionExecutiveField, //
posDictArea: formPositionSelect.positionArea, /// posDictArea: formPositionSelect.positionArea, ///
}; };

View file

@ -15,71 +15,74 @@
{{ header }} {{ header }}
</div> </div>
</div> </div>
<div class="q-gutter-sm q-mx-sm" v-if="addData == false"> <div v-if="!profileStore.isVerified">
<q-btn <div class="q-gutter-sm q-mx-sm" v-if="addData == false">
size="12px" <q-btn
v-if="!edit" size="12px"
flat v-if="!edit"
round flat
:disabled="disable" round
:color="edit ? 'grey-7' : 'primary'" :disabled="disable"
@click="ClickEdit" :color="edit ? 'grey-7' : 'primary'"
icon="mdi-pencil-outline" @click="ClickEdit"
> icon="mdi-pencil-outline"
<q-tooltip>แกไขขอม</q-tooltip> >
</q-btn> <q-tooltip>แกไขขอม</q-tooltip>
<q-btn </q-btn>
size="12px" <q-btn
flat size="12px"
round flat
v-if="edit" round
:color="!edit ? 'grey-7' : 'public'" v-if="edit"
@click="save" :color="!edit ? 'grey-7' : 'public'"
icon="mdi-content-save-outline" @click="save"
> icon="mdi-content-save-outline"
<q-tooltip>นทกขอม</q-tooltip> >
</q-btn> <q-tooltip>นทกขอม</q-tooltip>
<q-btn </q-btn>
size="12px" <q-btn
flat size="12px"
round flat
v-if="edit && !addEmployee" round
:color="!edit ? 'grey-7' : 'red'" v-if="edit && !addEmployee"
@click="ClickCancel" :color="!edit ? 'grey-7' : 'red'"
icon="mdi-undo" @click="ClickCancel"
> icon="mdi-undo"
<q-tooltip>ยกเล</q-tooltip> >
</q-btn> <q-tooltip>ยกเล</q-tooltip>
</div> </q-btn>
<div class="q-pl-sm" v-else-if="iconAdd != '' && iconAdd != null"> </div>
<q-btn <div class="q-pl-sm" v-else-if="iconAdd != '' && iconAdd != null">
size="12px" <q-btn
flat size="12px"
round flat
color="add" round
@click="addleave" color="add"
icon="mdi-plus" @click="addleave"
> icon="mdi-plus"
<q-tooltip>เพมขอม</q-tooltip> >
</q-btn> <q-tooltip>เพมขอม</q-tooltip>
<!-- <q-btn size="12px" flat round color="add" @click="add" :icon="iconAdd"> </q-btn>
<!-- <q-btn size="12px" flat round color="add" @click="add" :icon="iconAdd">
<q-tooltip>สรปวนลา</q-tooltip> <q-tooltip>สรปวนลา</q-tooltip>
</q-btn> --> </q-btn> -->
</div>
<div class="q-pl-sm" v-else>
<q-btn
size="12px"
flat
round
:disabled="disable"
color="add"
@click="add"
icon="mdi-plus"
>
<q-tooltip>เพมขอม</q-tooltip>
</q-btn>
</div>
</div> </div>
<div class="q-pl-sm" v-else>
<q-btn
size="12px"
flat
round
:disabled="disable"
color="add"
@click="add"
icon="mdi-plus"
>
<q-tooltip>เพมขอม</q-tooltip>
</q-btn>
</div>
<q-space /> <q-space />
<q-btn <q-btn
color="info" color="info"
@ -96,6 +99,9 @@
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useProfileDataStore } from "@/modules/04_registry/store";
const profileStore = useProfileDataStore();
const props = defineProps({ const props = defineProps({
header: { header: {
type: String, type: String,

View file

@ -153,81 +153,87 @@
</div> </div>
</div> </div>
<q-space /> <q-space />
<q-btn flat round color="green" icon="verified" @click="onClickVerified"
<q-btn ><q-tooltip>ตรวจสอบขอม</q-tooltip></q-btn
v-if="
profileType == 'officer' ||
(profileType == 'employee' && employeeClass == 'perm')
"
round
flat
:color="reasonStatus ? 'primary' : 'pink-5'"
:icon="
reasonStatus ? 'mdi-home-import-outline' : 'mdi-home-export-outline'
"
> >
<q-menu transition-show="jump-down" transition-hide="jump-up">
<q-list dense style="min-width: 160px"> <div v-if="!roleKeyregistry && !roleRegistryverify">
<q-item <q-btn
clickable v-if="
v-close-popup profileType == 'officer' ||
@click="helpPost" (profileType == 'employee' && employeeClass == 'perm')
v-if="profileType == 'officer'" "
> round
<q-item-section style="min-width: 0px" avatar class="q-py-sm"> flat
</q-item-section> :color="reasonStatus ? 'primary' : 'pink-5'"
<q-item-section>วยราชการ</q-item-section> :icon="
</q-item> reasonStatus
<q-separator /> ? 'mdi-home-import-outline'
<q-item : 'mdi-home-export-outline'
clickable "
v-close-popup >
@click="repatriationPost" <q-menu transition-show="jump-down" transition-hide="jump-up">
v-if="profileType == 'officer'" <q-list dense style="min-width: 160px">
> <q-item
<q-item-section style="min-width: 0px" avatar class="q-py-sm"> clickable
</q-item-section> v-close-popup
<q-item-section>งตวกล</q-item-section> @click="helpPost"
</q-item> v-if="profileType == 'officer'"
<q-separator /> >
<q-item <q-item-section style="min-width: 0px" avatar class="q-py-sm">
clickable </q-item-section>
v-close-popup <q-item-section>วยราชการ</q-item-section>
@click="appointPost" </q-item>
v-if="profileType == 'officer'" <q-separator />
> <q-item
<q-item-section style="min-width: 0px" avatar class="q-py-sm"> clickable
</q-item-section> v-close-popup
<q-item-section>แตงต-เลอน-าย</q-item-section> @click="repatriationPost"
</q-item> v-if="profileType == 'officer'"
<q-item >
clickable <q-item-section style="min-width: 0px" avatar class="q-py-sm">
v-close-popup </q-item-section>
@click="appointEmployeePost" <q-item-section>งตวกล</q-item-section>
v-if="profileType == 'employee'" </q-item>
> <q-separator />
<q-item-section style="min-width: 0px" avatar class="q-py-sm"> <q-item
</q-item-section> clickable
<q-item-section>ปรบระดบชนงาน - าย</q-item-section> v-close-popup
</q-item> @click="appointPost"
<q-separator /> v-if="profileType == 'officer'"
<q-item clickable v-close-popup @click="clickPassaway"> >
<q-item-section style="min-width: 0px" avatar class="q-py-sm"> <q-item-section style="min-width: 0px" avatar class="q-py-sm">
</q-item-section> </q-item-section>
<q-item-section>งแกกรรม</q-item-section> <q-item-section>แตงต-เลอน-าย</q-item-section>
</q-item> </q-item>
<q-separator /> <q-item
<q-item clickable
clickable v-close-popup
v-close-popup @click="appointEmployeePost"
@click="outPost" v-if="profileType == 'employee'"
v-if="profileType == 'officer'" >
> <q-item-section style="min-width: 0px" avatar class="q-py-sm">
<q-item-section style="min-width: 0px" avatar class="q-py-sm"> </q-item-section>
</q-item-section> <q-item-section>ปรบระดบชนงาน - าย</q-item-section>
<q-item-section>ใหออกจากราชการ</q-item-section> </q-item>
</q-item> <q-separator />
<!-- <q-separator /> <q-item clickable v-close-popup @click="clickPassaway">
<q-item-section style="min-width: 0px" avatar class="q-py-sm">
</q-item-section>
<q-item-section>งแกกรรม</q-item-section>
</q-item>
<q-separator />
<q-item
clickable
v-close-popup
@click="outPost"
v-if="profileType == 'officer'"
>
<q-item-section style="min-width: 0px" avatar class="q-py-sm">
</q-item-section>
<q-item-section>ใหออกจากราชการ</q-item-section>
</q-item>
<!-- <q-separator />
<q-item <q-item
clickable clickable
v-close-popup v-close-popup
@ -249,22 +255,23 @@
</q-item-section> </q-item-section>
<q-item-section>ไลออกจากราชการ</q-item-section> <q-item-section>ไลออกจากราชการ</q-item-section>
</q-item> --> </q-item> -->
<q-separator /> <q-separator />
<q-item <q-item
clickable clickable
v-close-popup v-close-popup
@click="otherPost" @click="otherPost"
v-if="profileType == 'officer'" v-if="profileType == 'officer'"
> >
<q-item-section style="min-width: 0px" avatar class="q-py-sm"> <q-item-section style="min-width: 0px" avatar class="q-py-sm">
</q-item-section> </q-item-section>
<q-item-section>นๆ</q-item-section> <q-item-section>นๆ</q-item-section>
</q-item> </q-item>
<q-separator /> <q-separator />
</q-list> </q-list>
</q-menu> </q-menu>
<!-- <q-tooltip>งรายช</q-tooltip> --> <!-- <q-tooltip>งรายช</q-tooltip> -->
</q-btn> </q-btn>
</div>
<!-- ดไปเพราะทำสวนของพนราชการแล --> <!-- ดไปเพราะทำสวนของพนราชการแล -->
<!-- <q-btn <!-- <q-btn
@ -781,6 +788,7 @@ import type { DataOption } from "@/modules/04_registry/interface/index/Main";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useProfileDataStore } from "@/modules/04_registry/store"; import { useProfileDataStore } from "@/modules/04_registry/store";
import keycloak from "@/plugins/keycloak";
const $q = useQuasar(); const $q = useQuasar();
const store = useDataStore(); const store = useDataStore();
@ -871,10 +879,30 @@ const reasonOptions = ref<DataOption[]>([
}, },
]); ]);
const roleKeyregistry = ref<boolean>(false);
const roleRegistryverify = ref<boolean>(false);
function onClickVerified() {
dialogConfirm(
$q,
async () => {},
"ยืนยันการตรวจสอบข้อมูล",
"ต้องการยืนยันการตรวจสอบข้อมูลนี้หรือไม่ ?"
);
}
onMounted(async () => { onMounted(async () => {
// await checkProfileData(); if (keycloak.tokenParsed != null) {
await fetchData(); roleKeyregistry.value = await keycloak.tokenParsed.role.includes(
"keyregistry"
);
roleRegistryverify.value = await keycloak.tokenParsed.role.includes(
"registryverify"
);
}
console.log(roleKeyregistry.value, roleRegistryverify.value);
await changeTab("information"); await changeTab("information");
await fetchData();
await checIsVerified();
}); });
const fetchData = async () => { const fetchData = async () => {
@ -907,21 +935,29 @@ const fetchData = async () => {
}); });
}; };
const checkProfileData = async () => { const isVerified = ref<boolean>(false);
showLoader(); async function checIsVerified() {
// showLoader();
await http await http
.get(config.API.profileCheckId(profileId.value)) .get(config.API.profileInforId(profileId.value))
.then((res) => { .then((res) => {
let data = res.data.result; const data = res.data.result;
if (data == false) router.push("/registry");
profileStore.isVerified = data.isVerified
? true
: roleRegistryverify.value
? true
: roleKeyregistry.value
? false
: false;
}) })
.catch((e) => { .catch((err) => {
router.push("/registry"); messageError($q, err);
}) })
.finally(() => { .finally(() => {
hideLoader(); // hideLoader();
}); });
}; }
const fetchAvatarHistory = async () => { const fetchAvatarHistory = async () => {
showLoader(); showLoader();
@ -1502,7 +1538,12 @@ const clickSaveDeceased = async () => {
watch( watch(
() => profileStore.isLoad, () => profileStore.isLoad,
() => { () => {
const num = profileType.value === 'officer' ? 32:employeeClass.value === 'temp' ? 29:31 const num =
profileType.value === "officer"
? 32
: employeeClass.value === "temp"
? 29
: 31;
profileStore.isLoad >= num && hideLoader(); profileStore.isLoad >= num && hideLoader();
} }
); );

View file

@ -31,6 +31,7 @@ interface RequestItemsObject {
insigniaLast: String; insigniaLast: String;
isLeave: String; isLeave: String;
leaveDateOrder: Date | string | null; leaveDateOrder: Date | string | null;
isVerified: boolean;
} }
//columns //columns

View file

@ -32,6 +32,7 @@ interface ResponseObject {
insigniaLast: String; insigniaLast: String;
isLeave: boolean; isLeave: boolean;
leaveDateOrder: Date | null; leaveDateOrder: Date | null;
isVerified: boolean;
} }
export type { ResponseObject }; export type { ResponseObject };

View file

@ -2,6 +2,7 @@ import { ref, computed } from "vue";
import { defineStore } from "pinia"; import { defineStore } from "pinia";
export const useProfileDataStore = defineStore("profile", () => { export const useProfileDataStore = defineStore("profile", () => {
const isVerified = ref<boolean>(false);
const emplployeeClass = ref<string | null>(""); const emplployeeClass = ref<string | null>("");
interface profile { interface profile {
main: { columns: String[] }; main: { columns: String[] };
@ -77,6 +78,7 @@ export const useProfileDataStore = defineStore("profile", () => {
return { return {
isLoad, isLoad,
isVerified,
profileData, profileData,
changeProfileColumns, changeProfileColumns,
birthDate, birthDate,

View file

@ -94,26 +94,39 @@
<div v-if="col.name == 'no'" class="table_ellipsis"> <div v-if="col.name == 'no'" class="table_ellipsis">
{{ props.rowIndex + 1 }} {{ props.rowIndex + 1 }}
</div> </div>
<div v-else-if="col.name == 'isVerified'">
<q-icon
v-if="props.row.isVerified"
name="verified"
color="green"
size="2rem"
/>
</div>
<div v-else-if="col.name == 'fullname'"> <div v-else-if="col.name == 'fullname'">
<div class="row col-12 wrap items-center"> <div class="row col-12 wrap items-center">
<img <q-item>
v-if="props.row.avatar == null" <q-item-section avatar>
src="@/assets/avatar_user.jpg" <img
class="col-4 img-info" v-if="props.row.avatar == null"
/> src="@/assets/avatar_user.jpg"
<img class="col-4 img-info"
v-else />
:src="props.row.avatar" <img
class="col-4 img-info" v-else
/> :src="props.row.avatar"
<div class="col-4"> class="col-4 img-info"
<div class="text-weight-medium"> />
{{ props.row.fullname }} </q-item-section>
</div>
<div class="text-weight-light"> <q-item-section>
{{ props.row.citizenId }} <div class="text-weight-medium">
</div> {{ props.row.fullname }}
</div> </div>
<div class="text-weight-light">
{{ props.row.citizenId }}
</div>
</q-item-section>
</q-item>
</div> </div>
</div> </div>
<div v-else class="table_ellipsis"> <div v-else class="table_ellipsis">
@ -182,6 +195,7 @@ const selected = ref<string>("");
const nodesTree = ref<treeTab[]>([]); const nodesTree = ref<treeTab[]>([]);
const visibleColumns = ref<String[]>([]); const visibleColumns = ref<String[]>([]);
visibleColumns.value = [ visibleColumns.value = [
"isVerified",
"no", "no",
"fullname", "fullname",
"fullnameOld", "fullnameOld",
@ -209,6 +223,7 @@ visibleColumns.value = [
]; ];
const visibleColumnsOfficer = ref<String[]>([]); const visibleColumnsOfficer = ref<String[]>([]);
visibleColumnsOfficer.value = [ visibleColumnsOfficer.value = [
"isVerified",
"no", "no",
"fullname", "fullname",
"fullnameOld", "fullnameOld",
@ -235,6 +250,14 @@ visibleColumnsOfficer.value = [
"leaveDateOrder", "leaveDateOrder",
]; ];
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{
name: "isVerified",
align: "center",
label: "",
sortable: true,
field: "isVerified",
headerStyle: "min-width: 50px",
},
{ {
name: "no", name: "no",
align: "left", align: "left",
@ -542,6 +565,7 @@ const columns = ref<QTableProps["columns"]>([
const rows = ref<RequestItemsObject[]>([]); const rows = ref<RequestItemsObject[]>([]);
const visibleColumnsEmployee = ref<String[]>([]); const visibleColumnsEmployee = ref<String[]>([]);
visibleColumnsEmployee.value = [ visibleColumnsEmployee.value = [
"isVerified",
"no", "no",
"fullname", "fullname",
"fullnameOld", "fullnameOld",
@ -567,6 +591,14 @@ visibleColumnsEmployee.value = [
"leaveDateOrder", "leaveDateOrder",
]; ];
const columnsEmployee = ref<QTableProps["columns"]>([ const columnsEmployee = ref<QTableProps["columns"]>([
{
name: "isVerified",
align: "center",
label: "",
sortable: true,
field: "isVerified",
headerStyle: "min-width: 50px",
},
{ {
name: "no", name: "no",
align: "left", align: "left",
@ -845,6 +877,7 @@ const columnsEmployee = ref<QTableProps["columns"]>([
]); ]);
const visibleColumnsEmployeeTemp = ref<String[]>([]); const visibleColumnsEmployeeTemp = ref<String[]>([]);
visibleColumnsEmployeeTemp.value = [ visibleColumnsEmployeeTemp.value = [
"isVerified",
"no", "no",
"fullname", "fullname",
"fullnameOld", "fullnameOld",
@ -870,6 +903,14 @@ visibleColumnsEmployeeTemp.value = [
"leaveDateOrder", "leaveDateOrder",
]; ];
const columnsEmployeeTemp = ref<QTableProps["columns"]>([ const columnsEmployeeTemp = ref<QTableProps["columns"]>([
{
name: "isVerified",
align: "center",
label: "",
sortable: true,
field: "isVerified",
headerStyle: "min-width: 50px",
},
{ {
name: "no", name: "no",
align: "left", align: "left",
@ -1316,6 +1357,7 @@ const doSearch = async () => {
}) })
.then((res) => { .then((res) => {
let data = res.data.result; let data = res.data.result;
rows.value = []; rows.value = [];
data.map((e: ResponseObject) => { data.map((e: ResponseObject) => {
rows.value.push({ rows.value.push({
@ -1358,6 +1400,7 @@ const doSearch = async () => {
? null ? null
: date2Thai(new Date(e.leaveDateOrder)), : date2Thai(new Date(e.leaveDateOrder)),
refSalary: e.refSalary, refSalary: e.refSalary,
isVerified: e.isVerified,
}); });
}); });
}) })