Merge remote-tracking branch 'origin/master'

master
魔神煜修罗皇 2 years ago
commit 8990f9aacd
  1. 6
      psdc-business/src/main/java/com/psdc/mapper/PsdcTimerMapper.java
  2. 4
      psdc-business/src/main/java/com/psdc/service/impl/PsdcControlLogServiceImpl.java
  3. 124
      psdc-business/src/main/java/com/psdc/service/impl/PsdcTimerServiceImpl.java
  4. 2
      psdc-business/src/main/resources/mapper/business/PsdcTimerMapper.xml
  5. 134
      psdc-ui/src/views/analyse/nhfx/index.vue
  6. 1
      psdc-ui/src/views/control/timer/index.vue

@ -21,7 +21,7 @@ public interface PsdcTimerMapper{
* @param timerId 主键 * @param timerId 主键
* @return 实例对象 * @return 实例对象
*/ */
PsdcTimer queryById(Integer timerId); PsdcTimer queryById(@Param("timerId") Integer timerId);
/** /**
* 通过ID查询单条数据 * 通过ID查询单条数据
@ -29,7 +29,7 @@ public interface PsdcTimerMapper{
* @param timerId 主键 * @param timerId 主键
* @return 实例对象 * @return 实例对象
*/ */
PsdcTimerVo queryById2(Integer timerId); PsdcTimerVo queryById2(@Param("timerId") Integer timerId);
/** /**
* 分页查询指定行数据 * 分页查询指定行数据
* *
@ -71,5 +71,5 @@ public interface PsdcTimerMapper{
* @param timerId 主键 * @param timerId 主键
* @return 影响行数 * @return 影响行数
*/ */
int deleteById(Integer timerId); int deleteById(@Param("timerId") Integer timerId);
} }

