feat(首页工作台): 新增首页工作台内容

This commit is contained in:
Kven 2024-12-26 11:08:15 +08:00
parent 92f4189810
commit 7386ea2a94
5 changed files with 301 additions and 348 deletions

View File

@ -3,9 +3,9 @@
<head>
<meta charset="UTF-8" />
<link rel="icon" href="./src/image/票据服务.png" type="image/x-icon">
<link rel="icon" href="./src/assets/objectNetwork.png" type="image/x-icon">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>票据管理系统</title>
<title>物联网网关系统</title>
</head>
<body>

View File

@ -2,17 +2,13 @@
<div class="navbar">
<div class="left-side">
<a-space>
<img style="height: 24px" alt="logo" src="../../image/票据服务.png" />
<img style="height: 24px" alt="logo" src="../../assets/objectNetwork.png" />
<a-typography-title
:style="{ margin: 0, fontSize: '18px' }"
:heading="5"
@click="
{
router.push({ name: 'Workplace' });
}
"
@click="$router.push({ name: 'Workplace' })"
>
{{ $t('ticket.manage.system') }}
物联网网关系统
</a-typography-title>
<icon-menu-fold
v-if="!topMenu && appStore.device === 'mobile'"
@ -26,21 +22,47 @@
</div>
<ul class="right-side">
<li>
<a-tooltip content="消息中心">
<a-tooltip content="公告通知">
<a-button
class="nav-btn"
type="outline"
:shape="'circle'"
@click="$router.push({ name: 'notice' })"
@click="$router.push({ name: 'Bulletins' })"
>
<template #icon>
<a-badge :count="9" dot :offset="[2, -2]">
<icon-message />
</a-badge>
</template>
</a-button>
</a-tooltip>
</li>
<li>
<a-tooltip content="消息通知">
<div class="message-box-trigger">
<a-badge :count="9" dot>
<a-button
class="nav-btn"
type="outline"
:shape="'circle'"
@click="setPopoverVisible"
>
<icon-notification />
</a-button>
</a-badge>
</div>
</a-tooltip>
<a-popover
trigger="click"
:arrow-style="{ display: 'none' }"
:content-style="{ padding: 0, minWidth: '400px' }"
content-class="message-popover"
>
<div ref="refBtn" class="ref-btn"></div>
<template #content>
<message-box />
</template>
</a-popover>
</li>
<li>
<a-tooltip :content="$t('settings.language')">
<a-button
@ -133,9 +155,6 @@
</li>
<li>
<a-dropdown trigger="click">
<a-button style="margin-right: 20px" status="normal">{{
userStore.nickName
}}</a-button>
<a-avatar
:size="32"
:style="{ marginRight: '8px', cursor: 'pointer' }"
@ -145,7 +164,6 @@
alt="avatar"
:src="'/api/rest/attachment/' + avatar"
/>
<img v-else :src="userIcon" alt="" />
</a-avatar>
<template #content>
<a-doption>
@ -182,6 +200,7 @@ import Menu from '@/components/menu/index.vue';
import userIcon from '@/assets/images/user-circle.png';
import { useRouter } from 'vue-router';
import { clearToken } from '@/utils/auth';
import messageBox from '@/components/message-box/index.vue';
const router = useRouter();
const appStore = useAppStore();
@ -208,8 +227,16 @@ const isDark = useDark({
appStore.toggleTheme(dark);
},
});
const refBtn = ref();
const toggleTheme = useToggle(isDark);
const setPopoverVisible = () => {
const event = new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: true,
});
refBtn.value.dispatchEvent(event);
};
const handleToggleTheme = () => {
toggleTheme();
};

View File

@ -16,7 +16,7 @@ import { useUserStore } from '@/store';
const userStore = useUserStore();
const userInfo = computed(() => {
return {
name: userStore.username,
name: userStore.name,
};
});
</script>

View File

@ -1,11 +1,10 @@
<template>
<div style="width: 100%">
<a-grid :cols="24" :row-gap="16" class="panel">
<a-grid-item
class="panel-col"
:span="{ xs: 12, sm: 12, md: 12, lg: 12, xl: 12, xxl: 6 }"
>
<a-space @click="to('PASS')">
<a-space>
<a-avatar :size="54" class="col-avatar">
<img
alt="avatar"
@ -13,13 +12,15 @@
/>
</a-avatar>
<a-statistic
:title="$t('workplace.pass')"
:value="formData.pass || 0"
:title="$t('workplace.onlineContent')"
:value="373.5"
:precision="1"
:value-from="0"
animation
show-group-separator
>
<template #suffix>
<span class="unit">{{ $t('workplace.pecs') }}</span>
W+ <span class="unit">{{ $t('workplace.pecs') }}</span>
</template>
</a-statistic>
</a-space>
@ -28,7 +29,7 @@
class="panel-col"
:span="{ xs: 12, sm: 12, md: 12, lg: 12, xl: 12, xxl: 6 }"
>
<a-space @click="to('FAILED')">
<a-space>
<a-avatar :size="54" class="col-avatar">
<img
alt="avatar"
@ -36,9 +37,10 @@
/>
</a-avatar>
<a-statistic
:title="$t('workplace.notPass')"
:value="formData.notPass || 0"
:title="$t('workplace.putIn')"
:value="368"
:value-from="0"
animation
show-group-separator
>
<template #suffix>
@ -51,7 +53,7 @@
class="panel-col"
:span="{ xs: 12, sm: 12, md: 12, lg: 12, xl: 12, xxl: 6 }"
>
<a-space @click="to('EXAMINE')">
<a-space>
<a-avatar :size="54" class="col-avatar">
<img
alt="avatar"
@ -59,9 +61,10 @@
/>
</a-avatar>
<a-statistic
:title="$t('workplace.notAudit')"
:value="formData.notAudit || 0"
:title="$t('workplace.newDay')"
:value="8874"
:value-from="0"
animation
show-group-separator
>
<template #suffix>
@ -71,12 +74,11 @@
</a-space>
</a-grid-item>
<a-grid-item
v-if="userStore.permissions !== 'auditor'"
class="panel-col"
:span="{ xs: 12, sm: 12, md: 12, lg: 12, xl: 12, xxl: 6 }"
style="border-right: none"
>
<a-space @click="to('SUBMIT')">
<a-space>
<a-avatar :size="54" class="col-avatar">
<img
alt="avatar"
@ -84,15 +86,13 @@
/>
</a-avatar>
<a-statistic
v-model="formData.notFiled"
:title="$t('workplace.notFiled')"
:value="formData.notFiled || 0"
:title="$t('workplace.newFromYesterday')"
:value="2.8"
:precision="1"
:value-from="0"
show-group-separator
animation
>
<template #suffix>
<span class="unit">{{ $t('workplace.pecs') }}</span>
</template>
<template #suffix> % <icon-caret-up class="up-icon" /> </template>
</a-statistic>
</a-space>
</a-grid-item>
@ -100,116 +100,9 @@
<a-divider class="panel-border" />
</a-grid-item>
</a-grid>
<a-card :bordered="false">
<a-space id="TicketEcharts" style="width: 98%; height: 400px"></a-space>
</a-card>
</div>
</template>
<script lang="ts" setup>
import { useI18n } from 'vue-i18n';
import { useTicketStore, useUserStore } from '@/store';
import { onMounted, ref } from 'vue';
import * as echarts from 'echarts';
import router from '@/router';
const { t } = useI18n();
const ticketStore = useTicketStore();
const userStore = useUserStore();
const formData = ref({
notAudit: undefined,
notFiled: undefined,
notPass: undefined,
pass: undefined,
});
onMounted(async () => {
const res = await ticketStore.getChart();
type EChartsOption = echarts.EChartsOption;
const chartDom = document.getElementById('TicketEcharts');
const myChart = echarts.init(chartDom);
const option = {
title: {
text: t('workplace.chart'),
},
tooltip: {
trigger: 'axis',
},
legend: {
data: [
t('workplace.pass'),
t('workplace.notPass'),
t('workplace.notAudit'),
],
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true,
},
toolbox: {
feature: {
saveAsImage: {},
},
},
xAxis: {
type: 'category',
boundaryGap: false,
data: res.data.dates,
},
yAxis: {
type: 'value',
},
series: [
{
name: t('workplace.pass'),
type: 'line',
data: res.data.status2Counts,
},
{
name: t('workplace.notPass'),
type: 'line',
data: res.data.status3Counts,
},
{
name: t('workplace.notAudit'),
type: 'line',
data: res.data.status1Counts,
},
],
};
myChart.setOption(option);
});
const getHomeData = async (params: {
auditorId: number | undefined;
userId: number | string | undefined;
}) => {
if (userStore.permissions === 'admin') {
params.userId = '';
} else if (userStore.permissions === 'auditor') {
params.auditorId = userStore.id;
} else if (userStore.permissions === 'user') {
params.userId = userStore.id;
}
ticketStore.getHome(params).then((res) => {
formData.value = res.data;
});
};
const to = (key: string) => {
router.push({
name: 'TicketManage',
query: {
status: key,
},
});
};
getHomeData({});
</script>
<script lang="ts" setup></script>
<style lang="less" scoped>
.arco-grid.panel {

View File

@ -1,7 +1,37 @@
<template>
<div class="container">
<div class="left-side">
<div class="panel"> <Banner /> <DataPanel /></div>
<div class="panel">
<Banner />
<DataPanel />
</div>
<a-grid :cols="24" :col-gap="16" :row-gap="16" style="margin-top: 16px">
<a-grid-item
:span="{ xs: 24, sm: 24, md: 24, lg: 12, xl: 12, xxl: 12 }"
>
</a-grid-item>
<a-grid-item
:span="{ xs: 24, sm: 24, md: 24, lg: 12, xl: 12, xxl: 12 }"
>
</a-grid-item>
</a-grid>
</div>
<div class="right-side">
<a-grid :cols="24" :row-gap="16">
<a-grid-item :span="24">
<div class="panel moduler-wrap">
<QuickOperation />
<RecentlyVisited />
</div>
</a-grid-item>
<a-grid-item class="panel" :span="24">
</a-grid-item>
<a-grid-item class="panel" :span="24">
<Announcement />
</a-grid-item>
<a-grid-item class="panel" :span="24">
</a-grid-item>
</a-grid>
</div>
</div>
</template>
@ -9,6 +39,9 @@
<script lang="ts" setup>
import Banner from './components/banner.vue';
import DataPanel from './components/data-panel.vue';
import RecentlyVisited from './components/recently-visited.vue';
import QuickOperation from './components/quick-operation.vue';
import Announcement from './components/announcement.vue';
</script>
<script lang="ts">