Merge branch 'dev' of https://gitea.wangzhiwen.top/0214/ALOps_sys1 into dev
# Conflicts: # ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/equManagement/EquBaseController.java # ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/equManagement/EquSupplierController.java # ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/exceptionController/AlertMessageController.java # ALOps_sys_backend/alops-system/pom.xml # ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquBase.java # ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquSupplier.java # ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquVlan.java # ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/dto/EquBaseQueryDto.java # ALOps_sys_backend/alops-system/src/main/java/com/alops/system/mapper/AlertMessageMapper.java # ALOps_sys_backend/alops-system/src/main/java/com/alops/system/mapper/EquBaseMapper.java # ALOps_sys_backend/alops-system/src/main/java/com/alops/system/mapper/EquSupplierMapper.java # ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/IAlertMessageService.java # ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/IEquBaseService.java # ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/IEquSupplierService.java # ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/AlertMessageServiceImpl.java # ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/EquBaseServiceImpl.java # ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/EquSupplierServiceImpl.java # ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/EquTypeServiceImpl.java # ALOps_sys_backend/alops-system/src/main/resources/mapper/system/AlertMessageMapper.xml # ALOps_sys_backend/alops-system/src/main/resources/mapper/system/EquBaseMapper.xml # ALOps_sys_backend/alops-system/src/main/resources/mapper/system/EquSupplierMapper.xmldev
commit
f38f389443
@ -0,0 +1,15 @@ |
||||
package com.alops.system.domain.dto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.util.Date; |
||||
|
||||
@Data |
||||
public class AlertDto { |
||||
private Date minTime; |
||||
private Date maxTime; |
||||
private Long level; |
||||
private String status; |
||||
private String location; |
||||
private String inCharge; |
||||
} |
||||
@ -0,0 +1,11 @@ |
||||
package com.alops.system.domain.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class RolePickerVo { |
||||
|
||||
private Long roleId; |
||||
private String roleName; |
||||
private String roleKey; |
||||
} |
||||
@ -0,0 +1,13 @@ |
||||
package com.alops.system.domain.vo; |
||||
|
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Data; |
||||
import lombok.NoArgsConstructor; |
||||
|
||||
@Data |
||||
@AllArgsConstructor |
||||
@NoArgsConstructor |
||||
public class dropDownVo { |
||||
private String id; |
||||
private String name; |
||||
} |
||||
@ -0,0 +1,8 @@ |
||||
package com.alops.system.domain.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class imageVo { |
||||
private byte[] equImage; |
||||
} |
||||
@ -0,0 +1,101 @@ |
||||
package com.alops.system.job; |
||||
|
||||
import com.alops.system.domain.InternalMessage; |
||||
import com.alops.system.domain.ScheduleRules; |
||||
import com.alops.system.mapper.ScheduleRulesMapper; |
||||
import com.alops.system.service.IAlertSenderService; |
||||
import com.alops.system.service.IScheduleRulesService; |
||||
import com.alops.system.service.impl.ScheduleRulesServiceImpl; |
||||
import org.quartz.*; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Component; |
||||
; |
||||
import java.util.Date; |
||||
|
||||
@Component |
||||
public class GatherJob implements Job { |
||||
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(GatherJob.class); |
||||
@Autowired |
||||
private ScheduleRulesMapper scheduleRulesMapper; |
||||
|
||||
@Autowired |
||||
private IScheduleRulesService iScheduleRulesService; |
||||
|
||||
@Autowired |
||||
private IAlertSenderService iAlertSenderService; |
||||
|
||||
@Override |
||||
public void execute(JobExecutionContext context) throws JobExecutionException { |
||||
|
||||
Long ruleId = context.getJobDetail().getJobDataMap().getLong("ruleId"); |
||||
ScheduleRules rule = scheduleRulesMapper.selectScheduleRulesById(ruleId); |
||||
|
||||
// 统一使用 Date
|
||||
Date now = new Date(); |
||||
try { |
||||
if (rule == null) return; |
||||
|
||||
// 按频率判断时间范围
|
||||
if (rule.getRuleType() == 0) { |
||||
Date start = rule.getStartTime(); |
||||
Date end = rule.getEndTime(); |
||||
if (start != null && end != null) { |
||||
// 当前时间不在范围内
|
||||
if ( now.after(end)) { |
||||
rule.setStatus(2); // 超出范围标记完成
|
||||
scheduleRulesMapper.updateScheduleRules(rule); |
||||
|
||||
return; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// 执行任务
|
||||
iScheduleRulesService.executeImmediately(); |
||||
|
||||
// 执行成功
|
||||
if (rule.getRuleType() == 0 || rule.getRuleType() == 1) { |
||||
rule.setStatus(2); |
||||
} |
||||
scheduleRulesMapper.updateScheduleRules(rule); |
||||
|
||||
} catch (Exception e) { |
||||
//执行失败是不会有采集信息和预警信息的
|
||||
|
||||
// 记录详细异常日志,方便排查
|
||||
log.error("GatherJob 执行失败, ruleId={}, 原因: {}", rule.getId(), e.getMessage(), e); |
||||
|
||||
// 更新数据库任务状态为失败
|
||||
rule.setStatus(3); |
||||
scheduleRulesMapper.updateScheduleRules(rule); |
||||
try { |
||||
String Content=String.format("任务执行失败,规则ID=%s,规则名称=%s,原因:%s", |
||||
rule.getId(), rule.getRuleName(), e.getMessage()); |
||||
|
||||
iAlertSenderService.sendInternalMessage( Content,"2" ); |
||||
|
||||
log.info("已发送失败通知给运维人员"); |
||||
} catch (Exception ne) { |
||||
log.error("发送站内信失败: {}", ne.getMessage(), ne); |
||||
} |
||||
|
||||
|
||||
// 如果是定时类规则,取消后续调度
|
||||
if (rule.getRuleType() == 0) { |
||||
try { |
||||
// 从上下文取出 Scheduler
|
||||
Scheduler scheduler = context.getScheduler(); |
||||
JobKey jobKey = context.getJobDetail().getKey(); |
||||
scheduler.deleteJob(jobKey); // 取消后续执行
|
||||
log.info("已取消定时任务: {}", jobKey); |
||||
} catch (SchedulerException se) { |
||||
log.error("取消后续定时任务失败: {}", se.getMessage(), se); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -1,7 +1,8 @@ |
||||
package com.alops.system.service; |
||||
|
||||
import java.util.List; |
||||
import java.util.concurrent.ExecutionException; |
||||
|
||||
public interface IAlertLaunchService { |
||||
public void executeImmediateAlerts(List<Long> ruleIds); |
||||
public void executeImmediateAlerts() throws ExecutionException, InterruptedException; |
||||
} |
||||
|
||||
@ -0,0 +1,12 @@ |
||||
package com.alops.system.service; |
||||
|
||||
import com.alops.system.domain.ScheduleRules; |
||||
import com.alops.system.service.impl.QuartzService; |
||||
import org.quartz.SchedulerException; |
||||
|
||||
public interface IQuartzService { |
||||
|
||||
public void createOrUpdateJob(ScheduleRules rule); |
||||
public void deleteJob(Long ruleId) throws SchedulerException; |
||||
|
||||
} |
||||
@ -0,0 +1,105 @@ |
||||
package com.alops.system.service.impl; |
||||
|
||||
import com.alops.system.domain.ScheduleRules; |
||||
import com.alops.system.job.GatherJob; |
||||
import com.alops.system.service.IQuartzService; |
||||
import org.quartz.*; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.quartz.Trigger; // ✅ Quartz 的 Trigger
|
||||
import org.quartz.TriggerBuilder; |
||||
import org.quartz.Scheduler; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.Date; |
||||
|
||||
|
||||
@Service |
||||
public class QuartzService implements IQuartzService { |
||||
|
||||
@Autowired |
||||
private Scheduler scheduler; |
||||
|
||||
@Override |
||||
public void createOrUpdateJob(ScheduleRules rule) { |
||||
try { |
||||
String jobName = "job_" + rule.getId(); |
||||
String groupName = "gather_rules"; |
||||
|
||||
JobDetail jobDetail = JobBuilder.newJob(GatherJob.class) |
||||
.withIdentity(jobName, groupName) |
||||
.usingJobData("ruleId", rule.getId()) |
||||
.build(); |
||||
|
||||
TriggerBuilder<Trigger> triggerBuilder = TriggerBuilder.newTrigger() |
||||
.withIdentity("trigger_" + rule.getId(), groupName); |
||||
|
||||
if (rule.getRuleType() == 1 && rule.getGatherTime() != null) { |
||||
triggerBuilder.startAt(Date.from(rule.getGatherTime() |
||||
.toInstant())); |
||||
} else if (rule.getRuleType() == 0 && rule.getFrequency() != null) { |
||||
if (rule.getStartTime() != null) { |
||||
triggerBuilder.startAt(rule.getStartTime()); |
||||
} |
||||
if (rule.getEndTime() != null) { |
||||
triggerBuilder.endAt(rule.getEndTime()); |
||||
} |
||||
// 替换这里:不再使用 Cron,而是使用 SimpleSchedule
|
||||
triggerBuilder.withSchedule( |
||||
SimpleScheduleBuilder.simpleSchedule() |
||||
.withIntervalInMinutes(rule.getFrequency()) // 每 rule.getFrequency() 分钟
|
||||
.repeatForever() // 一直重复,直到 endTime
|
||||
); |
||||
} |
||||
|
||||
Trigger trigger = triggerBuilder.build(); |
||||
|
||||
if (scheduler.checkExists(jobDetail.getKey())) { |
||||
scheduler.deleteJob(jobDetail.getKey()); |
||||
} |
||||
scheduler.scheduleJob(jobDetail, trigger); |
||||
if (!scheduler.isStarted()) { |
||||
scheduler.start(); |
||||
} |
||||
|
||||
} catch (SchedulerException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
|
||||
// /**
|
||||
// * 将分钟频率转换为 Quartz Cron 表达式
|
||||
// * 支持 frequency >= 1
|
||||
// * 最大间隔是23小时59分钟 !!!!!!!!!!!!!!1
|
||||
// */
|
||||
// private String convertFrequencyToCron(Integer frequency) {
|
||||
// if (frequency == null || frequency <= 0) {
|
||||
// throw new IllegalArgumentException("frequency 必须是大于 0 的分钟数");
|
||||
// }
|
||||
//
|
||||
// // 计算小时和分钟
|
||||
// int hours = frequency / 60; // 每隔多少小时
|
||||
// int minutes = frequency % 60; // 余下多少分钟
|
||||
//
|
||||
// if (hours > 0 && minutes == 0) {
|
||||
// // 整小时倍数
|
||||
// return String.format("0 0 0/%d * * ?", hours);
|
||||
// } else if (hours > 0) {
|
||||
// // 既有小时又有分钟,折中为:每 hours 小时的第 minutes 分
|
||||
// return String.format("0 %d 0/%d * * ?", minutes, hours);
|
||||
// } else {
|
||||
// // 纯分钟且小于 60
|
||||
// return String.format("0 0/%d * * * ?", minutes);
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override |
||||
public void deleteJob(Long ruleId) throws SchedulerException { |
||||
String jobName = "job_" + ruleId; |
||||
String groupName = "gather_rules"; |
||||
JobKey key = JobKey.jobKey(jobName, groupName); |
||||
if (scheduler.checkExists(key)) { |
||||
scheduler.deleteJob(key); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@ -0,0 +1,40 @@ |
||||
<template> |
||||
<dv-digital-flop :config="config" /> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
props: { |
||||
configData: { |
||||
type: Object, |
||||
default: () => { |
||||
return {} |
||||
} |
||||
} |
||||
}, |
||||
data() { |
||||
return { |
||||
config:{ |
||||
number: [123456], |
||||
content: '{nt}个', |
||||
formatter: this.formatter, |
||||
style:{ |
||||
fill: '#000', |
||||
fontSize: 26, |
||||
fontWeight: 'bold' |
||||
}, |
||||
...this.configData |
||||
} |
||||
} |
||||
}, |
||||
methods: { |
||||
formatter (number) { |
||||
const numbers = number.toString().split('').reverse() |
||||
const segs = [] |
||||
while (numbers.length) segs.push(numbers.splice(0, 3).join('')) |
||||
return segs.join(',').split('').reverse().join('') |
||||
}, |
||||
|
||||
} |
||||
} |
||||
</script> |
||||
@ -0,0 +1,449 @@ |
||||
<template> |
||||
<div class="app-container"> |
||||
<el-row :gutter="20"> |
||||
<splitpanes :horizontal="this.$store.getters.device === 'mobile'" class="default-theme"> |
||||
<!--供应商--> |
||||
<pane size="84"> |
||||
<el-col> |
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
||||
<el-form-item label="供应商名称" prop="name"> |
||||
<el-input v-model="queryParams.name" placeholder="请输入厂商名称" clearable style="width: 240px" @keyup.enter.native="handleQuery" /> |
||||
</el-form-item> |
||||
<el-form-item label="联系人" prop="contactBy"> |
||||
<el-input v-model="queryParams.contactBy" placeholder="请输入联系人" clearable style="width: 240px" @keyup.enter.native="handleQuery" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
|
||||
<el-row :gutter="10" class="mb8"> |
||||
<el-col :span="1.5"> |
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['device:deviceManufacturer:add']">新增</el-button> |
||||
</el-col> |
||||
<!-- <el-col :span="1.5"> |
||||
<el-button type="info" plain icon="el-icon-upload2" size="mini" @click="handleImport" v-hasPermi="['device:deviceManufacturer:import']">导入</el-button> |
||||
</el-col> |
||||
<el-col :span="1.5"> |
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['device:deviceManufacturer:export']">导出</el-button> |
||||
</el-col> --> |
||||
</el-row> |
||||
|
||||
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange"> |
||||
<el-table-column type="selection" width="50" align="center" /> |
||||
<el-table-column label="序号" align="center" key="Id" prop="Id" /> |
||||
<el-table-column label="供应商名称" align="center" key="name" prop="name" width="120" /> |
||||
<el-table-column label="联系人" align="center" key="contactBy" prop="contactBy" width="120" /> |
||||
<el-table-column label="联系方式" align="center" key="contactWay" prop="contactWay" width="120" /> |
||||
<el-table-column label="供应商简介" align="center" key="contactWay" prop="contactWay" width="120" /> |
||||
<el-table-column label="创建人" align="center" key="CreateBy" prop="CreateBy" width="120" /> |
||||
<el-table-column label="创建日期" align="center" prop="CreateDate" width="160"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ parseTime(scope.row.CreateDate) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="状态" align="center" key="Status" prop="Status" width="120" /> |
||||
<el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width"> |
||||
<template slot-scope="scope"> |
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['device:deviceManufacturer:edit']">修改</el-button> |
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['device:deviceManufacturer:remove']">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" /> |
||||
</el-col> |
||||
</pane> |
||||
</splitpanes> |
||||
</el-row> |
||||
|
||||
<el-dialog :title="title" :visible.sync="open" width="760px" append-to-body> |
||||
<el-form ref="form" :model="form" :rules="rules" label-width="90px"> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="12"> |
||||
<el-form-item label="厂商名称" prop="name"> |
||||
<el-input v-model="form.name" placeholder="请输入用户昵称" maxlength="30" /> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12"> |
||||
<el-form-item label="联系人" prop="contactBy"> |
||||
<el-input v-model="form.contactBy" placeholder="请输入手机号码" maxlength="30" /> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12"> |
||||
<el-form-item label="联系方式" prop="contactWay"> |
||||
<el-input v-model="form.contactWay" placeholder="请输入手机号码" maxlength="11" /> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form> |
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
<el-button @click="cancel">取 消</el-button> |
||||
</span> |
||||
|
||||
</el-dialog> |
||||
|
||||
<!-- 用户导入对话框 --> |
||||
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body> |
||||
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag> |
||||
<i class="el-icon-upload"></i> |
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
||||
<div class="el-upload__tip text-center" slot="tip"> |
||||
<div class="el-upload__tip" slot="tip"> |
||||
<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的供应商 |
||||
</div> |
||||
<span>仅允许导入xls、xlsx格式文件。</span> |
||||
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="importTemplate">下载模板</el-link> |
||||
</div> |
||||
</el-upload> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitFileForm">确 定</el-button> |
||||
<el-button @click="upload.open = false">取 消</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus, deptTreeSelect } from "@/api/system/user" |
||||
import { getToken } from "@/utils/auth" |
||||
import Treeselect from "@riophae/vue-treeselect" |
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css" |
||||
import { Splitpanes, Pane } from "splitpanes" |
||||
import "splitpanes/dist/splitpanes.css" |
||||
|
||||
export default { |
||||
name: "User", |
||||
dicts: ['sys_normal_disable', 'sys_user_sex'], |
||||
components: { Treeselect, Splitpanes, Pane }, |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 选中数组 |
||||
ids: [], |
||||
// 非单个禁用 |
||||
single: true, |
||||
// 非多个禁用 |
||||
multiple: true, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 用户表格数据 |
||||
userList: null, |
||||
// 弹出层标题 |
||||
title: "", |
||||
// 所有部门树选项 |
||||
deptOptions: undefined, |
||||
// 过滤掉已禁用部门树选项 |
||||
enabledDeptOptions: undefined, |
||||
// 是否显示弹出层 |
||||
open: false, |
||||
// 部门名称 |
||||
deptName: undefined, |
||||
// 默认密码 |
||||
initPassword: undefined, |
||||
// 日期范围 |
||||
dateRange: [], |
||||
// 岗位选项 |
||||
postOptions: [], |
||||
// 角色选项 |
||||
roleOptions: [], |
||||
// 表单参数 |
||||
form: {}, |
||||
defaultProps: { |
||||
children: "children", |
||||
label: "label" |
||||
}, |
||||
// 用户导入参数 |
||||
upload: { |
||||
// 是否显示弹出层(用户导入) |
||||
open: false, |
||||
// 弹出层标题(用户导入) |
||||
title: "", |
||||
// 是否禁用上传 |
||||
isUploading: false, |
||||
// 是否更新已经存在的供应商 |
||||
updateSupport: 0, |
||||
// 设置上传的请求头部 |
||||
headers: { Authorization: "Bearer " + getToken() }, |
||||
// 上传的地址 |
||||
url: process.env.VUE_APP_BASE_API + "/system/user/importData" |
||||
}, |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNum: 1, |
||||
pageSize: 10, |
||||
name: undefined, |
||||
contactBy: undefined, |
||||
status: undefined, |
||||
deptId: undefined |
||||
}, |
||||
// 表单校验 |
||||
rules: { |
||||
name: [ |
||||
{ required: true, message: "用户名称不能为空", trigger: "blur" }, |
||||
{ min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur' } |
||||
], |
||||
nickName: [ |
||||
{ required: true, message: "用户昵称不能为空", trigger: "blur" } |
||||
], |
||||
password: [ |
||||
{ required: true, message: "用户密码不能为空", trigger: "blur" }, |
||||
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }, |
||||
{ pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" } |
||||
], |
||||
email: [ |
||||
{ |
||||
type: "email", |
||||
message: "请输入正确的邮箱地址", |
||||
trigger: ["blur", "change"] |
||||
} |
||||
], |
||||
contactBy: [ |
||||
{ |
||||
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, |
||||
message: "请输入正确的手机号码", |
||||
trigger: "blur" |
||||
} |
||||
] |
||||
} |
||||
} |
||||
}, |
||||
watch: { |
||||
// 根据名称筛选部门树 |
||||
deptName(val) { |
||||
this.$refs.tree.filter(val) |
||||
} |
||||
}, |
||||
created() { |
||||
this.getList() |
||||
// this.getDeptTree() |
||||
this.getConfigKey("sys.user.initPassword").then(response => { |
||||
this.initPassword = response.msg |
||||
}) |
||||
}, |
||||
methods: { |
||||
/** 查询用户列表 */ |
||||
getList() { |
||||
this.loading = true |
||||
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => { |
||||
this.userList = response.rows |
||||
this.total = response.total |
||||
this.loading = false |
||||
} |
||||
) |
||||
}, |
||||
// /** 查询部门下拉树结构 */ |
||||
// getDeptTree() { |
||||
// deptTreeSelect().then(response => { |
||||
// this.deptOptions = response.data |
||||
// this.enabledDeptOptions = this.filterDisabledDept(JSON.parse(JSON.stringify(response.data))) |
||||
// }) |
||||
// }, |
||||
// 过滤禁用的部门 |
||||
filterDisabledDept(deptList) { |
||||
return deptList.filter(dept => { |
||||
if (dept.disabled) { |
||||
return false |
||||
} |
||||
if (dept.children && dept.children.length) { |
||||
dept.children = this.filterDisabledDept(dept.children) |
||||
} |
||||
return true |
||||
}) |
||||
}, |
||||
// 筛选节点 |
||||
filterNode(value, data) { |
||||
if (!value) return true |
||||
return data.label.indexOf(value) !== -1 |
||||
}, |
||||
// 节点单击事件 |
||||
handleNodeClick(data) { |
||||
this.queryParams.deptId = data.id |
||||
this.handleQuery() |
||||
}, |
||||
// 用户状态修改 |
||||
handleStatusChange(row) { |
||||
let text = row.status === "0" ? "启用" : "停用" |
||||
this.$modal.confirm('确认要"' + text + '""' + row.name + '"用户吗?').then(function() { |
||||
return changeUserStatus(row.Id, row.status) |
||||
}).then(() => { |
||||
this.$modal.msgSuccess(text + "成功") |
||||
}).catch(function() { |
||||
row.status = row.status === "0" ? "1" : "0" |
||||
}) |
||||
}, |
||||
// 取消按钮 |
||||
cancel() { |
||||
this.open = false |
||||
this.reset() |
||||
}, |
||||
// 表单重置 |
||||
reset() { |
||||
this.form = { |
||||
Id: undefined, |
||||
deptId: undefined, |
||||
name: undefined, |
||||
nickName: undefined, |
||||
password: undefined, |
||||
contactBy: undefined, |
||||
email: undefined, |
||||
sex: undefined, |
||||
status: "0", |
||||
remark: undefined, |
||||
postIds: [], |
||||
roleIds: [] |
||||
} |
||||
this.resetForm("form") |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNum = 1 |
||||
this.getList() |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.dateRange = [] |
||||
this.resetForm("queryForm") |
||||
this.queryParams.deptId = undefined |
||||
this.$refs.tree.setCurrentKey(null) |
||||
this.handleQuery() |
||||
}, |
||||
// 多选框选中数据 |
||||
handleSelectionChange(selection) { |
||||
this.ids = selection.map(item => item.Id) |
||||
this.single = selection.length != 1 |
||||
this.multiple = !selection.length |
||||
}, |
||||
// 更多操作触发 |
||||
handleCommand(command, row) { |
||||
switch (command) { |
||||
case "handleResetPwd": |
||||
this.handleResetPwd(row) |
||||
break |
||||
case "handleAuthRole": |
||||
this.handleAuthRole(row) |
||||
break |
||||
default: |
||||
break |
||||
} |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.reset() |
||||
getUser().then(response => { |
||||
this.postOptions = response.posts |
||||
this.roleOptions = response.roles |
||||
this.open = true |
||||
this.title = "添加用户" |
||||
this.form.password = this.initPassword |
||||
}) |
||||
}, |
||||
/** 修改按钮操作 */ |
||||
handleUpdate(row) { |
||||
this.reset() |
||||
const Id = row.Id || this.ids |
||||
getUser(Id).then(response => { |
||||
this.form = response.data |
||||
this.postOptions = response.posts |
||||
this.roleOptions = response.roles |
||||
this.$set(this.form, "postIds", response.postIds) |
||||
this.$set(this.form, "roleIds", response.roleIds) |
||||
this.open = true |
||||
this.title = "修改用户" |
||||
this.form.password = "" |
||||
}) |
||||
}, |
||||
/** 重置密码按钮操作 */ |
||||
handleResetPwd(row) { |
||||
this.$prompt('请输入"' + row.name + '"的新密码', "提示", { |
||||
confirmButtonText: "确定", |
||||
cancelButtonText: "取消", |
||||
closeOnClickModal: false, |
||||
inputPattern: /^.{5,20}$/, |
||||
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间", |
||||
inputValidator: (value) => { |
||||
if (/<|>|"|'|\||\\/.test(value)) { |
||||
return "不能包含非法字符:< > \" ' \\\ |" |
||||
} |
||||
}, |
||||
}).then(({ value }) => { |
||||
resetUserPwd(row.Id, value).then(response => { |
||||
this.$modal.msgSuccess("修改成功,新密码是:" + value) |
||||
}) |
||||
}).catch(() => {}) |
||||
}, |
||||
/** 分配角色操作 */ |
||||
handleAuthRole: function(row) { |
||||
const Id = row.Id |
||||
this.$router.push("/system/user-auth/role/" + Id) |
||||
}, |
||||
/** 提交按钮 */ |
||||
submitForm: function() { |
||||
this.$refs["form"].validate(valid => { |
||||
if (valid) { |
||||
if (this.form.Id != undefined) { |
||||
updateUser(this.form).then(response => { |
||||
this.$modal.msgSuccess("修改成功") |
||||
this.open = false |
||||
this.getList() |
||||
}) |
||||
} else { |
||||
addUser(this.form).then(response => { |
||||
this.$modal.msgSuccess("新增成功") |
||||
this.open = false |
||||
this.getList() |
||||
}) |
||||
} |
||||
} |
||||
}) |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
handleDelete(row) { |
||||
const Ids = row.Id || this.ids |
||||
this.$modal.confirm('是否确认删除用户编号为"' + Ids + '"的数据项?').then(function() { |
||||
return delUser(Ids) |
||||
}).then(() => { |
||||
this.getList() |
||||
this.$modal.msgSuccess("删除成功") |
||||
}).catch(() => {}) |
||||
}, |
||||
/** 导出按钮操作 */ |
||||
handleExport() { |
||||
this.download('system/user/export', { |
||||
...this.queryParams |
||||
}, `user_${new Date().getTime()}.xlsx`) |
||||
}, |
||||
/** 导入按钮操作 */ |
||||
handleImport() { |
||||
this.upload.title = "用户导入" |
||||
this.upload.open = true |
||||
}, |
||||
/** 下载模板操作 */ |
||||
importTemplate() { |
||||
this.download('system/user/importTemplate', { |
||||
}, `user_template_${new Date().getTime()}.xlsx`) |
||||
}, |
||||
// 文件上传中处理 |
||||
handleFileUploadProgress(event, file, fileList) { |
||||
this.upload.isUploading = true |
||||
}, |
||||
// 文件上传成功处理 |
||||
handleFileSuccess(response, file, fileList) { |
||||
this.upload.open = false |
||||
this.upload.isUploading = false |
||||
this.$refs.upload.clearFiles() |
||||
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true }) |
||||
this.getList() |
||||
}, |
||||
// 提交上传文件 |
||||
submitFileForm() { |
||||
this.$refs.upload.submit() |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
@ -1,187 +1,300 @@ |
||||
<template> |
||||
<div class="dashboard"> |
||||
<h1>唐山烟草智能网络设备运维与问答系统</h1> |
||||
|
||||
<el-row :gutter="20"> |
||||
<!-- 设备状态监控 --> |
||||
<el-col :span="12"> |
||||
<el-card> |
||||
<h2>设备状态监控</h2> |
||||
<!-- 这里可以添加设备状态监控的具体内容,例如表格或图表 --> |
||||
<el-table :data="deviceStatusData" style="width: 100%"> |
||||
<el-table-column prop="name" label="设备名称"></el-table-column> |
||||
<el-table-column prop="location" label="设备位置"></el-table-column> |
||||
<el-table-column prop="cpuUsage" label="CPU使用率"></el-table-column> |
||||
<el-table-column prop="memoryUsage" label="内存使用率"></el-table-column> |
||||
<el-table-column prop="status" label="状态"> |
||||
<template slot-scope="scope"> |
||||
<el-tag :type="scope.row.status === '正常' ? 'success' : 'danger'"> |
||||
{{ scope.row.status }} |
||||
</el-tag> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</el-card> |
||||
</el-col> |
||||
|
||||
<!-- 设备状态统计图表 --> |
||||
<el-col :span="12"> |
||||
<el-card> |
||||
<h2>检测设备信息 (按状态统计,饼状图)</h2> |
||||
<!-- 这里可以使用echarts或其他图表库来展示饼状图 --> |
||||
<div id="statusChart" style="width: 100%; height: 300px;"></div> |
||||
</el-card> |
||||
|
||||
<el-card> |
||||
<h2>检测设备信息 (按设备类型,饼状图)</h2> |
||||
<div id="typeChart" style="width: 100%; height: 300px;"></div> |
||||
</el-card> |
||||
<div class="dashboard-editor-container"> |
||||
|
||||
<el-row :gutter="32"> |
||||
<el-col :xs="24" :sm="24" :lg="8"> |
||||
<div class="chart-wrapper"> |
||||
<div class="card-title"><i class="el-icon-data-line"></i>预警信息统计</div> |
||||
<div class="data-overview"> |
||||
<div class="data-item"> |
||||
<div class="data-label">预警总数</div> |
||||
<digital :configData="{number:[111]}" /> |
||||
</div> |
||||
<div class="data-item"> |
||||
<div class="data-label">预警总数</div> |
||||
<digital :configData="{number:[111]}" /> |
||||
</div> |
||||
<div class="data-item"> |
||||
<div class="data-label">预警总数</div> |
||||
<digital :configData="{number:[111]}" /> |
||||
</div> |
||||
<div class="data-item"> |
||||
<div class="data-label">预警总数</div> |
||||
<digital :configData="{number:[111]}" /> |
||||
</div> |
||||
<div class="data-item"> |
||||
<div class="data-label">预警总数</div> |
||||
<digital :configData="{number:[111]}" /> |
||||
</div> |
||||
<div class="data-item"> |
||||
<div class="data-label">预警总数</div> |
||||
<digital :configData="{number:[111]}" /> |
||||
</div> |
||||
<div class="data-item"> |
||||
<div class="data-label">预警总数</div> |
||||
<digital :configData="{number:[111]}" /> |
||||
</div> |
||||
<div class="data-item"> |
||||
<div class="data-label">预警总数</div> |
||||
<digital :configData="{number:[111]}" /> |
||||
</div> |
||||
<div class="data-item"> |
||||
<div class="data-label">预警总数</div> |
||||
<digital :configData="{number:[111]}" /> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</el-col> |
||||
</el-row> |
||||
|
||||
<el-row :gutter="20" style="margin-top: 20px;"> |
||||
<!-- 设备预警信息 --> |
||||
<el-col :span="12"> |
||||
<el-card> |
||||
<h2>设备预警信息</h2> |
||||
<el-table :data="alertData" style="width: 100%"> |
||||
<el-table-column prop="time" label="预警时间"></el-table-column> |
||||
<el-table-column prop="device" label="设备名称"></el-table-column> |
||||
<el-table-column prop="location" label="设备位置"></el-table-column> |
||||
<el-table-column prop="level" label="预警等级"> |
||||
<template slot-scope="scope"> |
||||
<el-tag :type="getTagType(scope.row.level)"> |
||||
{{ scope.row.level }} |
||||
</el-tag> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</el-card> |
||||
<el-col :xs="24" :sm="24" :lg="8"> |
||||
<div class="chart-wrapper"> |
||||
<div class="card-title"><i class="el-icon-pie-chart"></i>检测设备信息</div> |
||||
<pie-chart /> |
||||
</div> |
||||
</el-col> |
||||
|
||||
<!-- 预警信息统计 --> |
||||
<el-col :span="12"> |
||||
<el-card> |
||||
<h2>预警信息统计</h2> |
||||
<div id="alertStatsChart" style="width: 100%; height: 300px;"></div> |
||||
</el-card> |
||||
<el-col :xs="24" :sm="24" :lg="8"> |
||||
<div class="chart-wrapper"> |
||||
<div class="card-title"><i class="el-icon-monitor"></i>设备预警信息</div> |
||||
|
||||
<div class="div0"> |
||||
<div class="div1" v-for="(alert, index) in alerts" :key="index" :class="`alert-level-${alert.level}`"> |
||||
<dv-border-box-13 class="div2"> |
||||
<el-row> |
||||
<el-col span="12"> |
||||
<span class="alert-lable">预警时间:{{ alert.time }}</span> |
||||
</el-col> |
||||
<el-col span="12"> |
||||
<span class="alert-lable">设备名称:{{ alert.deviceName }}</span> |
||||
</el-col> |
||||
<el-col span="12"> |
||||
<span class="alert-lable">设备位置:{{ alert.deviceLocation }}</span> |
||||
</el-col> |
||||
<el-col span="12"> |
||||
<span class="alert-lable">预警等级:<span class="alert-lable" :style="{ color: getLevelColor(alert.level) }">{{ alert.level }}</span></span> |
||||
</el-col> |
||||
<el-col span="12"> |
||||
<span class="alert-lable">预警信息:{{ alert.message }}</span> |
||||
</el-col> |
||||
<el-col span="12"> |
||||
<span class="alert-lable">预警状态:{{ alert.status }}</span> |
||||
</el-col> |
||||
</el-row> |
||||
</dv-border-box-13> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</el-col> |
||||
</el-row> |
||||
<el-row style="background:#fff;padding:16px;"> |
||||
<div class="card-title"><i class="el-icon-s-data"></i> 设备状态监控</div> |
||||
<dv-scroll-board :config="scrollConfig" style="height:220px;" /> |
||||
</el-row> |
||||
|
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import * as echarts from 'echarts' |
||||
require('echarts/theme/macarons') // echarts theme |
||||
import PanelGroup from './dashboard/PanelGroup' |
||||
import LineChart from './dashboard/LineChart' |
||||
import RaddarChart from './dashboard/RaddarChart' |
||||
import PieChart from './dashboard/PieChart' |
||||
import BarChart from './dashboard/BarChart' |
||||
import digital from './dashboard/digital' |
||||
|
||||
const lineChartData = { |
||||
newVisitis: { |
||||
expectedData: [100, 120, 161, 134, 105, 160, 165], |
||||
actualData: [120, 82, 91, 154, 162, 140, 145] |
||||
}, |
||||
messages: { |
||||
expectedData: [200, 192, 120, 144, 160, 130, 140], |
||||
actualData: [180, 160, 151, 106, 145, 150, 130] |
||||
}, |
||||
purchases: { |
||||
expectedData: [80, 100, 121, 104, 105, 90, 100], |
||||
actualData: [120, 90, 100, 138, 142, 130, 130] |
||||
}, |
||||
shoppings: { |
||||
expectedData: [130, 140, 141, 142, 145, 150, 160], |
||||
actualData: [120, 82, 91, 154, 162, 140, 130] |
||||
} |
||||
} |
||||
|
||||
export default { |
||||
name: 'Index', |
||||
components: { |
||||
PanelGroup, |
||||
LineChart, |
||||
RaddarChart, |
||||
PieChart, |
||||
BarChart, |
||||
digital |
||||
}, |
||||
data() { |
||||
return { |
||||
deviceStatusData: [ |
||||
// 示例数据 |
||||
{ name: '设备1', location: '位置1', cpuUsage: '30%', memoryUsage: '40%', status: '正常' }, |
||||
{ name: '设备2', location: '位置2', cpuUsage: '70%', memoryUsage: '80%', status: '异常' }, |
||||
], |
||||
alertData: [ |
||||
// 示例数据 |
||||
{ time: '2023-10-01 10:00:00', device: '设备2', location: '位置2', level: '高' }, |
||||
{ time: '2023-10-01 11:00:00', device: '设备3', location: '位置3', level: '中' }, |
||||
], |
||||
}; |
||||
}, |
||||
mounted() { |
||||
this.initCharts(); |
||||
lineChartData: lineChartData.newVisitis, |
||||
scrollConfig:{ |
||||
header: ['设备名称', '设备位置', 'CPU使用率','内存使用率','温度', '健康度', '设备运行时长','采集时间'], |
||||
data: [ |
||||
['行1列1', '行1列2', '行1列3', '行1列4', '行1列5', '行1列6','行1列7', '行1列8'], |
||||
['行2列1', '行2列2', '行2列3', '行2列4', '行2列5', '行2列6','行2列7', '行2列8'], |
||||
['行3列1', '行3列2', '行3列3', '行3列4', '行3列5', '行3列6','行3列7', '行3列8'], |
||||
['行4列1', '行4列2', '行4列3', '行4列4', '行4列5', '行4列6','行4列7', '行4列8'], |
||||
['行5列1', '行5列2', '行5列3', '行5列4', '行5列5', '行5列6','行5列7', '行5列8'], |
||||
['行6列1', '行6列2', '行6列3', '行6列4', '行6列5', '行6列6','行6列7', '行6列8'], |
||||
['行7列1', '行7列2', '行7列3', '行7列4', '行7列5', '行7列6','行7列7', '行7列8'], |
||||
['行8列1', '行8列2', '行8列3', '行8列4', '行8列5', '行8列6','行8列7', '行8列8'], |
||||
['行9列1', '行9列2', '行9列3', '行9列4', '行9列5', '行9列6','行9列7', '行9列8'], |
||||
['行10列1', '行10列2', '行10列3', '行10列4', '行10列5', '行10列6','行10列7', '行10列8'] |
||||
], |
||||
headerBGC:'#f8f8f9', |
||||
headerHeight:60, |
||||
oddRowBGC:'#f5f7fa', |
||||
evenRowBGC:'#fff', |
||||
}, |
||||
alerts: [ |
||||
{ |
||||
time: '2021-10-16 14:54:11', |
||||
deviceName: 'PLC远程监控系统', |
||||
deviceLocation: '污水处理监控系统', |
||||
level: 1, |
||||
message: '2#电机运行状态等于1', |
||||
status: '触发值: 1' |
||||
}, |
||||
{ |
||||
time: '2021-10-16 14:54:04', |
||||
deviceName: 'PLC远程监控系统', |
||||
deviceLocation: '污水处理监控系统', |
||||
level: 0, |
||||
message: '2#电机运行状态报警恢复', |
||||
status: '触发值: 0' |
||||
}, |
||||
{ |
||||
time: '2021-10-16 14:54:11', |
||||
deviceName: 'PLC远程监控系统', |
||||
deviceLocation: '污水处理监控系统', |
||||
level: 1, |
||||
message: '2#电机运行状态等于1', |
||||
status: '触发值: 1' |
||||
}, |
||||
{ |
||||
time: '2021-10-16 14:54:04', |
||||
deviceName: 'PLC远程监控系统', |
||||
deviceLocation: '污水处理监控系统', |
||||
level: 0, |
||||
message: '2#电机运行状态报警恢复', |
||||
status: '触发值: 0' |
||||
}, |
||||
// 可以继续添加更多预警信息 |
||||
] |
||||
} |
||||
}, |
||||
methods: { |
||||
getTagType(level) { |
||||
const types = { '高': 'danger', '中': 'warning', '低': 'success' }; |
||||
return types[level] || 'info'; |
||||
handleSetLineChartData(type) { |
||||
this.lineChartData = lineChartData[type] |
||||
}, |
||||
initCharts() { |
||||
// 初始化状态统计图表 |
||||
const statusChart = echarts.init(document.getElementById('statusChart')); |
||||
statusChart.setOption({ |
||||
title: { text: '设备状态统计', subtext: '按状态', left: 'center' }, |
||||
tooltip: { trigger: 'item' }, |
||||
series: [ |
||||
{ |
||||
name: '设备状态', |
||||
type: 'pie', |
||||
radius: '50%', |
||||
data: [ |
||||
{ value: 44, name: '自主房屋' }, |
||||
{ value: 33, name: '出租房屋' }, |
||||
{ value: 11, name: '空置房屋' }, |
||||
{ value: 11, name: '其他' }, |
||||
], |
||||
}, |
||||
], |
||||
}); |
||||
getLevelColor(level) { |
||||
const levelColors = { |
||||
0: 'green', |
||||
1: 'orange', |
||||
2: 'red' |
||||
}; |
||||
return levelColors[level] || 'black'; // 默认颜色 |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
// 初始化设备类型统计图表 |
||||
const typeChart = echarts.init(document.getElementById('typeChart')); |
||||
typeChart.setOption({ |
||||
title: { text: '设备类型统计', subtext: '按设备类型', left: 'center' }, |
||||
tooltip: { trigger: 'item' }, |
||||
series: [ |
||||
{ |
||||
name: '设备类型', |
||||
type: 'pie', |
||||
radius: '50%', |
||||
data: [ |
||||
{ value: 44, name: '自主房屋' }, |
||||
{ value: 33, name: '出租房屋' }, |
||||
{ value: 11, name: '空置房屋' }, |
||||
{ value: 11, name: '其他' }, |
||||
], |
||||
}, |
||||
], |
||||
}); |
||||
<style lang="scss" scoped> |
||||
.dashboard-editor-container { |
||||
padding: 32px; |
||||
background-color: rgb(240, 242, 245); |
||||
position: relative; |
||||
|
||||
// 初始化预警信息统计图表 |
||||
const alertStatsChart = echarts.init(document.getElementById('alertStatsChart')); |
||||
alertStatsChart.setOption({ |
||||
title: { text: '预警信息统计', left: 'center' }, |
||||
tooltip: {}, |
||||
radar: { |
||||
indicator: [ |
||||
{ name: '火警类', max: 500 }, |
||||
{ name: '冲禁类', max: 500 }, |
||||
{ name: '灾害', max: 500 }, |
||||
{ name: '群体性', max: 500 }, |
||||
{ name: '行政类', max: 500 }, |
||||
{ name: '交通类', max: 500 }, |
||||
{ name: '重大', max: 500 }, |
||||
], |
||||
}, |
||||
series: [{ |
||||
name: '预警统计', |
||||
type: 'radar', |
||||
data: [ |
||||
{ |
||||
value: [75, 452, 64, 94, 44, 0, 29], |
||||
name: '预警次数', |
||||
}, |
||||
], |
||||
}], |
||||
}); |
||||
}, |
||||
}, |
||||
}; |
||||
</script> |
||||
.chart-wrapper { |
||||
background: #fff; |
||||
padding: 16px; |
||||
margin-bottom: 32px; |
||||
height: 420px; |
||||
} |
||||
} |
||||
|
||||
<style> |
||||
.dashboard { |
||||
padding: 20px; |
||||
background-color: #f0f2f5; |
||||
min-height: 100vh; |
||||
@media (max-width:1024px) { |
||||
.chart-wrapper { |
||||
padding: 8px; |
||||
} |
||||
} |
||||
.dv-scroll-board{ |
||||
color: #3d3d3d; |
||||
} |
||||
.card-title { |
||||
font-size: 16px; |
||||
margin-bottom: 15px; |
||||
display: flex; |
||||
align-items: center; |
||||
color: #3d3d3d; |
||||
font-weight: bold; |
||||
} |
||||
|
||||
.card-title i { |
||||
margin-right: 8px; |
||||
font-size: 18px; |
||||
} |
||||
|
||||
.data-overview { |
||||
display: flex; |
||||
flex-wrap: wrap; |
||||
gap: 15px; |
||||
} |
||||
|
||||
h1, h2 { |
||||
.data-item { |
||||
flex: 1; |
||||
min-width: 30%; |
||||
text-align: center; |
||||
padding: 15px 10px; |
||||
background: #f5f7fa; |
||||
border-radius: 8px; |
||||
transition: all 0.3s ease; |
||||
} |
||||
|
||||
.el-card { |
||||
margin-bottom: 20px; |
||||
.data-item:hover { |
||||
background: #f1f2f4; |
||||
transform: translateY(-3px); |
||||
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); |
||||
} |
||||
|
||||
.data-value { |
||||
font-size: 24px; |
||||
font-weight: bold; |
||||
margin: 10px 0; |
||||
color: #3d3d3d; |
||||
} |
||||
|
||||
.data-label { |
||||
font-size: 14px; |
||||
color: #3d3d3d; |
||||
} |
||||
.alert-list .div0 { |
||||
list-style-type: none; |
||||
padding: 0; |
||||
} |
||||
|
||||
.alert-list .div1 { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
} |
||||
.div1{ |
||||
margin-bottom: 5px; |
||||
} |
||||
.div2{ |
||||
padding: 20px 16px; |
||||
} |
||||
|
||||
.alert-time, .alert-device-name, .alert-device-location, .alert-message, .alert-status { |
||||
flex: 1; |
||||
} |
||||
|
||||
.alert-level { |
||||
flex: 0.5; |
||||
text-align: center; |
||||
} |
||||
</style> |
||||
</style> |
||||
|
||||
@ -1,98 +0,0 @@ |
||||
<template> |
||||
<div class="dashboard-editor-container"> |
||||
|
||||
<panel-group @handleSetLineChartData="handleSetLineChartData" /> |
||||
|
||||
<el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;"> |
||||
<line-chart :chart-data="lineChartData" /> |
||||
</el-row> |
||||
|
||||
<el-row :gutter="32"> |
||||
<el-col :xs="24" :sm="24" :lg="8"> |
||||
<div class="chart-wrapper"> |
||||
<raddar-chart /> |
||||
</div> |
||||
</el-col> |
||||
<el-col :xs="24" :sm="24" :lg="8"> |
||||
<div class="chart-wrapper"> |
||||
<pie-chart /> |
||||
</div> |
||||
</el-col> |
||||
<el-col :xs="24" :sm="24" :lg="8"> |
||||
<div class="chart-wrapper"> |
||||
<bar-chart /> |
||||
</div> |
||||
</el-col> |
||||
</el-row> |
||||
|
||||
|
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import PanelGroup from './dashboard/PanelGroup' |
||||
import LineChart from './dashboard/LineChart' |
||||
import RaddarChart from './dashboard/RaddarChart' |
||||
import PieChart from './dashboard/PieChart' |
||||
import BarChart from './dashboard/BarChart' |
||||
|
||||
const lineChartData = { |
||||
newVisitis: { |
||||
expectedData: [100, 120, 161, 134, 105, 160, 165], |
||||
actualData: [120, 82, 91, 154, 162, 140, 145] |
||||
}, |
||||
messages: { |
||||
expectedData: [200, 192, 120, 144, 160, 130, 140], |
||||
actualData: [180, 160, 151, 106, 145, 150, 130] |
||||
}, |
||||
purchases: { |
||||
expectedData: [80, 100, 121, 104, 105, 90, 100], |
||||
actualData: [120, 90, 100, 138, 142, 130, 130] |
||||
}, |
||||
shoppings: { |
||||
expectedData: [130, 140, 141, 142, 145, 150, 160], |
||||
actualData: [120, 82, 91, 154, 162, 140, 130] |
||||
} |
||||
} |
||||
|
||||
export default { |
||||
name: 'Index', |
||||
components: { |
||||
PanelGroup, |
||||
LineChart, |
||||
RaddarChart, |
||||
PieChart, |
||||
BarChart |
||||
}, |
||||
data() { |
||||
return { |
||||
lineChartData: lineChartData.newVisitis |
||||
} |
||||
}, |
||||
methods: { |
||||
handleSetLineChartData(type) { |
||||
this.lineChartData = lineChartData[type] |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.dashboard-editor-container { |
||||
padding: 32px; |
||||
background-color: rgb(240, 242, 245); |
||||
position: relative; |
||||
|
||||
.chart-wrapper { |
||||
background: #fff; |
||||
padding: 16px 16px 0; |
||||
margin-bottom: 32px; |
||||
} |
||||
} |
||||
|
||||
@media (max-width:1024px) { |
||||
.chart-wrapper { |
||||
padding: 8px; |
||||
} |
||||
} |
||||
</style> |
||||
Loading…
Reference in new issue