@ -23,6 +23,7 @@ public class PsdcControlLogServiceImpl implements IPsdcControlLogService {
* @param controlLogId 主键 * @param controlLogId 主键
* @return 实例对象 * @return 实例对象
*/ */
@Override
public PsdcControlLog queryById(Integer controlLogId){ public PsdcControlLog queryById(Integer controlLogId){
return psdcControlLogMapper.queryById(controlLogId); return psdcControlLogMapper.queryById(controlLogId);
} }
@ -35,6 +36,7 @@ public class PsdcControlLogServiceImpl implements IPsdcControlLogService {
* @param psdcControlLog 实例对象 * @param psdcControlLog 实例对象
* @return 实例对象 * @return 实例对象
*/ */
@Override
public PsdcControlLog insert(PsdcControlLog psdcControlLog){ public PsdcControlLog insert(PsdcControlLog psdcControlLog){
psdcControlLogMapper.insert(psdcControlLog); psdcControlLogMapper.insert(psdcControlLog);
return psdcControlLog; return psdcControlLog;
@ -46,6 +48,7 @@ public class PsdcControlLogServiceImpl implements IPsdcControlLogService {
* @param psdcControlLog 实例对象 * @param psdcControlLog 实例对象
* @return 实例对象 * @return 实例对象
*/ */
@Override
public PsdcControlLog update(PsdcControlLog psdcControlLog){ public PsdcControlLog update(PsdcControlLog psdcControlLog){
psdcControlLogMapper.update(psdcControlLog); psdcControlLogMapper.update(psdcControlLog);
return queryById(psdcControlLog.getControlLogId()); return queryById(psdcControlLog.getControlLogId());
@ -57,6 +60,7 @@ public class PsdcControlLogServiceImpl implements IPsdcControlLogService {
* @param controlLogId 主键 * @param controlLogId 主键
* @return 是否成功 * @return 是否成功
*/ */
@Override
public boolean deleteById(Integer controlLogId){ public boolean deleteById(Integer controlLogId){
int total = psdcControlLogMapper.deleteById(controlLogId); int total = psdcControlLogMapper.deleteById(controlLogId);
return total > 0; return total > 0;

@ -25,10 +25,13 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.function.Function;
/** /**
* 定时控制任务表;(psdc_timer)表服务实现类 * 定时控制任务表;(psdc_timer)表服务实现类
*
* @date : 2023-5-10 * @date : 2023-5-10
*/ */
@Service @Service
@ -50,19 +53,20 @@ public class PsdcTimerServiceImpl implements IPsdcTimerService {
* @param timerId 主键 * @param timerId 主键
* @return 实例对象 * @return 实例对象
*/ */
public PsdcTimerVo queryById(Integer timerId){ @Override
public PsdcTimerVo queryById(Integer timerId) {
return psdcTimerMapper.queryById2(timerId); return psdcTimerMapper.queryById2(timerId);
} }
/** /**
* 新增数据 * 新增数据
* *
* @param psdcTimer 实例对象 * @param psdcTimer 实例对象
* @return 实例对象 * @return 实例对象
*/ */
public PsdcTimer insert(PsdcTimer psdcTimer){ @Override
public PsdcTimer insert(PsdcTimer psdcTimer) {
psdcTimerMapper.insert(psdcTimer); psdcTimerMapper.insert(psdcTimer);
return psdcTimer; return psdcTimer;
} }
@ -73,7 +77,8 @@ public class PsdcTimerServiceImpl implements IPsdcTimerService {
* @param psdcTimer 实例对象 * @param psdcTimer 实例对象
* @return 实例对象 * @return 实例对象
*/ */
public PsdcTimerVo update(PsdcTimer psdcTimer){ @Override
public PsdcTimerVo update(PsdcTimer psdcTimer) {
psdcTimerMapper.update(psdcTimer); psdcTimerMapper.update(psdcTimer);
return queryById(psdcTimer.getTimerId()); return queryById(psdcTimer.getTimerId());
} }
@ -84,7 +89,8 @@ public class PsdcTimerServiceImpl implements IPsdcTimerService {
* @param timerId 主键 * @param timerId 主键
* @return 是否成功 * @return 是否成功
*/ */
public boolean deleteById(Integer timerId){ @Override
public boolean deleteById(Integer timerId) {
int total = psdcTimerMapper.deleteById(timerId); int total = psdcTimerMapper.deleteById(timerId);
return total > 0; return total > 0;
} }
@ -92,124 +98,135 @@ public class PsdcTimerServiceImpl implements IPsdcTimerService {
@Override @Override
public List<PsdcTimerVo> query(PsdcTimerRequest psdcTimerRequest) { public List<PsdcTimerVo> query(PsdcTimerRequest psdcTimerRequest) {
psdcTimerRequest.setUserId(SecurityUtils.getUserId()); psdcTimerRequest.setUserId(SecurityUtils.getUserId());
return psdcTimerMapper.queryAllByLimit(psdcTimerRequest); List<PsdcTimerVo> psdcTimerVos = psdcTimerMapper.queryAllByLimit(psdcTimerRequest);
for (PsdcTimerVo psdcTimerVo : psdcTimerVos) {
if ("startandstop".equals(psdcTimerVo.getControlKey())) {
if ("1".equals(psdcTimerVo.getControlValue())) {
psdcTimerVo.setControlValue("开启");
} else {
psdcTimerVo.setControlValue("关闭");
}
}
}
return psdcTimerVos;
} }
/** /**
* 创建定时任务 * 创建定时任务
*
* @param psdcTimerRunTimeRequest 请求类 * @param psdcTimerRunTimeRequest 请求类
* @return int * @return int
*/ */
@Override @Override
@Transactional @Transactional
public Integer addTimer(PsdcTimerRunTimeRequest psdcTimerRunTimeRequest) { public Integer addTimer(PsdcTimerRunTimeRequest psdcTimerRunTimeRequest) {
//获取psdcTimerRunTimeRequest中的timeList数组,根据内容拼出cron表达式 // 获取psdcTimerRunTimeRequest中的timeList数组,根据内容拼出cron表达式
String runDay = psdcTimerRunTimeRequest.getRunday(); String runDay = psdcTimerRunTimeRequest.getRunday();
String runtime = psdcTimerRunTimeRequest.getRuntime(); String runtime = psdcTimerRunTimeRequest.getRuntime();
//设置cron表达式 // 设置cron表达式
String[] cronArr = new String[7]; String[] cronArr = new String[7];
//秒,默认为每分钟的0秒 // 秒,默认为每分钟的0秒
if (runtime == null || !runtime.contains(":") ){ if (runtime == null || !runtime.contains(":")) {
throw new ServiceException("设定执行时间错误,创建定时任务失败,设定时间为:"+runtime); throw new ServiceException("设定执行时间错误,创建定时任务失败,设定时间为:" + runtime);
} }
if (runDay == null || "".equals(runDay)) { if (runDay == null || "".equals(runDay)) {
throw new ServiceException("设定日期错误,创建定时任务失败,设定日期为:" + runDay); throw new ServiceException("设定日期错误,创建定时任务失败,设定日期为:" + runDay);
} }
Integer deviceId = psdcTimerRunTimeRequest.getDeviceId(); Integer deviceId = psdcTimerRunTimeRequest.getDeviceId();
PsdcDevice psdcDevice = psdcDeviceService.queryById(deviceId); PsdcDevice psdcDevice = psdcDeviceService.queryById(deviceId);
if(psdcDevice == null){ if (psdcDevice == null) {
throw new ServiceException("创建定时任务失败,未找到该设备"); throw new ServiceException("创建定时任务失败,未找到该设备");
} }
if (psdcDevice.getIsControl() != 2 ){ if (psdcDevice.getIsControl() != 2) {
throw new ControlException("该设备无法控制,请联系管理员"); throw new ControlException("该设备无法控制,请联系管理员");
} }
String[] split1 = runtime.split(":"); String[] split1 = runtime.split(":");
cronArr[0] = "0"; cronArr[0] = "0";
//分 //
cronArr[1] = split1[1]; cronArr[1] = split1[1];
//时 //
cronArr[2] = split1[0]; cronArr[2] = split1[0];
/* /*
接下来拼装日月或周只有三种情况 接下来拼装日月或周只有三种情况
*/ */
if(runDay.equals("0")){ if (runDay.equals("0")) {
//每天的情况 // 每天的情况
//日 //
cronArr[3] = "*"; cronArr[3] = "*";
//月 //
cronArr[4] = "*"; cronArr[4] = "*";
//周 //
cronArr[5] = "?"; cronArr[5] = "?";
} else if (runDay.length() == 10 && (runDay.contains("-"))) { } else if (runDay.length() == 10 && (runDay.contains("-"))) {
//设定日期情况,就是一次的情况 // 设定日期情况,就是一次的情况
String[] split = runDay.split("-"); String[] split = runDay.split("-");
//日 //
cronArr[3] = split[2]; cronArr[3] = split[2];
//月 //
cronArr[4] = split[1]; cronArr[4] = split[1];
//周 //
cronArr[5] = "?"; cronArr[5] = "?";
} else if (runDay.contains(",")) { } else if (runDay.contains(",")) {
//设定星期情况 // 设定星期情况
String[] split = runDay.split("-"); String[] split = runDay.split("-");
//日 //
cronArr[3] = "?"; cronArr[3] = "?";
//月 //
cronArr[4] = "*"; cronArr[4] = "*";
//周 //
cronArr[5] = StringUtils.join(split,","); cronArr[5] = StringUtils.join(split, ",");
} else { } else {
throw new ServiceException("设定日期错误,创建定时任务失败,设定日期为:" + runDay); throw new ServiceException("设定日期错误,创建定时任务失败,设定日期为:" + runDay);
} }
//年,。暂时不用 // 年,。暂时不用
// cronArr[6] = // cronArr[6] =
String cron = StringUtils.join(cronArr, " "); String cron = StringUtils.join(cronArr, " ");
log.info("cron表达式:{}",cron); log.info("cron表达式:{}", cron);
try { try {
/* /*
创建job对象往quartz中插入执行的任务拿到jobId 创建job对象往quartz中插入执行的任务拿到jobId
*/ */
SysJob job = new SysJob(); SysJob job = new SysJob();
//设备id + 控制键 + 控制值 + 控制日期 + 控制时间 + // 设备id + 控制键 + 控制值 + 控制日期 + 控制时间 +
String jobName = psdcTimerRunTimeRequest.getDeviceId() + "+" + ControlKeyEnum.getControlContext(psdcTimerRunTimeRequest.getControlKey()) + "-" + String jobName = psdcTimerRunTimeRequest.getDeviceId() + "+" + ControlKeyEnum.getControlContext(psdcTimerRunTimeRequest.getControlKey()) + "-" +
psdcTimerRunTimeRequest.getControlValue() + "+" + psdcTimerRunTimeRequest.getRunday() + "+" + psdcTimerRunTimeRequest.getRuntime() + "+" + System.currentTimeMillis(); psdcTimerRunTimeRequest.getControlValue() + "+" + psdcTimerRunTimeRequest.getRunday() + "+" + psdcTimerRunTimeRequest.getRuntime() + "+" + System.currentTimeMillis();
job.setJobName(jobName); job.setJobName(jobName);
//默认 // 默认
job.setJobGroup("psdc"); job.setJobGroup("psdc");
String controlKey = psdcTimerRunTimeRequest.getControlKey(); String controlKey = psdcTimerRunTimeRequest.getControlKey();
String jobClassName = ""; String jobClassName = "";
//判断控制指令 // 判断控制指令
if (controlKey.equals( "startandstop")){ if (controlKey.equals("startandstop")) {
//控制启停 // 控制启停
log.info("控制设备启停"); log.info("控制设备启停");
jobClassName = String.format("psdcDeviceServiceImpl.controlDeviceStartAndStop(%d,%d,'%s',%d))",psdcTimerRunTimeRequest.getDeviceId(),Integer.valueOf(psdcTimerRunTimeRequest.getControlValue()),SecurityUtils.getUsername(),2); jobClassName = String.format("psdcDeviceServiceImpl.controlDeviceStartAndStop(%d,%d,'%s',%d))", psdcTimerRunTimeRequest.getDeviceId(), Integer.valueOf(psdcTimerRunTimeRequest.getControlValue()), SecurityUtils.getUsername(), 2);
} else if (controlKey.equals( "intemp") || controlKey.equals( "outtemp") || controlKey.equals( "temp") ) { } else if (controlKey.equals("intemp") || controlKey.equals("outtemp") || controlKey.equals("temp")) {
//控制温度 // 控制温度
jobClassName = String.format("psdcDeviceServiceImpl.setTemperature(%d,'%s','%s','%s',%d))",psdcTimerRunTimeRequest.getDeviceId(),controlKey,psdcTimerRunTimeRequest.getControlValue(),SecurityUtils.getUsername(),2); jobClassName = String.format("psdcDeviceServiceImpl.setTemperature(%d,'%s','%s','%s',%d))", psdcTimerRunTimeRequest.getDeviceId(), controlKey, psdcTimerRunTimeRequest.getControlValue(), SecurityUtils.getUsername(), 2);
} }
job.setInvokeTarget(jobClassName); job.setInvokeTarget(jobClassName);
//cron表达式 // cron表达式
job.setCronExpression(cron); job.setCronExpression(cron);
//执行错误放弃执行 // 执行错误放弃执行
job.setMisfirePolicy("3"); job.setMisfirePolicy("3");
//是否并发,不并发 // 是否并发,不并发
job.setConcurrent("1"); job.setConcurrent("1");
job.setCreateBy(SecurityUtils.getUsername()); job.setCreateBy(SecurityUtils.getUsername());
int i = jobService.insertJob(job); int i = jobService.insertJob(job);
SysJob job1 = null; SysJob job1 = null;
if( i > 0){ if (i > 0) {
job1 = jobService.selectJobByName(jobName); job1 = jobService.selectJobByName(jobName);
} else { } else {
throw new ServiceException("创建定时任务失败,请联系管理员"); throw new ServiceException("创建定时任务失败,请联系管理员");
} }
//将创建的任务插入psdcTimer表 // 将创建的任务插入psdcTimer表
PsdcTimer psdcTimer = new PsdcTimer(); PsdcTimer psdcTimer = new PsdcTimer();
BeanUtils.copyProperties(psdcTimerRunTimeRequest,psdcTimer); BeanUtils.copyProperties(psdcTimerRunTimeRequest, psdcTimer);
psdcTimer.setUserId(SecurityUtils.getUserId().intValue()); psdcTimer.setUserId(SecurityUtils.getUserId().intValue());
psdcTimer.setControlContext( ControlKeyEnum.getControlContext(psdcTimerRunTimeRequest.getControlKey())); psdcTimer.setControlContext(ControlKeyEnum.getControlContext(psdcTimerRunTimeRequest.getControlKey()));
psdcTimer.setCronText(cron); psdcTimer.setCronText(cron);
psdcTimer.setJobId(job1.getJobId().intValue()); psdcTimer.setJobId(job1.getJobId().intValue());
psdcTimer.setTimerStatus(Integer.valueOf(job1.getStatus())); psdcTimer.setTimerStatus(Integer.valueOf(job1.getStatus()));
@ -222,21 +239,20 @@ public class PsdcTimerServiceImpl implements IPsdcTimerService {
} }
} }
@Override @Override
@Transactional @Transactional
public int updateStatus(Integer timerId, Integer status) throws SchedulerException { public int updateStatus(Integer timerId, Integer status) throws SchedulerException {
//获取jobId // 获取jobId
PsdcTimer psdcTimer = psdcTimerMapper.queryById(timerId); PsdcTimer psdcTimer = psdcTimerMapper.queryById(timerId);
//修改quartz状态 // 修改quartz状态
SysJob job = new SysJob(); SysJob job = new SysJob();
job.setStatus(status.toString()); job.setStatus(status.toString());
job.setJobId(psdcTimer.getJobId().longValue()); job.setJobId(psdcTimer.getJobId().longValue());
job.setJobGroup("psdc"); job.setJobGroup("psdc");
int i = jobService.changeStatus(job); int i = jobService.changeStatus(job);
if (i > 0){ if (i > 0) {
return psdcTimerMapper.updateStatus(timerId, status); return psdcTimerMapper.updateStatus(timerId, status);
} else { } else {
throw new ServiceException("修改定时任务状态失败"); throw new ServiceException("修改定时任务状态失败");
@ -246,14 +262,14 @@ public class PsdcTimerServiceImpl implements IPsdcTimerService {
@Override @Override
@Transactional @Transactional
public Integer delete(Integer timerId) throws SchedulerException { public Integer delete(Integer timerId) throws SchedulerException {
//获取jobId // 获取jobId
PsdcTimer psdcTimer = psdcTimerMapper.queryById(timerId); PsdcTimer psdcTimer = psdcTimerMapper.queryById(timerId);
//删除quartz任务 // 删除quartz任务
SysJob job = new SysJob(); SysJob job = new SysJob();
job.setJobId(psdcTimer.getJobId().longValue()); job.setJobId(psdcTimer.getJobId().longValue());
job.setJobGroup("psdc"); job.setJobGroup("psdc");
int i = jobService.deleteJob(job); int i = jobService.deleteJob(job);
if (i > 0){ if (i > 0) {
return psdcTimerMapper.deleteById(timerId); return psdcTimerMapper.deleteById(timerId);
} else { } else {
throw new ServiceException("删除定时任务失败"); throw new ServiceException("删除定时任务失败");

@ -54,7 +54,7 @@
</select> </select>
<!--分页查询指定行数据--> <!--分页查询指定行数据-->
<select id="queryAllByLimit" resultMap="PsdcTimerMap"> <select id="queryAllByLimit" resultMap="PsdcTimerVoMap">
select select
pt.timer_id,pt.device_id,pd.device_name,pt.user_id,pt.runday,pt.runtime,pt.control_key,pt.control_context,pt.control_value,pt.cron_text,pt.job_id,pt.timer_status,pt.create_by,pt.create_time,pt.update_by,pt.update_time pt.timer_id,pt.device_id,pd.device_name,pt.user_id,pt.runday,pt.runtime,pt.control_key,pt.control_context,pt.control_value,pt.cron_text,pt.job_id,pt.timer_status,pt.create_by,pt.create_time,pt.update_by,pt.update_time
from psdc_timer pt left join psdc_device pd on pt.device_id = pd.device_id from psdc_timer pt left join psdc_device pd on pt.device_id = pd.device_id

@ -15,8 +15,8 @@
<el-form-item><el-button type="primary" icon="Search" @click="handleQuery1">查询</el-button></el-form-item> <el-form-item><el-button type="primary" icon="Search" @click="handleQuery1">查询</el-button></el-form-item>
</el-form> </el-form>
<div class="chartBox" ref="container"> <div class="chartBox" ref="container">
<div v-show="isShow1" id="tongbiChart" ref="div"></div> <div v-show="isShow1" id="tongbiChart"></div>
<el-empty v-show="isShow2" description="暂无数据" ref="el-empty"/> <el-empty v-show="isShow2" description="暂无数据"/>
</div> </div>
<div class="tableBox1"> <div class="tableBox1">
<el-table :data="tbfxDataTable" height="345px"> <el-table :data="tbfxDataTable" height="345px">
@ -49,7 +49,7 @@
<el-table-column label="环比(%)" align="center" prop="compute"/> <el-table-column label="环比(%)" align="center" prop="compute"/>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template v-slot="scope"> <template v-slot="scope">
<el-button type="primary" size="small" :icon="Histogram" @click="handleChart">图表</el-button> <el-button type="primary" size="small" :icon="Histogram" @click="handleChart(scope)">图表</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -79,6 +79,8 @@
</template> </template>
<script setup name="Index"> <script setup name="Index">
import {Histogram} from '@element-plus/icons-vue' import {Histogram} from '@element-plus/icons-vue'
import {ref, reactive, onMounted, nextTick, onBeforeUnmount} from "vue"; import {ref, reactive, onMounted, nextTick, onBeforeUnmount} from "vue";
import { getHuanbiFx,getTongbiFx } from "@/api/analyse/nhfx/nhfx" import { getHuanbiFx,getTongbiFx } from "@/api/analyse/nhfx/nhfx"
@ -209,8 +211,6 @@ function getTongbiFxFun(){
} }
let tongbiChart; let tongbiChart;
function tongbiChartFun(){ function tongbiChartFun(){
console.log('echart数据本期:',tongbiBenqi.value)
console.log('echart数据同期:',tongbiTongqi.value)
const chartDom = document.getElementById('tongbiChart') const chartDom = document.getElementById('tongbiChart')
tongbiChart = echarts.init(chartDom); tongbiChart = echarts.init(chartDom);
const option = { const option = {
@ -230,7 +230,7 @@ function tongbiChartFun(){
show: true, show: true,
top: '20%', top: '20%',
bottom:'6%', bottom:'6%',
left:'2%', left:'3%',
right:'2%', right:'2%',
borderWidth: 1, borderWidth: 1,
borderColor: '#767da1', borderColor: '#767da1',
@ -413,6 +413,7 @@ const dateType = ref('date')
const format = ref('YYYY-MM-DD') const format = ref('YYYY-MM-DD')
const valueFormat = ref('YYYY-MM-DD') const valueFormat = ref('YYYY-MM-DD')
const timeType = ref(1) const timeType = ref(1)
const echartLegend = ref([])
// //
function handleDaily(){ function handleDaily(){
activeIndex.value = 0; activeIndex.value = 0;
@ -425,6 +426,7 @@ function handleDaily(){
valueFormat.value = 'YYYY-MM-DD' valueFormat.value = 'YYYY-MM-DD'
timeType.value = 1 timeType.value = 1
dateValue2.value = `${year}-${month}-${day}` dateValue2.value = `${year}-${month}-${day}`
echartLegend.value = ['当日','上日']
console.log(dateValue2.value) console.log(dateValue2.value)
getHuanbiFxFun() getHuanbiFxFun()
} }
@ -440,6 +442,7 @@ function handleMonthly(){
valueFormat.value = 'YYYY-MM' valueFormat.value = 'YYYY-MM'
timeType.value = 2 timeType.value = 2
dateValue2.value = `${year}-${month}` dateValue2.value = `${year}-${month}`
echartLegend.value = ['本月','上月']
console.log(dateValue2.value) console.log(dateValue2.value)
getHuanbiFxFun() getHuanbiFxFun()
} }
@ -481,9 +484,16 @@ function getHuanbiFxFun(){
/** 生成图表按鈕操作*/ /** 生成图表按鈕操作*/
const title = ref() const title = ref()
const open = ref(false) const open = ref(false)
function handleChart(){ //
const lastMonthData = ref([])
const thisMonthData = ref([])
function handleChart(scope){
open.value = true; open.value = true;
lastMonthData.value = scope.row.lastMonthTotal
thisMonthData.value = scope.row.thisMonthTotal
setTimeout(()=>{
huanbiChartFun()
},100)
}; };
// //
@ -491,13 +501,115 @@ function close(){
open.value = false; open.value = false;
} }
/** echart处理*/
let huanbiChart;
function huanbiChartFun(){
dateValue2.value = dateValue2.value.toString()
console.log('X轴:',dateValue2.value)
console.log('本月:',thisMonthData.value,'上月:',lastMonthData.value)
const chartDom = document.getElementById('huanbiChart')
tongbiChart = echarts.init(chartDom);
const option = {
legend: {
data: echartLegend.value,
// selectedMode: 'single',
textStyle: {
color: "#333"
}
},
tooltip: {
trigger: "axis",
// borderColor: '#00fcff',
borderWidth: 1
},
grid:{
show: true,
top: '20%',
bottom:'6%',
left:'4%',
right:'3%',
borderWidth: 1,
borderColor: '#767da1',
},
xAxis: {
type: 'category',
name:'',
data: [dateValue2.value],
nameTextStyle: {
color: "#333",
nameLocation: "start"
},
axisLabel: {
textStyle: {
color: "#333"
}
},
axisLine: {
lineStyle: {
color: '#767da1' // x线
}
},
axisTick: {
show: false // x
},
splitArea: {
show: true,
interval:0,
areaStyle: {
color: ['rgb(54,68,148,.8)', 'rgb(37,51,133,.8)'] //
//
}
}
},
yAxis: {
type: 'value',
name:'kWh',
nameTextStyle: {
color: "#333",
nameLocation: "start"
},
axisLabel: {
textStyle: {
color: "#333"
}
},
splitLine: {
show: true,
lineStyle: {color: "#767da1", type: "solid"} //dashed
} //s线
},
series: [
{
name: echartLegend.value[0],
data: thisMonthData.value,
type: 'bar',
smooth: true,
symbol: "none", //
itemStyle: { //线
color: 'rgba(51,221,223)',
},
},
{
name: echartLegend.value[1],
data: lastMonthData.value,
type: 'bar',
smooth: true,
symbol: "none", //
itemStyle: { //线
color: 'rgba(182,162,222)',
},
},
],
};
option && tongbiChart.setOption(option);
}
/** 页面销毁时*/ /** 页面销毁时*/
onBeforeUnmount(() => { onBeforeUnmount(() => {
tongbiChart.dispose(); // tongbiChart.dispose(); //
// huanbiChart.dispose(); huanbiChart.dispose();
}); });
</script> </script>
@ -561,7 +673,9 @@ onBeforeUnmount(() => {
.floatRight{ .floatRight{
margin-left: 90%; margin-left: 90%;
} }
::v-deep .el-dialog{
background-color: rgba(47,61,138) !important;
}
::v-deep .el-tabs__item{ ::v-deep .el-tabs__item{
color: #fff; color: #fff;

@ -55,6 +55,7 @@
<el-table-column label="执行日期" align="center" prop="runday"/> <el-table-column label="执行日期" align="center" prop="runday"/>
<el-table-column label="执行时间" align="center" prop="runtime"/> <el-table-column label="执行时间" align="center" prop="runtime"/>
<el-table-column label="创建时间" align="center" prop="createTime"/> <el-table-column label="创建时间" align="center" prop="createTime"/>
<el-table-column label="创建者" align="center" prop="createBy"/>
<el-table-column label="操作" align="center" prop="handle"> <el-table-column label="操作" align="center" prop="handle">
<template v-slot="scope"> <template v-slot="scope">
<el-button type="danger" size="small" :icon="Delete" @click="getDeleteTimerFun(scope)">删除</el-button> <el-button type="danger" size="small" :icon="Delete" @click="getDeleteTimerFun(scope)">删除</el-button>

Loading…
Cancel
Save