รายการลาออก
This commit is contained in:
parent
045bd3aee6
commit
474a856eb0
11 changed files with 285 additions and 165 deletions
|
|
@ -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) =>
|
||||
|
|
@ -190,13 +192,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 = [];
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import http from "@/plugins/http";
|
|||
import config from "@/app.config";
|
||||
import genReport from "@/plugins/genreport";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useRoleWorkflowDataStore } from "@/stores/roleWorkflow";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { useRetirementDataStore } from "@/modules/06_retirement/store/Main";
|
||||
|
||||
|
|
@ -34,6 +35,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 +45,6 @@ const {
|
|||
showLoader,
|
||||
hideLoader,
|
||||
success,
|
||||
|
||||
dialogConfirm,
|
||||
dialogRemove,
|
||||
} = mixin;
|
||||
|
|
@ -54,6 +55,7 @@ const personId = ref<string>("");
|
|||
const roleUser = ref<string>("");
|
||||
const dataProfile = ref<DataProfile>();
|
||||
const approveStep = ref<string>("");
|
||||
const group = ref<string>("");
|
||||
|
||||
// const approveCheck = computed(() => {
|
||||
// return (
|
||||
|
|
@ -309,7 +311,10 @@ function diffDate() {
|
|||
return false;
|
||||
}
|
||||
|
||||
/** นำข้อมูลมาจาก API*/
|
||||
/**
|
||||
* ฟังก์ชันดึงข้อมูลรายละเอียดการลาออก
|
||||
* @param id id ของผู้ใช้งาน
|
||||
*/
|
||||
async function fetchData(id: string) {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -346,6 +351,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 = {
|
||||
|
|
@ -361,7 +367,11 @@ async function fetchData(id: string) {
|
|||
});
|
||||
}
|
||||
|
||||
/**Pop up */
|
||||
/**
|
||||
* ฟังก์ชันเปิด pop up อนุญาตหรือยับยั้ง
|
||||
* @param action action อนุญาตหรือยับยั้ง
|
||||
* @param type ประเภทผู้ใช้งาน
|
||||
*/
|
||||
function popUp(action: "pass" | "passNot", type: string) {
|
||||
reasonReign.value = "";
|
||||
dateBreak.value = null;
|
||||
|
|
@ -370,7 +380,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");
|
||||
|
|
@ -396,7 +409,10 @@ function onSubmit(type: string) {
|
|||
// }
|
||||
}
|
||||
|
||||
//pop up ยืนยันการอนุญาต
|
||||
/**
|
||||
* ฟังก์ชันยืนยันการอนุญาต
|
||||
* @param path path สำหรับการอนุญาต
|
||||
*/
|
||||
async function confirmpopUp(path: string) {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
|
|
@ -427,7 +443,10 @@ async function confirmpopUp(path: string) {
|
|||
);
|
||||
}
|
||||
|
||||
//pop up การยับยั้งสำเร็จ
|
||||
/**
|
||||
* ฟังก์ชันยืนยันการยับยั้ง
|
||||
* @param path path สำหรับการยับยั้ง
|
||||
*/
|
||||
async function rejectpopUp(path: string) {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
|
|
@ -459,9 +478,7 @@ async function rejectpopUp(path: string) {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* กดยกเลิก
|
||||
*/
|
||||
/** ฟังก์ชันยกเลิกการแก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย*/
|
||||
async function clickCancel() {
|
||||
edit.value = false;
|
||||
const data = dataDetail.value;
|
||||
|
|
@ -483,15 +500,14 @@ async function clickCancel() {
|
|||
}
|
||||
myForm.value?.resetValidation();
|
||||
}
|
||||
/**
|
||||
* กดยกเลิก
|
||||
*/
|
||||
|
||||
/** ฟังก์ชันยกเลิกการแก้ไขข้อมูลรายการตรวจสอบเงื่อนไขต่างๆ*/
|
||||
async function clickCancelConditions() {
|
||||
await fetchData(id.value);
|
||||
conditions.value = false;
|
||||
}
|
||||
|
||||
/** Function บันทึก รายการตรวจสอบเงื่อนไขต่างๆ*/
|
||||
/** ฟังก์ชันบันทึกเงื่อนไขต่างๆ*/
|
||||
function onSubmitConditions() {
|
||||
dialogConfirm($q, () => {
|
||||
showLoader();
|
||||
|
|
@ -515,7 +531,7 @@ function onSubmitConditions() {
|
|||
});
|
||||
}
|
||||
|
||||
/** Function บันทึก ,แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย*/
|
||||
/** ฟังก์ชันบันทึกข้อมูลเพื่อลงบัญชีแนบท้าย*/
|
||||
function onSubmitAttached() {
|
||||
dialogConfirm($q, () => {
|
||||
const formData = new FormData();
|
||||
|
|
@ -550,7 +566,7 @@ function onSubmitAttached() {
|
|||
}
|
||||
|
||||
/**
|
||||
* Function เพิ่ม Class เวลา Edit
|
||||
* ฟังก์ชันเปลี่ยน Class
|
||||
* @param val เมื่อเป็นEdit จะเปลี่ยน Class
|
||||
*/
|
||||
function getClass(val: boolean) {
|
||||
|
|
@ -560,16 +576,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();
|
||||
|
|
@ -673,7 +679,7 @@ async function downloadFiles(fileName: string) {
|
|||
}
|
||||
|
||||
/**
|
||||
* ลบไฟล์
|
||||
* ฟังก์ชันลบไฟล์
|
||||
* @param id id file
|
||||
*/
|
||||
function removeFile(fileName: string) {
|
||||
|
|
@ -719,47 +725,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 +784,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();
|
||||
|
|
@ -1025,11 +1035,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 +1117,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 +1176,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
|
||||
|
|
@ -1243,8 +1260,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"
|
||||
|
|
@ -1316,12 +1338,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 +1357,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 +1405,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 +1428,13 @@ onMounted(async () => {
|
|||
<div
|
||||
class="q-gutter-x-sm"
|
||||
v-if="
|
||||
approveStep == 'st3' &&
|
||||
!checkRoutePermisson &&
|
||||
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 +1515,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 +1559,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
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ 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 {
|
||||
|
|
@ -26,6 +27,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 == "resignDetailReject");
|
||||
const mixin = useCounterMixin();
|
||||
|
|
@ -406,16 +408,13 @@ function onAddPerson(type: string) {
|
|||
}
|
||||
|
||||
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() {
|
||||
|
|
@ -456,7 +455,7 @@ async function fetchKeycloakPosition() {
|
|||
/** Hook */
|
||||
onMounted(async () => {
|
||||
await fetchData(id.value);
|
||||
await fetchKeycloakPosition()
|
||||
await fetchKeycloakPosition();
|
||||
await checkOfficer();
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ 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,
|
||||
|
|
@ -35,6 +36,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();
|
||||
|
|
@ -384,7 +386,14 @@ 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"
|
||||
),
|
||||
body
|
||||
)
|
||||
.then(async () => {
|
||||
await fetchData(id.value);
|
||||
closeModal();
|
||||
|
|
@ -413,7 +422,14 @@ 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"
|
||||
),
|
||||
body
|
||||
)
|
||||
.then(async () => {
|
||||
await fetchData(id.value);
|
||||
closeModal();
|
||||
|
|
@ -698,16 +714,13 @@ function onAddPerson(type: string) {
|
|||
}
|
||||
|
||||
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() {
|
||||
|
|
|
|||
|
|
@ -1,22 +1,17 @@
|
|||
<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 {
|
||||
|
|
@ -34,6 +29,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 == "resignDetailRejectEMP");
|
||||
const mixin = useCounterMixin();
|
||||
|
|
@ -423,16 +419,13 @@ function onAddPerson(type: string) {
|
|||
}
|
||||
|
||||
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() {
|
||||
|
|
@ -472,7 +465,11 @@ async function fetchKeycloakPosition() {
|
|||
|
||||
/** Hook */
|
||||
onMounted(async () => {
|
||||
await Promise.all([await fetchKeycloakPosition(),fetchData(id.value), checkOfficer()]);
|
||||
await Promise.all([
|
||||
await fetchKeycloakPosition(),
|
||||
fetchData(id.value),
|
||||
checkOfficer(),
|
||||
]);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -134,7 +134,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,7 +146,7 @@ function onSubmit() {
|
|||
keycloakId: items.keycloakId,
|
||||
}));
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.post(
|
||||
config.API.addResign(
|
||||
(props.profileType?.toLocaleLowerCase() as string) == "officer"
|
||||
|
|
@ -157,10 +157,10 @@ function onSubmit() {
|
|||
),
|
||||
body
|
||||
)
|
||||
.then((res) => {
|
||||
.then(async () => {
|
||||
await props.getData?.(pageId.value);
|
||||
closeDialog();
|
||||
success($q, "บันทึกสำเร็จ");
|
||||
props.getData?.(pageId.value);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -179,6 +179,7 @@ function closeDialog() {
|
|||
modal.value = false;
|
||||
rows.value = [];
|
||||
selected.value = [];
|
||||
keyword.value = "";
|
||||
}
|
||||
|
||||
watch(
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import genReport from "@/plugins/genreport";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { useRoleWorkflowDataStore } from "@/stores/roleWorkflow";
|
||||
|
||||
/** importType */
|
||||
import type { FremData } from "@/modules/09_leave/interface/request/leave";
|
||||
|
|
@ -38,6 +39,7 @@ import DialogAddCommander from "@/modules/09_leave/components/05_Leave/Dialog/Di
|
|||
/** use */
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { fetchDataCheckIsoffice } = useRoleWorkflowDataStore();
|
||||
const {
|
||||
dialogConfirm,
|
||||
showLoader,
|
||||
|
|
@ -426,10 +428,7 @@ function checkLeaveType(leaveTypeId: string, formData: FremData) {
|
|||
checkForm.value = "FormHajj";
|
||||
} else if (type === "LV-007") {
|
||||
checkForm.value = "FormCheckSelect";
|
||||
} else if (
|
||||
type === "LV-008" &&
|
||||
formData.leaveSubTypeName === "ศึกษาต่อ"
|
||||
) {
|
||||
} else if (type === "LV-008" && formData.leaveSubTypeName === "ศึกษาต่อ") {
|
||||
checkForm.value = "FormStudy";
|
||||
} else if (
|
||||
(type === "LV-008" && formData.leaveSubTypeName === "ฝึกอบรม") ||
|
||||
|
|
@ -615,23 +614,19 @@ function onSend() {
|
|||
}
|
||||
|
||||
async function checkOfficer() {
|
||||
http
|
||||
.get(
|
||||
config.API.checkIsofficer +
|
||||
`${
|
||||
formData.profileType == "OFFICER"
|
||||
? "SYS_LEAVE_LIST"
|
||||
: "SYS_LEAVE_LIST_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(
|
||||
`${
|
||||
formData.profileType == "OFFICER"
|
||||
? "SYS_LEAVE_LIST"
|
||||
: "SYS_LEAVE_LIST_EMP"
|
||||
}`
|
||||
);
|
||||
isOfficer.value = data.isOfficer;
|
||||
isStaff.value = data.isStaff;
|
||||
} catch (err) {
|
||||
messageError($q, err);
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchKeycloakPosition() {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import genReport from "@/plugins/genreport";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { useRoleWorkflowDataStore } from "@/stores/roleWorkflow";
|
||||
|
||||
/** importType */
|
||||
import type {
|
||||
|
|
@ -35,6 +36,7 @@ import FormVocationalRehabilitation from "@/modules/09_leave/components/05_Leave
|
|||
|
||||
/** use */
|
||||
const $q = useQuasar();
|
||||
const { fetchDataCheckIsoffice } = useRoleWorkflowDataStore();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
dialogConfirm,
|
||||
|
|
@ -450,23 +452,19 @@ async function onClickDownloadFile(id: string, fileName: string, type: string) {
|
|||
}
|
||||
|
||||
async function checkOfficer() {
|
||||
http
|
||||
.get(
|
||||
config.API.checkIsofficer +
|
||||
`${
|
||||
formData.profileType == "OFFICER"
|
||||
? "SYS_LEAVE_LIST"
|
||||
: "SYS_LEAVE_LIST_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(
|
||||
`${
|
||||
formData.profileType == "OFFICER"
|
||||
? "SYS_LEAVE_LIST"
|
||||
: "SYS_LEAVE_LIST_EMP"
|
||||
}`
|
||||
);
|
||||
isOfficer.value = data.isOfficer;
|
||||
isStaff.value = data.isStaff;
|
||||
} catch (err) {
|
||||
messageError($q, err);
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchKeycloakPosition() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue