ประวัติยการแก้ไข

This commit is contained in:
STW_TTTY\stwtt 2024-05-09 09:28:20 +07:00
parent 55111ed126
commit 6299afbeab
3 changed files with 59 additions and 18 deletions

View file

@ -3,17 +3,29 @@ import { ref } from "vue";
import type { QTableProps } from "quasar";
import DialogHeader from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin";
const mixin = useCounterMixin();
const { date2Thai } = mixin;
const modal = defineModel<boolean>("modal", { required: true });
const rows = ref<any[]>([]);
const visibleColumns = ref<string[]>(["fullName"]);
const rows = defineModel<any[]>("rows", { required: true });
const visibleColumns = ref<string[]>(["createdFullName", "lastUpdatedAt"]);
const columns = ref<QTableProps["columns"]>([
{
name: "fullName",
name: "createdFullName",
align: "left",
label: "ชื่อ",
sortable: true,
field: "fullName",
field: "createdFullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "lastUpdatedAt",
align: "left",
label: "เวลาที่แก้ไข",
sortable: true,
field: "lastUpdatedAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@ -24,7 +36,7 @@ function close() {
</script>
<template>
<q-dialog persistent v-model="modal">
<q-card style="min-width: 50vw">
<q-card style="min-width: 30vw">
<DialogHeader tittle="ประวัติการแก้ไข" :close="close" />
<q-separator />
<q-card-section>
@ -46,13 +58,15 @@ function close() {
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th auto-width />
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div class="table_ellipsis">
<div v-if="col.name == 'lastUpdatedAt'" class="table_ellipsis">
{{ col.value ? date2Thai(col.value, false, true) : "-" }}
</div>
<div v-else class="table_ellipsis">
{{ col.value ? col.value : "-" }}
</div>
</q-td>