no message

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-12-13 15:34:28 +07:00
parent 74b68a7f65
commit 75c677f58c

View file

@ -1,17 +1,17 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, Static } from "vue" import { ref, onMounted, Static } from "vue";
const link = ref<number>(1) const link = ref<number>(1);
import { useQuasar } from "quasar" import { useQuasar } from "quasar";
import router from "@/router" import router from "@/router";
import http from "@/plugins/http" import http from "@/plugins/http";
import config from "@/app.config" import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin" import { useCounterMixin } from "@/stores/mixin";
const $q = useQuasar() const $q = useQuasar();
const mixin = useCounterMixin() const mixin = useCounterMixin();
const { showLoader, hideLoader, date2Thai } = mixin const { showLoader, hideLoader, date2Thai } = mixin;
const fullname = ref<string>("ธัญลักษณ์") const fullname = ref<string>("ธัญลักษณ์");
const inboxList = ref<any>([ const inboxList = ref<any>([
// { // {
// no: 1, // no: 1,
@ -21,7 +21,7 @@ const inboxList = ref<any>([
// body: " -", // body: " -",
// ratingModel: 0, // ratingModel: 0,
// }, // },
]) ]);
const items = ref<any>([ const items = ref<any>([
{ {
icon: "mdi-account-group-outline", icon: "mdi-account-group-outline",
@ -36,7 +36,7 @@ const items = ref<any>([
title: "ประเมินผล", title: "ประเมินผล",
sub: "ข้อมูลการประเมินผลการปฏิบัติราชการ", sub: "ข้อมูลการประเมินผลการปฏิบัติราชการ",
color: "lime-4", color: "lime-4",
path: "", path: "/assess",
active: false, active: false,
}, },
{ {
@ -79,61 +79,87 @@ const items = ref<any>([
path: "/appeal-complain", path: "/appeal-complain",
active: false, active: false,
}, },
]) ]);
onMounted(async () => { onMounted(async () => {
await fetchlistInbox() await fetchlistInbox();
}) });
const fetchlistInbox = async () => { const fetchlistInbox = async () => {
showLoader() showLoader();
await http await http
.get(config.API.msgInbox) .get(config.API.msgInbox)
.then(res => { .then((res) => {
let data = res.data.result let data = res.data.result;
console.log(data) console.log(data);
let listItem: any = [] let listItem: any = [];
data.map((e: any) => { data.map((e: any) => {
listItem.push({ listItem.push({
no: e.id ?? "", no: e.id ?? "",
sender: e.createdFullName == "" || e.createdFullName == null ? "เจ้าหน้าที่" : e.createdFullName, sender:
e.createdFullName == "" || e.createdFullName == null
? "เจ้าหน้าที่"
: e.createdFullName,
subject: e.subject ?? "", subject: e.subject ?? "",
timereceive: date2Thai(e.createdAt), timereceive: date2Thai(e.createdAt),
body: e.body ?? "", body: e.body ?? "",
ratingModel: 0, ratingModel: 0,
});
});
inboxList.value = listItem;
}) })
}) .catch((err) => {
inboxList.value = listItem console.log(err);
})
.catch(err => {
console.log(err)
}) })
.finally(() => { .finally(() => {
hideLoader() hideLoader();
}) });
} };
const transferToPage = (path?: string) => { const transferToPage = (path?: string) => {
router.push(`${path}`) router.push(`${path}`);
} };
</script> </script>
<template> <template>
<div class="col-12 row q-col-gutter-md" style="padding-top: 1.8%"> <div class="col-12 row q-col-gutter-md" style="padding-top: 1.8%">
<div class="col-12 row" v-if="!$q.screen.gt.xs"> <div class="col-12 row" v-if="!$q.screen.gt.xs">
<div class="text-white text-weight-light text-18px">สวสด, {{ fullname }}</div> <div class="text-white text-weight-light text-18px">
<div style="color: #ffffff" class="text-18px text-weight-medium col-12">ระบบทรพยากรบคคล</div> สวสด, {{ fullname }}
</div>
<div style="color: #ffffff" class="text-18px text-weight-medium col-12">
ระบบทรพยากรบคคล
</div>
</div> </div>
<div class="col-xs-12 col-sm-12 col-md-9"> <div class="col-xs-12 col-sm-12 col-md-9">
<div class="row justify-start q-col-gutter-md"> <div class="row justify-start q-col-gutter-md">
<div class="col-xs-6 col-sm-4 col-md-4 col-lg-3 col-xl-2 row" v-for="(item, j) in items" :key="j"> <div
<q-card bordered @click="transferToPage(item.path)" class="noactive col-12"> class="col-xs-6 col-sm-4 col-md-4 col-lg-3 col-xl-2 row"
v-for="(item, j) in items"
:key="j"
>
<q-card
bordered
@click="transferToPage(item.path)"
class="noactive col-12"
>
<div class="col-12"> <div class="col-12">
<q-avatar :color="item.color" text-color="white" :size="$q.screen.gt.xs ? '55px' : '40px'"> <q-avatar
<q-icon :name="item.icon" :size="$q.screen.gt.xs ? '28px' : '20px'" color="black" /> :color="item.color"
text-color="white"
:size="$q.screen.gt.xs ? '55px' : '40px'"
>
<q-icon
:name="item.icon"
:size="$q.screen.gt.xs ? '28px' : '20px'"
color="black"
/>
</q-avatar> </q-avatar>
</div> </div>
<div class="q-pt-md col-12 text-left text-18px"> <div class="q-pt-md col-12 text-left text-18px">
{{ item.title }} {{ item.title }}
</div> </div>
<div class="col-12 text-left text-grey text-weight-regular gt-xs" style="font-size: 14px"> <div
class="col-12 text-left text-grey text-weight-regular gt-xs"
style="font-size: 14px"
>
{{ item.sub }} {{ item.sub }}
</div> </div>
</q-card> </q-card>
@ -141,18 +167,44 @@ const transferToPage = (path?: string) => {
</div> </div>
</div> </div>
<div class="col-xs-12 col-sm-12 col-md-3 row"> <div class="col-xs-12 col-sm-12 col-md-3 row">
<q-card flat bordered :style="$q.screen.gt.xs ? 'max-height: 74vh' : 'height: auto;'" class="q-pb-md col-12"> <q-card
flat
bordered
:style="$q.screen.gt.xs ? 'max-height: 74vh' : 'height: auto;'"
class="q-pb-md col-12"
>
<div class="col-12 row q-pa-md"> <div class="col-12 row q-pa-md">
<div class="text-subtitle1 text-weight-bold text-dark">กลองขอความ</div> <div class="text-subtitle1 text-weight-bold text-dark">
กลองขอความ
</div>
<q-space /> <q-space />
<q-btn dense icon="mdi-dots-vertical" color="grey-6" size="11px" flat /> <q-btn
dense
icon="mdi-dots-vertical"
color="grey-6"
size="11px"
flat
/>
</div> </div>
<q-scroll-area style="height: 64vh" v-if="inboxList.length > 1"> <q-scroll-area style="height: 64vh" v-if="inboxList.length > 1">
<q-list v-for="(contact, index) in inboxList" :key="index" class="q-px-md"> <q-list
<q-item clickable v-ripple class="q-py-md q-mb-sm my-menu" :active="link === contact.no" @click="link = contact.no" active-class="my-menu-link"> v-for="(contact, index) in inboxList"
:key="index"
class="q-px-md"
>
<q-item
clickable
v-ripple
class="q-py-md q-mb-sm my-menu"
:active="link === contact.no"
@click="link = contact.no"
active-class="my-menu-link"
>
<q-item-section> <q-item-section>
<q-item-label>{{ contact.sender }}</q-item-label> <q-item-label>{{ contact.sender }}</q-item-label>
<q-item-label caption class="text-grey-6" lines="2">{{ contact.subject }}</q-item-label> <q-item-label caption class="text-grey-6" lines="2">{{
contact.subject
}}</q-item-label>
</q-item-section> </q-item-section>
<q-item-section side top> <q-item-section side top>
@ -163,7 +215,12 @@ const transferToPage = (path?: string) => {
</q-scroll-area> </q-scroll-area>
<q-banner rounded class="bg-amber-1 text-center q-mx-sm" v-else> <q-banner rounded class="bg-amber-1 text-center q-mx-sm" v-else>
<div class="text-yellow-10"> <div class="text-yellow-10">
<q-icon name="mdi-alert-box" class="q-mx-xs" size="sm" color="yellow-10" /> <q-icon
name="mdi-alert-box"
class="q-mx-xs"
size="sm"
color="yellow-10"
/>
ไมพบขอความ ไมพบขอความ
</div> </div>
</q-banner> </q-banner>