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

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

@ -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>