ทะเบียนประวัติ: แก้หน้าประวัติ+

This commit is contained in:
oat_dev 2024-03-29 11:31:43 +07:00
parent 02ea3431e7
commit 645d631b60
6 changed files with 405 additions and 25 deletions

View file

@ -91,6 +91,89 @@ const columns = ref<QTableProps["columns"]>([
},
]);
const historyColumns = ref<QTableProps["columns"]>([
{
name: "certificateType",
align: "left",
label: "ชื่อใบอนุญาต",
sortable: true,
field: "certificateType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "issuer",
align: "left",
label: "หน่วยงานผู้ออกใบอนุญาต",
sortable: true,
field: "issuer",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "certificateNo",
align: "left",
label: "เลขที่ใบอนุญาต",
sortable: true,
field: "certificateNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "issueDate",
align: "left",
label: "วันที่ออกใบอนุญาต",
sortable: true,
field: "issueDate",
format: (v) => date2Thai(v),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "expireDate",
align: "left",
label: "วันที่หมดอายุ",
sortable: true,
format: (v) => date2Thai(v),
field: "expireDate",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "lastUpdateFullName",
align: "left",
label: "ผู้ดำเนินการ",
sortable: true,
field: "lastUpdateFullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "lastUpdatedAt",
align: "left",
label: "วันที่แก้ไข",
sortable: true,
field: "lastUpdatedAt",
format: (v) => date2Thai(v),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const profesLicenseData = reactive<RequestItemsObject>({
certificateType: "",
issuer: "",
@ -122,6 +205,8 @@ const historyVisibleColumns = ref<string[]>([
"certificateNo",
"issueDate",
"expireDate",
"lastUpdateFullName",
"lastUpdatedAt",
]);
async function onSubmit() {
@ -249,7 +334,7 @@ onMounted(async () => {
</script>
<template>
<q-toolbar style="padding: 0px">
<q-toolbar style="padding: 0px" class="q-mb-xs">
<q-btn
round
flat
@ -445,6 +530,26 @@ onMounted(async () => {
</q-card>
</div>
</template>
<template v-slot:no-data="{ icon, message, filter }">
<div class="full-width row flex-center text-accent q-gutter-sm">
<span
><div
style="
height: 50vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
"
class="text-grey-5"
>
<q-icon name="search" size="4rem" />
<span>ไมพบขอม</span>
</div>
</span>
</div>
</template>
</d-table>
<q-dialog v-model="dialog" class="dialog" persistent>
@ -632,7 +737,7 @@ onMounted(async () => {
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
:options="historyColumns"
option-value="name"
options-cover
style="min-width: 150px"
@ -640,7 +745,7 @@ onMounted(async () => {
</q-toolbar>
<d-table
ref="table"
:columns="columns"
:columns="historyColumns"
:rows="historyRows"
row-key="name"
flat
@ -670,6 +775,26 @@ onMounted(async () => {
</q-td>
</q-tr>
</template>
<template v-slot:no-data="{ icon, message, filter }">
<div class="full-width row flex-center text-accent q-gutter-sm">
<span
><div
style="
height: 50vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
"
class="text-grey-5"
>
<q-icon name="search" size="4rem" />
<span>ไมพบขอม</span>
</div>
</span>
</div>
</template>
</d-table>
</q-card-section>
</q-card>

View file

@ -144,6 +144,147 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const historyColumns = ref<QTableProps["columns"]>([
{
name: "name",
align: "left",
label: "ชื่อโครงการ/หลักสูตรการฝึกอบรม",
sortable: true,
field: "name",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "topic",
align: "left",
label: "หัวข้อการฝึกอบรม/ดูงาน",
sortable: true,
field: "topic",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "startDate",
align: "left",
label: "วันเริ่มต้นการฝึกอบรม/ดูงาน",
sortable: true,
field: (v) =>
v.isDate
? date2Thai(v.startDate)
: new Date(v.startDate).getFullYear() + 543,
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "endDate",
align: "left",
label: "วันสิ้นสุดการฝึกอบรม/ดูงาน",
sortable: true,
field: (v) =>
v.isDate ? date2Thai(v.endDate) : new Date(v.endDate).getFullYear() + 543,
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "yearly",
align: "left",
label: "ปีที่อบรม (พ.ศ.)",
sortable: true,
field: "yearly",
format: (v) => v + 543,
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "place",
align: "left",
label: "สถานที่ฝึกอบรม/ดูงาน",
sortable: true,
field: "place",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "duration",
align: "left",
label: "รวมระยะเวลาในการฝึกอบรม/ดูงาน",
sortable: true,
field: "duration",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "department",
align: "left",
label: "หน่วยงานที่รับผิดชอบจัดการฝึกอบรม/ดูงาน",
sortable: true,
field: "department",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "numberOrder",
align: "left",
label: "เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ",
sortable: true,
field: "numberOrder",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "dateOrder",
align: "left",
label: "คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่",
sortable: true,
field: "dateOrder",
format: (v) => date2Thai(v),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "lastUpdateFullName",
align: "left",
label: "ผู้ดำเนินการ",
sortable: true,
field: "lastUpdateFullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "lastUpdatedAt",
align: "left",
label: "วันที่แก้ไข",
sortable: true,
field: "lastUpdatedAt",
format: (v) => date2Thai(v),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const isDate = ref<string>("false");
const dialogStatus = ref<string>("create");
const historyDialog = ref<boolean>(false);
@ -199,6 +340,8 @@ const historyVisibleColumns = ref<string[]>([
"dateOrder", //
"startDate", //
"endDate", //
"lastUpdateFullName", //
"lastUpdatedAt", //
]);
async function onSubmit() {
@ -548,6 +691,26 @@ onMounted(async () => {
</q-card>
</div>
</template>
<template v-slot:no-data="{ icon, message, filter }">
<div class="full-width row flex-center text-accent q-gutter-sm">
<span
><div
style="
height: 50vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
"
class="text-grey-5"
>
<q-icon name="search" size="4rem" />
<span>ไมพบขอม</span>
</div>
</span>
</div>
</template>
</d-table>
<q-dialog v-model="dialog" class="dialog" persistent>
@ -964,7 +1127,7 @@ onMounted(async () => {
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
:options="historyColumns"
option-value="name"
options-cover
style="min-width: 150px"
@ -972,7 +1135,7 @@ onMounted(async () => {
</q-toolbar>
<d-table
ref="table"
:columns="columns"
:columns="historyColumns"
:rows="historyRows"
row-key="name"
flat
@ -1002,6 +1165,26 @@ onMounted(async () => {
</q-td>
</q-tr>
</template>
<template v-slot:no-data="{ icon, message, filter }">
<div class="full-width row flex-center text-accent q-gutter-sm">
<span
><div
style="
height: 50vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
"
class="text-grey-5"
>
<q-icon name="search" size="4rem" />
<span>ไมพบขอม</span>
</div>
</span>
</div>
</template>
</d-table>
</q-card-section>
</q-card>

View file

@ -45,6 +45,8 @@ const visibleColumns = ref<String[]>([
"totalLeave",
"status",
"reason",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const columns = ref<QTableProps["columns"]>([
{
@ -113,6 +115,29 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "lastUpdateFullName",
align: "left",
label: "ผู้ดำเนินการ",
sortable: true,
field: "lastUpdateFullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "lastUpdatedAt",
align: "left",
label: "วันที่แก้ไข",
sortable: true,
field: "lastUpdatedAt",
format: (v) => date2Thai(v),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
function getHistory() {
showLoader();
@ -123,6 +148,7 @@ function getHistory() {
rows.value = [];
data.map((e: any) => {
rows.value.push({
...e,
id: e.id,
typeLeave: e.leaveType.name,
code: e.leaveType.refCommandDate,
@ -150,7 +176,7 @@ function getHistory() {
* แปลงชวงวนทา2คาเปนวนเดยวกนจะโชววนเดยวแตาไมเทากนจะแสดงเปนชวง
* @param val วงวนท
*/
function dateThaiRange(val: [Date, Date]) {
function dateThaiRange(val: [Date, Date]) {
if (val === null) {
} else if (date2Thai(val[0]) === date2Thai(val[1])) {
return `${date2Thai(val[0])}`;
@ -159,7 +185,7 @@ function getHistory() {
}
}
function statusLeave(val: string){
function statusLeave(val: string) {
switch (val) {
case "waitting":
return "รออนุมัติ";
@ -172,7 +198,7 @@ function statusLeave(val: string){
default:
return "-";
}
};
}
watch(modal, (status) => {
if (status == true) {
@ -276,8 +302,8 @@ watch(modal, (status) => {
}}
</div>
<div v-else-if="col.name == 'status'">
{{ statusLeave(col.value) }}
</div>
{{ statusLeave(col.value) }}
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>

View file

@ -32,7 +32,6 @@ async function fetchHistoryData(id: string) {
await http
.get(config.API.profileNewFamilyHisByFamilyId(id))
.then(async (res) => {
console.log(res.data.result);
historyRows.value = res.data.result;
})
.catch((err) => {

View file

@ -314,7 +314,6 @@ function onSubmit() {
}
async function submit() {
console.log(formDataSalary);
const formData = {
profileId: isStatusEdit.value ? undefined : profileId.value,
date: formDataSalary.date, //
@ -340,7 +339,6 @@ async function submit() {
refCommandNo: formDataSalary.refCommandNo, //
templateDoc: formDataSalary.doc, //
};
console.log(formData);
try {
const url = isStatusEdit.value
@ -398,7 +396,7 @@ onMounted(() => {
});
</script>
<template>
<q-toolbar style="padding: 0px" class="text-primary">
<q-toolbar style="padding: 0px" class="text-primary q-mb-xs">
<q-btn flat round dense icon="add" @click="onClickOpenDialog()">
<q-tooltip>เพ</q-tooltip>
</q-btn>
@ -490,16 +488,25 @@ onMounted(() => {
<!-- <q-tooltip>เลอนลำดบลง</q-tooltip> -->
</q-btn>
</q-td>
<q-td
v-for="col in props.cols"
:key="col.id"
@click="onClickOpenDialog(true, props.row)"
>
<q-td v-for="col in props.cols" :key="col.id">
<div class="table_ellipsis">
{{ col.value ? col.value : "-" }}
</div>
</q-td>
<q-td auto-width>
<q-btn
color="primary"
flat
dense
round
class="q-mr-xs"
size="14px"
icon="mdi-pencil-outline"
clickable
@click="onClickOpenDialog(true, props.row)"
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
color="info"
flat
@ -526,6 +533,26 @@ onMounted(() => {
direction-links
></q-pagination>
</template>
<template v-slot:no-data="{ icon, message, filter }">
<div class="full-width row flex-center text-accent q-gutter-sm">
<span
><div
style="
height: 50vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
"
class="text-grey-5"
>
<q-icon name="search" size="4rem" />
<span>ไมพบขอม</span>
</div>
</span>
</div>
</template>
</d-table>
<q-dialog v-model="modalDialogSalary" persistent full-width>

View file

@ -173,20 +173,20 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
{
name: "createdFullName",
name: "lastUpdateFullName",
align: "left",
label: "ผู้ดำเนินการ",
sortable: true,
field: "createdFullName",
field: "lastUpdateFullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "createdAt",
name: "lastUpdatedAt",
align: "left",
label: "วันที่แก้ไข",
sortable: true,
field: "createdAt",
field: "lastUpdatedAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => date2Thai(v),
@ -209,8 +209,8 @@ const visibleColumns = ref<string[]>([
"salaryClass",
"templateDoc",
"refCommandNo",
"createdFullName",
"createdAt",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const rows = ref<any>([]);
const pagination = ref({
@ -321,6 +321,26 @@ watch(
</q-td>
</q-tr>
</template>
<template v-slot:no-data="{ icon, message, filter }">
<div class="full-width row flex-center text-accent q-gutter-sm">
<span
><div
style="
height: 50vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
"
class="text-grey-5"
>
<q-icon name="search" size="4rem" />
<span>ไมพบขอม</span>
</div>
</span>
</div>
</template>
</d-table>
</q-card-section>
</q-card>