Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2025-06-05 15:39:20 +07:00
commit 832cb12367
134 changed files with 4809 additions and 1610 deletions

View file

@ -181,11 +181,11 @@ export default {
//EditPage
salaryTemp: `${orgProfile}/salaryTemp`,
profilePermission: `${orgProfile}/keycloak/permissionProfile`,
profilePermission: (rootId: string) =>
`${orgProfile}/keycloak/permissionProfile/${rootId}`,
profileidPosition: (type: string) =>
`${orgProfile}${type}/profileid/position`,
workflowCommanderOperate:`${workflow}/commander/operate`,
workflowCommanderSign:`${workflow}/commander/sign`,
workflowCommanderOperate: `${workflow}/commander/operate`,
workflowCommanderSign: `${workflow}/commander/sign`,
};

View file

@ -77,9 +77,31 @@ export default {
//รายงาน
retirementReport: `${report}`,
addResign: (profileType:string,type: string, id: string) =>
addResign: (profileType: string, type: string, id: string) =>
`${retirement}/resign${profileType}/officer/add-resign/${type}/${id}`,
sendApproveRetirement:(type:string,id:string)=>`${retirement}/resign${type}/admin/approve/officer/${id}`,
commanderApproveRetirement:(type:string,id:string,typeApprove:string,path:string)=>`${retirement}/resign${type}/admin/${typeApprove}${path}/${id}`
addResignCancel: (profileType: string, type: string, id: string) =>
`${retirement}/resign${profileType}/officer-cancel/add-resign/${type}/${id}`,
sendApproveRetirement: (type: string, id: string) =>
`${retirement}/resign${type}/admin/approve/officer/${id}`,
commanderApproveRetirement: (
type: string,
id: string,
typeApprove: string,
path: string = ""
) => `${retirement}/resign${type}/admin/${typeApprove}${path}/${id}`,
// รายการยกเลิกการลาออก
// สำหรับเจ้าหน้าที่
officerCancelResign: (typeEmp: string, id: string) =>
`${retirement}/resign${typeEmp}/admin-cancel/approve/officer/${id}`,
// สำหรับผู้บังคับบัญชา
comanderCancelResign: (typeEmp: string, action: string, id: string) =>
`${retirement}/resign${typeEmp}/admin-cancel/${action}/comander/${id}`,
// สำหรับผู้มีอำนาจ
approverCancelResign: (typeEmp: string, action: string, id: string) =>
`${retirement}/resign${typeEmp}/admin-cancel/${action}/${id}`,
};

View file

@ -23,33 +23,44 @@ export default {
ocId: string,
role: string,
status: any,
isDeputy: boolean = false
isDeputy: boolean = false,
type: string = "officer"
) =>
`${insignia}/request/${insigniaPeriodId}/${ocId}/${role}/${status}/${isDeputy}`,
`${insignia}/request/${insigniaPeriodId}/${ocId}/${role}/${status}/${isDeputy}/${type}`,
insigniaReject: (profileId: string) =>
`${insignia}/request/status/reject/${profileId}`,
insigniaDelete: (profileId: string) =>
`${insignia}/request/status/delete/${profileId}`,
insigniaEdit: (profileId: string) => `${insignia}/request/${profileId}`,
insigniaNosend: (insigniaPeriodId: any) =>
`${insignia}/request/org/no-send/${insigniaPeriodId}`,
insigniaNosend: (insigniaPeriodId: any, type: string = "officer") =>
`${insignia}/request/org/no-send/${type}/${insigniaPeriodId}`,
insigniaAgency: () => `${insignia}/request/agency`,
insigniaDashboard: (insigniaPeriodId: string) =>
`${insignia}/request/dashboard/${insigniaPeriodId}`,
insigniaDashboard: (insigniaPeriodId: string, type: string = "officer") =>
`${insignia}/request/dashboard/${type}/${insigniaPeriodId}`,
// record
noteround: () => `${insignia}/request/note`,
requestDocNote: (id: string) => `${insignia}/request/note/doc/${id}`,
noteSearch: () => `${insignia}/request/note/search`,
noteSearch: (type: string = "officer") =>
`${insignia}/request/note/search/${type}`,
noteSearchList: () => `${insignia}/request/note-list/search`,
noteAdd: (insigniaId: string) => `${insignia}/request/note/${insigniaId}`,
noteByid: (id: string) => `${insignia}/request/note/${id}`,
insigniaSendToDirector: (roundId: string, ocId: string) =>
`${insignia}/request/officer/approve/${roundId}/${ocId}`,
insigniaDirectorBackToEdit: (roundId: string, ocId: string) =>
`${insignia}/request/director/reject/${roundId}/${ocId}`,
insigniaDirectorApproved: (roundId: string, ocId: string) =>
`${insignia}/request/director/approve/${roundId}/${ocId}`,
insigniaSendToDirector: (
roundId: string,
ocId: string,
type: string = "officer"
) => `${insignia}/request/officer/approve/${type}/${roundId}/${ocId}`,
insigniaDirectorBackToEdit: (
roundId: string,
ocId: string,
type: string = "officer"
) => `${insignia}/request/director/reject/${type}/${roundId}/${ocId}`,
insigniaDirectorApproved: (
roundId: string,
ocId: string,
type: string = "officer"
) => `${insignia}/request/director/approve/${type}/${roundId}/${ocId}`,
insigniaRequestSendNote: (insigniaPeriodId: string) =>
`${insignia}/request/send/note/${insigniaPeriodId}`,
@ -105,8 +116,8 @@ export default {
uploadfileOnlyInsignia: (requestId: string) =>
`${insignia}/request/upload/${requestId}`,
// สกจ. ตีกลับให้หัวหน้าเขต
rejectRequest: (id: string, ocId: string) =>
`${insignia}/request/head/reject/${id}/${ocId}`,
rejectRequest: (id: string, ocId: string, type: string = "officer") =>
`${insignia}/request/head/reject/${type}/${id}/${ocId}`,
reportInsigniaNew: `${insignia}/report`,
};

View file

@ -49,4 +49,7 @@ export default {
checkIsofficer: `${env.API_URI}/org/workflow/keycloak/isofficer/`,
insigniaReclaim,
// update คุณสมบัติการจัดการเครื่องราชฯ
insigniaUpdateProperty: `${env.API_URI}/insignia/request/update`,
};

View file

@ -42,5 +42,9 @@ export default {
exportPassExamList: (id: string) => `${recruit_report}pass/${id}`,
periodRecruitToPlacement: (examId: string) => `${recruit}placement/${examId}`,
reportRecruit:(type:string)=>`${recruit}${type}`
reportRecruit:(type:string)=>`${recruit}${type}`,
exportCandidateListNew: (id: string) => `${recruit_report}candidate-new/${id}`,
};

View file

