更新细节

This commit is contained in:
yaooo 2023-11-27 16:41:48 +08:00
parent 03eec6bb0d
commit f5a232a2eb
2 changed files with 134 additions and 98 deletions

View File

@ -1,7 +1,6 @@
<template>
<div class="workbench">
<div class="lg:flex">
<el-card class="!border-none mb-4 flex-1" shadow="never">
<template #header>
<div>
@ -12,7 +11,66 @@
</div>
</template>
<div class="flex flex-wrap">
<div class="w-1/2 md:w-1/4">
<div class="leading-10">土地数</div>
<div class="text-6xl">{{ workbenchData.today.total_land }}</div>
<div class="text-tx-secondary">
今日新增{{ workbenchData.today.today_land }}
</div>
</div>
<div class="w-1/2 md:w-1/4">
<div class="leading-10">产品数</div>
<div class="text-6xl">{{ workbenchData.today.total_product }}</div>
<div class="text-tx-secondary">
今日新增{{ workbenchData.today.today_product }}
</div>
</div>
<div class="w-1/2 md:w-1/4">
<div class="leading-10">设备数</div>
<div class="text-6xl">{{ workbenchData.today.total_device }}</div>
<div class="text-tx-secondary">
今日新增{{ workbenchData.today.today_device }}
</div>
</div>
<div class="w-1/2 md:w-1/4">
<div class="leading-10">报警数</div>
<div class="text-6xl">{{ workbenchData.today.total_alarm }}</div>
<div class="text-tx-secondary">
今日新增{{ workbenchData.today.today_alarm }}
</div>
</div>
</div>
</el-card>
</div>
<div class="function mb-4">
<el-card class="flex-1 !border-none" shadow="never">
<template #header>
<span>快捷入口</span>
</template>
<div class="flex flex-wrap">
<div
v-for="item in workbenchData.menu"
class="md:w-[12.5%] w-1/4 flex flex-col items-center"
:key="item"
>
<router-link :to="item.url" class="mb-3 flex flex-col items-center">
<image-contain width="40px" height="40px" :src="item?.image" />
<div class="mt-2">{{ item.name }}</div>
</router-link>
</div>
</div>
</el-card>
</div>
<div class="md:flex">
<el-card class="flex-1 !border-none md:mr-4 mb-4" shadow="never">
<div>
<v-charts
style="height: 350px"
:option="workbenchData.visitorOption"
:autoresize="true"
/>
</div>
</el-card>
</div>
</div>
@ -23,31 +81,20 @@ import { getWorkbench } from '@/api/app'
import vCharts from 'vue-echarts'
//
const workbenchData: any = reactive({
version: {
version: '', //
website: '', //
based: '',
channel: {
gitee: '',
website: ''
}
},
support: [],
today: {}, //
menu: [], //
visitor: [], // 访
article: [], //
visitor: [], //
visitorOption: {
xAxis: {
type: 'category',
data: [0]
data: [0],
},
yAxis: {
type: 'value'
},
legend: {
data: ['访问量']
data: ['土地数', '产品数', '设备数', '报警数']
},
itemStyle: {
//
@ -58,10 +105,28 @@ const workbenchData: any = reactive({
},
series: [
{
name: '访问量',
name: '土地数',
data: [0],
type: 'line',
smooth: true
},
{
name: '产品数',
data: [1],
type: 'line',
smooth: true
},
{
name: '设备数',
data: [2],
type: 'line',
smooth: true
},
{
name: '报警数',
data: [3],
type: 'line',
smooth: true
}
]
}
@ -71,15 +136,15 @@ const workbenchData: any = reactive({
const getData = () => {
getWorkbench()
.then((res: any) => {
workbenchData.version = res.version
workbenchData.today = res.today
workbenchData.menu = res.menu
workbenchData.visitor = res.visitor
workbenchData.support = res.support
// echarts
workbenchData.visitorOption.xAxis.data = []
workbenchData.visitorOption.series[0].data = []
workbenchData.visitorOption.series[1].data = []
workbenchData.visitorOption.series[2].data = []
workbenchData.visitorOption.series[3].data = []
//
res.visitor.date.reverse().forEach((item: any) => {
@ -88,6 +153,15 @@ const getData = () => {
res.visitor.list[0].data.forEach((item: any) => {
workbenchData.visitorOption.series[0].data.push(item)
})
res.visitor.list[1].data.forEach((item: any) => {
workbenchData.visitorOption.series[1].data.push(item)
})
res.visitor.list[2].data.forEach((item: any) => {
workbenchData.visitorOption.series[2].data.push(item)
})
res.visitor.list[3].data.forEach((item: any) => {
workbenchData.visitorOption.series[3].data.push(item)
})
})
.catch((err: any) => {
console.log('err', err)

View File

@ -37,22 +37,18 @@ class WorkbenchLogic extends BaseLogic
public static function index()
{
return [
// 版本信息
'version' => self::versionInfo(),
// 今日数据
'today' => self::today(),
// 常用功能
// 快捷入口
'menu' => self::menu(),
// 近15日访客数
// 图表数据
'visitor' => self::visitor(),
// 服务支持
'support' => self::support()
];
}
/**
* @notes 常用功能
* @notes 快捷入口
* @return array[]
* @author 段誉
* @date 2021/12/29 16:40
@ -61,70 +57,28 @@ class WorkbenchLogic extends BaseLogic
{
return [
[
'name' => '管理员',
'image' => FileService::getFileUrl(config('project.default_image.menu_admin')),
'url' => '/permission/admin'
],
[
'name' => '角色管理',
'image' => FileService::getFileUrl(config('project.default_image.menu_role')),
'url' => '/permission/role'
],
[
'name' => '部门管理',
'image' => FileService::getFileUrl(config('project.default_image.menu_dept')),
'url' => '/organization/department'
],
[
'name' => '字典管理',
'name' => '土地列表',
'image' => FileService::getFileUrl(config('project.default_image.menu_dict')),
'url' => '/dev_tools/dict'
'url' => '/land/land'
],
[
'name' => '代码生成器',
'image' => FileService::getFileUrl(config('project.default_image.menu_generator')),
'url' => '/dev_tools/code'
],
[
'name' => '素材中心',
'name' => '产品列表',
'image' => FileService::getFileUrl(config('project.default_image.menu_file')),
'url' => '/material/index'
'url' => '/land/product'
],
[
'name' => '菜单权限',
'image' => FileService::getFileUrl(config('project.default_image.menu_auth')),
'url' => '/permission/menu'
],
[
'name' => '网站信息',
'name' => '设备列表',
'image' => FileService::getFileUrl(config('project.default_image.menu_web')),
'url' => '/setting/website/information'
'url' => '/device/device'
],
];
}
/**
* @notes 版本信息
* @return array
* @author 段誉
* @date 2021/12/29 16:08
*/
public static function versionInfo(): array
{
return [
'version' => config('project.version'),
'website' => config('project.website.url'),
'name' => ConfigService::get('website', 'name'),
'based' => 'vue3.x、ElementUI、MySQL',
'channel' => [
'website' => 'https://www.likeadmin.cn',
'gitee' => 'https://gitee.com/likeadmin/likeadmin_php',
[
'name' => '监控报警',
'image' => FileService::getFileUrl(config('project.default_image.menu_auth')),
'url' => '/device/monitor_alarm'
]
];
}
/**
* @notes 今日数据
* @return int[]
@ -135,25 +89,27 @@ class WorkbenchLogic extends BaseLogic
{
return [
'time' => date('Y-m-d H:i:s'),
// 今日销售额
'today_sales' => 100,
// 总销售额
'total_sales' => 1000,
// 土地数
'today_land' => 3,
// 今日新增
'total_land' => 10,
// 今日访问量
'today_visitor' => 10,
// 总访问量
'total_visitor' => 100,
// 产品数
'today_product' => 2,
// 今日新增
'total_product' => 100,
// 今日新增用户量
'today_new_user' => 30,
// 总用户量
'total_new_user' => 3000,
// 设备数
'today_device' => 2,
// 今日新增
'total_device' => 12,
// 订单量 (笔)
'order_num' => 12,
// 总订单量
'order_sum' => 255
// 报警数
'today_alarm' => 5,
// 今日新增
'total_alarm' => 35,
];
}
@ -166,18 +122,24 @@ class WorkbenchLogic extends BaseLogic
*/
public static function visitor(): array
{
$num = [];
$land = $device = $product = $alarm = [];
$date = [];
for ($i = 0; $i < 15; $i++) {
$where_start = strtotime("- " . $i . "day");
$date[] = date('Y/m/d', $where_start);
$num[$i] = rand(0, 100);
$land[$i] = rand(0, 100);
$product[$i] = rand(0, 100);
$device[$i] = rand(0, 100);
$alarm[$i] = rand(0, 100);
}
return [
'date' => $date,
'list' => [
['name' => '访客数', 'data' => $num]
['name' => '土地数', 'data' => $land],
['name' => '产品数', 'data' => $product],
['name' => '设备数', 'data' => $device],
['name' => '报警数', 'data' => $alarm],
]
];
}