รายการลาออก
This commit is contained in:
parent
2c3be4c51e
commit
e2e24b7717
9 changed files with 231 additions and 132 deletions
|
|
@ -9,6 +9,7 @@ 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 DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
|
|
@ -31,6 +32,9 @@ import DialogAddCommander from "@/modules/06_retirement/components/DialogAddComm
|
|||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const store = useRetirementDataStore();
|
||||
const { convertStatusText } = store;
|
||||
const checkRoutePermisson = ref<boolean>(route.name == "resignDetailbyid");
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
|
|
@ -49,11 +53,14 @@ 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"
|
||||
(commander) =>
|
||||
commander.approveStatus === "APPROVE" ||
|
||||
commander.approveStatus === "REJECT"
|
||||
) ?? false
|
||||
);
|
||||
});
|
||||
|
|
@ -97,7 +104,9 @@ const approvePendingCheck = computed(() => {
|
|||
|
||||
const previousApproved = commanders
|
||||
.slice(0, index)
|
||||
.every((c) => c.approveStatus === "APPROVE");
|
||||
.every(
|
||||
(c) => c.approveStatus === "APPROVE" || c.approveStatus === "REJECT"
|
||||
);
|
||||
return previousApproved;
|
||||
});
|
||||
const isOfficer = ref<boolean>(false);
|
||||
|
|
@ -141,20 +150,11 @@ const columnsCommanders = ref<QTableProps["columns"]>([
|
|||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "org",
|
||||
align: "left",
|
||||
label: "สังกัด",
|
||||
sortable: true,
|
||||
field: "org",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "สถานะ",
|
||||
name: "approveStatus",
|
||||
align: "left",
|
||||
label: "สถานะ",
|
||||
sortable: true,
|
||||
field: "สถานะ",
|
||||
field: "approveStatus",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
|
|
@ -175,6 +175,9 @@ const columnsCommanders = ref<QTableProps["columns"]>([
|
|||
sortable: true,
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
format(val, row) {
|
||||
return `${row.rejectDate ? date2Thai(row.rejectDate) : "-"}`;
|
||||
},
|
||||
},
|
||||
]);
|
||||
const id = ref<string>(route.params.id.toString());
|
||||
|
|
@ -341,7 +344,8 @@ async function fetchData(id: string) {
|
|||
isNoDebt.value = data.isNoDebt;
|
||||
isNoBurden.value = data.isNoBurden;
|
||||
isDiscipline.value = data.isDiscipline;
|
||||
|
||||
statusCheck.value = data.status;
|
||||
approveStep.value = data.approveStep;
|
||||
profileType.value = data.profileType;
|
||||
keycloakUserId.value = data.keycloakUserId;
|
||||
rowsApprover.value = {
|
||||
|
|
@ -367,16 +371,24 @@ function popUp(action: "pass" | "passNot", type: string) {
|
|||
}
|
||||
|
||||
//เงื่อนไขpop up
|
||||
function onSubmit() {
|
||||
function onSubmit(type: string) {
|
||||
if (actionPass.value) {
|
||||
confirmpopUp();
|
||||
if (type !== "approver") {
|
||||
confirmpopUp("/comander");
|
||||
} else {
|
||||
confirmpopUp("");
|
||||
}
|
||||
} else {
|
||||
rejectpopUp();
|
||||
if (type !== "approver") {
|
||||
rejectpopUp("/comander");
|
||||
} else {
|
||||
rejectpopUp("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//pop up ยืนยันการอนุญาต
|
||||
async function confirmpopUp() {
|
||||
async function confirmpopUp(path: string) {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
|
|
@ -385,7 +397,10 @@ async function confirmpopUp() {
|
|||
reason: reasonReign.value,
|
||||
};
|
||||
await http
|
||||
.put(config.API.resignConfirm(roleUser.value, id.value), body)
|
||||
.put(
|
||||
config.API.commanderApproveRetirement("", id.value, "approve", path),
|
||||
body
|
||||
)
|
||||
.then(async () => {
|
||||
await fetchData(id.value);
|
||||
closeModal();
|
||||
|
|
@ -404,7 +419,7 @@ async function confirmpopUp() {
|
|||
}
|
||||
|
||||
//pop up การยับยั้งสำเร็จ
|
||||
async function rejectpopUp() {
|
||||
async function rejectpopUp(path: string) {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
|
|
@ -414,7 +429,10 @@ async function rejectpopUp() {
|
|||
date: dateBreak.value,
|
||||
};
|
||||
await http
|
||||
.put(config.API.resignReject(roleUser.value, id.value), body)
|
||||
.put(
|
||||
config.API.commanderApproveRetirement("", id.value, "reject", path),
|
||||
body
|
||||
)
|
||||
.then(async () => {
|
||||
await fetchData(id.value);
|
||||
closeModal();
|
||||
|
|
@ -717,10 +735,10 @@ function onSend() {
|
|||
() => {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.sendApprove(id.value))
|
||||
.get(config.API.sendApproveRetirement("", id.value))
|
||||
.then(async (res) => {
|
||||
await fetchData(id.value);
|
||||
await fetchFile();
|
||||
await fetchData(id.value);
|
||||
success($q, "ส่งไปพิจารณา");
|
||||
})
|
||||
.catch((e) => {
|
||||
|
|
@ -733,11 +751,26 @@ function onSend() {
|
|||
);
|
||||
}
|
||||
|
||||
async function fetchKeycloakPosition() {
|
||||
if (keycloakId.value == "") {
|
||||
await http
|
||||
.get(config.API.keycloakPosition())
|
||||
.then(async (res) => {
|
||||
const data = await res.data.result;
|
||||
keycloakId.value = data.profileId;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** Hook */
|
||||
onMounted(async () => {
|
||||
showLoader();
|
||||
await Promise.all([
|
||||
await fetchData(id.value),
|
||||
await fetchKeycloakPosition(),
|
||||
await checkOfficer(),
|
||||
fetchFile(),
|
||||
]).finally(() => {
|
||||
|
|
@ -1202,7 +1235,7 @@ onMounted(async () => {
|
|||
</div>
|
||||
<!-- ตัวอย่างเช็คของ การลา -->
|
||||
<q-btn
|
||||
v-if="statusCheck == 'NEW' && (isOfficer || isStaff)"
|
||||
v-if="statusCheck == 'WAITTING' && (isOfficer || isStaff)"
|
||||
flat
|
||||
round
|
||||
icon="add"
|
||||
|
|
@ -1276,6 +1309,7 @@ onMounted(async () => {
|
|||
props.row.approveStatus == 'PENDING' &&
|
||||
props.row.comment == ''
|
||||
"
|
||||
class="q-gutter-x-xs"
|
||||
>
|
||||
<q-btn
|
||||
:disable="
|
||||
|
|
@ -1324,6 +1358,13 @@ onMounted(async () => {
|
|||
{{ props.row.comment ? props.row.comment : "-" }}
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="col.name == 'approveStatus'">
|
||||
{{
|
||||
props.row.approveStatus
|
||||
? convertStatusText(props.row.approveStatus)
|
||||
: "-"
|
||||
}}
|
||||
</div>
|
||||
<div v-else>
|
||||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
|
|
@ -1340,9 +1381,8 @@ onMounted(async () => {
|
|||
<div class="q-pl-sm text-weight-bold text-dark">
|
||||
ผลการพิจารณาของผู้มีอำนาจ
|
||||
</div>
|
||||
|
||||
<q-btn
|
||||
v-if="statusCheck == 'NEW' && (isOfficer || isStaff)"
|
||||
v-if="statusCheck == 'WAITTING' && (isOfficer || isStaff)"
|
||||
flat
|
||||
round
|
||||
icon="add"
|
||||
|
|
@ -1360,8 +1400,7 @@ onMounted(async () => {
|
|||
class="q-gutter-x-sm"
|
||||
v-if="
|
||||
checkPermission($route)?.attrIsUpdate &&
|
||||
dataDetail.oligarchReject === null &&
|
||||
dataDetail.statusMain === 'WAITTING' &&
|
||||
approveStep == 'st3' &&
|
||||
rowsApprover &&
|
||||
rowsApprover.approvers &&
|
||||
rowsApprover.approvers[0]?.profileId == keycloakId &&
|
||||
|
|
@ -1408,8 +1447,10 @@ onMounted(async () => {
|
|||
<div class="col-12 text-top">สถานะ</div>
|
||||
<div class="col-12 text-detail">
|
||||
{{
|
||||
dataDetail.oligarchReject !== null
|
||||
? statusOrder(dataDetail.oligarchReject)
|
||||
rowsApprover &&
|
||||
rowsApprover.approvers &&
|
||||
rowsApprover.approvers[0]?.approveStatus
|
||||
? convertStatusText(rowsApprover?.approvers[0].approveStatus)
|
||||
: "-"
|
||||
}}
|
||||
</div>
|
||||
|
|
@ -1418,8 +1459,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>
|
||||
|
|
@ -1428,9 +1471,11 @@ 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>
|
||||
|
|
@ -1441,7 +1486,7 @@ onMounted(async () => {
|
|||
<q-card
|
||||
bordered
|
||||
class="row col-12 text-dark q-mt-sm q-pa-sm"
|
||||
v-if="statusCheck == 'NEW' && (isOfficer || isStaff)"
|
||||
v-if="statusCheck == 'WAITTING' && (isOfficer || isStaff)"
|
||||
>
|
||||
<q-btn
|
||||
@click="onSend"
|
||||
|
|
@ -1707,7 +1752,7 @@ onMounted(async () => {
|
|||
|
||||
<q-dialog v-model="modal" persistent>
|
||||
<q-card style="width: 800px">
|
||||
<q-form greedy @submit.prevent @validation-success="onSubmit">
|
||||
<q-form greedy @submit.prevent @validation-success="onSubmit('approver')">
|
||||
<DialogHeader
|
||||
:tittle="`${actionPass ? 'อนุญาตการลาออก' : 'ยับยั้งการลาออก'}`"
|
||||
:close="closeModal"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue