1
This commit is contained in:
@@ -10,11 +10,14 @@ const app = AdminFramework.createApp({
|
||||
title: '我的管理系统',
|
||||
apiUrl: config.apiUrl,
|
||||
componentMap: componentMap,
|
||||
HomePage: CustomHomePage, // 可选:自定义首页组件,覆盖整个首页
|
||||
storeModules: {
|
||||
device: deviceModule // 注册设备选择模块
|
||||
}
|
||||
HomePage: CustomHomePage // 可选:自定义首页组件,覆盖整个首页
|
||||
})
|
||||
|
||||
// 手动注册 store 模块(如果框架不支持 storeModules 参数)
|
||||
if (app.$store && !app.$store.hasModule(['device'])) {
|
||||
app.$store.registerModule('device', deviceModule)
|
||||
}
|
||||
|
||||
// 挂载应用
|
||||
app.$mount('#app')
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="home-statistics">
|
||||
<!-- 设备选择器 -->
|
||||
<Card style="margin-bottom: 16px;">
|
||||
<Card class="home-card" style="margin-bottom: 16px;">
|
||||
<p slot="title">设备选择</p>
|
||||
<Select
|
||||
v-model="selectedDeviceSn"
|
||||
@@ -137,7 +137,7 @@
|
||||
<!-- 统计卡片 -->
|
||||
<Row :gutter="16" style="margin-bottom: 16px;">
|
||||
<Col span="6">
|
||||
<Card>
|
||||
<Card class="home-card">
|
||||
<div class="statistic-item">
|
||||
<div class="statistic-title">今日投递</div>
|
||||
<div class="statistic-value">{{ todayStats.applyCount }}</div>
|
||||
@@ -145,7 +145,7 @@
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span="6">
|
||||
<Card>
|
||||
<Card class="home-card">
|
||||
<div class="statistic-item">
|
||||
<div class="statistic-title">今日找工作</div>
|
||||
<div class="statistic-value">{{ todayStats.jobSearchCount }}</div>
|
||||
@@ -153,7 +153,7 @@
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span="6">
|
||||
<Card>
|
||||
<Card class="home-card">
|
||||
<div class="statistic-item">
|
||||
<div class="statistic-title">今日沟通</div>
|
||||
<div class="statistic-value">{{ todayStats.chatCount }}</div>
|
||||
@@ -161,7 +161,7 @@
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span="6">
|
||||
<Card>
|
||||
<Card class="home-card">
|
||||
<div class="statistic-item">
|
||||
<div class="statistic-title">执行中任务</div>
|
||||
<div class="statistic-value">{{ todayStats.runningTaskCount }}</div>
|
||||
@@ -171,7 +171,7 @@
|
||||
</Row>
|
||||
|
||||
<!-- 当前执行任务的命令区块(指令列表) -->
|
||||
<Card style="margin-bottom: 16px;">
|
||||
<Card class="home-card" style="margin-bottom: 16px;">
|
||||
<p slot="title">当前执行中的任务</p>
|
||||
<Table
|
||||
v-if="runningTasks.length > 0"
|
||||
@@ -190,7 +190,7 @@
|
||||
</Card>
|
||||
|
||||
<!-- 趋势图表(7天趋势) -->
|
||||
<Card>
|
||||
<Card class="home-card">
|
||||
<p slot="title">近7天统计趋势</p>
|
||||
<div ref="chartContainer" style="height: 400px;"></div>
|
||||
</Card>
|
||||
@@ -716,6 +716,8 @@ export default {
|
||||
}
|
||||
|
||||
try {
|
||||
console.log('加载账户信息,设备SN:', this.selectedDeviceSn)
|
||||
|
||||
// 根据 sn_code 查询账户信息
|
||||
const res = await PlaAccountServer.page({
|
||||
seachOption: {
|
||||
@@ -728,13 +730,20 @@ export default {
|
||||
}
|
||||
})
|
||||
|
||||
if (res.code === 0 && res.data && res.data.rows && res.data.rows.length > 0) {
|
||||
const accountData = res.data.rows[0]
|
||||
console.log('账户信息接口返回:', res)
|
||||
|
||||
// 支持多种数据格式
|
||||
const accountList = res.data?.rows || res.data?.list || res.data?.data || []
|
||||
|
||||
if (accountList.length > 0) {
|
||||
const accountData = accountList[0]
|
||||
console.log('找到账户信息:', accountData)
|
||||
|
||||
// 如果接口没有返回设备状态,则单独查询
|
||||
if (accountData.is_online === undefined || accountData.is_logged_in === undefined) {
|
||||
try {
|
||||
const deviceRes = await DeviceStatusServer.getById(this.selectedDeviceSn)
|
||||
console.log('设备状态接口返回:', deviceRes)
|
||||
if (deviceRes.code === 0 && deviceRes.data) {
|
||||
accountData.is_online = deviceRes.data.isOnline || false
|
||||
accountData.is_logged_in = deviceRes.data.isLoggedIn || false
|
||||
@@ -756,7 +765,9 @@ export default {
|
||||
accountData.auto_active = accountData.auto_active !== undefined ? accountData.auto_active : 0
|
||||
|
||||
this.accountInfo = accountData
|
||||
console.log('设置账户信息:', this.accountInfo)
|
||||
} else {
|
||||
console.warn('未找到账户信息,设备SN:', this.selectedDeviceSn)
|
||||
this.accountInfo = {}
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -863,6 +874,8 @@ export default {
|
||||
<style scoped>
|
||||
.home-statistics {
|
||||
padding: 16px;
|
||||
background: #f7f8fa;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
.statistic-item {
|
||||
@@ -883,12 +896,24 @@ export default {
|
||||
|
||||
.account-info-card {
|
||||
cursor: pointer;
|
||||
background: #fff !important;
|
||||
}
|
||||
|
||||
.account-info-card:hover {
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* 所有卡片背景色 */
|
||||
.home-card {
|
||||
background: #fff !important;
|
||||
}
|
||||
|
||||
.home-card >>> .ivu-card,
|
||||
.home-card /deep/ .ivu-card,
|
||||
.home-card ::v-deep .ivu-card {
|
||||
background: #fff !important;
|
||||
}
|
||||
|
||||
.account-info-item {
|
||||
padding: 8px 0;
|
||||
}
|
||||
@@ -919,4 +944,49 @@ export default {
|
||||
margin-bottom: 8px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 确保卡片样式正常 */
|
||||
.home-statistics >>> .ivu-card,
|
||||
.home-statistics /deep/ .ivu-card,
|
||||
.home-statistics ::v-deep .ivu-card {
|
||||
background: #fff !important;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.home-statistics >>> .ivu-card-head,
|
||||
.home-statistics /deep/ .ivu-card-head,
|
||||
.home-statistics ::v-deep .ivu-card-head {
|
||||
border-bottom: 1px solid #e8eaec;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.home-statistics >>> .ivu-card-body,
|
||||
.home-statistics /deep/ .ivu-card-body,
|
||||
.home-statistics ::v-deep .ivu-card-body {
|
||||
padding: 16px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
/* 确保表格样式正常 */
|
||||
.home-statistics >>> .ivu-table {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.home-statistics >>> .ivu-table th {
|
||||
background: #f8f8f9;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.home-statistics >>> .ivu-table-stripe .ivu-table-body tr:nth-child(2n) td {
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
.home-statistics >>> .ivu-table td {
|
||||
padding: 12px 8px;
|
||||
}
|
||||
|
||||
/* 确保图表容器样式正常 */
|
||||
.home-statistics >>> .ivu-card-body {
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user