Merge branch 'develop' of github.com:Frappet/bma-ehr-admin into develop

This commit is contained in:
Kittapath 2024-07-10 16:07:13 +07:00
commit 457d694f89
3 changed files with 532 additions and 1 deletions

View file

@ -0,0 +1,95 @@
<script setup lang="ts">
defineProps<{
index: number;
label: string;
icon: string;
}>();
</script>
<template>
<div
class="shadow-2 rounded-borders column items-center bg-white q-pa-md"
style="min-height: 165px"
>
<div :class="`avatar-color-${index + 1}`">
<q-avatar size="70px" :icon="icon" class="avatar-color" />
</div>
<div class="q-mt-md text-center text-weight-medium" style="font-size: 16px">
{{ label }}
</div>
</div>
</template>
<style scoped>
.avatar-color {
background: rgba(var(--color), 1); /* 0.5 คือค่า alpha */
}
.avatar-color-1 {
--color: 226, 181, 138;
}
.avatar-color-2 {
--color: 202, 206, 154;
}
.avatar-color-3 {
--color: 204, 201, 229;
}
.avatar-color-4 {
--color: 201, 232, 246;
}
.avatar-color-5 {
--color: 228, 174, 205;
}
.avatar-color-6 {
--color: 224, 167, 164;
}
.avatar-color-7 {
--color: 234, 197, 204;
}
.avatar-color-8 {
--color: 178, 211, 193;
}
.avatar-color-9 {
--color: 198, 231, 235;
}
.avatar-color-10 {
--color: 190, 157, 228;
}
.avatar-color-11 {
--color: 218, 149, 174;
}
.avatar-color-12 {
--color: 230, 222, 172;
}
.avatar-color-13 {
--color: 147, 223, 178;
}
.avatar-color-14 {
--color: 213, 160, 160;
}
.avatar-color-15 {
--color: 148, 208, 160;
}
.avatar-color-16 {
--color: 126, 211, 208;
}
.avatar-color-17 {
--color: 159, 204, 214;
}
</style>

View file

