พ้นจากราชการ => ถึงแก่กรรม

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-05-03 13:24:48 +07:00
parent 79a6e52973
commit 932a8a930e
8 changed files with 362 additions and 517 deletions

View file

@ -7,12 +7,21 @@ import type { ResponseItems } from "@/modules/06_retirement/interface/response/M
import DialogHeader from "@/modules/06_retirement/components/DialogHeader.vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useTransferDataStore } from "@/modules/05_placement/store";
/** use */
const $q = useQuasar();
const { statusText } = useTransferDataStore();
const selected = ref<ResponseItems[]>([]);
const mixin = useCounterMixin();
const { showLoader, success, messageError, dialogConfirm, hideLoader } = mixin;
const {
showLoader,
success,
messageError,
dialogConfirm,
hideLoader,
findOrgName,
} = mixin;
/** คอลัมน์ */
const columns2 = ref<QTableProps["columns"]>([
@ -33,6 +42,9 @@ const columns2 = ref<QTableProps["columns"]>([
field: "fullname",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return `${row.prefix}${row.firstName} ${row.lastName}`;
},
},
{
name: "position",
@ -46,29 +58,44 @@ const columns2 = ref<QTableProps["columns"]>([
{
name: "positionLevel",
align: "left",
label: "ระดับ",
label: "ประเภทตำแหน่ง",
sortable: true,
field: "positionLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
let name = "";
if (row.posTypeName && row.posLevelName) {
name = `${row.posTypeName} (${row.posLevelName})`;
} else if (row.posTypeName) {
name = `${row.posTypeName}`;
} else if (row.posLevelName) {
name = `(${row.posLevelName})`;
} else name = "-";
return name;
},
},
{
name: "organizationPositionOld",
name: "org",
align: "left",
label: "สังกัด",
sortable: true,
field: "organizationPositionOld",
field: "org",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return findOrgName(row);
},
},
{
name: "statustext",
name: "status",
align: "left",
label: "สถานะ",
sortable: true,
field: "statustext",
field: "status",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val) => statusText(val),
},
]);
@ -78,16 +105,15 @@ const visibleColumns2 = ref<string[]>([
"fullname",
"position",
"positionLevel",
"positionNumberOld",
"organizationPositionOld",
"statustext",
"org",
"status",
]);
/** props*/
const props = defineProps({
modal: Boolean,
closeModal: Function,
getData: Function,
fecthlistRecevice: Function,
rows2: Array,
filterKeyword2: String,
});
@ -128,7 +154,7 @@ const Ordersave = async () => {
messageError($q, e);
})
.finally(async () => {
props.getData?.();
props.fecthlistRecevice?.();
hideLoader();
});
};
@ -224,31 +250,15 @@ watchEffect(() => {
v-model="props.selected"
/>
</q-td>
<q-td key="no" :props="props">
{{ props.rowIndex + 1 }}
</q-td>
<q-td key="fullname" :props="props">
{{ props.row.fullname }}
</q-td>
<q-td key="position" :props="props">
{{ props.row.position }}
</q-td>
<q-td key="positionLevel" :props="props">
{{ props.row.positionLevel }}
</q-td>
<q-td key="organizationPositionOld" :props="props">
<div class="table_ellipsis">
{{ props.row.organizationPositionOld }}
<q-td v-for="col in props.cols" :key="col.id">
<div v-if="col.name === 'no'">
{{ props.rowIndex + 1 }}
</div>
</q-td>
<q-td key="organization" :props="props">
<div class="table_ellipsis">
{{ props.row.organization }}
<div v-else :class="col.name === 'org' ? 'table_ellipsis' : ''">
{{ col.value ? col.value : "-" }}
</div>
</q-td>
<q-td key="statustext" :props="props">
{{ props.row.statustext }}
</q-td>
</q-tr>
</template>
</d-table>

View file

@ -22,6 +22,7 @@ const {
hideLoader,
success,
dialogMessage,
findOrgName,
} = mixin;
const { statusText } = transferStore;
const modal = ref<boolean>(false);
@ -32,9 +33,9 @@ const visibleColumns = ref<string[]>([
"fullname",
"position",
"positionLevel",
"organizationPositionOld",
"org",
"createdAt",
"statustext",
"status",
]);
//
@ -64,6 +65,9 @@ const columns = ref<QTableProps["columns"]>([
field: "fullname",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return `${row.prefix}${row.firstName} ${row.lastName}`;
},
},
{
name: "position",
@ -77,20 +81,34 @@ const columns = ref<QTableProps["columns"]>([
{
name: "positionLevel",
align: "left",
label: "ระดับ",
label: "ประเภทตำแหน่ง",
sortable: true,
field: "positionLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
let name = "";
if (row.posTypeName && row.posLevelName) {
name = `${row.posTypeName} (${row.posLevelName})`;
} else if (row.posTypeName) {
name = `${row.posTypeName}`;
} else if (row.posLevelName) {
name = `(${row.posLevelName})`;
} else name = "-";
return name;
},
},
{
name: "organizationPositionOld",
name: "org",
align: "left",
label: "สังกัด",
sortable: true,
field: "organizationPositionOld",
field: "org",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return findOrgName(row);
},
},
{
name: "createdAt",
@ -100,15 +118,17 @@ const columns = ref<QTableProps["columns"]>([
field: "createdAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val) => date2Thai(val),
},
{
name: "statustext",
name: "status",
align: "left",
label: "สถานะ",
sortable: true,
field: "statustext",
field: "status",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val) => statusText(val),
},
]);
onMounted(async () => {
@ -140,33 +160,8 @@ const getData = async () => {
.get(config.API.retirementOut)
.then((res: any) => {
const data = res.data.result;
let list: ResponseData[] = [];
data.map((r: ResponseData) => {
list.push({
createdAt: date2Thai(r.createdAt),
date: r.date,
firstName: r.firstName ?? "",
id: r.id ?? "",
isActive: r.isActive ? r.isActive : false,
lastName: r.lastName ?? "",
organization: r.organization ?? "",
organizationPositionOld: r.organizationPositionOld ?? "",
posNo: r.posNo ?? "",
position: r.position ?? "",
positionLevel: r.positionLevel ?? "",
positionLevelOld: r.positionLevelOld ?? "",
positionNumberOld: r.positionNumberOld ?? "",
positionTypeOld: r.positionTypeOld ?? "",
prefix: r.prefix ?? "",
reason: r.reason ?? "",
salary: r.salary ? r.salary : 0,
status: r.status ?? "",
statustext: statusText(r.status ?? ""),
fullname: `${r.prefix ?? ""}${r.firstName ?? ""} ${r.lastName ?? ""}`,
});
});
rows.value = list;
filters.value = list;
rows.value = data;
filters.value = data;
})
.catch((e) => {
messageError($q, e);
@ -192,7 +187,7 @@ const clickDelete = async (id: string) => {
const deleteData = async (id: string) => {
await http
.delete(config.API.outByid(id))
.then((res) => {
.then(() => {
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((e) => {
@ -295,70 +290,38 @@ const pagination = ref({
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td
key="no"
:props="props"
v-for="col in props.cols"
:key="col.id"
@click="router.push(`/retirement/out/${props.row.id}`)"
>
{{ props.rowIndex + 1 }}
</q-td>
<q-td
key="fullname"
:props="props"
@click="router.push(`/retirement/out/${props.row.id}`)"
>
{{ props.row.fullname }}
</q-td>
<q-td
key="position"
:props="props"
@click="router.push(`/retirement/out/${props.row.id}`)"
>
{{ props.row.position }}
</q-td>
<q-td
key="positionLevel"
:props="props"
@click="router.push(`/retirement/out/${props.row.id}`)"
>
{{ props.row.positionLevel }}
</q-td>
<q-td
key="organizationPositionOld"
:props="props"
@click="router.push(`/retirement/out/${props.row.id}`)"
>
<div class="table_ellipsis">
{{ props.row.organizationPositionOld }}
<div v-if="col.name === 'no'">
{{ props.rowIndex + 1 }}
</div>
<div
v-else
:class="col.name === 'org' ? 'table_ellipsis' : ''"
>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
<q-td
key="organization"
:props="props"
@click="router.push(`/retirement/out/${props.row.id}`)"
>
<div class="table_ellipsis">
{{ props.row.organization }}
</div>
</q-td>
<q-td key="createdAt" :props="props">
{{ props.row.createdAt }}
</q-td>
<q-td key="statustext" :props="props">
{{ props.row.statustext }}
</q-td>
<q-td auto-width>
<q-btn
v-if="
props.row.status !== 'DONE' &&
props.row.status !== 'REPORT'
"
dense
size="12px"
flat
round
color="red"
:color="
props.row.status == 'REPORT' || props.row.status == 'DONE'
? 'grey'
: 'red-7'
"
@click="clickDelete(props.row.id)"
icon="mdi-delete"
:disable="
props.row.status == 'REPORT' || props.row.status == 'DONE'
"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>

View file

@ -10,11 +10,11 @@ import keycloak from "@/plugins/keycloak";
/**Import type */
import type { QForm } from "quasar";
import type { ResponseDataDetail } from "@/modules/06_retirement/interface/response/expulsion";
import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue";
import type { DataProfile } from "@/modules/05_placement/interface/index/Main";
/** importComponents*/
import CardProfile from "@/components/CardProfile.vue";
const modalPersonal = ref<boolean>(false);
const personId = ref<string>("");
/** use */
const $q = useQuasar();
const route = useRoute();
@ -28,6 +28,7 @@ const {
showLoader,
hideLoader,
success,
findOrgName,
} = mixin;
/**
@ -44,30 +45,10 @@ const salary = ref<number>(0);
const organization = ref<string>("");
const date = ref<Date | null>(null);
const reason = ref<string>("");
const responseData = ref<ResponseDataDetail>({
personId: "",
avataPath: "",
createdAt: new Date(),
date: new Date(),
id: "",
organization: "",
organizationPositionOld: "",
positionLevelOld: "",
positionNumberOld: "",
positionTypeOld: "",
reason: "",
salary: 0,
status: "",
fullname: "",
});
const dataProfile = ref<DataProfile>();
/** Hook */
onMounted(async () => {
if (keycloak.tokenParsed != null) {
roleAdmin.value = await keycloak.tokenParsed.role.includes("placement1");
}
await getData();
});
const fullName = ref<string>("");
const status = ref<string>("");
// API
const getData = async () => {
@ -76,26 +57,16 @@ const getData = async () => {
.get(config.API.outByid(dataId))
.then((res) => {
const data = res.data.result;
responseData.value.personId = data.profileId;
responseData.value.createdAt = data.createdAt;
responseData.value.date =
data.date !== null ? new Date(data.date) : new Date();
responseData.value.id = data.id ?? "";
responseData.value.organization = data.organization ?? "";
responseData.value.organizationPositionOld =
data.organizationPositionOld ?? "";
responseData.value.positionLevelOld = data.positionLevelOld ?? "";
responseData.value.positionNumberOld = data.positionNumberOld ?? "";
responseData.value.positionTypeOld = data.positionTypeOld ?? "";
responseData.value.reason = data.reason ?? "";
responseData.value.salary = data.salary !== null ? data.salary : 0;
responseData.value.status = data.status ?? "";
responseData.value.avataPath = data.avatar ?? "";
responseData.value.fullname = `${data.firstName ?? "-"} ${
dataProfile.value = data as DataProfile;
fullName.value = `${data.prefix}${data.firstName ?? "-"} ${
data.lastName ?? "-"
}`;
status.value = data.status;
organizationPositionOld.value = data.organizationPositionOld
? data.organizationPositionOld
: findOrgName(data);
organizationPositionOld.value = data.organizationPositionOld ?? "";
positionTypeOld.value = data.positionTypeOld ?? "";
positionLevelOld.value = data.positionLevelOld ?? "";
posNo.value = data.positionNumberOld ?? "";
@ -118,58 +89,48 @@ const getData = async () => {
const clickCancel = async () => {
await getData();
edit.value = false;
};
/**
* งก Save
*/
const conditionSave = async () => {
if (myForm.value !== null) {
myForm.value.validate().then((success) => {
if (success) {
dialogMessage(
$q,
"ต้องการแก้ไขข้อมูลหรือไม่?",
"แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย",
"mdi-help-circle-outline",
"ตกลง",
"public",
async () => await saveData(),
undefined
);
}
});
}
myForm.value?.resetValidation();
};
/**
* งก Saveจาก API
*/
const saveData = async () => {
const body = {
organization: organization.value,
reason: reason.value,
organizationPositionOld: organizationPositionOld.value,
date: date.value,
positionTypeOld: positionTypeOld.value,
positionLevelOld: positionLevelOld.value,
positionNumberOld: posNo.value,
amountOld: salary.value,
};
showLoader();
await http
.put(config.API.outByid(dataId), body)
.then((res: any) => {
success($q, "แก้ไขข้อมูลเพื่อลงบัญชีแนบท้ายสำเร็จ");
edit.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await getData();
hideLoader();
});
const onSubmit = async () => {
dialogMessage(
$q,
"ต้องการแก้ไขข้อมูลหรือไม่?",
"แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย",
"mdi-help-circle-outline",
"ตกลง",
"public",
async () => {
const body = {
organizationPositionOld: organizationPositionOld.value,
positionTypeOld: positionTypeOld.value,
positionLevelOld: positionLevelOld.value,
positionNumberOld: posNo.value,
amountOld: salary.value,
organization: organization.value,
reason: reason.value,
date: date.value,
};
showLoader();
await http
.put(config.API.outByid(dataId), body)
.then(() => {
success($q, "แก้ไขข้อมูลเพื่อลงบัญชีแนบท้ายสำเร็จ");
edit.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await getData();
hideLoader();
});
},
undefined
);
};
/**
@ -183,14 +144,13 @@ const getClass = (val: boolean) => {
};
};
function onclickViewinfo(id: string) {
modalPersonal.value = true;
personId.value = id;
}
function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal;
}
/** Hook */
onMounted(async () => {
if (keycloak.tokenParsed != null) {
roleAdmin.value = await keycloak.tokenParsed.role.includes("placement1");
}
await getData();
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">
@ -204,109 +164,61 @@ function updatemodalPersonal(modal: boolean) {
class="q-mr-sm"
@click="router.go(-1)"
/>
รายละเอยดการใหออกของ {{ responseData.fullname }}
รายละเอยดการใหออกของ {{ fullName }}
</div>
<q-card bordered class="row col-12 text-dark">
<div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
<div class="q-pl-sm text-weight-bold text-subtitle2">
{{ responseData.fullname }}
</div>
<q-space />
<q-btn
outline
color="blue"
dense
icon-right="mdi-open-in-new"
class="q-px-sm"
label="ดูข้อมูลทะเบียนประวัติ"
@click="onclickViewinfo(responseData.personId)"
/>
</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-3 col-sm-2 col-md-1 row">
<q-img
:src="responseData.avataPath"
v-if="responseData.avataPath !== ''"
/>
<q-img src="@/assets/avatar_user.jpg" v-else />
</div>
<div class="col-xs-6 col-sm-3 row items-center">
<div class="col-12 q-pl-md">
<div class="col-12 text-top">ตำแหนงในสายงาน</div>
<div class="col-12 text-detail">
{{ responseData.positionTypeOld }}
</div>
</div>
</div>
<div class="col-xs-6 col-sm-3 row items-center">
<div class="col-12">
<div class="col-12 text-top">ระด</div>
<div class="col-12 text-detail">
{{ responseData.positionLevelOld }}
</div>
</div>
</div>
<div class="col-xs-6 col-sm-3 row items-center">
<div class="col-12">
<div class="col-12 text-top">งก</div>
<div class="col-12 text-detail">
{{ responseData.organizationPositionOld }}
</div>
</div>
</div>
</div>
</div>
</q-card>
<CardProfile :data="dataProfile as DataProfile" />
<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
v-if="
responseData.status !== 'DONE' && responseData.status !== 'REPORT'
"
>
<div class="q-gutter-sm" v-if="!edit">
<q-btn
outline
color="primary"
dense
icon-right="mdi-file-edit-outline"
class="q-px-sm"
label="แก้ไข"
style="width: 80px"
@click="edit = !edit"
/>
<q-form
ref="myForm"
greedy
@submit.prevent
@validation-success="onSubmit"
class="col-12"
>
<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 class="q-gutter-sm" v-else>
<q-btn
outline
color="public"
dense
class="q-px-sm"
label="บันทึก"
style="width: 80px"
@click="conditionSave"
/>
<q-btn
outline
color="red"
dense
class="q-px-sm"
label="ยกเลิก"
style="width: 80px"
@click="clickCancel"
/>
<q-space />
<div v-if="status !== 'DONE' && status !== 'REPORT'">
<div class="q-gutter-sm" v-if="!edit">
<q-btn
outline
color="primary"
dense
icon-right="mdi-file-edit-outline"
class="q-px-sm"
label="แก้ไข"
style="width: 80px"
@click="edit = !edit"
/>
</div>
<div class="q-gutter-sm" v-else>
<q-btn
outline
color="public"
dense
class="q-px-sm"
label="บันทึก"
style="width: 80px"
type="submit"
/>
<q-btn
outline
color="red"
dense
class="q-px-sm"
label="ยกเลิก"
style="width: 80px"
@click="clickCancel"
/>
</div>
</div>
</div>
</div>
<div class="col-12"><q-separator /></div>
<q-form ref="myForm">
<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-12 row items-center">
@ -468,12 +380,6 @@ function updatemodalPersonal(modal: boolean) {
</div>
</q-form>
</q-card>
<PopupPersonal
:modal="modalPersonal"
:id="personId"
@update:modal="updatemodalPersonal"
/>
</template>
<style lang="scss" scope>
.q-img {