@ -30,8 +30,8 @@ interface Goverment {
positionLevel: string;
positionExecutive: string;
positionExecutiveSide: string;
dateLeave: string;
dateRetireLaw: string;
dateLeave?: string;
dateRetireLaw?: string;
}
interface GovermentEmpTemp {

View file

@ -43,4 +43,18 @@ interface DataRoles {
parentNode: string;
}
export type { ListMenu, ChildLevelTree, ChildConfig, DataPermissions,DataRoles };
interface DataRoleWorkflow {
isDeputy: boolean;
isDirector: boolean;
isOfficer: boolean;
isStaff: boolean;
}
export type {
ListMenu,
ChildLevelTree,
ChildConfig,
DataPermissions,
DataRoles,
DataRoleWorkflow,
};

View file

@ -258,7 +258,7 @@ onMounted(() => {
outlined
v-model="formFilter.keyword"
label="ค้นหา"
@keydown.enter="fetchNewList"
@keydown.enter.prevent="fetchNewList"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -207,7 +207,7 @@ watch(
dense
v-model="filterTable"
label="ค้นหา"
@keydown.enter="onSearchData"
@keydown.enter.prevent="onSearchData"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -4,7 +4,11 @@ import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { checkPermission } from "@/utils/permissions";
import {
checkPermission,
checkPermissionList,
checkPermissionCreate,
} from "@/utils/permissions";
import { useOrganizational } from "@/modules/02_organization/store/organizational";
import { useCounterMixin } from "@/stores/mixin";
@ -338,7 +342,9 @@ onMounted(async () => {
<q-btn
v-if="
store.typeOrganizational === 'draft' &&
(store.isOfficer === true || store.isStaff === true)
(store.isOfficer === true || store.isStaff === true) &&
checkPermissionList(['COMMAND']) &&
checkPermissionCreate('COMMAND')
"
flat
round

View file

@ -139,7 +139,7 @@ function resetFilter() {
outlined
placeholder="ค้นหา"
style="max-width: 200px"
@keydown.enter="props.onSearch?.()"
@keydown.enter.prevent="props.onSearch?.()"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -110,7 +110,7 @@ const resetFilter = () => {
placeholder="ค้นหา"
style="max-width: 200px"
class="q-ml-sm"
@keydown.enter="props.onSearch?.(name)"
@keydown.enter.prevent="props.onSearch?.(name)"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -115,7 +115,7 @@ function resetFilter() {
dense
v-model="filter"
ref="filterRef"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
outlined
placeholder="ค้นหา"
style="max-width: 200px"

View file

@ -1,7 +1,7 @@
import { ref } from "vue";
interface Pagination {
rowsPerPage: number;
sortBy: string;
sortBy?: string;
}
interface DataDateMonthObject {

View file

@ -206,40 +206,42 @@ async function fetchData() {
* ดาวนโหลดรายชอผสอบแขงขนได
* @param id รอบสอบเเขงข
*/
function clickPassExam(id: string) {
async function clickPassExam(id: string) {
showLoader();
http
await http
.get(config.API.exportPassExamList(id))
.then((res) => {
.then(async (res) => {
const data = res.data.result;
data.reportName = `CandidateList`;
genReport(data, data.reportName, "pdf");
await genReport(data, data.reportName, "pdf");
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
hideLoader();
})
.finally(() => {});
.finally(() => {
hideLoader();
});
}
/**
* ดาวนโหลดรายชอผทธสอบ
* @param id รอบสอบเเขงข
*/
function clickCandidateList(id: string) {
async function clickCandidateList(id: string) {
showLoader();
http
.get(config.API.exportCandidateList(id))
.then((res) => {
await http
.get(config.API.exportCandidateListNew(id))
.then(async (res) => {
const data = res.data.result;
data.reportName = `CandidateList`;
genReport(data, data.reportName, "pdf");
await genReport(data, data.reportName, "pdf");
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
hideLoader();
})
.finally(() => {});
.finally(() => {
hideLoader();
});
}
/**

View file

@ -168,37 +168,39 @@ const visibleColumnsHistory = ref<String[]>([
]);
/** ดาวน์โหลดรายชื่อผู้สอบคัดเลือกคนพิการได้ */
function clickPassExam(id: string) {
async function clickPassExam(id: string) {
showLoader();
http
await http
.get(config.API.exportDisablePassExamList(id))
.then((res) => {
.then(async (res) => {
const data = res.data.result;
data.reportName = `CandidateList`;
genReport(data, data.reportName, "pdf");
await genReport(data, data.reportName, "pdf");
})
.catch(async (e) => {
hideLoader();
messageError($q, e);
})
.finally(() => {});
.finally(() => {
hideLoader();
});
}
/** ดาวน์โหลดรายชื่อผู้มีสิทธิ์สอบ */
function clickCandidateList(id: string) {
async function clickCandidateList(id: string) {
showLoader();
http
await http
.get(config.API.exportDisableCandidateList(id))
.then((res) => {
.then(async (res) => {
const data = res.data.result;
data.reportName = `CandidateList`;
genReport(data, data.reportName, "pdf");
await genReport(data, data.reportName, "pdf");
})
.catch(async (e) => {
hideLoader();
messageError($q, e);
})
.finally(() => {});
.finally(() => {
hideLoader();
});
}
/**

View file

@ -262,7 +262,7 @@ function onSubmit() {
watch(modal, async () => {
if (modal.value && props.dataSort) {
const dataList = props.dataSort;
rows.value = dataList;
rows.value.push(...dataList);
selected.value = dataList.filter((item: any) => item.isUse == true);
} else {
selected.value = [];
@ -294,7 +294,7 @@ watch(modal, async () => {
bordered
:rows="rows"
:columns="columns"
:rows-per-page-options="[100]"
:rows-per-page-options="[0]"
row-key="id"
hide-bottom
hide-pagination

View file

@ -242,7 +242,7 @@ onMounted(() => {
dense
label="ค้นหา"
style="min-width: 250px"
@keydown.enter="updateStatusValue()"
@keydown.enter.prevent="updateStatusValue()"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -327,7 +327,7 @@ onMounted(() => {
outlined
dense
label="ค้นหา"
@keydown.enter="updateStatusValue()"
@keydown.enter.prevent="updateStatusValue()"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -8,4 +8,23 @@ interface DataProfile {
org: string;
}
export type { DataProfile };
interface FormDataSalary {
positionLevel: string;
positionCee: string;
amount: number;
amountSpecial: number;
posNoAbb: string;
posNo: string;
orgRoot: string;
orgChild1: string;
orgChild2: string;
orgChild3: string;
orgChild4: string;
commandCode: string;
posNumCodeSit: string;
posNumCodeSitAbb: string;
commandNo: string;
commandYear: null | number;
}
export type { DataProfile, FormDataSalary };

View file

@ -27,8 +27,8 @@ interface DataPosition {
amount: number;
amountSpecial: number;
commandCode: string;
commandDateAffect: string;
commandDateSign: string;
commandDateAffect: Date;
commandDateSign: Date;
commandId: string;
commandName: string;
commandNo: string;
@ -68,6 +68,8 @@ interface DataPosition {
remark: string;
salaryId: string;
status: string;
posNumCodeSitAbb: string;
posNumCodeSit: string;
}
export type { DataSalaryPos, DataPosition };

View file

@ -1,11 +1,9 @@
import { defineStore } from "pinia";
import { ref, reactive, computed } from "vue";
import { useQuasar } from "quasar";
import axios from "axios";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useRoute } from "vue-router";
import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main";
@ -15,9 +13,6 @@ import type {
} from "@/modules/04_registryPerson/interface/response/Main";
import type { FormFilter } from "@/modules/04_registryPerson/interface/request/Main";
const $q = useQuasar();
const { messageError } = useCounterMixin();
export const useRegistryNewDataStore = defineStore("registryNew", () => {
const route = useRoute();
const tab = ref<string>("1");
@ -188,7 +183,7 @@ export const useRegistryNewDataStore = defineStore("registryNew", () => {
return res.data["เอกสารหลักฐาน"].uploadUrl;
} catch (err) {
messageError($q, err);
console.log(err);
}
}
@ -216,7 +211,7 @@ export const useRegistryNewDataStore = defineStore("registryNew", () => {
);
return res.data;
} catch (err) {
messageError($q, err);
console.log(err);
}
}
@ -233,7 +228,7 @@ export const useRegistryNewDataStore = defineStore("registryNew", () => {
},
});
} catch (err) {
messageError($q, err);
console.log(err);
}
}
@ -261,6 +256,6 @@ export const useRegistryNewDataStore = defineStore("registryNew", () => {
createPathUploadFlie,
getPathUploadFlie,
uploadFile,
tab
tab,
};
});

View file

@ -249,10 +249,15 @@ async function fetchDataOptionExecutive() {
* @param status แกไข , เพ
*/
async function updateSelectType(val: string, status: boolean = false) {
console.log(val);
console.log(dataLevel.value);
const listLevel = val
? dataLevel.value.find((e: DataPosType) => e.posTypeName === val)
: null;
console.log("เช็คประเภทตำแหน่งงาน", listLevel);
//
if (listLevel) {
store.posLevelData = listLevel.posLevels.map((e: DataPosLevel) => ({
id: e.id,
@ -263,10 +268,11 @@ async function updateSelectType(val: string, status: boolean = false) {
}));
formData.positionLevel = !status ? "" : formData.positionLevel;
} else {
store.posLevelData = [];
formData.positionLevel = "";
}
// else {
// store.posLevelData = [];
// // formData.positionLevel = "";
// }
}
/**
@ -363,16 +369,18 @@ function onSubmit() {
type: empType.value?.toLocaleUpperCase(),
commandDateAffect: convertDateToAPI(formData.commandDateAffect),
commandDateSign: convertDateToAPI(formData.commandDateSign),
amount: Number(String(formData.amount)?.replace(/,/g, "")),
amountSpecial: Number(
String(formData.amountSpecial)?.replace(/,/g, "")
),
positionSalaryAmount: Number(
String(formData.positionSalaryAmount)?.replace(/,/g, "")
),
mouthSalaryAmount: Number(
String(formData.mouthSalaryAmount)?.replace(/,/g, "")
),
amount: formData.amount
? Number(String(formData.amount)?.replace(/,/g, ""))
: null,
amountSpecial: formData.amountSpecial
? Number(String(formData.amountSpecial)?.replace(/,/g, ""))
: null,
positionSalaryAmount: formData.positionSalaryAmount
? Number(String(formData.positionSalaryAmount)?.replace(/,/g, ""))
: null,
mouthSalaryAmount: formData.mouthSalaryAmount
? Number(String(formData.mouthSalaryAmount)?.replace(/,/g, ""))
: null,
})
.then(async () => {
await props.fetchData?.();
@ -394,8 +402,8 @@ watch(modal, async (val) => {
if (empType.value === "officer") {
await Promise.all([
fetchType(),
fetchDataOption(),
fetchDataOptionExecutive(),
// fetchDataOption(),
// fetchDataOptionExecutive(),
]);
} else {
await fetchOptionGroup();

View file

@ -0,0 +1,214 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useRoute } from "vue-router";
/** importType*/
import type { QTableProps } from "quasar";
import type { PropType } from "vue";
import type { DataPosition } from "@/modules/04_registryPerson/interface/response/Edit";
/** importComponents*/
import DialogHeader from "@/components/DialogHeader.vue";
/** use*/
const $q = useQuasar();
const route = useRoute();
const {
dialogConfirm,
showLoader,
success,
hideLoader,
messageError,
findOrgNameHtml,
} = useCounterMixin();
/** props*/
const modal = defineModel<boolean>("modal", { required: true });
const props = defineProps({
dataSort: Array as PropType<DataPosition[]>,
columns: Array as PropType<QTableProps["columns"]>,
fetchData: Function,
});
const profileId = ref<string>(route.params.id.toString()); //id profile
/** ข้อมูล Table*/
const rowsData = ref<DataPosition[]>([]);
// /**
// * fiunction
// * @param from
// * @param to
// */
// function onDrop(from: number, to: number) {
// rowsData.value.splice(to - 1, 0, rowsData.value.splice(from - 1, 1)[0]);
// }
/** function บันทึกการจัดลำดับ*/
function onSubmit() {
dialogConfirm($q, async () => {
showLoader();
const body = rowsData.value.map((e: any) => e.id);
await http
.put(config.API.salaryTemp + `/change/sort/${profileId.value}`, {
id: body,
})
.then(async () => {
await success($q, "บันทึกข้อมูลสำเร็จ");
props.fetchData?.();
modal.value = false;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
let draggedIndex = -1; // index item drag
const cardSectionRef = ref<HTMLElement | null>(null); // ref container scroll
/**
* งกนนใชสำหรบการ drag item
* @param index index ของ item drag
*/
function onDragStart(index: number) {
// set draggedIndex index drag
draggedIndex = index;
}
/**
* งกนนใชสำหรบการ drop item
* @param targetIndex index จะ drop
*/
function onDrop(targetIndex: number) {
// draggedIndex -1 draggedIndex targetIndex
if (draggedIndex === -1 || draggedIndex === targetIndex) return;
// draggedIndex targetIndex item
const item = rowsData.value.splice(draggedIndex, 1)[0];
rowsData.value.splice(targetIndex, 0, item);
draggedIndex = -1;
}
/**
* งกนนใชสำหรบการเลอน scroll ของ container
* @param e DragEvent
* @description ทำให scroll container ไดเวลา drag อยใกลขอบ
*/
function onDragOver(e: DragEvent) {
let container = cardSectionRef.value;
// vue proxy container.$el
if (container && (container as any).$el) {
container = (container as any).$el;
}
// container HTMLElement warning
if (
!container ||
typeof (container as HTMLElement).getBoundingClientRect !== "function"
) {
console.warn("container is not HTMLElement:", container);
return;
}
const rect = (container as HTMLElement).getBoundingClientRect();
const offset = 40; // scroll
const scrollSpeed = 30; // scroll
// mouse container scroll
if (e.clientY < rect.top + offset) {
(container as HTMLElement).scrollTop -= scrollSpeed;
} else if (e.clientY > rect.bottom - offset) {
(container as HTMLElement).scrollTop += scrollSpeed;
}
}
watch(modal, async () => {
if (modal.value && props.dataSort) {
const dataList = props.dataSort;
rowsData.value.push(...dataList);
} else {
rowsData.value = [];
}
});
</script>
<template>
<q-dialog v-model="modal" persistent full-width>
<q-card style="min-width: 80vw">
<DialogHeader :tittle="`จัดลำดับการ`" :close="() => (modal = false)" />
<q-separator />
<q-card-section
ref="cardSectionRef"
style="max-height: 70vh; overflow-y: auto"
@dragover.prevent="onDragOver"
>
<q-table
class="custom-header-table"
v-if="rowsData.length > 0"
flat
bordered
:rows="rowsData"
:columns="columns"
:rows-per-page-options="[0]"
row-key="id"
hide-bottom
hide-pagination
>
<template v-slot:body="props">
<q-tr
:props="props"
draggable="true"
@dragstart="onDragStart(props.rowIndex)"
@drop="onDrop(props.rowIndex)"
@dragover.prevent.stop="onDragOver"
style="cursor: move"
>
<q-td v-for="col in props.cols" :key="col.id">
<div v-if="col.name === 'no'">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name === 'organization'" class="text-html">
{{
findOrgNameHtml({
root: props.row.orgRoot,
child1: props.row.orgChild1,
child2: props.row.orgChild2,
child3: props.row.orgChild3,
child4: props.row.orgChild4,
})
}}
</div>
<div v-else-if="col.name === 'commandCode'">
{{ col.value ? col.value : "-" }}
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</q-table>
<div v-else class="bg-grey-1 text-center q-pa-md">ไมอม</div>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn
:disable="rowsData.length === 0"
type="submit"
:label="`บันทึก`"
color="public"
@click="onSubmit"
>
<q-tooltip>นท</q-tooltip>
</q-btn>
</q-card-actions>
</q-card>
</q-dialog>
</template>
<style lang="scss"></style>

View file

@ -149,7 +149,6 @@ function classInput(val: boolean) {
:enableTimePicker="false"
week-start="0"
:class="classInput(isReadonly)"
teleport-center
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
@ -161,9 +160,15 @@ function classInput(val: boolean) {
outlined
dense
borderless
:model-value="date2Thai(formData.commandDateAffect)"
:model-value="
formData.commandDateAffect
? date2Thai(formData.commandDateAffect)
: null
"
:label="`${'วันที่คำสั่งมีผล'}`"
hide-bottom-space
clearable
@clear="formData.commandDateAffect = null"
>
<template v-slot:prepend>
<q-icon name="event" color="primary" class="cursor-pointer">
@ -230,7 +235,6 @@ function classInput(val: boolean) {
:enableTimePicker="false"
:class="classInput(isReadonly)"
:readonly="isReadonly"
teleport-center
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
@ -248,6 +252,8 @@ function classInput(val: boolean) {
: formData.commandYear + 543
"
:label="`${'พ.ศ.'}`"
clearable
@clear="formData.commandYear = null"
>
<template v-slot:prepend>
<q-icon
@ -274,7 +280,6 @@ function classInput(val: boolean) {
week-start="0"
:class="classInput(isReadonly)"
:readonly="isReadonly"
teleport-center
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
@ -286,9 +291,15 @@ function classInput(val: boolean) {
outlined
dense
borderless
:model-value="date2Thai(formData.commandDateSign)"
:model-value="
formData.commandDateSign
? date2Thai(formData.commandDateSign)
: null
"
:label="`${'วันที่ลงนาม'}`"
hide-bottom-space
clearable
@clear="formData.commandDateSign = null"
>
<template v-slot:prepend>
<q-icon name="event" color="primary" class="cursor-pointer">
@ -359,7 +370,7 @@ function classInput(val: boolean) {
lazy-rules
borderless
v-model="formData.positionType"
:label="empType === 'officer' ? 'ประเภทตำแหน่ง' : 'กลุ่มงาน'"
:label="empType === 'officer' ? 'ตำแหน่งประเภท' : 'กลุ่มงาน'"
emit-value
map-options
option-label="name"
@ -433,7 +444,18 @@ function classInput(val: boolean) {
</div>
<div class="col-xs-6 col-sm-6 col-md-4" v-if="empType === 'officer'">
<q-select
<q-input
:class="classInput(isReadonly)"
:readonly="isReadonly"
outlined
dense
lazy-rules
borderless
v-model="formData.positionLine"
hide-bottom-space
:label="`${'สายงาน'}`"
/>
<!-- <q-select
outlined
:class="classInput(isReadonly)"
:readonly="isReadonly"
@ -462,11 +484,22 @@ function classInput(val: boolean) {
<q-item-section class="text-grey"> ไมอม </q-item-section>
</q-item>
</template></q-select
>
> -->
</div>
<div class="col-xs-6 col-sm-6 col-md-4" v-if="empType === 'officer'">
<q-select
<q-input
:class="classInput(isReadonly)"
:readonly="isReadonly"
outlined
dense
lazy-rules
borderless
v-model="formData.positionPathSide"
hide-bottom-space
:label="`${'ด้าน/สาขา'}`"
/>
<!-- <q-select
:class="classInput(isReadonly)"
:readonly="isReadonly"
outlined
@ -495,11 +528,22 @@ function classInput(val: boolean) {
<q-item-section class="text-grey"> ไมอม </q-item-section>
</q-item>
</template>
</q-select>
</q-select> -->
</div>
<div class="col-xs-6 col-sm-6 col-md-4" v-if="empType === 'officer'">
<q-select
<q-input
:class="classInput(isReadonly)"
:readonly="isReadonly"
outlined
dense
lazy-rules
borderless
v-model="formData.positionExecutive"
hide-bottom-space
:label="`${'ตำแหน่งทางการบริหาร'}`"
/>
<!-- <q-select
:class="classInput(isReadonly)"
:readonly="isReadonly"
outlined
@ -528,7 +572,7 @@ function classInput(val: boolean) {
<q-item-section class="text-grey"> ไมอม </q-item-section>
</q-item>
</template>
</q-select>
</q-select> -->
</div>
<div class="col-12">
@ -544,7 +588,6 @@ function classInput(val: boolean) {
label="เงินเดือน"
mask="###,###,###,###"
reverse-fill-mask
:rules="!isReadonly ? [(val:string) => !!val || `${'กรุณากรอกเงินเดือน'}`] :[]"
lazy-rules
hide-bottom-space
/>

File diff suppressed because it is too large Load diff

View file

@ -47,6 +47,7 @@ async function fetchDataProfile() {
.then(async (res) => {
const data = res.data.result;
statusCheckEdit.value = data.statusCheckEdit;
fetchPromission(data.rootId);
dataProfile.value = {
fullName: `${data.prefix}${data.firstName} ${data.lastName}`,
position: data.position,
@ -62,9 +63,9 @@ async function fetchDataProfile() {
});
}
function fetchPromission() {
function fetchPromission(rootId: string) {
http
.get(config.API.profilePermission)
.get(config.API.profilePermission(rootId))
.then((res) => {
const data = res.data.result;
isConfirmEdit.value = data.isEdit;
@ -133,7 +134,7 @@ function onConfirmDone() {
onMounted(async () => {
try {
showLoader();
await Promise.all([fetchDataProfile(), fetchPromission()]);
await fetchDataProfile();
} catch (err) {
messageError($q, err);
} finally {

View file

@ -348,7 +348,7 @@ watch(
dense
v-model="filterKeyword2"
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -358,7 +358,7 @@ watch(
dense
v-model="filterKeyword2"
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -241,7 +241,7 @@ function onSearch() {
dense
v-model="filterKeyword2"
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append> <q-icon name="search" /> </template>
</q-input>

View file

@ -287,7 +287,7 @@ watch(
dense
v-model="filterKeyword2"
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -106,7 +106,7 @@ const resetFilter = () => {
placeholder="ค้นหา"
style="max-width: 200px"
class="q-ml-sm"
@keydown.enter="props.onSearch?.()"
@keydown.enter.prevent="props.onSearch?.()"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -366,7 +366,7 @@ onMounted(async () => {
dense
v-model="filters"
label="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -294,7 +294,7 @@ watch(
v-model="filter"
placeholder="ค้นหา"
style="width: 200px; max-width: auto"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -1459,7 +1459,7 @@ onMounted(async () => {
v-model="filterlistAdd"
placeholder="ค้นหา"
style="width: 850px; max-width: auto"
@keydown.enter="onSearchAdd"
@keydown.enter.prevent="onSearchAdd"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -1,7 +1,11 @@
<script setup lang="ts">
import { ref, useAttrs } from "vue";
import { QTooltip, useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions";
import {
checkPermission,
checkPermissionList,
checkPermissionCreate,
} from "@/utils/permissions";
import type { PropType } from "vue";
import type { optionData } from "@/modules/05_placement/interface/index/Main";
@ -267,6 +271,11 @@ function filterSelector(val: string, update: Function) {
</div>
<q-btn
v-if="
checkPermission($route)?.attrIsUpdate &&
checkPermissionList(['COMMAND']) &&
checkPermissionCreate('COMMAND')
"
flat
round
color="primary"
@ -296,7 +305,7 @@ function filterSelector(val: string, update: Function) {
placeholder="ค้นหา"
style="max-width: 200px"
class="q-ml-sm"
@keydown.enter="onUpdateNewRows"
@keydown.enter.prevent="onUpdateNewRows"
>
<template v-slot:append> </template>
</q-input>

View file

@ -257,7 +257,7 @@ watchEffect(() => {
:model-value="filterKeyword2"
@update:model-value="updateInput"
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -209,7 +209,7 @@ watch(
dense
v-model="filterKeyword2"
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -197,7 +197,7 @@ watch(
dense
v-model="filter"
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -302,7 +302,7 @@ watch(
v-model="filter"
placeholder="ค้นหา"
style="width: 200px; max-width: auto"
@keydown.enter="(pagination.page = 1), getList()"
@keydown.enter.prevent="(pagination.page = 1), getList()"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -172,7 +172,7 @@ watchEffect(() => {
dense
placeholder="ค้นหา"
v-model="filterKeyword"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -875,13 +875,13 @@ async function clickdownloadFile(type: string) {
`แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ-${fullname.value}`,
type
);
hideLoader();
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
hideLoader();
})
.finally(() => {});
.finally(() => {
hideLoader();
});
}
/** เช็ค จำนวนเดือน เเละ วันที่เริ่ม ไม่เท่ากับ undefined*/

View file

@ -6,7 +6,7 @@ import { useRoute, useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import { useProbationDataStore } from "@/modules/05_placement/storeProbation";
import genReport from "@/plugins/genreport";
import FormUploadFile from "@/modules/05_placement/components/probation/FormEvaluation/FormUploadFile.vue";
import DialogSelectAuthority from "@/modules/05_placement/components/probation/FormEvaluation/DialogSelectAuthority.vue";

View file

@ -97,13 +97,13 @@ async function FileDownload(type: string) {
`แบบบันทึกผล(ผู้บังคับบัญชา)_${probationStore.person.name}_ครั้งที่${numTab.no}`,
type
);
hideLoader();
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
hideLoader();
})
.finally(() => {});
.finally(() => {
hideLoader();
});
} else {
//
showLoader();
@ -116,13 +116,13 @@ async function FileDownload(type: string) {
`แบบบันทึกผล(ผู้บังคับบัญชา)_${probationStore.person.name}_ครั้งที่${numTab.no}`,
type
);
hideLoader();
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
hideLoader();
})
.finally(() => {});
.finally(() => {
hideLoader();
});
}
}

View file

@ -6,7 +6,11 @@ import { useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { checkPermission } from "@/utils/permissions";
import {
checkPermission,
checkPermissionList,
checkPermissionCreate,
} from "@/utils/permissions";
import type { AppointMainRows } from "@/modules/05_placement/interface/request/Main";
import DialogOrder from "@/modules/05_placement/components/probation/DialogOrder/DialogSendToCommand.vue";
@ -181,7 +185,11 @@ onMounted(async () => {
<div class="row q-col-gutter-sm">
<div class="q-px-sm">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
v-if="
checkPermission($route)?.attrIsUpdate &&
checkPermissionList(['COMMAND']) &&
checkPermissionCreate('COMMAND')
"
flat
round
dense
@ -200,7 +208,7 @@ onMounted(async () => {
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -5,7 +5,11 @@ import { useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import { checkPermission } from "@/utils/permissions";
import {
checkPermission,
checkPermissionList,
checkPermissionCreate,
} from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
@ -511,7 +515,9 @@ onMounted(() => {
<q-btn
v-if="
checkPermission($route)?.attrIsUpdate &&
checkPermission($route)?.attrIsGet
checkPermission($route)?.attrIsGet &&
checkPermissionList(['COMMAND']) &&
checkPermissionCreate('COMMAND')
"
@click="onCommand"
flat

View file

@ -421,7 +421,7 @@ onMounted(async () => {
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -423,7 +423,7 @@ onMounted(() => {
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -3,7 +3,11 @@ import { ref, onMounted, computed } from "vue";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import {
checkPermission,
checkPermissionList,
checkPermissionCreate,
} from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
import http from "@/plugins/http";
@ -240,7 +244,11 @@ onMounted(async () => {
</q-select>
</div>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
v-if="
checkPermission($route)?.attrIsUpdate &&
checkPermissionList(['COMMAND']) &&
checkPermissionCreate('COMMAND')
"
@click="openModalOrder"
flat
round

View file

@ -3,7 +3,11 @@ import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import {
checkPermission,
checkPermissionList,
checkPermissionCreate,
} from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
import http from "@/plugins/http";
@ -445,7 +449,11 @@ onMounted(async () => {
<q-tooltip>เพมขอม</q-tooltip>
</q-btn>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
v-if="
checkPermission($route)?.attrIsUpdate &&
checkPermissionList(['COMMAND']) &&
checkPermissionCreate('COMMAND')
"
size="14px"
flat
round
@ -463,7 +471,7 @@ onMounted(async () => {
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -2,7 +2,11 @@
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions";
import {
checkPermission,
checkPermissionList,
checkPermissionCreate,
} from "@/utils/permissions";
import { useRouter } from "vue-router";
import { useTransferDataStore } from "@/modules/05_placement/store";
import { useCounterMixin } from "@/stores/mixin";
@ -301,7 +305,11 @@ onMounted(async () => {
</q-select>
</div>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
v-if="
checkPermission($route)?.attrIsUpdate &&
checkPermissionList(['COMMAND']) &&
checkPermissionCreate('COMMAND')
"
@click="openModalOrder"
size="14px"
flat
@ -319,7 +327,7 @@ onMounted(async () => {
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -3,7 +3,11 @@ import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import {
checkPermission,
checkPermissionList,
checkPermissionCreate,
} from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
import http from "@/plugins/http";
@ -273,7 +277,11 @@ onMounted(async () => {
</q-select>
</div>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
v-if="
checkPermission($route)?.attrIsUpdate &&
checkPermissionList(['COMMAND']) &&
checkPermissionCreate('COMMAND')
"
flat
round
size="14px"
@ -291,7 +299,7 @@ onMounted(async () => {
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -3,7 +3,11 @@ import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import {
checkPermission,
checkPermissionList,
checkPermissionCreate,
} from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
import http from "@/plugins/http";
@ -403,7 +407,11 @@ onMounted(async () => {
</div>
<div>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
v-if="
checkPermission($route)?.attrIsUpdate &&
checkPermissionList(['COMMAND']) &&
checkPermissionCreate('COMMAND')
"
@click="sendToCommand()"
size="14px"
flat
@ -423,7 +431,7 @@ onMounted(async () => {
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -2,7 +2,11 @@
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions";
import {
checkPermission,
checkPermissionList,
checkPermissionCreate,
} from "@/utils/permissions";
import { useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
@ -400,7 +404,11 @@ onMounted(async () => {
</q-select>
</div>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
v-if="
checkPermission($route)?.attrIsUpdate &&
checkPermissionList(['COMMAND']) &&
checkPermissionCreate('COMMAND')
"
@click="popup()"
size="14px"
flat
@ -419,7 +427,7 @@ onMounted(async () => {
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
@ -586,7 +594,8 @@ onMounted(async () => {
props.row.posTypeName === "อำนวยการ"
? `${props.row.posTypeName}`
: ""
}} {{
}}
{{
props.row.posLevelName !== null
? `(${props.row.posLevelName})`
: ""

View file

@ -3,7 +3,11 @@ import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import {
checkPermission,
checkPermissionList,
checkPermissionCreate,
} from "@/utils/permissions";
import { useTransferDataStore } from "@/modules/05_placement/store";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
@ -353,7 +357,11 @@ onMounted(() => {
</q-select>
</div>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
v-if="
checkPermission($route)?.attrIsUpdate &&
checkPermissionList(['COMMAND']) &&
checkPermissionCreate('COMMAND')
"
@click="popup()"
size="14px"
flat
@ -371,7 +379,7 @@ onMounted(() => {
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -566,7 +566,7 @@ onMounted(async () => {
placeholder="ค้นหา"
style="max-width: 200px"
class="q-ml-sm"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -4,6 +4,7 @@ import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useRetirementDataStore } from "@/modules/06_retirement/store/Main";
import { useRoleWorkflowDataStore } from "@/stores/roleWorkflow";
import type { PropType } from "vue";
import type { QTableProps } from "quasar";
@ -15,6 +16,7 @@ import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCom
/** use */
const $q = useQuasar();
const stroe = useRetirementDataStore();
const { fetchDataCheckIsoffice } = useRoleWorkflowDataStore();
const { statusText } = stroe;
const selected = ref<ResponseItems[]>([]);
const dataMapToSend = computed(() => {
@ -33,7 +35,7 @@ const dataMapToSend = computed(() => {
}));
});
const mixin = useCounterMixin();
const { dialogConfirm, date2Thai, onSearchDataTable } = mixin;
const { dialogConfirm, date2Thai, onSearchDataTable, messageError } = mixin;
/** props*/
const props = defineProps({
@ -54,7 +56,7 @@ const columns = ref<QTableProps["columns"]>([
align: "left",
label: "ลำดับ",
sortable: false,
field: (row) => props?.rows!.indexOf(row) + 1,
field: (row) => rowsData.value!.indexOf(row) + 1,
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
@ -144,8 +146,11 @@ const columns = ref<QTableProps["columns"]>([
sortable: true,
field: "status",
format(val, row) {
return statusText(row.status);
return props.mainTabs === "1"
? statusText(row.status)
: statusText(row.status, "อนุญาต");
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@ -190,13 +195,36 @@ async function onSearch() {
);
}
const isOfficer = ref<boolean>(false);
const isStaff = ref<boolean>(false);
/** ฟังก์ดึงข้อมูลผู้บังคับบัญชา*/
async function fetchCheckOfficer() {
try {
const data = await fetchDataCheckIsoffice("SYS_RESIGN");
isOfficer.value = data.isOfficer;
isStaff.value = data.isStaff;
} catch (err) {
messageError($q, err);
}
}
watch(
() => props.modal,
(val) => {
async (val) => {
if (val) {
selected.value = [];
rowsData.value = props.rows ? props.rows : [];
rowsDataMain.value = props.rows ? props.rows : [];
await fetchCheckOfficer();
const data = props?.rows?.filter((e: any) => {
if (isStaff.value) {
return e.group === "1.1";
} else {
return e.group !== "1.1";
}
});
rowsData.value = data ? data : [];
rowsDataMain.value = data ? data : [];
} else {
rowsData.value = [];
rowsDataMain.value = [];
@ -218,7 +246,7 @@ watch(
outlined
dense
v-model="filterKeyword"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
placeholder="ค้นหา"
>
<template v-slot:append>

View file

@ -8,7 +8,7 @@ import http from "@/plugins/http";
import config from "@/app.config";
import genReport from "@/plugins/genreport";
import { useCounterMixin } from "@/stores/mixin";
import { checkPermission } from "@/utils/permissions";
import { useRoleWorkflowDataStore } from "@/stores/roleWorkflow";
import { useRetirementDataStore } from "@/modules/06_retirement/store/Main";
import DialogHeader from "@/components/DialogHeader.vue";
@ -25,7 +25,6 @@ import type { DataProfile } from "@/modules/05_placement/interface/index/Main";
import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue";
import CardProfile from "@/components/CardProfile.vue";
import WorkFlow from "@/components/Workflow/Main.vue";
import DialogAddCommander from "@/modules/06_retirement/components/DialogAddCommander.vue";
/** Use */
@ -34,6 +33,7 @@ const route = useRoute();
const router = useRouter();
const store = useRetirementDataStore();
const { fetchDataCheckIsoffice } = useRoleWorkflowDataStore();
const { convertStatusText } = store;
const checkRoutePermisson = ref<boolean>(route.name == "resignDetailbyid");
const mixin = useCounterMixin();
@ -43,7 +43,6 @@ const {
showLoader,
hideLoader,
success,
dialogConfirm,
dialogRemove,
} = mixin;
@ -54,16 +53,8 @@ const personId = ref<string>("");
const roleUser = ref<string>("");
const dataProfile = ref<DataProfile>();
const approveStep = ref<string>("");
const group = ref<string>("");
// const approveCheck = computed(() => {
// return (
// rowsApprover.value?.commanders?.every(
// (commander) =>
// commander.approveStatus === "APPROVE" ||
// commander.approveStatus === "REJECT"
// ) ?? false
// );
// });
const idCheck = computed(() => {
if (
typeAdd.value == "COMMANDER" &&
@ -84,31 +75,6 @@ const idCheck = computed(() => {
}
});
// const approvePendingCheck = computed(() => {
// const commanders = rowsApprover.value?.commanders || [];
// const index = commanders.findIndex((c) => c.profileId === myProfileId.value);
// if (index === -1) {
// return false;
// }
// const currentCommander = commanders[index];
// if (currentCommander.approveStatus !== "PENDING") {
// return false;
// }
// if (index === 0) {
// return true;
// }
// const previousApproved = commanders
// .slice(0, index)
// .every(
// (c) => c.approveStatus === "APPROVE" || c.approveStatus === "REJECT"
// );
// return previousApproved;
// });
const isOfficer = ref<boolean>(false);
const isStaff = ref<boolean>(false);
const profileType = ref<string>("");
@ -211,7 +177,6 @@ const dataDetail = ref<any>({
reasonResign: "",
});
const workflowRef = ref<any>(null);
const organizationPositionOld = ref<string>("");
const positionTypeOld = ref<string>("");
const positionLevelOld = ref<string>("");
@ -228,20 +193,6 @@ const actionPass = ref<boolean>(false);
const reasonReign = ref<string>("");
const dateBreak = ref<Date | null>(null);
const isCheckData = computed(() => {
if (
organizationPositionOld.value !== "" &&
positionTypeOld.value !== "" &&
positionLevelOld.value !== "" &&
posNo.value !== "" &&
date.value !== null &&
dataDetail.value.commanderReject !== null &&
dataDetail.value.oligarchReject !== null
) {
return true;
} else return false;
});
/** คอลัมน์ */
const rows = ref<TypeFile[]>([]);
const columns = ref<QTableProps["columns"]>([
@ -309,9 +260,11 @@ function diffDate() {
return false;
}
/** นำข้อมูลมาจาก API*/
/**
* งกนดงขอมลรายละเอยดการลาออก
* @param id id ของผใชงาน
*/
async function fetchData(id: string) {
showLoader();
await http
.get(config.API.resingByid(id))
.then(async (res) => {
@ -346,6 +299,7 @@ async function fetchData(id: string) {
isDiscipline.value = data.isDiscipline;
statusCheck.value = data.status;
approveStep.value = data.approveStep;
group.value = data.group;
profileType.value = data.profileType;
keycloakUserId.value = data.keycloakUserId;
rowsApprover.value = {
@ -355,13 +309,14 @@ async function fetchData(id: string) {
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**Pop up */
/**
* งกนเป pop up อนญาตหรอยบย
* @param action action อนญาตหรอยบย
* @param type ประเภทผใชงาน
*/
function popUp(action: "pass" | "passNot", type: string) {
reasonReign.value = "";
dateBreak.value = null;
@ -370,7 +325,10 @@ function popUp(action: "pass" | "passNot", type: string) {
openModal();
}
//pop up
/**
* งกนยนยนการอนญาตหรอยบย
* @param type ประเภทผหาร
*/
function onSubmit(type: string) {
if (roleUser.value === "commander" && actionPass.value) {
confirmpopUp("/comander");
@ -381,22 +339,12 @@ function onSubmit(type: string) {
} else if (roleUser.value === "oligarch" && !actionPass.value) {
rejectpopUp("");
}
// if (actionPass.value) {
// if (type === "approver") {
// confirmpopUp("/comander");
// } else {
// confirmpopUp("");
// }
// } else {
// if (type === "approver") {
// rejectpopUp("/comander");
// } else {
// rejectpopUp("");
// }
// }
}
//pop up
/**
* งกนยนยนการอนญาต
* @param path path สำหรบการอนญาต
*/
async function confirmpopUp(path: string) {
dialogConfirm(
$q,
@ -427,7 +375,10 @@ async function confirmpopUp(path: string) {
);
}
//pop up
/**
* งกนยนยนการยบย
* @param path path สำหรบการยบย
*/
async function rejectpopUp(path: string) {
dialogConfirm(
$q,
@ -459,9 +410,7 @@ async function rejectpopUp(path: string) {
);
}
/**
* กดยกเล
*/
/** ฟังก์ชันยกเลิกการแก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย*/
async function clickCancel() {
edit.value = false;
const data = dataDetail.value;
@ -483,19 +432,23 @@ async function clickCancel() {
}
myForm.value?.resetValidation();
}
/**
* กดยกเล
*/
/** ฟังก์ชันยกเลิกการแก้ไขข้อมูลรายการตรวจสอบเงื่อนไขต่างๆ*/
async function clickCancelConditions() {
await fetchData(id.value);
conditions.value = false;
const data = dataDetail.value;
if (data) {
isNoDebt.value = data.isNoDebt;
isNoBurden.value = data.isNoBurden;
isDiscipline.value = data.isDiscipline;
conditions.value = false;
}
}
/** Function บันทึก รายการตรวจสอบเงื่อนไขต่างๆ*/
/** ฟังก์ชันบันทึกเงื่อนไขต่างๆ*/
function onSubmitConditions() {
dialogConfirm($q, () => {
dialogConfirm($q, async () => {
showLoader();
http
await http
.put(config.API.resignConditions(id.value), {
isNoDebt: isNoDebt.value,
isNoBurden: isNoBurden.value,
@ -515,9 +468,9 @@ function onSubmitConditions() {
});
}
/** Function บันทึก ,แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย*/
/** ฟังก์ชันบันทึกข้อมูลเพื่อลงบัญชีแนบท้าย*/
function onSubmitAttached() {
dialogConfirm($q, () => {
dialogConfirm($q, async () => {
const formData = new FormData();
const send = date.value !== null ? new Date(date.value).toUTCString() : "";
const activeDate =
@ -533,7 +486,7 @@ function onSubmitAttached() {
formData.append("AmountOld", salary.value.toString());
formData.append("remarkHorizontal", remarkHorizontal.value);
showLoader();
http
await http
.put(config.API.resingByid(id.value), formData)
.then(async () => {
await fetchData(id.value);
@ -550,7 +503,7 @@ function onSubmitAttached() {
}
/**
* Function เพ Class เวลา Edit
* งกนเปลยน Class
* @param val เมอเปนEdit จะเปลยน Class
*/
function getClass(val: boolean) {
@ -560,16 +513,6 @@ function getClass(val: boolean) {
};
}
/** แปลง StatusOrder */
function statusOrder(val: boolean) {
switch (val) {
case true:
return "ยับยั้ง";
case false:
return "อนุญาต";
}
}
//
async function fileDownload(type: string, fileName: string) {
showLoader();
@ -592,7 +535,6 @@ function updatemodalPersonal(modal: boolean) {
}
async function fetchFile() {
showLoader();
await http
.get(config.API.file("พ้นจากราชการ", "หลักฐานลาออก", id.value))
.then(async (res) => {
@ -600,13 +542,12 @@ async function fetchFile() {
})
.catch((e) => {
messageError($q, e);
hideLoader();
});
}
function uploadFiles() {
async function uploadFiles() {
showLoader();
http
await http
.post(config.API.file("พ้นจากราชการ", "หลักฐานลาออก", id.value), {
replace: true,
fileList: [
@ -673,13 +614,13 @@ async function downloadFiles(fileName: string) {
}
/**
* ลบไฟล
* งกลบไฟล
* @param id id file
*/
function removeFile(fileName: string) {
dialogRemove($q, () => {
dialogRemove($q, async () => {
showLoader();
http
await http
.delete(
config.API.fileByFile(
"พ้นจากราชการ",
@ -688,15 +629,16 @@ function removeFile(fileName: string) {
fileName
)
)
.then(() => {
.then(async () => {
setTimeout(async () => {
await fetchFile();
success($q, `ลบไฟล์สำเร็จ`);
hideLoader();
}, 1000);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
});
@ -719,47 +661,51 @@ function convertStatus(val: string) {
} else return val;
}
/** เปิด POP UP */
/**
* งกนเป modal เพมผงคบบญชา
* @param type งคบบญชา,อำนาจ
*/
function onAddPerson(type: string) {
modalAdd.value = true;
typeAdd.value = type;
}
/** ฟังก์ดึงข้อมูลผู้บังคับบัญชา*/
async function checkOfficer() {
http
.get(config.API.checkIsofficer + `SYS_RESIGN`)
.then(async (res) => {
isOfficer.value = await res.data.result.isOfficer;
isStaff.value = await res.data.result.isStaff;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
try {
const data = await fetchDataCheckIsoffice("SYS_RESIGN");
isOfficer.value = data.isOfficer;
isStaff.value = data.isStaff;
} catch (err) {
messageError($q, err);
}
}
/** ฟังก์ชันส่งไปพิจารณา*/
function onSend() {
dialogConfirm(
$q,
() => {
async () => {
showLoader();
http
await http
.get(config.API.sendApproveRetirement("", id.value))
.then(async (res) => {
await fetchFile();
await fetchData(id.value);
.then(async () => {
await Promise.all([fetchFile(), fetchData(id.value)]);
success($q, "ส่งไปพิจารณา");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
.finally(() => {
hideLoader();
});
},
"ยืนยันการส่งไปพิจารณา",
"ต้องการส่งไปพิจารณาใช่หรือไม่"
);
}
/** ฟังก์ชันดึงข้อมูลตำแหน่งจาก Keycloak*/
async function fetchKeycloakPosition() {
if (myProfileId.value == "") {
await http
@ -774,13 +720,13 @@ async function fetchKeycloakPosition() {
}
}
/** Hook */
/** hook ฟังก์ชันเมื่อโหลดคอมโพเนนต์*/
onMounted(async () => {
showLoader();
await Promise.all([
await fetchData(id.value),
await fetchKeycloakPosition(),
await checkOfficer(),
fetchData(id.value),
fetchKeycloakPosition(),
checkOfficer(),
fetchFile(),
]).finally(() => {
hideLoader();
@ -813,39 +759,6 @@ onMounted(async () => {
<q-card bordered class="row col-12 text-dark q-mt-sm">
<div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
<div class="q-pl-sm text-weight-bold text-dark">อมลการลาออก</div>
<!-- <q-space />
<div
class="q-gutter-x-sm"
v-if="
(roleUser === 'officer' && dataDetail.officerReject === null) ||
(roleUser === 'commander' &&
dataDetail.commanderReject === null &&
dataDetail.officerReject !== null) ||
(roleUser === 'oligarch' &&
dataDetail.oligarchReject === null &&
dataDetail.commanderReject !== null &&
dataDetail.officerReject !== null)
"
>
<q-btn
outline
color="primary"
dense
icon-right="check"
class="q-px-sm"
label="อนุญาต"
@click="popUp('pass')"
/>
<q-btn
outline
color="red"
dense
icon-right="close"
class="q-px-sm"
label="ยับยั้ง"
@click="popUp('passNot')"
/>
</div> -->
</div>
<div class="col-12"><q-separator /></div>
<div class="row col-12 q-pa-md">
@ -1025,11 +938,11 @@ onMounted(async () => {
เงอนไขตางๆ
</div>
<q-space />
<!-- workflowRef?.permission.isUpdate && -->
<div
v-if="
!checkRoutePermisson && dataDetail.statusMain === 'WAITTING'
!checkRoutePermisson &&
((isStaff && group === '1.1' && approveStep === 'st1') ||
(isOfficer && group !== '1.1' && approveStep === 'st3'))
"
>
<div v-if="!conditions">
@ -1107,7 +1020,9 @@ onMounted(async () => {
<q-file
v-if="
!checkRoutePermisson && dataDetail.statusMain === 'WAITTING'
!checkRoutePermisson &&
((isStaff && group === '1.1' && approveStep === 'st1') ||
(isOfficer && group !== '1.1' && approveStep === 'st3'))
"
class="col-12"
for="#evidenceFiles"
@ -1164,7 +1079,12 @@ onMounted(async () => {
<q-btn
v-if="
!checkRoutePermisson &&
dataDetail.statusMain === 'WAITTING'
((isStaff &&
group === '1.1' &&
approveStep === 'st1') ||
(isOfficer &&
group !== '1.1' &&
approveStep === 'st3'))
"
dense
flat
@ -1191,51 +1111,6 @@ onMounted(async () => {
</div>
</q-card>
<!-- ผลการพจารณาของการเจาหนาทของหนวยงาน -->
<!-- <q-card bordered class="row col-12 text-dark q-mt-sm">
<div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
<div class="q-pl-sm text-weight-bold text-dark">
ผลการพจารณาของการเจาหนาทของหนวยงาน
</div>
</div>
<div class="col-12"><q-separator /></div>
<div class="row col-12 q-pa-md">
<div class="col-12 row bg-white q-col-gutter-md">
<div class="col-xs-6 row items-start">
<div class="col-12 text-top">สถานะ</div>
<div class="col-12 text-detail">
{{
dataDetail.officerReject !== null
? statusOrder(dataDetail.officerReject)
: "-"
}}
</div>
</div>
<div class="col-xs-6 row items-start">
<div class="col-12 text-top">นสดทายทบย</div>
<div class="col-12 text-detail">
{{
dataDetail.officerRejectDate !== null
? date2Thai(dataDetail.officerRejectDate)
: "-"
}}
</div>
</div>
<div class="col-xs-12 row items-start">
<div class="col-12 text-top">ความคดเหนและเหตผล</div>
<div class="col-12 text-detail">
{{
dataDetail.officerReject
? dataDetail.officerRejectReason
: dataDetail.officerApproveReason
}}
</div>
</div>
</div>
</div>
</q-card> -->
<!-- ผลการพจารณาของผงคบบญชา -->
<q-card bordered class="row col-12 text-dark q-mt-sm">
<div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
@ -1243,8 +1118,13 @@ onMounted(async () => {
ผลการพจารณาของผงคบบญชา
</div>
<!-- วอยางเชคของ การลา -->
<q-btn
v-if="statusCheck == 'WAITTING' && (isOfficer || isStaff)"
v-if="
!checkRoutePermisson &&
((isStaff && group === '1.1' && approveStep === 'st1') ||
(isStaff && group !== '1.1' && approveStep === 'st1'))
"
flat
round
icon="add"
@ -1256,34 +1136,6 @@ onMounted(async () => {
<q-tooltip>เพมรายชอผงคบบญชา</q-tooltip>
</q-btn>
<q-space />
<!-- workflowRef?.permission.isUpdate && -->
<!-- <div
class="q-gutter-x-sm"
v-if="
dataDetail.commanderReject === null &&
dataDetail.statusMain === 'WAITTING'
"
>
<q-btn
outline
color="primary"
dense
icon-right="check"
class="q-px-sm"
label="อนุญาต"
@click="popUp('pass', 'commander')"
/>
<q-btn
outline
color="red"
dense
icon-right="close"
class="q-px-sm"
label="ยับยั้ง"
@click="popUp('passNot', 'commander')"
/>
</div> -->
</div>
<div class="col-12"><q-separator /></div>
@ -1316,12 +1168,16 @@ onMounted(async () => {
<div
v-if="
props.row.approveStatus == 'PENDING' &&
props.row.comment == ''
props.row.comment == '' &&
approveStep === 'st2'
"
class="q-gutter-x-xs"
>
<q-btn
v-if="props.row.profileId === myProfileId"
v-if="
props.row.profileId === myProfileId &&
approveStep === 'st2'
"
outline
dense
color="primary"
@ -1331,7 +1187,10 @@ onMounted(async () => {
@click="popUp('pass', 'commander')"
/>
<q-btn
v-if="props.row.profileId === myProfileId"
v-if="
props.row.profileId === myProfileId &&
approveStep === 'st2'
"
outline
color="red"
dense
@ -1376,8 +1235,13 @@ onMounted(async () => {
<div class="q-pl-sm text-weight-bold text-dark">
ผลการพจารณาของผอำนาจ
</div>
<q-btn
v-if="statusCheck == 'WAITTING' && (isOfficer || isStaff)"
v-if="
!checkRoutePermisson &&
((isStaff && group === '1.1' && approveStep === 'st1') ||
(isOfficer && group !== '1.1' && approveStep === 'st3'))
"
flat
round
icon="add"
@ -1394,11 +1258,12 @@ onMounted(async () => {
<div
class="q-gutter-x-sm"
v-if="
approveStep == 'st3' &&
rowsApprover &&
rowsApprover.approvers &&
rowsApprover.approvers[0]?.profileId == myProfileId &&
rowsApprover.approvers[0]?.approveStatus == 'PENDING'
rowsApprover.approvers[0]?.approveStatus == 'PENDING' &&
((group === '1.1' && approveStep === 'st3') ||
(group !== '1.1' && approveStep === 'st4'))
"
>
<q-btn
@ -1479,20 +1344,33 @@ onMounted(async () => {
<q-card
bordered
class="row col-12 text-dark q-mt-sm q-pa-sm"
v-if="statusCheck == 'WAITTING' && (isOfficer || isStaff)"
v-if="
!checkRoutePermisson &&
((isStaff && group === '1.1' && approveStep === 'st1') ||
(isStaff && group !== '1.1' && approveStep === 'st1') ||
(isOfficer && group !== '1.1' && approveStep === 'st3'))
"
>
<q-btn
@click="onSend"
:disable="
rowsApprover?.approvers.length == 0 ||
rowsApprover?.commanders.length == 0
(group === '1.1' &&
(rowsApprover?.approvers.length == 0 ||
rowsApprover?.commanders.length == 0)) ||
(group !== '1.1 ' &&
rowsApprover?.commanders.length == 0 &&
approveStep === 'st1') ||
(group !== '1.1 ' &&
rowsApprover?.approvers.length == 0 &&
approveStep === 'st3')
"
@click="onSend"
label="ส่งไปพิจารณา"
color="secondary"
class="q-ml-auto"
><q-tooltip>คลกเพอสงไปพจารณา</q-tooltip></q-btn
>
</q-card>
<!-- แกไขขอมลเพอลงบญชแนบทาย -->
<q-card bordered class="row col-12 text-dark q-mt-sm">
<q-form
@ -1510,7 +1388,12 @@ onMounted(async () => {
<!-- workflowRef?.permission.isUpdate && -->
<div
v-if="!checkRoutePermisson && dataDetail.statusMain === 'WAITTING'"
v-if="
!checkRoutePermisson &&
(dataDetail.statusMain === 'APPROVE' ||
dataDetail.statusMain === 'REJECT') &&
((isStaff && group === '1.1') || (isOfficer && group !== '1.1'))
"
>
<div class="q-gutter-sm" v-if="!edit">
<q-btn
@ -1758,7 +1641,7 @@ onMounted(async () => {
dense
outlined
lazy-rules
:rules="[(val:string) => !!val || 'กรุณากรอกความคิดเห็น/เหตุผล']"
:rules=" !actionPass ? [(val:string) => !!val || 'กรุณากรอกความคิดเห็น/เหตุผล'] :[]"
v-model="reasonReign"
:label="`${'กรอกความคิดเห็น/เหตุผล'}`"
type="textarea"
@ -1809,12 +1692,11 @@ onMounted(async () => {
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white text-teal">
<q-card-actions align="right">
<q-btn label="บันทึก" color="secondary" type="submit"
><q-tooltip>นทกขอม</q-tooltip></q-btn
>
</q-card-actions>
<!-- <DialogFooter :editvisible="true" :save="conditionPopup" /> -->
</q-form>
</q-card>
</q-dialog>

View file

@ -7,8 +7,8 @@ import { useQuasar, QForm, type QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { checkPermission } from "@/utils/permissions";
import { useRetirementDataStore } from "@/modules/06_retirement/store/Main";
import { useRoleWorkflowDataStore } from "@/stores/roleWorkflow";
import type { DataProfile } from "@/modules/05_placement/interface/index/Main";
import type {
@ -18,7 +18,6 @@ import type {
import DialogHeader from "@/components/DialogHeader.vue";
import CardProfile from "@/components/CardProfile.vue";
import WorkFlow from "@/components/Workflow/Main.vue";
import DialogAddCommander from "@/modules/06_retirement/components/DialogAddCommander.vue";
/** Use */
@ -26,9 +25,8 @@ const $q = useQuasar();
const route = useRoute();
const router = useRouter();
const store = useRetirementDataStore();
const { fetchDataCheckIsoffice } = useRoleWorkflowDataStore();
const { convertStatusText } = store;
const checkRoutePermisson = ref<boolean>(route.name == "resignDetailReject");
const mixin = useCounterMixin();
const {
messageError,
date2Thai,
@ -36,19 +34,16 @@ const {
hideLoader,
success,
dialogConfirm,
} = mixin;
} = useCounterMixin();
const checkRoutePermisson = ref<boolean>(route.name == "resignDetailReject");
/** ตัวแปร */
const roleUser = ref<string>("");
const dataProfile = ref<DataProfile>();
const group = ref<string>("");
const approveStep = ref<string>("");
const approveCheck = computed(() => {
return (
rowsApprover.value?.commanders?.every(
(commander) => commander.approveStatus === "APPROVE"
) ?? false
);
});
const idCheck = computed(() => {
if (
typeAdd.value == "COMMANDER" &&
@ -69,29 +64,6 @@ const idCheck = computed(() => {
}
});
const approvePendingCheck = computed(() => {
const commanders = rowsApprover.value?.commanders || [];
const index = commanders.findIndex((c) => c.profileId === keycloakId.value);
if (index === -1) {
return false;
}
const currentCommander = commanders[index];
if (currentCommander.approveStatus !== "PENDING") {
return false;
}
if (index === 0) {
return true;
}
const previousApproved = commanders
.slice(0, index)
.every((c) => c.approveStatus === "APPROVE");
return previousApproved;
});
const isOfficer = ref<boolean>(false);
const isStaff = ref<boolean>(false);
const profileType = ref<string>("");
@ -151,15 +123,6 @@ const columnsCommanders = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "rejectDate",
align: "left",
label: "วันสุดท้ายที่ยับยั้ง",
field: "rejectDate",
sortable: true,
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const id = ref<string>(route.params.id.toString());
@ -187,9 +150,11 @@ const dataDetail = ref<any>({
statustext: "",
fullname: "",
statusMain: "",
cancelReason: "",
remark: "",
reasonResign: "",
});
const workflowRef = ref<any>(null);
const organizationPositionOld = ref<string>("");
const positionTypeOld = ref<string>("");
const positionLevelOld = ref<string>("");
@ -206,32 +171,21 @@ const actionPass = ref<boolean>(false);
const reasonReign = ref<string>("");
const dateBreak = ref<Date | null>(null);
const isCheckData = computed(() => {
if (
organizationPositionOld.value !== "" &&
positionTypeOld.value !== "" &&
positionLevelOld.value !== "" &&
posNo.value !== "" &&
date.value !== null &&
dataDetail.value.commanderReject !== null &&
dataDetail.value.oligarchReject !== null
) {
return true;
} else return false;
});
/**เปิด-ปิด modal */
function closeModal() {
modal.value = false;
}
function openModal() {
modal.value = true;
}
const isNoDebt = ref<boolean>(false);
const isNoBurden = ref<boolean>(false);
const isDiscipline = ref<boolean>(false);
/** ฟังก์ชันปิด popup อนุญาตหรือยับยั้ง*/
function closeModal() {
modal.value = false;
}
/** ฟังก์ชันเปิด popup อนุญาตหรือยับยั้ง*/
function openModal() {
modal.value = true;
}
/** ฟังก์ชันตรวจสอบวันที่ขอลาออกจากราชการน้อยกว่า 30 วัน*/
function diffDate() {
if (date.value !== null && dateLeave.value !== null) {
const time = dateLeave.value.getTime() - date.value.getTime();
@ -245,9 +199,11 @@ function diffDate() {
return false;
}
/** นำข้อมูลมาจาก API*/
/**
* งกนดงขอมลรายละเอยดการยกเลกการลาออก
* @param id id ของผใชงาน
*/
async function fetchData(id: string) {
showLoader();
await http
.get(config.API.listResign() + `/cancel/${id}`)
.then(async (res) => {
@ -269,6 +225,8 @@ async function fetchData(id: string) {
isNoDebt.value = data.isNoDebt;
isNoBurden.value = data.isNoBurden;
isDiscipline.value = data.isDiscipline;
approveStep.value = data.approveStep;
group.value = data.group;
statusCheck.value = data.status;
profileType.value = data.profileType;
@ -280,13 +238,14 @@ async function fetchData(id: string) {
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**Pop up */
/**
* งกนเป pop up อนญาตหรอยบย
* @param action action อนญาตหรอยบย
* @param type ประเภทผใชงาน
*/
function popUp(action: "pass" | "passNot", type: string) {
reasonReign.value = "";
dateBreak.value = null;
@ -295,16 +254,24 @@ function popUp(action: "pass" | "passNot", type: string) {
openModal();
}
//pop up
/** ฟังก์ชันยืนยันการอนุญาตหรือไม่อนุญาตการยกเลิกการลาออก*/
function onSubmit() {
dialogConfirm($q, async () => {
showLoader();
const body = {
reason: reasonReign.value,
reject: !actionPass.value,
// reject: !actionPass.value,
Date: new Date(),
};
const action = actionPass.value ? "approve" : "reject";
const endpoint =
roleUser.value === "commander"
? config.API.comanderCancelResign("", action, id.value)
: config.API.approverCancelResign("", action, id.value);
await http
.put(config.API.resignReject(`${roleUser.value}-cancel`, id.value), body)
.put(endpoint, body)
.then(async () => {
await fetchData(id.value);
closeModal();
@ -319,9 +286,7 @@ function onSubmit() {
});
}
/**
* กดยกเล
*/
/** ฟังก์ชันยกเลิกการแก้ไขข้อมูลแนบท้าย*/
async function clickCancel() {
edit.value = false;
const data = dataDetail.value;
@ -344,7 +309,7 @@ async function clickCancel() {
myForm.value?.resetValidation();
}
/** Function บันทึก ,แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย*/
/** ฟังก์ชันบันทึกข้อมูลเพื่อลงบัญชีแนบท้าย*/
function onSubmitAttached() {
dialogConfirm($q, () => {
const formData = new FormData();
@ -379,7 +344,7 @@ function onSubmitAttached() {
}
/**
* Function เพ Class เวลา Edit
* งกนเปลยน Class
* @param val เมอเปนEdit จะเปลยน Class
*/
function getClass(val: boolean) {
@ -389,56 +354,51 @@ function getClass(val: boolean) {
};
}
/** แปลง StatusOrder */
function statusOrder(val: boolean) {
switch (val) {
case true:
return "ยับยั้ง";
case false:
return "อนุญาต";
}
}
/** เปิด POP UP */
/**
* งกนเป popup เพมผงคบบญชา, อำนาจ
* @param type งคบบญชา, อำนาจ
*/
function onAddPerson(type: string) {
modalAdd.value = true;
typeAdd.value = type;
}
/** ฟังก์ดึงข้อมูลสิทธ์ สกจ,กจ*/
async function checkOfficer() {
http
.get(config.API.checkIsofficer + `SYS_RESIGN`)
.then(async (res) => {
isOfficer.value = await res.data.result.isOfficer;
isStaff.value = await res.data.result.isStaff;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
try {
const data = await fetchDataCheckIsoffice("SYS_RESIGN");
isOfficer.value = data.isOfficer;
isStaff.value = data.isStaff;
} catch (err) {
messageError($q, err);
}
}
/** ฟังก์ชันส่งไปพิจารณา*/
function onSend() {
dialogConfirm(
$q,
() => {
async () => {
showLoader();
http
.get(config.API.sendApproveRetirement("", id.value))
.then(async (res) => {
await http
.get(config.API.officerCancelResign("", id.value))
.then(async () => {
await fetchData(id.value);
success($q, "ส่งไปพิจารณา");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
.finally(() => {
hideLoader();
});
},
"ยืนยันการส่งไปพิจารณา",
"ต้องการส่งไปพิจารณาใช่หรือไม่"
);
}
/** ฟังก์ชันดึงข้อมูลตำแหน่งจาก Keycloak*/
async function fetchKeycloakPosition() {
if (keycloakId.value == "") {
await http
@ -453,11 +413,16 @@ async function fetchKeycloakPosition() {
}
}
/** Hook */
/** hook ฟังก์ชันเมื่อโหลดคอมโพเนนต์*/
onMounted(async () => {
await fetchData(id.value);
await fetchKeycloakPosition()
await checkOfficer();
showLoader();
await Promise.all([
fetchData(id.value),
fetchKeycloakPosition(),
checkOfficer(),
]).finally(() => {
hideLoader();
});
});
</script>
@ -486,39 +451,6 @@ onMounted(async () => {
<q-card bordered class="row col-12 text-dark q-mt-sm">
<div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
<div class="q-pl-sm text-weight-bold text-dark">อมลการลาออก</div>
<!-- <q-space />
<div
class="q-gutter-x-sm"
v-if="
(roleUser === 'officer' && dataDetail.officerReject === null) ||
(roleUser === 'commander' &&
dataDetail.commanderReject === null &&
dataDetail.officerReject !== null) ||
(roleUser === 'oligarch' &&
dataDetail.oligarchReject === null &&
dataDetail.commanderReject !== null &&
dataDetail.officerReject !== null)
"
>
<q-btn
outline
color="primary"
dense
icon-right="check"
class="q-px-sm"
label="อนุญาต"
@click="popUp('pass')"
/>
<q-btn
outline
color="red"
dense
icon-right="close"
class="q-px-sm"
label="ยับยั้ง"
@click="popUp('passNot')"
/>
</div> -->
</div>
<div class="col-12"><q-separator /></div>
<div class="row col-12 q-pa-md">
@ -566,6 +498,15 @@ onMounted(async () => {
</div>
</div>
</div>
<div class="col-12 row items-start">
<div class="col-12">
<div class="col-12 text-top">เหตผลการขอยกเล</div>
<div class="col-12 text-detail text-red">
{{ dataDetail.cancelReason }}
</div>
</div>
</div>
</div>
</div>
</q-card>
@ -577,7 +518,11 @@ onMounted(async () => {
ผลการพจารณาของผงคบบญชา
</div>
<q-btn
v-if="statusCheck == 'WAITTING' && (isOfficer || isStaff)"
v-if="
!checkRoutePermisson &&
((isStaff && group === '1.1' && approveStep === 'st1') ||
(isStaff && group !== '1.1' && approveStep === 'st1'))
"
flat
round
icon="add"
@ -589,34 +534,6 @@ onMounted(async () => {
<q-tooltip>เพมรายชอผงคบบญชา</q-tooltip>
</q-btn>
<q-space />
<!-- workflowRef?.permission.isUpdate && -->
<!-- <div
class="q-gutter-x-sm"
v-if="
dataDetail.commanderReject === null &&
dataDetail.statusMain === 'WAITTING'
"
>
<q-btn
outline
color="primary"
dense
icon-right="check"
class="q-px-sm"
label="อนุญาต"
@click="popUp('pass', 'commander')"
/>
<q-btn
outline
color="red"
dense
icon-right="close"
class="q-px-sm"
label="ยับยั้ง"
@click="popUp('passNot', 'commander')"
/>
</div> -->
</div>
<div class="col-12"><q-separator /></div>
@ -647,25 +564,19 @@ onMounted(async () => {
</div>
<div v-else-if="col.name == 'comment'">
<div
class="q-gutter-x-xs"
v-if="
props.row.approveStatus == 'PENDING' &&
props.row.comment == ''
props.row.comment == '' &&
approveStep === 'st2'
"
>
<q-btn
:disable="
statusCheck == 'NEW' ||
!approvePendingCheck ||
(props.row.profileId !== keycloakId &&
checkPermission($route)?.attrIsUpdate)
"
:outline="
props.row.profileId !== keycloakId ||
statusCheck == 'NEW' ||
!approvePendingCheck
? false
: true
v-if="
props.row.profileId === keycloakId &&
approveStep === 'st2'
"
outline
dense
color="primary"
icon-right="check"
@ -674,24 +585,16 @@ onMounted(async () => {
@click="popUp('pass', 'commander')"
/>
<q-btn
:disable="
statusCheck == 'NEW' ||
!approvePendingCheck ||
(props.row.profileId !== keycloakId &&
checkPermission($route)?.attrIsUpdate)
"
:outline="
props.row.profileId !== keycloakId ||
statusCheck == 'NEW' ||
!approvePendingCheck
? false
: true
v-if="
props.row.profileId === keycloakId &&
approveStep === 'st2'
"
outline
color="red"
dense
icon-right="close"
class="q-px-sm"
label="ยับยั้ง"
label="ไม่อนุญาต"
@click="popUp('passNot', 'commander')"
/>
</div>
@ -702,7 +605,7 @@ onMounted(async () => {
<div v-else-if="col.name == 'approveStatus'">
{{
props.row.approveStatus
? convertStatusText(props.row.approveStatus)
? convertStatusText(props.row.approveStatus, "ไม่อนุญาต")
: "-"
}}
</div>
@ -723,7 +626,11 @@ onMounted(async () => {
ผลการพจารณาของผอำนาจ
</div>
<q-btn
v-if="statusCheck == 'WAITTING' && (isOfficer || isStaff)"
v-if="
!checkRoutePermisson &&
((isStaff && group === '1.1' && approveStep === 'st1') ||
(isOfficer && group !== '1.1' && approveStep === 'st3'))
"
flat
round
icon="add"
@ -735,20 +642,17 @@ onMounted(async () => {
<q-tooltip>เพมรายชอผอำนาจ</q-tooltip>
</q-btn>
<q-space />
<!-- workflowRef?.permission.isUpdate && -->
<div
class="q-gutter-x-sm"
v-if="
checkPermission($route)?.attrIsUpdate &&
dataDetail.oligarchReject === null &&
dataDetail.statusMain === 'WAITTING' &&
rowsApprover &&
rowsApprover.approvers &&
rowsApprover.approvers[0]?.profileId == keycloakId &&
rowsApprover.approvers[0]?.approveStatus == 'PENDING' &&
approveCheck
((group === '1.1' && approveStep === 'st3') ||
(group !== '1.1' && approveStep === 'st4'))
"
class="q-gutter-x-sm"
>
<q-btn
outline
@ -765,7 +669,7 @@ onMounted(async () => {
dense
icon-right="close"
class="q-px-sm"
label="ยับยั้ง"
label="ไม่อนุญาต"
@click="popUp('passNot', 'oligarch')"
/>
</div>
@ -792,44 +696,55 @@ onMounted(async () => {
rowsApprover &&
rowsApprover.approvers &&
rowsApprover.approvers[0]?.approveStatus
? convertStatusText(rowsApprover?.approvers[0].approveStatus)
? convertStatusText(
rowsApprover?.approvers[0].approveStatus,
"ไม่อนุญาต"
)
: "-"
}}
</div>
</div>
<!-- <div class="col-xs-6 row items-start">
<div class="col-12 text-top">นสดทายทบย</div>
<div class="col-12 text-detail">
{{
dataDetail.oligarchRejectDate !== null
? date2Thai(dataDetail.oligarchRejectDate)
: "-"
}}
</div>
</div> -->
<div class="col-xs-12 row items-start">
<div class="col-12 text-top">ความคดเหนและเหตผล</div>
<div class="col-12 text-detail">
{{
dataDetail.oligarchReject
? dataDetail.oligarchApproveReason
: dataDetail.oligarchApproveReason
rowsApprover &&
rowsApprover.approvers &&
rowsApprover.approvers[0]?.comment
? rowsApprover?.approvers[0].comment
: "-"
}}
</div>
</div>
</div>
</div>
</q-card>
<!-- งไปพจารณา -->
<q-card
bordered
class="row col-12 text-dark q-mt-sm q-pa-sm"
v-if="statusCheck == 'WAITTING' && (isOfficer || isStaff)"
v-if="
!checkRoutePermisson &&
((isStaff && group === '1.1' && approveStep === 'st1') ||
(isStaff && group !== '1.1' && approveStep === 'st1') ||
(isOfficer && group !== '1.1' && approveStep === 'st3'))
"
>
<q-btn
@click="onSend"
:disable="
rowsApprover?.approvers.length == 0 ||
rowsApprover?.commanders.length == 0
(group === '1.1' &&
(rowsApprover?.approvers.length == 0 ||
rowsApprover?.commanders.length == 0)) ||
(group !== '1.1 ' &&
rowsApprover?.commanders.length == 0 &&
approveStep === 'st1') ||
(group !== '1.1 ' &&
rowsApprover?.approvers.length == 0 &&
approveStep === 'st3')
"
label="ส่งไปพิจารณา"
color="secondary"
@ -837,6 +752,7 @@ onMounted(async () => {
><q-tooltip>คลกเพอสงไปพจารณา</q-tooltip></q-btn
>
</q-card>
<!-- แกไขขอมลเพอลงบญชแนบทาย -->
<q-card bordered class="row col-12 text-dark q-mt-sm">
<q-form
@ -852,7 +768,14 @@ onMounted(async () => {
</div>
<q-space />
<!-- && workflowRef?.permission.isUpdate -->
<div v-if="!checkRoutePermisson">
<div
v-if="
!checkRoutePermisson &&
(dataDetail.status === 'APPROVE' ||
dataDetail.status === 'REJECT') &&
((isStaff && group === '1.1') || (isOfficer && group !== '1.1'))
"
>
<div class="q-gutter-sm" v-if="!edit">
<q-btn
outline
@ -956,24 +879,7 @@ onMounted(async () => {
/>
</div>
</div>
<!-- <div class="col-xs-6 col-sm-3 row">
<div class="col-12">
<q-input
v-model="salary"
:outlined="edit"
dense
:readonly="!edit"
:borderless="!edit"
hide-bottom-space
:label="`${'เงินเดือน'}`"
:rules="[(val:number) => !!val || `${'กรุณากรอกเงินเดือน'}`]"
lazy-rules
:class="getClass(edit)"
mask="###,###,###,###"
reverse-fill-mask
/>
</div>
</div> -->
<div class="col-12"><q-separator /></div>
<div class="col-xs-4 row">
<div class="col-12">
@ -1076,13 +982,6 @@ onMounted(async () => {
</div>
</q-form>
</q-card>
<!-- <WorkFlow
ref="workflowRef"
v-model:is-check-data="isCheckData"
:id="id"
sys-name="RETIREMENT_CANCEL"
/> -->
</div>
<q-dialog v-model="modal" persistent>
@ -1090,7 +989,7 @@ onMounted(async () => {
<q-form greedy @submit.prevent @validation-success="onSubmit">
<DialogHeader
:tittle="`${
actionPass ? 'อนุญาตยกเลิกการลาออก' : 'ยับยั้งยกเลิกการลาออก'
actionPass ? 'อนุญาตยกเลิกการลาออก' : 'ไม่อนุญาตยกเลิกการลาออก'
}`"
:close="closeModal"
/>
@ -1102,7 +1001,7 @@ onMounted(async () => {
dense
outlined
lazy-rules
:rules="[(val:string) => !!val || 'กรุณากรอกความคิดเห็น/เหตุผล']"
:rules=" !actionPass ? [(val:string) => !!val || 'กรุณากรอกความคิดเห็น/เหตุผล'] :[]"
v-model="reasonReign"
:label="`${'กรอกความคิดเห็น/เหตุผล'}`"
type="textarea"
@ -1111,12 +1010,11 @@ onMounted(async () => {
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white text-teal">
<q-card-actions align="right">
<q-btn label="บันทึก" color="secondary" type="submit"
><q-tooltip>นทกขอม</q-tooltip></q-btn
>
</q-card-actions>
<!-- <DialogFooter :editvisible="true" :save="conditionPopup" /> -->
</q-form>
</q-card>
</q-dialog>

View file

@ -6,7 +6,11 @@ import { useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/modules/06_retirement/store/resignMain";
import { useRetirementDataStore } from "@/modules/06_retirement/store/Main";
import { checkPermission } from "@/utils/permissions";
import {
checkPermission,
checkPermissionList,
checkPermissionCreate,
} from "@/utils/permissions";
import http from "@/plugins/http";
import config from "@/app.config";
@ -131,7 +135,9 @@ const columns = ref<QTableProps["columns"]>([
sortable: true,
field: "status",
format(val, row) {
return statusText(row.status);
return stroeResign.mainTabs === "1"
? statusText(row.status)
: statusText(row.status, "อนุญาต");
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
@ -290,7 +296,11 @@ onMounted(async () => {
</template>
</q-select>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
v-if="
checkPermission($route)?.attrIsUpdate &&
checkPermissionList(['COMMAND']) &&
checkPermissionCreate('COMMAND')
"
@click="openModalOrder"
flat
round
@ -309,7 +319,7 @@ onMounted(async () => {
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
@ -367,7 +377,11 @@ onMounted(async () => {
<q-btn
v-if="
checkPermission($route)?.attrIsGet &&
checkPermission($route)?.attrIsUpdate
checkPermission($route)?.attrIsUpdate &&
(props.row.status === 'WAITTING' ||
props.row.status === 'PENDING' ||
props.row.status === 'APPROVE' ||
props.row.status === 'REJECT')
"
flat
dense

View file

@ -119,7 +119,7 @@ const columns = ref<QTableProps["columns"]>([
field: "organizationPositionOld",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
// copy
// format(val, row) {
// return `${row.organizationPositionOld.replace(/\n/g, " ")}`;
@ -145,7 +145,9 @@ const columns = ref<QTableProps["columns"]>([
sortable: true,
field: "status",
format(val, row) {
return statusText(row.status);
return props.mainTabs === "1"
? statusText(row.status)
: statusText(row.status, "อนุญาต");
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
@ -220,7 +222,7 @@ watch(
dense
:model-value="filterKeyword"
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -8,8 +8,8 @@ import http from "@/plugins/http";
import config from "@/app.config";
import genReport from "@/plugins/genreport";
import { useCounterMixin } from "@/stores/mixin";
import { checkPermission } from "@/utils/permissions";
import { useRetirementDataStore } from "@/modules/06_retirement/store/Main";
import { useRoleWorkflowDataStore } from "@/stores/roleWorkflow";
import type {
TypeFile,
@ -27,7 +27,6 @@ import type {
import DialogHeader from "@/components/DialogHeader.vue";
import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue";
import CardProfile from "@/components/CardProfile.vue";
import WorkFlow from "@/components/Workflow/Main.vue";
import DialogAddCommander from "@/modules/06_retirement/components/DialogAddCommander.vue";
/** Use */
@ -35,6 +34,7 @@ const $q = useQuasar();
const route = useRoute();
const router = useRouter();
const store = useRetirementDataStore();
const { fetchDataCheckIsoffice } = useRoleWorkflowDataStore();
const { convertStatusText } = store;
const checkRoutePermisson = ref<boolean>(route.name == "resignDetailbyidEMP");
const mixin = useCounterMixin();
@ -54,14 +54,8 @@ const modalPersonal = ref<boolean>(false);
const personId = ref<string>("");
const roleUser = ref<string>("");
const dataProfile = ref<DataProfile>();
const approveStep = ref<string>("");
const approveCheck = computed(() => {
return (
rowsApprover.value?.commanders?.every(
(commander) => commander.approveStatus === "APPROVE"
) ?? false
);
});
const idCheck = computed(() => {
if (
typeAdd.value == "COMMANDER" &&
@ -82,29 +76,6 @@ const idCheck = computed(() => {
}
});
const approvePendingCheck = computed(() => {
const commanders = rowsApprover.value?.commanders || [];
const index = commanders.findIndex((c) => c.profileId === keycloakId.value);
if (index === -1) {
return false;
}
const currentCommander = commanders[index];
if (currentCommander.approveStatus !== "PENDING") {
return false;
}
if (index === 0) {
return true;
}
const previousApproved = commanders
.slice(0, index)
.every((c) => c.approveStatus === "APPROVE");
return previousApproved;
});
const isOfficer = ref<boolean>(false);
const isStaff = ref<boolean>(false);
const profileType = ref<string>("");
@ -169,6 +140,9 @@ const columnsCommanders = ref<QTableProps["columns"]>([
align: "left",
label: "วันสุดท้ายที่ยับยั้ง",
field: "rejectDate",
format(val, row) {
return date2Thai(val);
},
sortable: true,
headerStyle: "font-size: 14px",
style: "font-size: 14px",
@ -206,7 +180,6 @@ const dataDetail = ref<any>({
reasonResign: "",
});
const workflowRef = ref<any>(null);
const organizationPositionOld = ref<string>("");
const positionTypeOld = ref<string>("");
const positionLevelOld = ref<string>("");
@ -223,20 +196,6 @@ const actionPass = ref<boolean>(false);
const reasonReign = ref<string>("");
const dateBreak = ref<Date | null>(null);
const isCheckData = computed(() => {
if (
organizationPositionOld.value !== "" &&
positionTypeOld.value !== "" &&
positionLevelOld.value !== "" &&
posNo.value !== "" &&
date.value !== null &&
dataDetail.value.commanderReject !== null &&
dataDetail.value.oligarchReject !== null
) {
return true;
} else return false;
});
/** คอลัมน์ */
const rows = ref<TypeFile[]>([]);
const columns = ref<QTableProps["columns"]>([
@ -269,13 +228,10 @@ const columns = ref<QTableProps["columns"]>([
},
]);
/**เปิด-ปิด modal */
/**ฟังก์ชันปิด popup อนุญาตการลาออก,ยับยั้งการลาออก*/
function closeModal() {
modal.value = false;
}
function openModal() {
modal.value = true;
}
const file = ref<any>(null);
const fileList = ref<FileList[]>([]);
@ -291,6 +247,7 @@ const rowsFileDownload = ref<rowFile[]>([
},
]);
/** ฟังก์ชันคำนวนวันที่ขอลาออกจากราชการ*/
function diffDate() {
if (date.value !== null && dateLeave.value !== null) {
const time = dateLeave.value.getTime() - date.value.getTime();
@ -304,9 +261,11 @@ function diffDate() {
return false;
}
/** นำข้อมูลมาจาก API*/
/**
* งกนดงขอมลรายละเอยดการลาออก
* @param id รายการลาออก
*/
async function fetchData(id: string) {
showLoader();
await http
.get(config.API.resingByidEMP(id))
.then(async (res) => {
@ -339,7 +298,7 @@ async function fetchData(id: string) {
isNoDebt.value = data.isNoDebt;
isNoBurden.value = data.isNoBurden;
isDiscipline.value = data.isDiscipline;
approveStep.value = data.approveStep;
statusCheck.value = data.status;
profileType.value = data.profileType;
keycloakUserId.value = data.keycloakUserId;
@ -350,32 +309,40 @@ async function fetchData(id: string) {
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**Pop up */
/**
* งกนเป popup อนญาต,บย
* @param action อนญาต, บย
* @param type งคบบญชา, อำนาจ
*/
function popUp(action: "pass" | "passNot", type: string) {
reasonReign.value = "";
dateBreak.value = null;
actionPass.value = action === "pass";
roleUser.value = type;
openModal();
modal.value = true;
}
//pop up
/** ฟังก์ชันบันทึกผลการพิจารณา*/
function onSubmit() {
if (actionPass.value) {
confirmpopUp();
} else {
rejectpopUp();
if (roleUser.value === "commander" && actionPass.value) {
confirmpopUp("/comander");
} else if (roleUser.value === "commander" && !actionPass.value) {
rejectpopUp("/comander");
} else if (roleUser.value === "oligarch" && actionPass.value) {
confirmpopUp("");
} else if (roleUser.value === "oligarch" && !actionPass.value) {
rejectpopUp("");
}
}
//pop up
async function confirmpopUp() {
/**
* งกนยนยนการอนญาตผลการพจารณา
* @param path ประเภทของผจารณา comander === 'บังคับบัญชา', '' === 'ผู้มีอำนาจ'
*/
async function confirmpopUp(path: string) {
dialogConfirm(
$q,
async () => {
@ -384,7 +351,15 @@ async function confirmpopUp() {
reason: reasonReign.value,
};
await http
.put(config.API.commanderApproveRetirement("-employee", id.value,'approve'), body)
.put(
config.API.commanderApproveRetirement(
"-employee",
id.value,
"approve",
path
),
body
)
.then(async () => {
await fetchData(id.value);
closeModal();
@ -402,8 +377,11 @@ async function confirmpopUp() {
);
}
//pop up
async function rejectpopUp() {
/**
งกนยนยนการยบยงผลการพจารณา
* @param path ประเภทของผจารณา comander === 'บังคับบัญชา', '' === 'ผู้มีอำนาจ'
*/
async function rejectpopUp(path: string) {
dialogConfirm(
$q,
async () => {
@ -413,7 +391,15 @@ async function rejectpopUp() {
date: dateBreak.value,
};
await http
.put(config.API.commanderApproveRetirement('-employee', id.value,'reject'), body)
.put(
config.API.commanderApproveRetirement(
"-employee",
id.value,
"reject",
path
),
body
)
.then(async () => {
await fetchData(id.value);
closeModal();
@ -431,9 +417,7 @@ async function rejectpopUp() {
);
}
/**
* กดยกเล
*/
/** ฟังก์ชันยกเลิกการแก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย*/
async function clickCancel() {
edit.value = false;
const data = dataDetail.value;
@ -454,17 +438,20 @@ async function clickCancel() {
isDiscipline.value = data.isDiscipline;
}
myForm.value?.resetValidation();
// await fetchData(id.value);
}
/**
* กดยกเล
*/
async function clickCancelConditions() {
await fetchData(id.value);
conditions.value = false;
}
/** Function บันทึก รายการตรวจสอบเงื่อนไขต่างๆ*/
/** ฟังก์ขันยกเลิกการแก้ไขเงื่อนไขต่างๆ*/
async function clickCancelConditions() {
const data = dataDetail.value;
if (data) {
isNoDebt.value = data.isNoDebt;
isNoBurden.value = data.isNoBurden;
isDiscipline.value = data.isDiscipline;
conditions.value = false;
}
}
/** ฟังก์ชันบันทึกรายการตรวจสอบเงื่อนไขต่างๆ*/
function onSubmitConditions() {
dialogConfirm($q, async () => {
showLoader();
@ -488,7 +475,7 @@ function onSubmitConditions() {
});
}
/** Function บันทึก ,แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย*/
/** ฟังก์ชันบันทึกข้อมูลเพื่อลงบัญชีแนบท้าย*/
function onSubmitAttached() {
dialogConfirm($q, () => {
const formData = new FormData();
@ -522,7 +509,7 @@ function onSubmitAttached() {
}
/**
* Function เพ Class เวลา Edit
* งก Class เวลา Edit
* @param val เมอเปนEdit จะเปลยน Class
*/
function getClass(val: boolean) {
@ -532,17 +519,11 @@ function getClass(val: boolean) {
};
}
/** แปลง StatusOrder */
function statusOrder(val: boolean) {
switch (val) {
case true:
return "ยับยั้ง";
case false:
return "อนุญาต";
}
}
//
/**
* งกนดาวนโหลดไฟล
* @param type นามสกลไฟล
* @param fileName อไฟลองการโหลด
*/
async function fileDownload(type: string, fileName: string) {
showLoader();
await http
@ -559,12 +540,16 @@ async function fileDownload(type: string, fileName: string) {
});
}
/**
* งกนอปเดท modal ของ popup ทะเบยนประว
* @param modal modal
*/
function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal;
}
/** ฟังก์ชันดึงข้อมูลไฟล์*/
async function fetchFile() {
showLoader();
await http
.get(config.API.file("พ้นจากราชการ", "หลักฐานลาออก", id.value))
.then(async (res) => {
@ -572,10 +557,10 @@ async function fetchFile() {
})
.catch((e) => {
messageError($q, e);
hideLoader();
});
}
/** ฟังก์ชันสร้าง Path ที่เก็บไฟล์*/
function uploadFiles() {
showLoader();
http
@ -603,6 +588,10 @@ function uploadFiles() {
});
}
/**
* งกนอปโหลดไฟล
* @param uploadUrl อยเกบไฟล
*/
async function uploadFileURL(uploadUrl: string) {
const Data = new FormData();
Data.append("file", file.value);
@ -626,6 +615,10 @@ async function uploadFileURL(uploadUrl: string) {
});
}
/**
* งกนโหลดไฟล
* @param fileName อไฟลองการโหลด
*/
async function downloadFiles(fileName: string) {
showLoader();
await http
@ -645,13 +638,13 @@ async function downloadFiles(fileName: string) {
}
/**
* ลบไฟล
* @param id id file
* งกลบไฟล
* @param fileName อไฟลองการลบ
*/
function removeFile(fileName: string) {
dialogRemove($q, () => {
dialogRemove($q, async () => {
showLoader();
http
await http
.delete(
config.API.fileByFile(
"พ้นจากราชการ",
@ -660,20 +653,25 @@ function removeFile(fileName: string) {
fileName
)
)
.then(() => {
.then(async () => {
setTimeout(async () => {
await fetchFile();
success($q, `ลบไฟล์สำเร็จ`);
hideLoader();
}, 1000);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
});
}
/**
* งกนแปลงเหตผลทลาออก
* @param val เหตผลทลาออก
*/
function convertStatus(val: string) {
if (/^[A-Za-z]+$/.test(val)) {
switch (val) {
@ -691,25 +689,27 @@ function convertStatus(val: string) {
} else return val;
}
/** เปิด POP UP */
/**
* งกนเป pop up เพมรายชอพจารณา
* @param type COMMANDER === งคบบญชา, APPROVER === อำนาจ
*/
function onAddPerson(type: string) {
modalAdd.value = true;
typeAdd.value = type;
}
/** ฟังก์ชันดึงข้อมูลสิทธ์ของผู้ใช่*/
async function checkOfficer() {
http
.get(config.API.checkIsofficer + `SYS_RESIGN_EMP`)
.then(async (res) => {
isOfficer.value = await res.data.result.isOfficer;
isStaff.value = await res.data.result.isStaff;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
try {
const data = await fetchDataCheckIsoffice("SYS_RESIGN_EMP");
isOfficer.value = data.isOfficer;
isStaff.value = data.isStaff;
} catch (err) {
messageError($q, err);
}
}
/** ฟังก์ชันยืนยันการส่งไปพิจารณา*/
function onSend() {
dialogConfirm(
$q,
@ -717,20 +717,23 @@ function onSend() {
showLoader();
http
.get(config.API.sendApproveRetirement("-employee", id.value))
.then(async (res) => {
.then(async () => {
await fetchData(id.value);
success($q, "ส่งไปพิจารณา");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
.finally(() => {
hideLoader();
});
},
"ยืนยันการส่งไปพิจารณา",
"ต้องการส่งไปพิจารณาใช่หรือไม่"
);
}
/** ฟังก์ชันดึงข้อมูลตำแหน่งจาก Keycloak*/
async function fetchKeycloakPosition() {
if (keycloakId.value == "") {
await http
@ -749,10 +752,10 @@ async function fetchKeycloakPosition() {
onMounted(async () => {
showLoader();
await Promise.all([
await fetchData(id.value),
await fetchKeycloakPosition(),
fetchData(id.value),
fetchKeycloakPosition(),
fetchFile(),
await checkOfficer(),
checkOfficer(),
]).finally(() => {
hideLoader();
});
@ -784,39 +787,6 @@ onMounted(async () => {
<q-card bordered class="row col-12 text-dark q-mt-sm">
<div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
<div class="q-pl-sm text-weight-bold text-dark">อมลการลาออก</div>
<!-- <q-space />
<div
class="q-gutter-x-sm"
v-if="
(roleUser === 'officer' && dataDetail.officerReject === null) ||
(roleUser === 'commander' &&
dataDetail.commanderReject === null &&
dataDetail.officerReject !== null) ||
(roleUser === 'oligarch' &&
dataDetail.oligarchReject === null &&
dataDetail.commanderReject !== null &&
dataDetail.officerReject !== null)
"
>
<q-btn
outline
color="primary"
dense
icon-right="check"
class="q-px-sm"
label="อนุญาต"
@click="popUp('pass')"
/>
<q-btn
outline
color="red"
dense
icon-right="close"
class="q-px-sm"
label="ยับยั้ง"
@click="popUp('passNot')"
/>
</div> -->
</div>
<div class="col-12"><q-separator /></div>
<div class="row col-12 q-pa-md">
@ -998,11 +968,7 @@ onMounted(async () => {
<q-space />
<div
v-if="
!checkRoutePermisson &&
isStaff &&
dataDetail.statusMain === 'WAITTING'
"
v-if="!checkRoutePermisson && isStaff && approveStep === 'st1'"
>
<div v-if="!conditions">
<q-btn
@ -1164,51 +1130,6 @@ onMounted(async () => {
</div>
</q-card>
<!-- ผลการพจารณาของการเจาหนาทของหนวยงาน -->
<!-- <q-card bordered class="row col-12 text-dark q-mt-sm">
<div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
<div class="q-pl-sm text-weight-bold text-dark">
ผลการพจารณาของการเจาหนาทของหนวยงาน
</div>
</div>
<div class="col-12"><q-separator /></div>
<div class="row col-12 q-pa-md">
<div class="col-12 row bg-white q-col-gutter-md">
<div class="col-xs-6 row items-start">
<div class="col-12 text-top">สถานะ</div>
<div class="col-12 text-detail">
{{
dataDetail.officerReject !== null
? statusOrder(dataDetail.officerReject)
: "-"
}}
</div>
</div>
<div class="col-xs-6 row items-start">
<div class="col-12 text-top">นสดทายทบย</div>
<div class="col-12 text-detail">
{{
dataDetail.officerRejectDate !== null
? date2Thai(dataDetail.officerRejectDate)
: "-"
}}
</div>
</div>
<div class="col-xs-12 row items-start">
<div class="col-12 text-top">ความคดเหนและเหตผล</div>
<div class="col-12 text-detail">
{{
dataDetail.officerReject
? dataDetail.officerRejectReason
: dataDetail.officerApproveReason
}}
</div>
</div>
</div>
</div>
</q-card> -->
<!-- ผลการพจารณาของผงคบบญชา -->
<q-card bordered class="row col-12 text-dark q-mt-sm">
<div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
@ -1216,7 +1137,7 @@ onMounted(async () => {
ผลการพจารณาของผงคบบญชา
</div>
<q-btn
v-if="statusCheck == 'WAITTING' && (isOfficer || isStaff)"
v-if="!checkRoutePermisson && isStaff && approveStep === 'st1'"
flat
round
icon="add"
@ -1229,33 +1150,6 @@ onMounted(async () => {
</q-btn>
<q-space />
<!-- <div
class="q-gutter-x-sm"
v-if="
isDirector &&
dataDetail.commanderReject === null &&
dataDetail.statusMain === 'WAITTING'
"
>
<q-btn
outline
color="primary"
dense
icon-right="check"
class="q-px-sm"
label="อนุญาต"
@click="popUp('pass', 'commander')"
/>
<q-btn
outline
color="red"
dense
icon-right="close"
class="q-px-sm"
label="ยับยั้ง"
@click="popUp('passNot', 'commander')"
/>
</div> -->
</div>
<div class="col-12"><q-separator /></div>
@ -1286,25 +1180,19 @@ onMounted(async () => {
</div>
<div v-else-if="col.name == 'comment'">
<div
class="q-gutter-x-xs"
v-if="
props.row.approveStatus == 'PENDING' &&
props.row.comment == ''
props.row.comment == '' &&
approveStep === 'st2'
"
>
<q-btn
:disable="
statusCheck == 'NEW' ||
!approvePendingCheck ||
(props.row.profileId !== keycloakId &&
checkPermission($route)?.attrIsUpdate)
"
:outline="
props.row.profileId !== keycloakId ||
statusCheck == 'NEW' ||
!approvePendingCheck
? false
: true
v-if="
props.row.profileId === keycloakId &&
approveStep === 'st2'
"
outline
dense
color="primary"
icon-right="check"
@ -1312,20 +1200,13 @@ onMounted(async () => {
label="อนุญาต"
@click="popUp('pass', 'commander')"
/>
<q-btn
:disable="
statusCheck == 'NEW' ||
!approvePendingCheck ||
(props.row.profileId !== keycloakId &&
checkPermission($route)?.attrIsUpdate)
"
:outline="
props.row.profileId !== keycloakId ||
statusCheck == 'NEW' ||
!approvePendingCheck
? false
: true
v-if="
props.row.profileId === keycloakId &&
approveStep === 'st2'
"
outline
color="red"
dense
icon-right="close"
@ -1334,6 +1215,7 @@ onMounted(async () => {
@click="popUp('passNot', 'commander')"
/>
</div>
<div v-else>
{{ props.row.comment ? props.row.comment : "-" }}
</div>
@ -1362,7 +1244,7 @@ onMounted(async () => {
ผลการพจารณาของผอำนาจ
</div>
<q-btn
v-if="statusCheck == 'WAITTING' && (isOfficer || isStaff)"
v-if="!checkRoutePermisson && isStaff && approveStep === 'st1'"
flat
round
icon="add"
@ -1374,17 +1256,15 @@ onMounted(async () => {
<q-tooltip>เพมรายชอผอำนาจ</q-tooltip>
</q-btn>
<q-space />
<div
class="q-gutter-x-sm"
v-if="
checkPermission($route)?.attrIsUpdate &&
dataDetail.oligarchReject === null &&
dataDetail.statusMain === 'WAITTING' &&
rowsApprover &&
rowsApprover.approvers &&
rowsApprover.approvers[0]?.profileId == keycloakId &&
rowsApprover.approvers[0]?.approveStatus == 'PENDING' &&
approveCheck
approveStep === 'st3'
"
>
<q-btn
@ -1438,8 +1318,10 @@ onMounted(async () => {
<div class="col-12 text-top">นสดทายทบย</div>
<div class="col-12 text-detail">
{{
dataDetail.oligarchRejectDate !== null
? date2Thai(dataDetail.oligarchRejectDate)
rowsApprover &&
rowsApprover.approvers &&
rowsApprover.approvers[0]?.rejectDate
? date2Thai(rowsApprover?.approvers[0].rejectDate)
: "-"
}}
</div>
@ -1448,19 +1330,23 @@ onMounted(async () => {
<div class="col-12 text-top">ความคดเหนและเหตผล</div>
<div class="col-12 text-detail">
{{
dataDetail.oligarchReject
? dataDetail.oligarchRejectReason
: dataDetail.oligarchApproveReason
rowsApprover &&
rowsApprover.approvers &&
rowsApprover.approvers[0]?.comment
? rowsApprover?.approvers[0].comment
: "-"
}}
</div>
</div>
</div>
</div>
</q-card>
<!-- งไปพจารณา -->
<q-card
bordered
class="row col-12 text-dark q-mt-sm q-pa-sm"
v-if="statusCheck == 'WAITTING' && (isOfficer || isStaff)"
v-if="!checkRoutePermisson && isStaff && approveStep === 'st1'"
>
<q-btn
@click="onSend"
@ -1474,6 +1360,7 @@ onMounted(async () => {
><q-tooltip>คลกเพอสงไปพจารณา</q-tooltip></q-btn
>
</q-card>
<!-- แกไขขอมลเพอลงบญชแนบทาย -->
<q-card bordered class="row col-12 text-dark q-mt-sm">
<q-form
@ -1492,8 +1379,9 @@ onMounted(async () => {
<div
v-if="
!checkRoutePermisson &&
isStaff &&
dataDetail.statusMain === 'WAITTING'
(dataDetail.statusMain === 'APPROVE' ||
dataDetail.statusMain === 'REJECT') &&
isStaff
"
>
<div class="q-gutter-sm" v-if="!edit">
@ -1599,24 +1487,7 @@ onMounted(async () => {
/>
</div>
</div>
<!-- <div class="col-xs-6 col-sm-3 row">
<div class="col-12">
<q-input
v-model="salary"
:outlined="edit"
dense
:readonly="!edit"
:borderless="!edit"
hide-bottom-space
:label="`${'เงินเดือน'}`"
:rules="[(val:number) => !!val || `${'กรุณากรอกเงินเดือน'}`]"
lazy-rules
:class="getClass(edit)"
mask="###,###,###,###"
reverse-fill-mask
/>
</div>
</div> -->
<div class="col-12"><q-separator /></div>
<div class="col-xs-4 row">
<div class="col-12">
@ -1718,15 +1589,9 @@ onMounted(async () => {
</div>
</q-form>
</q-card>
<!-- <WorkFlow
ref="workflowRef"
v-model:is-check-data="isCheckData"
:id="id"
sys-name="SYS_RESIGN"
/> -->
</div>
<!-- popup อนญาตการลาออก,บยงการลาออก -->
<q-dialog v-model="modal" persistent>
<q-card style="width: 800px">
<q-form greedy @submit.prevent @validation-success="onSubmit">
@ -1742,7 +1607,7 @@ onMounted(async () => {
dense
outlined
lazy-rules
:rules="[(val:string) => !!val || 'กรุณากรอกความคิดเห็น/เหตุผล']"
:rules=" !actionPass ? [(val:string) => !!val || 'กรุณากรอกความคิดเห็น/เหตุผล'] :[]"
v-model="reasonReign"
:label="`${'กรอกความคิดเห็น/เหตุผล'}`"
type="textarea"
@ -1812,7 +1677,7 @@ onMounted(async () => {
<DialogAddCommander
v-model:modal="modalAdd"
:type="typeAdd"
:profileType="'officer'"
:profileType="'-employee'"
:get-data="fetchData"
:id-check="idCheck"
:keycloak-user-id="keycloakUserId"

View file

@ -1,22 +1,16 @@
<script setup lang="ts">
import { ref, onMounted, computed } from "vue";
import axios from "axios";
import { useRouter, useRoute } from "vue-router";
import { useQuasar, QForm } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import genReport from "@/plugins/genreport";
import { useCounterMixin } from "@/stores/mixin";
import { checkPermission } from "@/utils/permissions";
import DialogHeader from "@/components/DialogHeader.vue";
import { useRetirementDataStore } from "@/modules/06_retirement/store/Main";
import { useRoleWorkflowDataStore } from "@/stores/roleWorkflow";
import type {
TypeFile,
rowFile,
FileList,
} from "@/modules/06_retirement/interface/response/Main";
import type { QTableProps } from "quasar";
import type { DataProfile } from "@/modules/05_placement/interface/index/Main";
import type {
@ -25,15 +19,14 @@ import type {
} from "@/modules/06_retirement/interface/response/Main";
import DialogAddCommander from "@/modules/06_retirement/components/DialogAddCommander.vue";
import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue";
import CardProfile from "@/components/CardProfile.vue";
import WorkFlow from "@/components/Workflow/Main.vue";
/** Use */
const $q = useQuasar();
const route = useRoute();
const router = useRouter();
const store = useRetirementDataStore();
const { fetchDataCheckIsoffice } = useRoleWorkflowDataStore();
const { convertStatusText } = store;
const checkRoutePermisson = ref<boolean>(route.name == "resignDetailRejectEMP");
const mixin = useCounterMixin();
@ -43,22 +36,14 @@ const {
showLoader,
hideLoader,
success,
dialogConfirm,
dialogRemove,
} = mixin;
/** ตัวแปร */
const roleUser = ref<string>("");
const dataProfile = ref<DataProfile>();
const approveStep = ref<string>("");
const approveCheck = computed(() => {
return (
rowsApprover.value?.commanders?.every(
(commander) => commander.approveStatus === "APPROVE"
) ?? false
);
});
const idCheck = computed(() => {
if (
typeAdd.value == "COMMANDER" &&
@ -79,29 +64,6 @@ const idCheck = computed(() => {
}
});
const approvePendingCheck = computed(() => {
const commanders = rowsApprover.value?.commanders || [];
const index = commanders.findIndex((c) => c.profileId === keycloakId.value);
if (index === -1) {
return false;
}
const currentCommander = commanders[index];
if (currentCommander.approveStatus !== "PENDING") {
return false;
}
if (index === 0) {
return true;
}
const previousApproved = commanders
.slice(0, index)
.every((c) => c.approveStatus === "APPROVE");
return previousApproved;
});
const isOfficer = ref<boolean>(false);
const profileType = ref<string>("");
const keycloakUserId = ref<string>("");
@ -159,15 +121,6 @@ const columnsCommanders = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "rejectDate",
align: "left",
label: "วันสุดท้ายที่ยับยั้ง",
field: "rejectDate",
sortable: true,
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const id = ref<string>(route.params.id.toString());
@ -197,7 +150,6 @@ const dataDetail = ref<any>({
statusMain: "",
});
const workflowRef = ref<any>(null);
const organizationPositionOld = ref<string>("");
const positionTypeOld = ref<string>("");
const positionLevelOld = ref<string>("");
@ -214,32 +166,16 @@ const actionPass = ref<boolean>(false);
const reasonReign = ref<string>("");
const dateBreak = ref<Date | null>(null);
const isCheckData = computed(() => {
if (
organizationPositionOld.value !== "" &&
positionTypeOld.value !== "" &&
positionLevelOld.value !== "" &&
posNo.value !== "" &&
date.value !== null &&
dataDetail.value.commanderReject !== null &&
dataDetail.value.oligarchReject !== null
) {
return true;
} else return false;
});
/**เปิด-ปิด modal */
function closeModal() {
modal.value = false;
}
function openModal() {
modal.value = true;
}
const isNoDebt = ref<boolean>(false);
const isNoBurden = ref<boolean>(false);
const isDiscipline = ref<boolean>(false);
/** ฟังก์ชันคำนวนวันที่ขอลาออกจากราชการ*/
function diffDate() {
if (date.value !== null && dateLeave.value !== null) {
const time = dateLeave.value.getTime() - date.value.getTime();
@ -253,9 +189,11 @@ function diffDate() {
return false;
}
/** นำข้อมูลมาจาก API*/
/**
* งกนดงขอมลรายละเอยดการยกเลกลาออก
* @param id รายการยกเลกลาออก
*/
async function fetchData(id: string) {
showLoader();
await http
.get(config.API.listResignEMP() + `/cancel/${id}`)
.then(async (res) => {
@ -272,43 +210,55 @@ async function fetchData(id: string) {
dateLeave.value = data.activeDate ? new Date(data.activeDate) : null;
reason.value = data.reason ?? "";
location.value = data.location ?? "";
approveStep.value = data.approveStep ?? "";
status.value = data.status ?? "";
remarkHorizontal.value = data.remarkHorizontal ?? "-";
isNoDebt.value = data.isNoDebt;
statusCheck.value = data.status;
isNoBurden.value = data.isNoBurden;
isDiscipline.value = data.isDiscipline;
profileType.value = data.profileType;
keycloakUserId.value = data.keycloakUserId;
rowsApprover.value = {
commanders: data.commanders,
approvers: data.approvers,
};
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**Pop up */
/**
* งกนเป popup อนญาต,ไมอนญาต
* @param action อนญาต, ไมอนญาต
* @param type งคบบญชา, อำนาจ
*/
function popUp(action: "pass" | "passNot", type: string) {
reasonReign.value = "";
dateBreak.value = null;
actionPass.value = action === "pass";
roleUser.value = type;
openModal();
modal.value = true;
}
//pop up
/** ฟังก์ชันยืนยันการอนุญาตผลการพิจารณา*/
function onSubmit() {
dialogConfirm($q, async () => {
showLoader();
const body = {
reason: reasonReign.value,
reject: !actionPass.value,
Date: new Date(),
};
const action = actionPass.value ? "approve" : "reject";
const endpoint =
roleUser.value === "commander"
? config.API.comanderCancelResign("-employee", action, id.value)
: config.API.approverCancelResign("-employee", action, id.value);
await http
.put(
config.API.resignRejectEMP(`${roleUser.value}-cancel`, id.value),
body
)
.put(endpoint, body)
.then(async () => {
await fetchData(id.value);
closeModal();
@ -323,7 +273,7 @@ function onSubmit() {
});
}
/** กดยกเลิก*/
/** ฟังก์ชันยกเลิกการแก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย*/
async function clickCancel() {
edit.value = false;
const data = dataDetail.value;
@ -346,7 +296,7 @@ async function clickCancel() {
myForm.value?.resetValidation();
}
/** Function บันทึก ,แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย*/
/** ฟังก์ชันบันทึกข้อมูลเพื่อลงบัญชีแนบท้าย*/
function onSubmitAttached() {
dialogConfirm($q, () => {
const formData = new FormData();
@ -381,7 +331,7 @@ function onSubmitAttached() {
}
/**
* Function เพ Class เวลา Edit
* งก Class เวลา Edit
* @param val เมอเปนEdit จะเปลยน Class
*/
function getClass(val: boolean) {
@ -391,71 +341,53 @@ function getClass(val: boolean) {
};
}
/** แปลง StatusOrder */
function statusOrder(val: boolean) {
switch (val) {
case true:
return "ยับยั้ง";
case false:
return "อนุญาต";
}
}
const isDirector = ref<boolean>(false);
const isStaff = ref<boolean>(false);
function fetchCheckIsofficer() {
http
.get(config.API.workflowKeycloakSystem("RETIREMENT_CANCEL_EMP"))
.then((res) => {
isStaff.value = res.data.result.isStaff;
isDirector.value = res.data.result.isDirector;
})
.catch((err) => {
messageError($q, err);
});
}
/** เปิด POP UP */
/**
* งกนเป pop up เพมรายชอพจารณา
* @param type COMMANDER === งคบบญชา, APPROVER === อำนาจ
*/
function onAddPerson(type: string) {
modalAdd.value = true;
typeAdd.value = type;
}
/** ฟังก์ชันดึงข้อมูลสิทธ์ของผู้ใช่*/
async function checkOfficer() {
http
.get(config.API.checkIsofficer + `SYS_RESIGN_EMP`)
.then(async (res) => {
isOfficer.value = await res.data.result.isOfficer;
isStaff.value = await res.data.result.isStaff;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
try {
const data = await fetchDataCheckIsoffice("SYS_RESIGN_EMP");
isOfficer.value = data.isOfficer;
isStaff.value = data.isStaff;
} catch (err) {
messageError($q, err);
}
}
/** ฟังก์ชันยืนยันการส่งไปพิจารณา*/
function onSend() {
dialogConfirm(
$q,
() => {
async () => {
showLoader();
http
.get(config.API.sendApproveRetirement("-employee", id.value))
.then(async (res) => {
await http
.get(config.API.officerCancelResign("-employee", id.value))
.then(async () => {
await fetchData(id.value);
success($q, "ส่งไปพิจารณา");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
.finally(() => {
hideLoader();
});
},
"ยืนยันการส่งไปพิจารณา",
"ต้องการส่งไปพิจารณาใช่หรือไม่"
);
}
/** ฟังก์ชันดึงข้อมูลตำแหน่งจาก Keycloak*/
async function fetchKeycloakPosition() {
if (keycloakId.value == "") {
await http
@ -472,7 +404,14 @@ async function fetchKeycloakPosition() {
/** Hook */
onMounted(async () => {
await Promise.all([await fetchKeycloakPosition(),fetchData(id.value), checkOfficer()]);
showLoader();
await Promise.all([
fetchData(id.value),
fetchKeycloakPosition(),
checkOfficer(),
]).finally(() => {
hideLoader();
});
});
</script>
@ -490,7 +429,9 @@ onMounted(async () => {
@click="router.push('/retirement/resign-employee')"
/>
รายละเอยดการยกเลกลาออก
{{ dataDetail.prefix.dataDetail.firstName + " " + dataDetail.lastName }}
{{
dataDetail.prefix + dataDetail.firstName + " " + dataDetail.lastName
}}
</div>
<CardProfile :type="'employee'" :data="dataProfile as DataProfile" />
@ -499,39 +440,6 @@ onMounted(async () => {
<q-card bordered class="row col-12 text-dark q-mt-sm">
<div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
<div class="q-pl-sm text-weight-bold text-dark">อมลการลาออก</div>
<!-- <q-space />
<div
class="q-gutter-x-sm"
v-if="
(roleUser === 'officer' && dataDetail.officerReject === null) ||
(roleUser === 'commander' &&
dataDetail.commanderReject === null &&
dataDetail.officerReject !== null) ||
(roleUser === 'oligarch' &&
dataDetail.oligarchReject === null &&
dataDetail.commanderReject !== null &&
dataDetail.officerReject !== null)
"
>
<q-btn
outline
color="primary"
dense
icon-right="check"
class="q-px-sm"
label="อนุญาต"
@click="popUp('pass')"
/>
<q-btn
outline
color="red"
dense
icon-right="close"
class="q-px-sm"
label="ยับยั้ง"
@click="popUp('passNot')"
/>
</div> -->
</div>
<div class="col-12"><q-separator /></div>
<div class="row col-12 q-pa-md">
@ -579,6 +487,15 @@ onMounted(async () => {
</div>
</div>
</div>
<div class="col-12 row items-start">
<div class="col-12">
<div class="col-12 text-top">เหตผลการขอยกเล</div>
<div class="col-12 text-detail text-red">
{{ dataDetail.cancelReason }}
</div>
</div>
</div>
</div>
</div>
</q-card>
@ -590,7 +507,7 @@ onMounted(async () => {
ผลการพจารณาของผงคบบญชา
</div>
<q-btn
v-if="statusCheck == 'WAITTING' && (isOfficer || isStaff)"
v-if="!checkRoutePermisson && isStaff && approveStep === 'st1'"
flat
round
icon="add"
@ -602,33 +519,6 @@ onMounted(async () => {
<q-tooltip>เพมรายชอผงคบบญชา</q-tooltip>
</q-btn>
<q-space />
<!-- <div
class="q-gutter-x-sm"
v-if="
isDirector &&
dataDetail.commanderReject === null &&
dataDetail.statusMain === 'WAITTING'
"
>
<q-btn
outline
color="primary"
dense
icon-right="check"
class="q-px-sm"
label="อนุญาต"
@click="popUp('pass', 'commander')"
/>
<q-btn
outline
color="red"
dense
icon-right="close"
class="q-px-sm"
label="ยับยั้ง"
@click="popUp('passNot', 'commander')"
/>
</div> -->
</div>
<div class="col-12"><q-separator /></div>
@ -659,25 +549,19 @@ onMounted(async () => {
</div>
<div v-else-if="col.name == 'comment'">
<div
class="q-gutter-x-xs"
v-if="
props.row.approveStatus == 'PENDING' &&
props.row.comment == ''
props.row.comment == '' &&
approveStep === 'st2'
"
>
<q-btn
:disable="
statusCheck == 'NEW' ||
!approvePendingCheck ||
(props.row.profileId !== keycloakId &&
checkPermission($route)?.attrIsUpdate)
"
:outline="
props.row.profileId !== keycloakId ||
statusCheck == 'NEW' ||
!approvePendingCheck
? false
: true
v-if="
props.row.profileId === keycloakId &&
approveStep === 'st2'
"
outline
dense
color="primary"
icon-right="check"
@ -686,24 +570,16 @@ onMounted(async () => {
@click="popUp('pass', 'commander')"
/>
<q-btn
:disable="
statusCheck == 'NEW' ||
!approvePendingCheck ||
(props.row.profileId !== keycloakId &&
checkPermission($route)?.attrIsUpdate)
"
:outline="
props.row.profileId !== keycloakId ||
statusCheck == 'NEW' ||
!approvePendingCheck
? false
: true
v-if="
props.row.profileId === keycloakId &&
approveStep === 'st2'
"
outline
color="red"
dense
icon-right="close"
class="q-px-sm"
label="ยับยั้ง"
label="ไม่อนุญาต"
@click="popUp('passNot', 'commander')"
/>
</div>
@ -714,7 +590,7 @@ onMounted(async () => {
<div v-else-if="col.name == 'approveStatus'">
{{
props.row.approveStatus
? convertStatusText(props.row.approveStatus)
? convertStatusText(props.row.approveStatus, "ไม่อนุญาต")
: "-"
}}
</div>
@ -735,7 +611,8 @@ onMounted(async () => {
ผลการพจารณาของผอำนาจ
</div>
<q-btn
v-if="statusCheck == 'WAITTING' && (isOfficer || isStaff)"
q-btn
v-if="!checkRoutePermisson && isStaff && approveStep === 'st1'"
flat
round
icon="add"
@ -751,14 +628,11 @@ onMounted(async () => {
<div
class="q-gutter-x-sm"
v-if="
checkPermission($route)?.attrIsUpdate &&
dataDetail.oligarchReject === null &&
dataDetail.statusMain === 'WAITTING' &&
rowsApprover &&
rowsApprover.approvers &&
rowsApprover.approvers[0]?.profileId == keycloakId &&
rowsApprover.approvers[0]?.approveStatus == 'PENDING' &&
approveCheck
approveStep === 'st3'
"
>
<q-btn
@ -776,7 +650,7 @@ onMounted(async () => {
dense
icon-right="close"
class="q-px-sm"
label="ยับยั้ง"
label="ไม่อนุญาต"
@click="popUp('passNot', 'oligarch')"
/>
</div>
@ -803,38 +677,36 @@ onMounted(async () => {
rowsApprover &&
rowsApprover.approvers &&
rowsApprover.approvers[0]?.approveStatus
? convertStatusText(rowsApprover?.approvers[0].approveStatus)
? convertStatusText(
rowsApprover?.approvers[0].approveStatus,
"ไม่อนุญาต"
)
: "-"
}}
</div>
</div>
<!-- <div class="col-xs-6 row items-start">
<div class="col-12 text-top">นสดทายทบย</div>
<div class="col-12 text-detail">
{{
dataDetail.oligarchRejectDate !== null
? date2Thai(dataDetail.oligarchRejectDate)
: "-"
}}
</div>
</div> -->
<div class="col-xs-12 row items-start">
<div class="col-12 text-top">ความคดเหนและเหตผล</div>
<div class="col-12 text-detail">
{{
dataDetail.oligarchReject
? dataDetail.oligarchApproveReason
: dataDetail.oligarchApproveReason
rowsApprover &&
rowsApprover.approvers &&
rowsApprover.approvers[0]?.comment
? rowsApprover?.approvers[0].comment
: "-"
}}
</div>
</div>
</div>
</div>
</q-card>
<!-- งไปพจารณา -->
<q-card
bordered
class="row col-12 text-dark q-mt-sm q-pa-sm"
v-if="statusCheck == 'WAITTING' && (isOfficer || isStaff)"
v-if="!checkRoutePermisson && isStaff && approveStep === 'st1'"
>
<q-btn
@click="onSend"
@ -848,6 +720,7 @@ onMounted(async () => {
><q-tooltip>คลกเพอสงไปพจารณา</q-tooltip></q-btn
>
</q-card>
<!-- แกไขขอมลเพอลงบญชแนบทาย -->
<q-card bordered class="row col-12 text-dark q-mt-sm">
<q-form
@ -863,11 +736,13 @@ onMounted(async () => {
</div>
<q-space />
<!-- && workflowRef?.permission.isUpdate -->
<div
v-if="
!checkRoutePermisson &&
isStaff &&
dataDetail.statusMain === 'WAITTING'
(dataDetail.status === 'APPROVE' ||
dataDetail.status === 'REJECT') &&
isStaff
"
>
<div class="q-gutter-sm" v-if="!edit">
@ -1093,20 +968,15 @@ onMounted(async () => {
</div>
</q-form>
</q-card>
<!-- <WorkFlow
ref="workflowRef"
v-model:is-check-data="isCheckData"
:id="id"
sys-name="RETIREMENT_CANCEL"
/> -->
</div>
<!-- pooup อนญาตยกเลกการลาออก -->
<q-dialog v-model="modal" persistent>
<q-card style="width: 800px">
<q-form greedy @submit.prevent @validation-success="onSubmit">
<DialogHeader
:tittle="`${
actionPass ? 'อนุญาตยกเลิกการลาออก' : 'ยับยั้งยกเลิกการลาออก'
actionPass ? 'อนุญาตยกเลิกการลาออก' : 'ไม่อนุญาตยกเลิกการลาออก'
}`"
:close="closeModal"
/>
@ -1118,7 +988,7 @@ onMounted(async () => {
dense
outlined
lazy-rules
:rules="[(val:string) => !!val || 'กรุณากรอกความคิดเห็น/เหตุผล']"
:rules=" !actionPass ? [(val:string) => !!val || 'กรุณากรอกความคิดเห็น/เหตุผล'] :[]"
v-model="reasonReign"
:label="`${'กรอกความคิดเห็น/เหตุผล'}`"
type="textarea"
@ -1140,7 +1010,7 @@ onMounted(async () => {
<DialogAddCommander
v-model:modal="modalAdd"
:type="typeAdd"
:profileType="'officer'"
:profileType="'-employee'"
:get-data="fetchData"
:id-check="idCheck"
:keycloak-user-id="keycloakUserId"

View file

@ -6,7 +6,11 @@ import { useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/modules/06_retirement/store/resignMain";
import { useRetirementDataStore } from "@/modules/06_retirement/store/Main";
import { checkPermission } from "@/utils/permissions";
import {
checkPermission,
checkPermissionList,
checkPermissionCreate,
} from "@/utils/permissions";
import http from "@/plugins/http";
import config from "@/app.config";
@ -23,13 +27,8 @@ const stroeResign = useDataStore();
const { statusText } = stroe;
const router = useRouter();
const mixin = useCounterMixin();
const {
messageError,
date2Thai,
showLoader,
hideLoader,
onSearchDataTable
} = mixin;
const { messageError, date2Thai, showLoader, hideLoader, onSearchDataTable } =
mixin;
/** Table */
const rows = ref<ResponseItems[]>([]);
@ -130,7 +129,9 @@ const columns = ref<QTableProps["columns"]>([
sortable: true,
field: "status",
format(val, row) {
return statusText(row.status);
return stroeResign.mainTabs === "1"
? statusText(row.status)
: statusText(row.status, "อนุญาต");
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
@ -291,7 +292,11 @@ onMounted(async () => {
</q-select>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
v-if="
checkPermission($route)?.attrIsUpdate &&
checkPermissionList(['COMMAND']) &&
checkPermissionCreate('COMMAND')
"
@click="openModalOrder"
flat
round
@ -310,7 +315,7 @@ onMounted(async () => {
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -326,7 +326,7 @@ onMounted(async () => {
outlined
placeholder="ค้นหา"
class="q-ml-sm"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -206,7 +206,7 @@ watchEffect(() => {
dense
v-model="filterKeyword"
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -206,7 +206,7 @@ watchEffect(() => {
dense
v-model="filterKeyword"
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -31,6 +31,8 @@ const {
} = mixin;
const pageId = ref<string>(route.params.id as string);
const routeName = ref<string>(route?.name as string);
const keyword = ref<string>("");
const isAct = ref<boolean>(false);
@ -114,6 +116,7 @@ async function getData() {
keyword: keyword.value,
isAct: isAct.value,
keycloakId: props.keycloakUserId,
type: props.profileType === "officer" ? props.profileType : "employee",
})
.then(async (res) => {
const data = res.data.result;
@ -134,7 +137,7 @@ async function getData() {
function onSubmit() {
if (selected.value.length !== 0) {
dialogConfirm($q, () => {
dialogConfirm($q, async () => {
if (props.keycloakUserId) {
const body = selected.value.map((items: any, index: any) => ({
seq: index,
@ -146,26 +149,36 @@ function onSubmit() {
keycloakId: items.keycloakId,
}));
showLoader();
http
.post(
config.API.addResign(
(props.profileType?.toLocaleLowerCase() as string) == "officer"
? ""
: "-employee",
props.type?.toLocaleLowerCase() as string,
pageId.value
),
body
)
.then((res) => {
const profileSuffix =
(props.profileType?.toLocaleLowerCase() as string) === "officer"
? ""
: "-employee";
const apiEndpoint =
routeName.value === "resignReject" || routeName.value === "resignRejectEMP"
? config.API.addResignCancel(
profileSuffix,
props.type?.toLocaleLowerCase() as string,
pageId.value
)
: config.API.addResign(
profileSuffix,
props.type?.toLocaleLowerCase() as string,
pageId.value
);
await http
.post(apiEndpoint, body)
.then(async () => {
await props.getData?.(pageId.value);
closeDialog();
success($q, "บันทึกสำเร็จ");
props.getData?.(pageId.value);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
.finally(() => {
hideLoader();
});
} else {
closeDialog();
}
@ -179,6 +192,7 @@ function closeDialog() {
modal.value = false;
rows.value = [];
selected.value = [];
keyword.value = "";
}
watch(

View file

@ -1,16 +1,16 @@
import { defineStore } from "pinia";
export const useRetirementDataStore = defineStore("retirement", () => {
const statusText = (val: string) => {
const statusText = (val: string, rejectText: string = "อนุมัติ") => {
switch (val) {
case "WAITTING":
return "ใหม่";
case "PENDING":
return "รอดำเนินการ";
case "APPROVE":
return "อนุมัติ";
return rejectText;
case "REJECT":
return "ไม่อนุมัติ";
return `ไม่${rejectText}`;
case "REPORT":
return "ส่งรายชื่อไปออกคำสั่ง";
case "WAITING":
@ -18,29 +18,31 @@ export const useRetirementDataStore = defineStore("retirement", () => {
case "DONE":
return "ออกคำสั่งเสร็จสิ้น";
case "DONECANCEL":
return "ยกเลิกการลาออก";
return "ยกเลิกการลาออกสำเร็จ";
case "CANCEL":
return "ยกเลิกการลาออก";
return "ยกเลิกการลาออกสำเร็จ";
case "DONEREJECT":
return "ออกคำสั่งยกเลิกลาออกเสร็จแล้ว";
case "CANCELING":
return "กำลังดำเนินการยกเลิก";
default:
return "-";
}
};
function convertStatusText(val: string) {
function convertStatusText(val: string, rejectText: string = "ไม่อนุมัติ") {
switch (val) {
case "PENDING":
return "รอดำเนินการ";
case "APPROVE":
return "อนุญาต";
case "REJECT":
return "ยับยั้ง";
return rejectText;
}
}
return {
statusText,
convertStatusText
convertStatusText,
};
});

View file

@ -18,7 +18,7 @@ export const useDataStore = defineStore("resign", () => {
group: "1",
},
{
name: "อนุมัติแล้ว",
name: "อนุมัติ/ยับยั้ง",
value: "APPROVE",
group: "1",
},
@ -37,9 +37,13 @@ export const useDataStore = defineStore("resign", () => {
value: "DONE",
group: "1",
},
{
name: "ยกเลิกลาออก",
name: "กำลังดำเนินการยกเลิก",
value: "CANCELING",
group: "1",
},
{
name: "ยกเลิกลาออกสำเร็จ",
value: "CANCEL",
group: "1",
},
@ -54,7 +58,7 @@ export const useDataStore = defineStore("resign", () => {
group: "2",
},
{
name: "อนุมัติแล้ว",
name: "อนุญาต/ไม่อนุญาต",
value: "APPROVE",
group: "2",
},

View file

@ -321,7 +321,7 @@ onMounted(async () => {
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -328,7 +328,7 @@ onMounted(async () => {
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -231,7 +231,7 @@ onMounted(() => {
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -7,7 +7,11 @@ import { useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { checkPermission } from "@/utils/permissions";
import {
checkPermission,
checkPermissionList,
checkPermissionCreate,
} from "@/utils/permissions";
import { useTransferDataStore } from "@/modules/05_placement/store";
import type { DataOption } from "@/modules/06_retirement/interface/index/Main";
@ -259,7 +263,11 @@ onMounted(async () => {
</q-select>
</div>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
v-if="
checkPermission($route)?.attrIsUpdate &&
checkPermissionList(['COMMAND']) &&
checkPermissionCreate('COMMAND')
"
@click="openModalOrder"
size="14px"
flat
@ -278,7 +286,7 @@ onMounted(async () => {
v-model="filterKeyword"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -7,7 +7,11 @@ import { useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { checkPermission } from "@/utils/permissions";
import {
checkPermission,
checkPermissionList,
checkPermissionCreate,
} from "@/utils/permissions";
import { useTransferDataStore } from "@/modules/05_placement/store";
import type { DataOption } from "@/modules/06_retirement/interface/index/Main";
@ -261,7 +265,11 @@ onMounted(async () => {
</q-select>
</div>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
v-if="
checkPermission($route)?.attrIsUpdate &&
checkPermissionList(['COMMAND']) &&
checkPermissionCreate('COMMAND')
"
@click="openModalOrder"
size="14px"
flat
@ -281,7 +289,7 @@ onMounted(async () => {
v-model="filterKeyword"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -527,7 +527,7 @@ watch(
lazy-rules
label="คำค้น"
hide-bottom-space
@keydown.enter="fetchDataPos()"
@keydown.enter.prevent="fetchDataPos()"
>
<template v-slot:append>
<q-icon

View file

@ -174,7 +174,7 @@ onMounted(() => {
v-model="keyword"
label="ค้นหา"
class="q-mr-sm"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -269,7 +269,7 @@ onMounted(async () => {
v-model="keyword"
label="ค้นหา"
class="q-mr-sm"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -144,15 +144,15 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "employeeType",
align: "left",
label: "ประเภทตำแหน่ง",
sortable: true,
field: "employeeType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
// {
// name: "employeeType",
// align: "left",
// label: "",
// sortable: true,
// field: "employeeType",
// headerStyle: "font-size: 14px",
// style: "font-size: 14px",
// },
{
name: "position",
align: "left",
@ -375,7 +375,7 @@ async function fecthlistperson() {
http
.get(
config.API.registryNewOtherSystem(
employeeType.value == "officer" ? `` : `-employee`
DataStore.employeeClass == "officer" ? `` : `-employee`
),
{
params: { ...formFilter, nodeId: organization.value },
@ -501,8 +501,7 @@ async function downloadFileexcel() {
.put(
config.API.insigniaDowanload(DataStore.requestId),
{
profileType:
DataStore.employeeClass == "all" ? null : DataStore.employeeClass,
profileType: DataStore.employeeClass,
InsigniaId:
DataStore.typeinsignia == "all"
? null
@ -782,32 +781,32 @@ function clickCloseReson() {
dialogNote.value = false;
}
/**
* function แสดงแจงเต
* @param markDiscipline โทษทางว
* @param markLeave ไมไดเลอนเงนเดอน/ไมไดเลอนข เนองจากลาเก
* @param markRate ผลการประเมนการปฏราชการในรอบ 5 ำกวาระดบด (อยกวารอยละ 70)
*/
function clickShowWarn(
markDiscipline: boolean,
markLeave: boolean,
markRate: boolean
) {
checkboxData.value = [
{ id: 1, name: "มีโทษทางวินัย", val: markDiscipline },
{
id: 2,
name: "ไม่ได้เลื่อนเงินเดือน/ไม่ได้เลื่อนขั้น เนื่องจากลาเกิน",
val: markLeave,
},
{
id: 3,
name: "ผลการประเมินการปฏิบัติราชการในรอบ 5 ปี ต่ำกว่าระดับดี (น้อยกว่าร้อยละ 70)",
val: markRate,
},
];
dialogWarn.value = true;
}
// /**
// * function
// * @param markDiscipline
// * @param markLeave /
// * @param markRate 5 ( 70)
// */
// function clickShowWarn(
// markDiscipline: boolean,
// markLeave: boolean,
// markRate: boolean
// ) {
// checkboxData.value = [
// { id: 1, name: "", val: markDiscipline },
// {
// id: 2,
// name: "/ ",
// val: markLeave,
// },
// {
// id: 3,
// name: " 5 ( 70)",
// val: markRate,
// },
// ];
// dialogWarn.value = true;
// }
/**
* function นหาขอม option
@ -842,10 +841,11 @@ function clearInsigniaFilters(name: string) {
if (name === "typeinsigniaOptions") {
DataStore.typeinsignia = "all";
typeinsigniaOptions.value = DataStore.typeinsigniaOptions;
} else if (name === "employeeClassOps") {
DataStore.employeeClass = "all";
employeeClassOps.value = DataStore.employeeClassOps;
}
// else if (name === "employeeClassOps") {
// DataStore.employeeClass = "all";
// employeeClassOps.value = DataStore.employeeClassOps;
// }
}
watch(
@ -954,7 +954,7 @@ onMounted(async () => {
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
@ -1026,7 +1026,7 @@ onMounted(async () => {
</q-item>
</template>
</q-select>
<q-select
<!-- <q-select
v-model="DataStore.employeeClass"
dense
outlined
@ -1072,15 +1072,12 @@ onMounted(async () => {
<q-item-section class="text-grey"> ไมอม </q-item-section>
</q-item>
</template>
</q-select>
</q-select> -->
<q-space />
<div>
<q-btn
v-if="checkPermission($route)?.attrIsGet"
:disable="
DataStore.employeeClass === 'all' ||
DataStore.typeinsignia === 'all'
"
:disable="DataStore.typeinsignia === 'all'"
icon="mdi-download"
flat
round
@ -1089,6 +1086,7 @@ onMounted(async () => {
>
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
<q-btn
flat
round
@ -1096,10 +1094,10 @@ onMounted(async () => {
icon="mdi-plus"
@click="clickmodalAdd"
v-if="
(DataStore.isLock == false &&
DataStore.requestStatus == 'st5' &&
DataStore.isOfficer) ||
(checkStatus == true && checkPermission($route)?.attrIsCreate)
DataStore.isLock == false &&
checkPermission($route)?.attrIsCreate &&
((DataStore.requestStatus == 'st5' && DataStore.isOfficer) ||
checkStatus == true)
"
>
<q-tooltip>เพ</q-tooltip>
@ -1330,11 +1328,14 @@ onMounted(async () => {
</q-td> -->
<q-td key="discipline" class="text-center">
<q-btn
v-if="checkPermission($route)?.attrIsGet"
v-if="
checkPermission($route)?.attrIsGet &&
props.row.markDiscipline
"
flat
dense
icon="info"
color="info"
color="red"
@click.pervent="
onClickViewInfo(
'discipline',
@ -1344,14 +1345,17 @@ onMounted(async () => {
"
>
</q-btn>
<div v-else>-</div>
</q-td>
<q-td key="leave" class="text-center">
<q-btn
v-if="checkPermission($route)?.attrIsGet"
v-if="
checkPermission($route)?.attrIsGet && props.row.markLeave
"
flat
dense
icon="info"
color="info"
color="red"
@click.pervent="
onClickViewInfo(
'leave',
@ -1361,11 +1365,14 @@ onMounted(async () => {
"
>
</q-btn>
<div v-else>-</div>
</q-td>
<q-td key="assessments" class="text-center">
<!-- ผลการประเมนการปฏราชการในรอบ 5 ำกวาระดบด (อยกวารอยละ 70) -->
<q-btn
v-if="checkPermission($route)?.attrIsGet"
v-if="
checkPermission($route)?.attrIsGet && props.row.markRate
"
flat
dense
icon="info"
@ -1379,10 +1386,13 @@ onMounted(async () => {
"
>
</q-btn>
<div v-else>-</div>
</q-td>
<q-td key="insignia" class="text-center">
<q-btn
v-if="checkPermission($route)?.attrIsGet"
v-if="
checkPermission($route)?.attrIsGet && props.row.markInsignia
"
flat
dense
icon="info"
@ -1396,6 +1406,7 @@ onMounted(async () => {
"
>
</q-btn>
<div v-else>-</div>
</q-td>
</q-tr>
</template>
@ -1415,7 +1426,7 @@ onMounted(async () => {
<div class="col-xs-12 col-sm-7">
<q-card flat bordered class="fit q-pa-sm">
<div class="row q-col-gutter-sm q-mb-sm">
<div class="col-3">
<!-- <div class="col-3">
<q-select
outlined
dense
@ -1429,7 +1440,7 @@ onMounted(async () => {
@update:model-value="clearForm(), fecthlistperson()"
>
</q-select>
</div>
</div> -->
<div class="col-3">
<q-select
dense
@ -1451,7 +1462,9 @@ onMounted(async () => {
dense
placeholder="ค้นหา"
v-model="formFilter.searchKeyword"
@keydown.enter="(formFilter.page = 1), fecthlistperson()"
@keydown.enter.prevent="
(formFilter.page = 1), fecthlistperson()
"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -67,15 +67,15 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "employeeType",
align: "left",
label: "ประเภทตำแหน่ง",
sortable: true,
field: "employeeType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
// {
// name: "employeeType",
// align: "left",
// label: "",
// sortable: true,
// field: "employeeType",
// headerStyle: "font-size: 14px",
// style: "font-size: 14px",
// },
{
name: "position",
align: "left",
@ -253,7 +253,7 @@ function clearInsigniaFilters(name: string) {
DataStore.typeinsignia = "all";
typeinsigniaOptions.value = DataStore.typeinsigniaOptions;
} else if (name === "employeeClassOps") {
DataStore.employeeClass = "all";
// DataStore.employeeClass = "all";
employeeClassOps.value = DataStore.employeeClassOps;
}
}
@ -334,7 +334,7 @@ watch(
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
@ -405,7 +405,7 @@ watch(
</q-item>
</template>
</q-select>
<q-select
<!-- <q-select
v-model="DataStore.employeeClass"
dense
outlined
@ -451,7 +451,7 @@ watch(
<q-item-section class="text-grey"> ไมอม </q-item-section>
</q-item>
</template>
</q-select>
</q-select> -->
</div>
</q-card>
<div class="col-12 q-pt-sm">

View file

@ -68,15 +68,15 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "employeeType",
align: "left",
label: "ประเภทตำแหน่ง",
sortable: true,
field: "employeeType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
// {
// name: "employeeType",
// align: "left",
// label: "",
// sortable: true,
// field: "employeeType",
// headerStyle: "font-size: 14px",
// style: "font-size: 14px",
// },
{
name: "position",
align: "left",
@ -254,10 +254,11 @@ function clearInsigniaFilters(name: string) {
if (name === "typeinsigniaOptions") {
DataStore.typeinsignia = "all";
typeinsigniaOptions.value = DataStore.typeinsigniaOptions;
} else if (name === "employeeClassOps") {
DataStore.employeeClass = "all";
employeeClassOps.value = DataStore.employeeClassOps;
}
// else if (name === "employeeClassOps") {
// DataStore.employeeClass = "all";
// employeeClassOps.value = DataStore.employeeClassOps;
// }
}
function onSearch() {
@ -337,7 +338,7 @@ onMounted(async () => {
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
@ -406,7 +407,7 @@ onMounted(async () => {
</q-item>
</template>
</q-select>
<q-select
<!-- <q-select
v-model="DataStore.employeeClass"
dense
outlined
@ -450,7 +451,7 @@ onMounted(async () => {
<q-item-section class="text-grey"> ไมอม </q-item-section>
</q-item>
</template>
</q-select>
</q-select> -->
</div>
</q-card>
<div class="col-12 q-pt-sm">

View file

@ -63,7 +63,7 @@ const pagination = ref({
async function fecthOrg() {
showLoader();
await http
.get(config.API.insigniaNosend(props.roundId))
.get(config.API.insigniaNosend(props.roundId, DataStore.employeeClass))
.then((res) => {
let data = res.data.result;
rows.value = data.map((e: ResponseNoSend) => ({

View file

@ -171,7 +171,7 @@ function findlist(id: string = "", idCard: string) {
function fectDataByid(id: string) {
showLoader();
if (props.profileType !== undefined) {
employeeClass.value = "officer";
employeeClass.value = props.profileType;
}
http
.get(config.API.noteByid(id))
@ -291,7 +291,7 @@ function classInput(val: boolean) {
watch(props, () => {
if (props.modal === true) {
filterinsigniaOp2.value = DataStore.insigniaOp2;
employeeClass.value = "";
employeeClass.value = props.profileType || "";
cardid.value = "";
fullName.value = "";
position.value = "";
@ -335,9 +335,6 @@ watch(props, () => {
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-4">
<q-select
:rules="[
(val:string) => !!val || 'กรุณาเลือก ขรก.สามัญ/ลูกจ้างประจำ',
]"
hide-bottom-space
:options="employeeClassOps"
dense
@ -348,9 +345,9 @@ watch(props, () => {
map-options
outlined
v-model="employeeClass"
:label="`ขรก.สามัญ/ลูกจ้างประจำ`"
label="ประเภทตำแหน่ง"
@update:model-value="selectType"
:class="classInput(status !== '')"
disable
:readonly="status !== ''"
lazy-rules
/>
@ -383,7 +380,7 @@ watch(props, () => {
label="เลขประจำตัวประชาชน"
maxlength="13"
mask="#############"
@keyup="searchcardid"
@change="searchcardid"
/>
</div>

View file

@ -60,6 +60,7 @@ interface ResponseInsigniaType {
}
interface ResponseRecordLists {
profileId?: string;
address: string;
citizenId: string;
date: Date;
@ -128,6 +129,7 @@ interface ResponseManageList {
markDiscipline: boolean;
markLeave: boolean;
markRate: boolean;
markInsignia: boolean;
posNo: string;
position: string;
profileId: string;

View file

@ -30,6 +30,12 @@ const report_02 = () =>
const ReclaimMain = () =>
import("@/modules/07_insignia/views/07_ReclaimMain.vue");
// รายชื่อลูกจ้างประจำ ที่มีสิทธิ์ยื่นขอพระราชทานเครื่องราชอิสริยาภรณ์
const ManageEmpMain = () =>
import("@/modules/07_insignia/views/08_ManageEmpMain.vue");
const RecordInsigniaEmp = () =>
import("@/modules/07_insignia/views/09_ResultMainEmp.vue");
export default [
{
path: "/insignia/round",
@ -124,4 +130,24 @@ export default [
Role: "STAFF",
},
},
{
path: "/insignia/manage-emp/list-manage",
name: "insigniaManageEmp",
component: ManageEmpMain,
meta: {
Auth: true,
Key: "SYS_INSIGNIA_MANAGE_EMP",
Role: "STAFF",
},
},
{
path: "/insignia/record-emp",
name: "insigniaRecordEmp",
component: RecordInsigniaEmp,
meta: {
Auth: true,
Key: "SYS_INSIGNIA_RECORD_EMP",
Role: "STAFF",
},
},
];

View file

@ -37,11 +37,11 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
const typeinsigniaOptions = ref<OptionData[]>([
{ id: "all", name: "ทั้งหมด" },
]);
const employeeClass = ref<string>("all");
const employeeClass = ref<string>("officer");
const employeeClassOps = ref<OptionData[]>([
{ name: "ทั้งหมด", id: "all" },
// { name: "ทั้งหมด", id: "all" },
{ name: "ข้าราชการ กทม.สามัญ", id: "officer" },
{ name: "ลูกจ้างประจำ", id: "perm" },
{ name: "ลูกจ้างประจำ", id: "employee" },
]);
const isOfficer = ref<boolean>(false);
@ -101,6 +101,7 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
markDiscipline: e.markDiscipline,
markLeave: e.markLeave,
markRate: e.markRate,
markInsignia: e.markInsignia,
isApprove: e.isApprove,
statusMark:
e.markDiscipline === true ||

View file

@ -27,7 +27,7 @@ export const useBrrowDataStore = defineStore("insigniaBrrow", () => {
const employeeClassOps = ref<OptionData[]>([
{ name: "ทั้งหมด", id: "all" },
{ name: "ข้าราชการ กทม.สามัญ", id: "officer" },
{ name: "ลูกจ้างประจำ", id: "perm" },
{ name: "ลูกจ้างประจำ", id: "employee" },
]);
const type = ref<any[]>([]);

View file

@ -10,7 +10,7 @@ export const useInsigniaReclaimStore = defineStore("insigniaReclaim", () => {
const employeeClassData = ref<OptionData[]>([
{ name: "ทั้งหมด", id: "all" },
{ name: "ข้าราชการ กทม.สามัญ", id: "officer" },
{ name: "ลูกจ้างประจำ", id: "perm" },
{ name: "ลูกจ้างประจำ", id: "employee" },
]);
return {

View file

@ -87,6 +87,7 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
rows.value = [];
const alllist = await data.map((e: ResponseRecordLists) => ({
id: e.id,
profileId: e.profileId,
citizenId: e.citizenId,
prefix: e.prefix,
position: e.position,

View file

@ -0,0 +1,192 @@
<script setup lang="ts">
import { useQuasar } from "quasar";
import { onMounted, ref } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import { useRoleWorkflowDataStore } from "@/stores/roleWorkflow";
/** import Type*/
import type { DataStat } from "@/modules/07_insignia/interface/index/Main";
import type { ResponsePeriod } from "@/modules/07_insignia/interface/response/Main";
/**import Componrnts*/
import cardTop from "@/modules/07_insignia/components/2_Manage/StatCard.vue"; // stat
/**use */
const $q = useQuasar(); // noti quasar
const { fetchDataCheckIsoffice } = useRoleWorkflowDataStore();
const { messageError, dialogConfirm, showLoader, hideLoader, success } =
useCounterMixin();
//
const isStaff = ref<boolean>(false);
const isOfficer = ref<boolean>(false);
const isDirector = ref<boolean>(false);
const isDeputy = ref<boolean>(false);
//
const stat = ref<DataStat>({
allUserUser: 0,
orgAllCount: 0,
orgNoSendCount: 0,
orgSendCount: 0,
});
//
const round = ref<string>("");
const optionRound = ref<
Array<{ id: number; year: string; name: string; period_revision: string }>
>([]);
/** ฟังก์ชันเรียกข้อมูลการเป็นเจ้าหน้าที่*/
async function fetchCheckIsofficer() {
try {
const data = await fetchDataCheckIsoffice("SYS_INSIGNIA_MANAGE_EMP");
isStaff.value = data.isStaff;
// isStaff.value = true; //
isOfficer.value = data.isOfficer;
isDirector.value = data.isDirector;
isDeputy.value = data.isDeputy;
} catch (err) {
messageError($q, err);
}
}
/** ฟังก์ชันเรียกข้อมูลรอบการเสนอขอพระราชทานเครื่องราชอิสริยาภรณ์*/
async function fecthRoundData() {
await http
.get(config.API.listRoundInsignia(), { params: { path: "MANAGE" } })
.then(async (res) => {
optionRound.value = await res.data.result.map((e: ResponsePeriod) => ({
id: e.period_id,
year: e.period_year,
name: e.period_name,
period_revision: e.period_revision,
}));
//
if (optionRound.value.length !== 0) {
// DataStore.optionRound = optionRound.value;
// const lastValue = optionRound.value[0];
// await fetchListOrg(lastValue.period_revision);
// await fecthAgency(lastValue.period_revision);
// if (DataStore.roundId) {
// round.value = DataStore.roundId; //
// } else {
// round.value = lastValue.id.toString(); //
// }
// await fecthStat(round.value);
// DataStore.roundId = round.value;
// roundName.value = lastValue.name;
// loadview.value = true;
}
})
.catch((err) => {
messageError($q, err);
});
}
/** ฟังก์ชันยื่นยันการล็อกข้อมูล*/
function onConfrimIsLockData() {
dialogConfirm(
$q,
() => {},
"ยืนยันการล็อกข้อมูล",
"คุณต้องการล็อกข้อมูลใช่หรือไม่"
);
}
onMounted(async () => {
showLoader();
try {
await fetchCheckIsofficer();
if (isStaff.value || isOfficer.value || isDirector.value) {
await Promise.all([fecthRoundData()]);
}
} catch (error) {
messageError($q, error);
} finally {
hideLoader();
}
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">
รายชอลกจางประจำ ทธนขอพระราชทานเครองราชอสรยาภรณ
</div>
<q-card
bordered
class="row col-12 q-mt-sm"
v-if="isDirector || isOfficer || isStaff"
>
<div class="row col-12 items-center bg-grey-1">
<div class="q-pl-md q-pr-sm text-weight-medium text-grey-7">รอบ</div>
<q-select
borderless
dense
v-model="round"
:options="optionRound"
map-options
emit-value
option-value="id"
option-label="name"
/>
<!-- @update:model-value="changround" -->
<q-space />
<!-- สกจ. Freez อม -->
<q-btn
v-if="isOfficer && checkPermission($route)?.attrIsUpdate"
dense
unelevated
label="ล็อกข้อมูล"
color="public"
class="q-px-md q-ml-md"
@click="onConfrimIsLockData"
>
<q-tooltip>อกขอม</q-tooltip>
</q-btn>
</div>
<div class="col-12"><q-separator /></div>
<div v-if="isOfficer" class="col-12 row bg-white">
<div class="fit q-px-md q-py-sm">
<div class="row col-12 q-col-gutter-sm fit">
<cardTop
:amount="stat.orgAllCount"
label="หน่วยงานทั้งหมด"
color="#016987"
/>
<cardTop
:amount="stat.orgSendCount"
label="หน่วยงานที่ส่งรายชื่อเเล้ว"
color="#02A998"
/>
<cardTop
:amount="stat.orgNoSendCount"
label="หน่วยงานที่ยังไม่ได้ส่งรายชื่อ"
color="#2EA0FF"
/>
<cardTop
:amount="stat.allUserUser"
label="จำนวนคนที่ยื่นขอ"
color="#4154B3"
/>
</div>
</div>
</div>
</q-card>
<q-card v-else>
<div class="q-pa-md q-gutter-sm">
<q-banner inline-actions rounded class="bg-grey-1 text-center">
ไมอมลรอบการเสนอขอพระราชทานเครองราชอสรยาภรณ
</q-banner>
</div>
</q-card>
</template>
<style scoped></style>

View file

@ -210,7 +210,7 @@ onMounted(async () => {
v-model="filterKeyword"
outlined
placeholder="ค้นหา"
@keydown.enter="onSearch"
@keydown.enter.prevent="onSearch"
>
<template v-slot:append>
<q-icon name="search" />

View file

@ -5,6 +5,7 @@ import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useRoleWorkflowDataStore } from "@/stores/roleWorkflow";
import { checkPermission } from "@/utils/permissions";
import http from "@/plugins/http";
import config from "@/app.config";
@ -33,6 +34,7 @@ const tab1 = defineAsyncComponent(
const $q = useQuasar(); // noti quasar
const route = useRoute();
const DataStore = useInsigniaDataStore();
const { fetchDataCheckIsoffice } = useRoleWorkflowDataStore();
const mixin = useCounterMixin();
const { messageError, dialogConfirm, showLoader, hideLoader, success } = mixin;
@ -184,18 +186,15 @@ async function fecthInsignia() {
}
async function fetchCheckIsofficer() {
http
.get(config.API.checkIsofficer + `SYS_INSIGNIA_MANAGE`)
.then((res) => {
const data = res.data.result;
DataStore.isStaff = data.isStaff;
DataStore.isOfficer = data.isOfficer;
DataStore.isDirector = data.isDirector;
DataStore.isDeputy = data.isDeputy;
})
.catch((err) => {
messageError($q, err);
});
try {
const data = await fetchDataCheckIsoffice("SYS_INSIGNIA_MANAGE");
DataStore.isStaff = data.isStaff;
DataStore.isOfficer = data.isOfficer;
DataStore.isDirector = data.isDirector;
DataStore.isDeputy = data.isDeputy;
} catch (err) {
messageError($q, err);
}
}
/**
@ -235,7 +234,7 @@ async function fecthInsigniaByOc(
ocId: string,
role: string,
status: string,
isDeputy: boolean = false
isDeputy: boolean = DataStore.isDeputy
) {
DataStore.rows = [];
if (roundId && ocId && role && status) {
@ -243,6 +242,7 @@ async function fecthInsigniaByOc(
await http
.get(config.API.insigniaList(roundId, ocId, role, status, isDeputy))
.then(async (res) => {
DataStore.isLock = res.data.result.isLock; //
requestNote.value = res.data.result.requestNote;
requestStatus.value = res.data.result.requestStatus;
requestId.value = res.data.result.requestId;
@ -423,6 +423,35 @@ function requestSendNote() {
});
}
/**
* function ปเดตขอมลคณสมบ
*/
async function updateDataProperty() {
dialogConfirm($q, async () => {
showLoader();
await http
.put(config.API.insigniaUpdateProperty, {
insigniaPeriodId: round.value,
agencyId: DataStore.agency,
type: "officer",
})
.then(async () => {
hideLoader();
await fecthInsigniaByOc(
round.value,
DataStore.agency,
"officer",
tab.value
);
success($q, "อัปเดตข้อมูลคุณสมบัติสำเร็จ");
})
.catch((err) => {
messageError($q, err);
hideLoader();
});
});
}
/**
* function ปโหลดไฟลเจาหนาท
* @param event file
@ -456,6 +485,7 @@ async function uploadFile(event: any) {
* hook
*/
onMounted(async () => {
DataStore.employeeClass = "officer"; // .
tab.value = DataStore.mainTab ?? "";
await Promise.all([fecthlistRound(), fecthInsignia(), fetchCheckIsofficer()]);
});
@ -508,6 +538,23 @@ onUnmounted(() => {
>
<q-tooltip>อกขอม</q-tooltip>
</q-btn>
<!-- ปเดตขอมลคณสมบ -->
<q-btn
v-if="
((DataStore.isOfficer && DataStore.optionsTypeOc.findIndex(
(v: OptionData) => v.id === DataStore.selectOrganization && v.isDeputy === true) > -1) || DataStore.isStaff) &&
DataStore.isLock !== true && (requestStatus == 'st1' || requestStatus == 'st4') &&
checkPermission($route)?.attrIsUpdate
"
dense
unelevated
label="อัปเดตข้อมูลคุณสมบัติ"
color="info"
class="q-px-md q-ml-sm"
@click="updateDataProperty"
>
<q-tooltip>ปเดตขอมลคณสมบ</q-tooltip>
</q-btn>
</div>
<div class="col-12"><q-separator /></div>
<div v-if="DataStore.isOfficer" class="col-12 row bg-white">
@ -643,7 +690,7 @@ onUnmounted(() => {
dense
v-model="fileUpload"
accept=".pdf"
:style="fileUpload === null ? 'width: 150px' : 'width: auto'"
:style="fileUpload === null ? 'width: 250px' : 'width: auto'"
label="อัปโหลดไฟล์"
>
<template v-slot:prepend>
@ -689,6 +736,7 @@ onUnmounted(() => {
<q-btn
v-if="
!DataStore.isLock &&
((DataStore.isOfficer && DataStore.optionsTypeOc.findIndex(
(v: OptionData) => v.id === DataStore.selectOrganization && v.isDeputy === true) > -1) || DataStore.isStaff) &&
(requestStatus == 'st1' || requestStatus == 'st4') &&
@ -702,6 +750,7 @@ onUnmounted(() => {
/>
<q-btn
v-if="
!DataStore.isLock &&
DataStore.isDirector &&
(requestStatus == 'st3' || requestStatus == 'st5') &&
checkPermission($route)?.attrIsUpdate
@ -714,6 +763,7 @@ onUnmounted(() => {
/>
<q-btn
v-if="
!DataStore.isLock &&
DataStore.isDirector &&
requestStatus == 'st3' &&
checkPermission($route)?.attrIsUpdate

View file

@ -22,6 +22,7 @@ import DialogHeader from "@/components/DialogHeader.vue";
import Dialogbody from "@/modules/07_insignia/components/3_result/DialogReceive_Return.vue"; //-
import DialogForm from "@/modules/07_insignia/components/3_result/DialogResults.vue"; //
import fileUploadview from "../components/3_result/TabDocuments.vue";
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
/** use*/
const $q = useQuasar();
@ -106,15 +107,15 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "employeeType",
align: "left",
label: "ประเภทตำแหน่ง",
field: "employeeType",
sortable: true,
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
// {
// name: "employeeType",
// align: "left",
// label: "",
// field: "employeeType",
// sortable: true,
// sort: (a: string, b: string) =>
// a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
// },
{
name: "type",
align: "left",
@ -480,12 +481,13 @@ function filterSelector(val: string, update: Function, name: string) {
filterInvoice.value = DataStore.invoiceTypeop.filter(
(v: OptionData) => v.name.toLowerCase().indexOf(needle) > -1
);
} else if (name === "filterEmployee") {
DataStore.employeeClass = val ? "" : DataStore.employeeClass;
filterEmployee.value = DataStore.employeeClassOps.filter(
(v: OptionData) => v.name.toLowerCase().indexOf(needle) > -1
);
}
// else if (name === "filterEmployee") {
// DataStore.employeeClass = val ? "" : DataStore.employeeClass;
// filterEmployee.value = DataStore.employeeClassOps.filter(
// (v: OptionData) => v.name.toLowerCase().indexOf(needle) > -1
// );
// }
});
}
@ -501,7 +503,7 @@ function clearInsigniaFilters(name: string) {
DataStore.invoiceType = "all";
filterInvoice.value = DataStore.invoiceTypeop;
} else if (name === "filterEmployee") {
DataStore.employeeClass = "all";
// DataStore.employeeClass = "all";
filterEmployee.value = DataStore.employeeClassOps;
}
}
@ -534,6 +536,21 @@ function serchDataTableDailog() {
);
}
const modalPersonal = ref<boolean>(false); // popup
/**
* function redirect to ทะเบยนประว
* @param id profileId
*/
function viewRegistry(id: string, type: string) {
modalPersonal.value = true;
personId.value = id;
profileType.value = type;
}
function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal;
}
/**
* callback function จำทำงานเม tab การเปลยนแปลง
*/
@ -805,7 +822,7 @@ onMounted(() => {
</q-item>
</template>
</q-select>
<q-select
<!-- <q-select
v-model="DataStore.employeeClass"
dense
outlined
@ -851,7 +868,7 @@ onMounted(() => {
</q-item-section>
</q-item>
</template>
</q-select>
</q-select> -->
<div>
<q-btn
v-if="checkPermission($route)?.attrIsCreate"
@ -884,6 +901,23 @@ onMounted(() => {
<template v-slot:body="props">
<q-tr :props="props">
<q-td auto-width>
<!-- อมลทะเบยนประว -->
<q-btn
v-if="
checkPermission($route)?.attrIsGet && props.row.profileId
"
flat
round
dense
icon="info"
color="info"
@click.stop="
viewRegistry(props.row.profileId, props.row.profileType)
"
>
<q-tooltip>อมลทะเบยนประว</q-tooltip>
</q-btn>
<q-btn
v-if="
checkPermission($route)?.attrIsGet &&
@ -962,7 +996,7 @@ onMounted(() => {
:round-id="selectRound"
:action="action"
:person-id="personId"
:profile-type="profileType"
profile-type="officer"
:fecthlist-insignia="fecthlistInsignia"
/>
@ -1036,6 +1070,13 @@ onMounted(() => {
</q-card-actions>
</q-card>
</q-dialog>
<PopupPersonal
:modal="modalPersonal"
:id="personId"
:type="profileType"
@update:modal="updatemodalPersonal"
/>
</template>
<style lang="scss" scoped>
.arrow {

View file

@ -213,7 +213,7 @@ const isInsigniaRound = ref<boolean>(false); //สถานะรอบ
const roundOps = ref<DataRound[]>(roundData.value); //
const insigniaTypeOps = ref<OptionData[]>(insigniaTypeData.value); //
const employeeClassOps = ref<OptionData[]>(employeeClassData.value); //
const employeeClassOps = ref<OptionData[]>(employeeClassData.value); //
const modalForm = ref<boolean>(false); // modal
const isEdit = ref<boolean>(false); //
@ -515,7 +515,7 @@ onMounted(async () => {
outlined
lazy-rules
hide-bottom-space
:label="`${'ตำแหน่งประเภท'}`"
:label="`${'ประเภทตำแหน่ง'}`"
emit-value
use-input
hide-selected

View file

@ -0,0 +1,799 @@
<script setup lang="ts">
import { onMounted, onUnmounted, defineAsyncComponent, ref } from "vue";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useRoleWorkflowDataStore } from "@/stores/roleWorkflow";
import { checkPermission } from "@/utils/permissions";
import http from "@/plugins/http";
import config from "@/app.config";
import type { DataStructureTree } from "@/interface/main";
import type {
OptionData,
OptionRound,
DataStat,
} from "@/modules/07_insignia/interface/index/Main";
import type { ResponsePeriod } from "@/modules/07_insignia/interface/response/Main";
/**import Componrnts*/
import cardTop from "@/modules/07_insignia/components/2_Manage/StatCard.vue"; // stat
// import tab1 from "@/modules/07_insignia/components/2_Manage/Tab1.vue"; //
import tab2 from "@/modules/07_insignia/components/2_Manage/Tab2.vue"; //
import tab3 from "@/modules/07_insignia/components/2_Manage/Tab3.vue"; //
import tab4 from "@/modules/07_insignia/components/2_Manage/Tab4.vue"; //
import DialogPopupReason from "@/components/Dialogs/PopupReason.vue"; //
const tab1 = defineAsyncComponent(
() => import("@/modules/07_insignia/components/2_Manage/Tab1.vue")
);
/**use */
const $q = useQuasar(); // noti quasar
const route = useRoute();
const DataStore = useInsigniaDataStore();
const { fetchDataCheckIsoffice } = useRoleWorkflowDataStore();
const mixin = useCounterMixin();
const { messageError, dialogConfirm, showLoader, hideLoader, success } = mixin;
/**
* วแปร
*/
const loadview = ref<boolean>(false); // View
// const hideBottom = ref<boolean>(false);
const round = ref<string>(""); //
const roundName = ref<string>(""); //
const optionRound = ref<OptionRound[]>([]);
const optiontypeOc = ref<OptionData[]>([]);
const tab = ref<string>(""); //tab
//
const stat = ref<DataStat>({
allUserUser: 0,
orgAllCount: 0,
orgNoSendCount: 0,
orgSendCount: 0,
});
const requestNote = ref<string>(""); //
const requestStatus = ref<string>(""); //
const requestId = ref<string>(""); //id
const document = ref<string>(""); //
const fileUpload = ref<any>(null); //
const modalPopupBackToEdit = ref<boolean>(false); //model
const modalbackInsignia2Role = ref<boolean>(false); // popup
/**
* function เรยกรอบการเสนอขอพระราชทานเครอง
*/
async function fecthlistRound() {
showLoader();
loadview.value = false;
await http
.get(config.API.listRoundInsignia(), { params: { path: "MANAGE" } })
.then(async (res) => {
optionRound.value = await res.data.result.map((e: ResponsePeriod) => ({
id: e.period_id,
year: e.period_year,
name: e.period_name,
period_revision: e.period_revision,
}));
// UI
if (optionRound.value.length !== 0) {
DataStore.optionRound = optionRound.value;
const lastValue = optionRound.value[0];
await fetchListOrg(lastValue.period_revision);
await fecthAgency(lastValue.period_revision);
if (DataStore.roundId) {
round.value = DataStore.roundId; //
} else {
round.value = lastValue.id.toString(); //
}
await fecthStat(round.value);
DataStore.roundId = round.value;
roundName.value = lastValue.name;
loadview.value = true;
}
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/**
* function เรยกด Stat ของรอบการเสนอขอพระราชทานเครอง
*/
async function fecthStat(id: string) {
if (DataStore.isOfficer) {
await http
.get(config.API.insigniaDashboard(id, "employee"))
.then((res) => {
stat.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
});
}
}
/**
* function fetch อมลโครองสรางปจจ
* @param id โครงสรางปจจ
*/
async function fetchListOrg(id: string) {
if (DataStore.isOfficer) {
await http
.get(config.API.orgByIdSystemRoot(id, route.meta.Key as string))
.then(async (res) => {
const data = res.data.result;
if (data.length !== 0) {
optiontypeOc.value = await res.data.result.map(
(item: DataStructureTree) => ({
id: item.orgTreeId,
name: item.orgName,
isDeputy: item.isDeputy,
})
);
await DataStore.fetchOption(optiontypeOc.value); // DataStore
}
})
.catch((err) => {
messageError($q, err);
});
}
}
/**
* funcion เชคหนวยงาน
*/
async function fecthAgency(id: string) {
await http
.get(config.API.keycloakPosition(), {
params: {
revisionId: id,
},
})
.then((res) => {
DataStore.agency = res.data.result.rootId;
DataStore.selectOrganization = res.data.result.rootId;
DataStore.typeOc = DataStore.agency;
})
.catch((err) => {
messageError($q, err);
});
}
/**
* function เรยกประเภทเครองราช
*/
async function fecthInsignia() {
if (DataStore.dataInsigniaType.length === 0) {
await http
.get(config.API.insigniaOrg)
.then((res) => {
const data = res.data.result;
DataStore.fetchInsigniaType(data);
})
.catch((err) => {
messageError($q, err);
});
}
}
async function fetchCheckIsofficer() {
try {
const data = await fetchDataCheckIsoffice("SYS_INSIGNIA_MANAGE");
DataStore.isStaff = data.isStaff;
DataStore.isOfficer = data.isOfficer;
DataStore.isDirector = data.isDirector;
DataStore.isDeputy = data.isDeputy;
} catch (err) {
messageError($q, err);
}
}
/**
* function เปลยนรอบการแสดง
*/
async function changround() {
DataStore.roundId = round.value;
// get round name
await fecthStat(round.value); // Stat
const roundFilter = optionRound.value.find(
(x: OptionRound) => x.id === round.value
);
if (roundFilter) {
await fetchListOrg(roundFilter?.period_revision);
await fecthAgency(roundFilter?.period_revision);
roundName.value = `รอบการเสนอขอพระราชทานเครื่องราชฯ ปี ${
roundFilter.year + 543
}`;
}
var organization =
DataStore.agency != null // agency agency Oc
? DataStore.agency
: DataStore.typeOc;
await fecthInsigniaByOc(round.value, organization, "officer", tab.value); //
}
/**
* function เรยกขอมลรายชอขาราชการสามญฯ ทธนขอพระราชทานเครองราชอสรยาภรณ ตามรอบการเสนอขอ
* @param roundId id รอบการเสนอขอ
* @param ocId id หนวยงาน
* @param role ประเภท officer,employee
* @param status สถานะ
*/
async function fecthInsigniaByOc(
roundId: string,
ocId: string,
role: string,
status: string,
isDeputy: boolean = DataStore.isDeputy
) {
DataStore.rows = [];
if (roundId && ocId && role && status) {
showLoader();
await http
.get(
config.API.insigniaList(
roundId,
ocId,
role,
status,
isDeputy,
"employee"
)
)
.then(async (res) => {
requestNote.value = res.data.result.requestNote;
requestStatus.value = res.data.result.requestStatus;
requestId.value = res.data.result.requestId;
document.value = res.data.result.document;
await DataStore.fetchData(res.data.result.items); //
await DataStore.fetchDataInsignia(res.data.result); //
//
// if (res.data.result.items !== null) {
// if (res.data.result.items.length !== 0) {
// hideBottom.value = true;
// } else hideBottom.value = false;
// }
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
}
/**
* function นยนการสงรอบการเสนอขอต เฉพาะ รอบท requestStatus st1 และ st4
*/
function sendToDirector() {
dialogConfirm($q, () => {
showLoader();
http
.get(
config.API.insigniaSendToDirector(
round.value,
DataStore.agency,
"employee"
)
)
.then(async () => {
await fecthStat(round.value);
await fecthInsigniaByOc(
round.value,
DataStore.agency,
"officer",
tab.value
);
await success($q, "บันทึกสำเร็จ");
})
.catch((err) => {
messageError($q, err);
hideLoader();
});
});
}
/**
* function open popup แกไข*
*/
function popupBackToEdit() {
modalPopupBackToEdit.value = true;
}
/**
* function open popup กล admin
*/
function popupBackToInsignia2Role() {
modalbackInsignia2Role.value = true;
}
/**
* funtion นยนการ กลบรอบการเสนอขอ เฉพาะ รอบท requestStatus st3 และ insignia2Role
* @param reason หมายเหตการตกล
*/
function backToEdit(reason: string) {
dialogConfirm(
$q,
() => {
showLoader();
http
.put(
config.API.insigniaDirectorBackToEdit(
round.value,
DataStore.agency,
"employee"
),
{
reason: reason,
}
)
.then(async () => {
await fecthInsigniaByOc(
round.value,
DataStore.agency,
"officer",
tab.value
);
await success($q, "บันทึกสำเร็จ");
modalPopupBackToEdit.value = false;
})
.catch((err) => {
messageError($q, err);
hideLoader();
});
},
"ยืนยันการตีกลับ",
"ต้องการยืนยันการตีกลับใช่หรือไม่?"
);
}
/**
* function นยนการอนรอบการเสนอขอ เฉพาะ รอบท requestStatus st3 และ insignia2Role
*/
function directorApproved() {
dialogConfirm(
$q,
() => {
showLoader();
http
.get(
config.API.insigniaDirectorApproved(
round.value,
DataStore.agency,
"employee"
)
)
.then(async () => {
await fecthInsigniaByOc(
round.value,
DataStore.agency,
"officer",
tab.value
);
await fecthStat(round.value);
await success($q, "บันทึกสำเร็จ");
})
.catch((err) => {
messageError($q, err);
hideLoader();
});
},
"ยืนยันการอนุมัติ",
"ต้องการยืนยันการอนุมัติใช่หรือไม่?"
);
}
/**
* function นยนการตกลบรอบการเสนอขอ เฉพาะ รอบท requestStatus st5 และ adminRole
* @param reason หมายเหตการตกล
*/
function backToEditinsignia2Role(reason: string) {
dialogConfirm($q, () => {
http
.put(
config.API.rejectRequest(round.value, DataStore.typeOc, "employee"),
{
reason: reason,
}
)
.then(async () => {
await fecthInsigniaByOc(
round.value,
DataStore.typeOc,
"officer",
tab.value
);
await success($q, "การตีกลับสำเร็จ");
modalbackInsignia2Role.value = false;
})
.catch((err) => {
messageError($q, err);
});
});
}
/**
* function ปเดตขอมลคณสมบ
*/
async function updateDataProperty() {
dialogConfirm($q, async () => {
showLoader();
await http
.put(config.API.insigniaUpdateProperty, {
insigniaPeriodId: round.value,
agencyId: DataStore.agency,
type: "employee",
})
.then(async () => {
hideLoader();
await fecthInsigniaByOc(
round.value,
DataStore.agency,
"officer",
tab.value
);
success($q, "อัปเดตข้อมูลคุณสมบัติสำเร็จ");
})
.catch((err) => {
messageError($q, err);
hideLoader();
});
});
}
/**
* function ปโหลดไฟลเจาหนาท
* @param event file
*/
async function uploadFile(event: any) {
dialogConfirm($q, async () => {
const selectedFile = event;
const formdata = new FormData();
formdata.append("Document", selectedFile);
await http
.put(config.API.uploadfileOnlyInsignia(requestId.value), formdata)
.then(async () => {
await fecthInsigniaByOc(
round.value,
DataStore.agency,
"officer",
tab.value
);
success($q, "อัปโหลดไฟล์สำเร็จ");
fileUpload.value = null;
})
.catch((err) => {
messageError($q, err);
}),
"ยืนยันการอัปโหลดไฟล์",
"ต้องการยืนยันการอัปโหลดไฟล์นี้หรือไม่ ?";
});
}
/**
* hook
*/
onMounted(async () => {
tab.value = DataStore.mainTab ?? "";
DataStore.employeeClass = "employee"; //
await Promise.all([fecthlistRound(), fecthInsignia(), fetchCheckIsofficer()]);
});
onUnmounted(() => {
DataStore.typeOc = "";
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">
รายชอลกจางประจำ ทธนขอพระราชทานเครองราชอสรยาภรณ
</div>
<q-card
bordered
class="row col-12 q-mt-sm"
v-if="
loadview &&
(DataStore.isDirector || DataStore.isOfficer || DataStore.isStaff)
"
>
<div class="row col-12 items-center bg-grey-1">
<div class="q-pl-md q-pr-sm text-weight-medium text-grey-7">รอบ</div>
<q-select
borderless
dense
v-model="round"
:options="optionRound"
map-options
emit-value
option-value="id"
option-label="name"
@update:model-value="changround"
/>
<q-space />
<!-- ปเดตขอมลคณสมบ -->
<q-btn
v-if="
((DataStore.isOfficer && DataStore.optionsTypeOc.findIndex(
(v: OptionData) => v.id === DataStore.selectOrganization && v.isDeputy === true) > -1) || DataStore.isStaff) &&
DataStore.isLock !== true && (requestStatus == 'st1' || requestStatus == 'st4') &&
checkPermission($route)?.attrIsUpdate
"
dense
unelevated
label="อัปเดตข้อมูลคุณสมบัติ"
color="info"
class="q-px-md q-ml-sm"
@click="updateDataProperty"
>
<q-tooltip>ปเดตขอมลคณสมบ</q-tooltip>
</q-btn>
</div>
<div class="col-12"><q-separator /></div>
<div v-if="DataStore.isOfficer" class="col-12 row bg-white">
<div class="fit q-px-md q-py-sm">
<div class="row col-12 q-col-gutter-sm fit">
<!-- stat -->
<cardTop
:amount="stat.orgAllCount"
label="หน่วยงานทั้งหมด"
color="#016987"
/>
<cardTop
:amount="stat.orgSendCount"
label="หน่วยงานที่ส่งรายชื่อเเล้ว"
color="#02A998"
/>
<cardTop
:amount="stat.orgNoSendCount"
label="หน่วยงานที่ยังไม่ได้ส่งรายชื่อ"
color="#2EA0FF"
/>
<cardTop
:amount="stat.allUserUser"
label="จำนวนคนที่ยื่นขอ"
color="#4154B3"
/>
</div>
</div>
</div>
</q-card>
<q-card v-else>
<div class="q-pa-md q-gutter-sm">
<q-banner inline-actions rounded class="bg-grey-1 text-center">
ไมอมลรอบการเสนอขอพระราชทานเครองราชอสรยาภรณ
</q-banner>
</div>
</q-card>
<q-card
flat
bordered
class="col-12 q-mt-sm"
v-if="
loadview &&
(DataStore.isDirector || DataStore.isOfficer || DataStore.isStaff)
"
>
<div
v-if="
(((DataStore.isOfficer && DataStore.optionsTypeOc.findIndex((v: OptionData) => v.id === DataStore.selectOrganization && v.isDeputy === true) > -1) || DataStore.isStaff) && requestStatus == 'st4') ||
(DataStore.isDirector && requestStatus == 'st5')
"
class="q-pa-md q-gutter-sm"
>
<q-banner
inline-actions
bordered
class="bg-orange-1 text-orange border-orange"
>
<q-icon name="mdi-information-outline" size="20px" /> หมายเหต กล
{{ requestNote }}
</q-banner>
</div>
<q-tabs
v-model="tab"
dense
class="text-grey"
active-color="primary"
active-class="bg-teal-1"
indicator-color="primary"
align="left"
>
<q-tab name="pending" label="ผู้มีคุณสมบัติ" />
<q-tab name="delete" label="ผู้ขาดคุณสมบัติ" />
<q-tab name="reject" label="ผู้ไม่เสนอขอ" />
<q-tab
v-if="DataStore.isOfficer"
name="organization"
label="หน่วยงานที่ยังไม่ได้ส่งรายชื่อ"
/>
</q-tabs>
<div class="col-12"><q-separator /></div>
<q-tab-panels v-model="tab" animated>
<!-- แทบคนทนขอ -->
<q-tab-panel name="pending" class="q-pa-none">
<tab1
:tab="tab"
:round-id="round"
:round-name="roundName"
:fecth-insignia-by-oc="fecthInsigniaByOc"
:request-status="requestStatus"
:fecth-stat="fecthStat"
/>
</q-tab-panel>
<!-- แทบคนทไมนขอ -->
<q-tab-panel name="reject" class="q-pa-none">
<tab2
:tab="tab"
:round-id="round"
:fecth-insignia-by-oc="fecthInsigniaByOc"
/>
</q-tab-panel>
<!-- แทบคนทกลบออก -->
<q-tab-panel name="delete" class="q-pa-none">
<tab3
:tab="tab"
:round-id="round"
:fecth-insignia-by-oc="fecthInsigniaByOc"
/>
</q-tab-panel>
<!-- แทบหนวยงานทงไมไดงรายช -->
<q-tab-panel
v-if="DataStore.isOfficer"
name="organization"
class="q-pa-none"
>
<tab4 :tab="tab" :round-id="round" />
</q-tab-panel>
</q-tab-panels>
<q-toolbar class="q-py-md text-right">
<q-file
v-if="((DataStore.isOfficer && DataStore.optionsTypeOc.findIndex((v: OptionData) => v.id === DataStore.selectOrganization && v.isDeputy === true) > -1) || DataStore.isStaff) && checkPermission($route)?.attrIsUpdate"
bg-color="white"
clearable
outlined
dense
v-model="fileUpload"
accept=".pdf"
:style="fileUpload === null ? 'width: 250px' : 'width: auto'"
label="อัปโหลดไฟล์"
>
<template v-slot:prepend>
<q-icon color="light-blue" name="attach_file" />
<q-tooltip>ปโหลดไฟล</q-tooltip>
</template>
</q-file>
<q-btn
flat
round
color="light-blue"
icon="upload"
@click="uploadFile(fileUpload)"
v-if="fileUpload !== null"
/>
<div v-if="document">
<q-btn
size="md"
icon="mdi-download"
flat
round
color="primary"
v-if="checkPermission($route)?.attrIsGet"
:href="document"
target="_blank"
>
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
<q-btn
v-else-if="checkPermission($route)?.attrIsGet"
color="primary"
icon-right="mdi-download"
label="ดาวน์โหลดไฟล์"
outline
:href="document"
target="_blank"
>
<q-tooltip>ดาวนโหลด</q-tooltip></q-btn
>
</div>
<q-space />
<q-btn
v-if="
!DataStore.isLock &&
((DataStore.isOfficer && DataStore.optionsTypeOc.findIndex(
(v: OptionData) => v.id === DataStore.selectOrganization && v.isDeputy === true) > -1) || DataStore.isStaff) &&
(requestStatus == 'st1' || requestStatus == 'st4') &&
checkPermission($route)?.attrIsUpdate
"
unelevated
label="บันทึกข้อมูล"
color="public"
class="q-px-md"
@click="sendToDirector"
/>
<q-btn
v-if="
!DataStore.isLock &&
DataStore.isDirector &&
(requestStatus == 'st3' || requestStatus == 'st5') &&
checkPermission($route)?.attrIsUpdate
"
unelevated
label="ตีกลับ"
color="orange"
class="q-px-md"
@click="popupBackToEdit"
/>
<q-btn
v-if="
!DataStore.isLock &&
DataStore.isDirector &&
requestStatus == 'st3' &&
checkPermission($route)?.attrIsUpdate
"
unelevated
label="อนุมัติ"
color="positive"
class="q-px-md q-ml-md"
@click="directorApproved"
/>
<q-btn
v-if="
!DataStore.isLock &&
requestStatus == 'st6' &&
DataStore.isOfficer &&
!DataStore.isLock &&
checkPermission($route)?.attrIsUpdate
"
unelevated
label="ตีกลับ"
color="orange"
class="q-px-md"
@click="popupBackToInsignia2Role"
/>
</q-toolbar>
</q-card>
<!-- popup หมายเหต -->
<DialogPopupReason
v-model:modal="modalPopupBackToEdit"
title="หมายเหตุการตีกลับ"
label="หมายเหตุ"
:savaForm="backToEdit"
/>
<DialogPopupReason
v-model:modal="modalbackInsignia2Role"
title="หมายเหตุการตีกลับ"
label="หมายเหตุ"
:savaForm="backToEditinsignia2Role"
/>
</template>
<style lang="scss" scope>
.border-orange {
border: 1px solid #ffa800;
border-radius: 5px;
}
</style>

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,11 @@
import { ref, onMounted, reactive, watch } from "vue";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import {
checkPermission,
checkPermissionList,
checkPermissionCreate,
} from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import { useRegistryEmp } from "@/modules/08_registryEmployee/stores/registry-employee";
import http from "@/plugins/http";
@ -318,7 +322,11 @@ onMounted(async () => {
<q-tooltip>เพมขอม</q-tooltip>
</q-btn>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
v-if="
checkPermission($route)?.attrIsUpdate &&
checkPermissionList(['COMMAND']) &&
checkPermissionCreate('COMMAND')
"
flat
round
color="primary"

View file

@ -144,6 +144,7 @@ async function fetchListTimeRecord() {
keyword: keyword.value.trim(), //keyword
profileType: roleStatus.value.trim(), //keyword
};
showLoader();
await http
.get(
@ -219,10 +220,11 @@ onMounted(async () => {
@update:pagination="updatePaging"
v-model:role-status="roleStatus"
/>
<TableList
:total="total"
:rows="rows.length > 0 ? rows : []"
:page="page"
v-model:page="page"
:rowsPerPage="rowsPerPage"
:maxPage="maxPage"
@update:pagination="updatePaging"

View file

@ -181,7 +181,7 @@ onMounted(async () => {
<TableList
:total="total"
:rows="rows.length > 0 ? rows : []"
:page="page"
v-model:page="page"
:rowsPerPage="rowsPerPage"
:maxPage="maxPage"
@update:pagination="updatePagingProp"

View file

@ -9,15 +9,18 @@ import DialogDetail from "@/modules/09_leave/components/02_WorkList/DialogDetail
import DialogEdit from "@/modules/09_leave/components/02_WorkList/DialogEdit.vue";
const workStore = useWorklistDataStore();
const currentPage = defineModel<number>("page", {
default: 1,
});
const props = defineProps({
rows: {
type: Object,
require: true,
},
page: {
type: Number,
require: true,
},
// page: {
// type: Number,
// require: true,
// },
rowsPerPage: {
type: Number,
require: true,
@ -48,10 +51,10 @@ const dataDetail = ref<any>();
const modalEdit = ref<boolean>(false);
/** pagination */
const currentPage = ref<number>(1);
// const currentPage = ref<number>(1);
const pagination = ref({
descending: false,
page: Number(props.page),
page: Number(currentPage.value),
rowsPerPage: props.rowsPerPage,
});

Some files were not shown because too many files have changed in this diff Show more