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

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

@ -2,7 +2,6 @@
import { onMounted, ref } from "vue"; import { onMounted, ref } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import keycloak from "@/plugins/keycloak"; import keycloak from "@/plugins/keycloak";
@ -16,9 +15,14 @@ import type { QForm } from "quasar";
import type { DataProfile } from "@/modules/05_placement/interface/index/Main"; import type { DataProfile } from "@/modules/05_placement/interface/index/Main";
/** importComponents*/ /** importComponents*/
import CardProfile from "@/components/CardProfile.vue"; import CardProfile from "@/components/CardProfile.vue";
import CurruncyInput from "@/components/CurruncyInput.vue"; import CurruncyInput from "@/components/CurruncyInput.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute(); const route = useRoute();

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

View file

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

View file

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

View file

@ -11,7 +11,14 @@ import config from "@/app.config";
const router = useRouter(); const router = useRouter();
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, success, date2Thai } = mixin; const {
showLoader,
hideLoader,
messageError,
success,
date2Thai,
findOrgName,
} = mixin;
/** คอลัมน์ */ /** คอลัมน์ */
const rows = ref<any>([]); const rows = ref<any>([]);
@ -24,8 +31,6 @@ const columns = ref<QTableProps["columns"]>([
field: "no", field: "no",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "fullname", name: "fullname",
@ -35,15 +40,9 @@ const columns = ref<QTableProps["columns"]>([
field: "fullname", field: "fullname",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, format(val, row) {
{ return `${row.prefix}${row.firstName} ${row.lastName}`;
name: "positionType", },
align: "left",
label: "ตำแหน่งประเภท",
sortable: true,
field: "positionType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
}, },
{ {
name: "position", name: "position",
@ -55,31 +54,46 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "positionLevel", name: "positionType",
align: "left", align: "left",
label: "ระดับ", label: "ประเภทตำแหน่ง",
sortable: true, sortable: true,
field: "positionLevel", field: "positionType",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "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: "positionExecutive",
// align: "left",
// label: "",
// sortable: true,
// field: "positionExecutive",
// headerStyle: "font-size: 14px",
// style: "font-size: 14px",
// },
{ {
name: "positionExecutive", name: "org",
align: "left",
label: "ตำแหน่งทางการบริหาร",
sortable: true,
field: "positionExecutive",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "oc",
align: "left", align: "left",
label: "สังกัด", label: "สังกัด",
sortable: true, sortable: true,
field: "oc", field: "org",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format(val, row) {
return findOrgName(row);
},
}, },
{ {
name: "createdAt", name: "createdAt",
@ -89,19 +103,19 @@ const columns = ref<QTableProps["columns"]>([
field: "createdAt", field: "createdAt",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format: (val) => date2Thai(val),
}, },
]); ]);
/** คอลัมน์ที่แสดง */ /** คอลัมน์ที่แสดง */
const visibleColumns = ref<string[]>([ const visibleColumns = ref<string[]>([
"no", "no",
"prefix",
"fullname", "fullname",
"positionType", "positionType",
"position", "position",
"positionLevel", "positionLevel",
"positionExecutive", "positionExecutive",
"oc", "org",
"createdAt", "createdAt",
]); ]);
@ -116,17 +130,8 @@ const fectListDecased = async () => {
await http await http
.get(config.API.listDeceased()) .get(config.API.listDeceased())
.then((res) => { .then((res) => {
rows.value = res.data.result.map((e: any) => ({ const data = res.data.result;
personalId: e.id, rows.value = data;
fullname: `${e.prefix ?? ""}${e.firstName ?? ""} ${e.lastName ?? ""}`,
positionType: e.positionType == null ? "-" : e.positionType,
position: e.positionLine == null ? "-" : e.positionLine,
positionLevel: e.positionLevel === null ? "-" : e.positionLevel,
positionExecutive:
e.positionExecutive == null ? "-" : e.positionExecutive,
oc: e.organization == null ? "-" : e.organization,
createdAt: date2Thai(e.createdAt),
}));
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -228,35 +233,23 @@ const pagination = ref({
<q-tr <q-tr
:props="props" :props="props"
class="cursor-pointer" class="cursor-pointer"
@click="nextPage(props.row.personalId)" @click="nextPage(props.row.id)"
> >
<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="positionType" :props="props">
{{ props.row.positionType }}
</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="positionExecutive" :props="props">
{{ props.row.positionExecutive }}
</q-td>
<q-td key="oc" :props="props">
{{ props.row.oc }}
</q-td>
<q-td <q-td
key="createdAt" v-for="col in props.cols"
:props="props" :key="col.id"
@click="nextPage(props.row)" @click.stop.prevent="nextPage(props.row.id)"
> >
{{ props.row.createdAt }} <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>
</q-tr> </q-tr>
</template> </template>

View file

@ -2,13 +2,19 @@
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue";
/** importType*/
const modalPersonal = ref<boolean>(false); import type { DataProfile } from "@/modules/05_placement/interface/index/Main";
const personId = ref<string>(""); import type { ResDetailDeceased } from "@/modules/06_retirement/interface/response/Deceased";
/** importComponents*/
import CardProfile from "@/components/CardProfile.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
/**use*/ /**use*/
const $q = useQuasar(); const $q = useQuasar();
const router = useRouter(); const router = useRouter();
@ -17,21 +23,26 @@ const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, date2Thai } = mixin; const { showLoader, hideLoader, messageError, date2Thai } = mixin;
const fullName = ref<string>(""); const fullName = ref<string>("");
const profileId = ref<string>(route.params.id.toString()); const profileId = ref<string>(route.params.id.toString());
const detail = ref<any>([]); const detail = ref<ResDetailDeceased>();
const dataProfile = ref<DataProfile>();
/** Hook */ /** Hook */
onMounted(() => { onMounted(() => {
fectdata(); fetchData();
}); });
// API // API
const fectdata = async () => { const fetchData = async () => {
showLoader(); showLoader();
await http await http
.get(config.API.detailDeceased(profileId.value)) .get(config.API.detailDeceased(profileId.value))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
dataProfile.value = data as DataProfile;
detail.value = data; detail.value = data;
console.log(detail.value?.firstName);
fullName.value = `${data.prefix}${data.firstName} ${data.lastName}`; fullName.value = `${data.prefix}${data.firstName} ${data.lastName}`;
}) })
.catch((e) => { .catch((e) => {
@ -42,7 +53,6 @@ const fectdata = async () => {
}); });
}; };
//detail deceased //detail deceased
const openDeceased = (id: string) => { const openDeceased = (id: string) => {
router.push(`/deceased/detail/${id}`); router.push(`/deceased/detail/${id}`);
@ -87,15 +97,6 @@ const fileDownload = async (type: string) => {
hideLoader(); hideLoader();
}); });
}; };
function onclickViewinfo(id: string) {
modalPersonal.value = true;
personId.value = id;
}
function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal;
}
</script> </script>
<template> <template>
@ -112,50 +113,8 @@ function updatemodalPersonal(modal: boolean) {
/> />
รายละเอยดบนทกเวยนแจงการถงแกกรรม {{ fullName }} รายละเอยดบนทกเวยนแจงการถงแกกรรม {{ fullName }}
</div> </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"> <CardProfile :data="dataProfile as DataProfile" />
<div class="q-pl-sm text-weight-bold text-subtitle2">
{{ fullName }}
</div>
<q-space />
<q-btn
outline
color="blue"
dense
icon-right="mdi-open-in-new"
class="q-px-sm"
label="ดูข้อมูลทะเบียนประวัติ"
@click="onclickViewinfo(detail.profileId)"
/>
</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="detail.avatar" v-if="detail.avatar !== null" />
<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">{{ detail.positionLine }}</div>
</div>
</div>
<div class="col-xs-6 col-sm-2 row items-center">
<div class="col-12">
<div class="col-12 text-top">ระด</div>
<div class="col-12 text-detail">{{ detail.positionLevel }}</div>
</div>
</div>
<div class="col-xs-6 col-sm row items-center">
<div class="col-12">
<div class="col-12 text-top">งก</div>
<div class="col-12 text-detail">{{ detail.organization }}</div>
</div>
</div>
</div>
</div>
</q-card>
<q-card bordered class="row col-12 text-dark q-mt-sm"> <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="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
@ -189,27 +148,28 @@ function updatemodalPersonal(modal: boolean) {
<div class="col-12"> <div class="col-12">
<div class="col-12 text-top">เลขทใบมรณบตร</div> <div class="col-12 text-top">เลขทใบมรณบตร</div>
<div class="col-12 text-detail"> <div class="col-12 text-detail">
{{ detail.number }} {{ detail?.number }}
</div> </div>
</div> </div>
</div> </div>
<div class="col-xs-6 col-sm-3 row items-center"> <div class="col-xs-6 col-sm-3 row items-center">
<div class="col-12"> <div class="col-12">
<div class="col-12 text-top">สถานทออกใบมรณบตร</div> <div class="col-12 text-top">สถานทออกใบมรณบตร</div>
<div class="col-12 text-detail">{{ detail.location }}</div> <div class="col-12 text-detail">{{ detail?.location }}</div>
</div> </div>
</div> </div>
<div class="col-xs-6 col-sm-3 row items-center"> <div class="col-xs-6 col-sm-3 row items-center">
<div class="col-12"> <div class="col-12">
<div class="col-12 text-top">เหตผลการเสยช</div> <div class="col-12 text-top">เหตผลการเสยช</div>
<div class="col-12 text-detail">{{ detail.reason }}</div> <div class="col-12 text-detail">{{ detail?.reason }}</div>
</div> </div>
</div> </div>
<div class="col-xs-6 col-sm-3 row items-center"> <div class="col-xs-6 col-sm-3 row items-center">
<div class="col-12"> <div class="col-12">
<div class="col-12 text-top">นทเสยช</div> <div class="col-12 text-top">นทเสยช</div>
<div class="col-12 text-detail">{{ date2Thai(detail.date) }}</div> <div class="col-12 text-detail">
{{ detail?.date ? date2Thai(detail?.date) : "-" }}
</div>
</div> </div>
</div> </div>
<div class="col-xs-6 col-sm-3 row items-center"> <div class="col-xs-6 col-sm-3 row items-center">
@ -221,35 +181,27 @@ function updatemodalPersonal(modal: boolean) {
round round
color="red" color="red"
icon="mdi-file-pdf" icon="mdi-file-pdf"
@click="nextPage(detail.pathName)" @click="detail?.pathName ? nextPage(detail?.pathName) : null"
> >
<q-tooltip>ใบมรณบตร</q-tooltip></q-btn <q-tooltip>ใบมรณบตร</q-tooltip></q-btn
> >
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="col-12"> <div class="col-12">
<div class="row"> <div class="row">
<q-space /> <q-space />
<q-btn <q-btn
color="public" color="public"
dense label="ส่งหนังสือเวียน"
class="q-px-sm" @click="openDeceased(profileId)"
label="ส่งหนังสือเวียน" />
@click="openDeceased(profileId)"
/>
</div>
</div> </div>
</div> </div>
</div> </div>
</q-card> </q-card>
<PopupPersonal
:modal="modalPersonal"
:id="personId"
@update:modal="updatemodalPersonal"
/>
</template> </template>
<style lang="scss" scope> <style lang="scss" scope>

View file

@ -1,27 +1,61 @@
interface requestSendNoti { interface requestSendNoti {
profileId: string; profileId: string;
isSendMail: boolean; isSendMail: boolean;
isSendInbox: boolean; isSendInbox: boolean;
isSendNotification: boolean; isSendNotification: boolean;
} }
interface DataCopyOrder { interface DataCopyOrder {
id:string; id: string;
personalId: string; personalId: string;
name: string; name: string;
idCard: string; idCard: string;
position: string; position: string;
unit: string; unit: string;
send: string; send: string;
mutiselect: number[]; mutiselect: number[];
} }
interface ResponseOrganiz { interface ResponseOrganiz {
firstName: string; firstName: string;
idCard: string; idCard: string;
lastName: string; lastName: string;
name: string; name: string;
position: string; position: string;
prefixId: string; prefixId: string;
profileId: string; profileId: string;
unit: string; unit: string;
} }
export type { requestSendNoti,DataCopyOrder,ResponseOrganiz };
interface ResDetailDeceased {
id: string;
profileId: string;
prefix: string;
firstName: string;
lastName: string;
root: string;
rootShortName: string;
child1: string | null;
child1ShortName: string | null;
child2: string | null;
child2ShortName: string | null;
child3: string | null;
child3ShortName: null;
child4: string | null;
child4ShortName: string | null;
posMasterNo: number | null;
position: string;
posLevelName: string;
posTypeName: string;
number: string;
date: Date | null | undefined;
location: string;
reason: string;
pathName: string | null;
isActive: boolean;
createdAt: string;
}
export type {
requestSendNoti,
DataCopyOrder,
ResponseOrganiz,
ResDetailDeceased,
};

View file

@ -26,21 +26,4 @@ interface TypeFile {
pathName: string; pathName: string;
} }
interface ResponseDataDetail { export type { ResponseData, TypeFile };
personId: string;
avataPath: string;
createdAt: Date;
date: Date;
id: string;
organization: string;
organizationPositionOld: string;
positionLevelOld: string;
positionNumberOld: string;
positionTypeOld: string;
reason: string;
salary: number;
status: string;
fullname: string;
}
export type { ResponseData, ResponseDataDetail, TypeFile };