@ -0,0 +1,284 @@
<script setup lang="ts">
import { ref } from "vue";
import type { QTableProps } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
const { date2Thai } = useCounterMixin();
const columns = ref<QTableProps["columns"]>([
{
name: "timestamp",
align: "left",
label: "เวลา",
sortable: true,
field: "timestamp",
headerStyle: "font-size: 14px",
format: (v) => date2Thai(v, false, true),
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "username",
align: "left",
label: "username",
sortable: true,
field: "username",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "host",
align: "left",
label: "host",
sortable: true,
field: "host",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "endpoint",
align: "left",
label: "endpoint",
sortable: true,
field: "endpoint",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "method",
align: "left",
label: "method",
sortable: true,
field: "method",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "responseCode",
align: "left",
label: "responseCode",
sortable: true,
field: "responseCode",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "status",
align: "left",
label: "สถานะ",
sortable: true,
field: "status",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "message",
align: "left",
label: "ข้อความ",
sortable: true,
field: "message",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const selectDate = ref<Date>(new Date());
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const inputSearch = ref<string>("");
const visibleColumns = ref<string[]>([
"timestamp",
"username",
"host",
"endpoint",
"method",
"responseCode",
"status",
"message",
]);
const rows = [
{
timestamp: new Date(),
username: "สมรักษ์ จงใจรักชาติ",
host: "http://localhost:3005/lists",
endpoint: "registry-employee",
method: "Put",
responseCode: 401,
status: "Error",
message: "Unknow value Found",
},
{
timestamp: new Date(),
username: "สมรักษ์ จงใจรักชาติ",
host: "http://localhost:3005/lists",
endpoint: "registry-employee",
method: "Delete",
responseCode: 200,
status: "Warning",
message: "Balance getting below",
},
{
timestamp: new Date(),
username: "สมรักษ์ จงใจรักชาติ",
host: "http://localhost:3005/lists",
endpoint: "registry-employee",
method: "Get",
responseCode: 200,
status: "Info",
message: "Backup success",
},
];
</script>
<template>
<div class="bg-white">
<div class="row q-pa-md">
<datepicker
menu-class-name="modalfix"
v-model="selectDate"
:locale="'th'"
autoApply
:enableTimePicker="false"
@update:modelValue="console.log('test')"
week-start="0"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
outlined
dense
:model-value="date2Thai(selectDate)"
hide-bottom-space
>
<template v-slot:prepend>
<q-icon name="event" class="cursor-pointer" color="primary">
</q-icon>
</template>
</q-input>
</template>
</datepicker>
<q-space />
<div class="items-center q-gutter-md" style="display: flex">
<!-- นหาขอความใน table -->
<q-input
standout
dense
clearable
:model-value="inputSearch"
ref="filterRef"
@update:model-value="console.log('update')"
outlined
debounce="300"
placeholder="ค้นหา"
style="max-width: 200px"
class="q-ml-sm"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<!-- แสดงคอลมนใน table -->
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
options-cover
style="min-width: 150px"
/>
</div>
</div>
<d-table
ref="table"
:columns="columns"
:rows="rows"
row-key="name"
flat
bordered
:paging="true"
:filter="inputSearch"
dense
v-model:pagination="pagination"
:rows-per-page-options="[20, 50, 100]"
class="custom-header-table"
:visible-columns="visibleColumns"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</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.id">
<div v-if="col.name === 'username'">
{{ col.value }}
<div class="text-grey">{{ 12421321334 }}</div>
</div>
<div v-else-if="col.name === 'method'">
<q-badge text-color="blue" style="background-color: #f0ecec">{{
col.value
}}</q-badge>
</div>
<div v-else-if="col.name === 'status'">
<q-badge
text-color="white"
:color="
col.value === 'Error'
? 'red'
: col.value === 'Info'
? 'primary'
: 'warning'
"
>{{ col.value }}</q-badge
>
</div>
<div
v-else-if="col.name === 'message'"
:class="`text-${
props.row.status === 'Error'
? 'red'
: props.row.status === 'Info'
? 'primary'
: 'warning'
}`"
>
{{ col.value }}
</div>
<div v-else>
{{ col.value === "" || col.value === null ? "-" : col.value }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</div>
</template>
<style scoped></style>

View file

@ -1,3 +1,155 @@
<script setup lang="ts">
/** importType*/
/** importComponents*/
import CardComponents from "@/modules/03_logs/components/CardComponents.vue";
import LogTable from "@/modules/03_logs/components/LogTable.vue";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import { ref, onMounted } from "vue";
import { useCurrencyInput } from "vue-currency-input";
/** importStore*/
const route = useRoute();
/** use*/
const menuList = ref<{ icon: string; label: string; path: string }[]>([
{
icon: "mdi-file-account-outline",
label: "ระบบทะเบียนประวัติ",
path: "lists?system=register",
},
{
icon: "mdi-account-group",
label: "ระบบโครงสร้างหน่วยงานและกรอบอัตรากำลัง",
path: "lists?system=organization",
},
{
icon: "mdi-calendar",
label: "ระบบบันทึกเวลาปฏิบัติงานและการลา",
path: "lists?system=timekeeping",
},
{
icon: "mdi-magnify",
label: "ระบบการสรรหาบุคคล",
path: "lists?system=search",
},
{
icon: "mdi-account-check-outline",
label: "ระบบการประเมินบุคคล",
path: "lists?system=evaluation",
},
{
icon: "mdi-account-cancel-outline",
label: "ระบบพ้นจากราชการ",
path: "lists?system=recruit",
},
{
icon: "mdi-cash",
label: "ระบบการเลื่อนเงินเดือน/ค่าจ้าง",
path: "lists?system=payroll",
},
{
icon: "mdi-account-check-outline",
label: "ระบบการบรรจุ แต่งตั้ง ย้าย โอน",
path: "lists?system=transfer",
},
{
icon: "mdi-account-star",
label: "ระบบการประเมินผลการปฏิบัติราชการระดับบุคคล",
path: "lists?system=assessment",
},
{
icon: "mdi-briefcase-account",
label: "ระบบการพัฒนาบุคลากร /การศึกษาต่อ",
path: "lists?system=development",
},
{
icon: "mdi-medal-outline",
label: "ระบบงานเครื่องราชอิสริยาภรณ์",
path: "lists?system=machine",
},
{
icon: "mdi-monitor-dashboard",
label: "ระบบการรายงานและ Dashboard",
path: "lists?system=report",
},
{
icon: "mdi-scale-balance",
label: "ระบบดำเนินการทางวินัย",
path: "lists?system=cybersecurity",
},
{
icon: "mdi-briefcase-account",
label: "ระบบบริการเจ้าของข้อมูลบุคคล",
path: "lists?system=owner",
},
{
icon: "mdi-account-settings-outline",
label: "ระบบข้อมูลหลัก",
path: "lists?system=master",
},
{
icon: "mdi-account-child-circle",
label: "ระบบ Admin",
path: "lists?system=admin",
},
{
icon: "mdi-shield-key",
label: "ระบบ Single Sign-On",
path: "lists?system=sso",
},
]);
onMounted(async () => {
console.log("");
});
</script>
<template>
<div>ประวจกรรม (Logs)</div>
<div>
<div class="row q-mb-lg">
<q-btn
flat
v-if="route.query.system"
round
class="q-mr-sm"
color="primary"
icon="mdi-arrow-left"
dense
to="lists"
>
</q-btn>
<div class="row items-center">
<span class="toptitle text-dark items-center q-mr-md">
ประวจกรรม (Logs)
</span>
<div
v-if="route.query.system"
class="toptitle text-primary items-center"
>
ระบบทะเบยนประว
</div>
</div>
</div>
<div v-if="!route.query.system" class="row q-col-gutter-lg full-width">
<div class="col-3" :key="index" v-for="(item, index) in menuList">
<CardComponents
class="cursor-pointer"
@click="$router.push(item.path)"
:index="index"
:icon="item.icon"
:label="item.label"
/>
</div>
</div>
</div>
<div v-if="route.query.system">
<LogTable />
</div>
</template>
<style scoped lang="scss"></style>