林颖晨 3 years ago
commit 3c393e86ec
  1. 4
      psdc-admin/src/main/resources/application-dev.yml
  2. 2
      psdc-admin/src/main/resources/application-prop.yml
  3. 4
      psdc-business/src/main/java/com/psdc/entity/vo/SceneVo.java
  4. 22
      psdc-business/src/main/java/com/psdc/mapper/PsdcSceneMapper.java
  5. 20
      psdc-business/src/main/java/com/psdc/service/IPsdcSceneService.java
  6. 1
      psdc-business/src/main/java/com/psdc/service/impl/PsdcDeviceServiceImpl.java
  7. 92
      psdc-business/src/main/java/com/psdc/service/impl/PsdcSceneServiceImpl.java
  8. 54
      psdc-business/src/main/resources/mapper/business/PsdcSceneMapper.xml
  9. 4
      psdc-ui/src/api/emonitor/api.js
  10. 8
      psdc-ui/src/views/emonitor/db/index.vue
  11. 619
      psdc-ui/src/views/emonitor/drgl/index.vue
  12. 592
      psdc-ui/src/views/emonitor/frdl/index.vue
  13. 619
      psdc-ui/src/views/emonitor/kqyrb/index.vue
  14. 294
      psdc-ui/src/views/emonitor/wdcgq/index.vue
  15. 17
      psdc-ui/src/views/emonitor/xrgl/index.vue
  16. 38
      psdc-web/src/main/java/com/psdc/controller/manager/PsdcSceneController.java

@ -55,7 +55,7 @@ spring:
# 数据库驱动
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://192.168.10.99:3306/psdc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://192.168.10.99:3306/psdc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
username: hwjsolar
password: 123456
messages:
@ -139,7 +139,7 @@ mqtt:
#QOS等级 0, 1, 2
qos: 1
#客户端id 必须唯一
clientId: psdc-dev1234
clientId: psdcdev123
#连接超时,默认30000
timeOut: 10
#心跳间隔时间,默认3000

@ -54,7 +54,7 @@ spring:
# 数据库驱动
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://192.168.10.99:3306/psdc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://192.168.10.99:3306/psdc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
username: hwjsolar
password: 123456
messages:

@ -17,9 +17,9 @@ public class SceneVo {
/**
* 策略码
*/
private Integer sceneCode;
private Long sceneCode;
/** 用户id */
private Integer userId;
private Long userId;
/** 设备id */
private Integer deviceId ;
/** 设备名称 */

@ -1,5 +1,6 @@
package com.psdc.mapper;
import com.psdc.entity.PsdcDevice;
import com.psdc.entity.PsdcScene;
import com.psdc.entity.vo.SceneVo;
import org.apache.ibatis.annotations.Mapper;
@ -33,7 +34,26 @@ public interface PsdcSceneMapper{
*/
int insert(PsdcScene psdcScene);
/**
/**
* 新增场景策略
* @param sceneList
*/
void InsertSceneData(@Param(value = "sceneRecord") List<SceneVo> sceneList);
/**
* 修改场景策略
* @param sceneList
*/
void UpdateSceneData(@Param(value = "sceneRecord") List<SceneVo> sceneList);
/**
* 通过策略名称删除场景策略
* @param sceneName
* @return
*/
Integer deleteBySceneName(@Param(value = "sceneName") String sceneName);
/**
* 更新数据
*
* @param psdcScene 实例对象

@ -21,28 +21,26 @@ public interface IPsdcSceneService {
/**
* 新增数据
*
* @param psdcScene 实例对象
* @return 实例对象
* @param scenes 实例对象集合
* @return
*/
PsdcScene insert(PsdcScene psdcScene);
Boolean insert(List<SceneVo> scenes);
List<PsdcScene> sceneList();
/**
* 更新数据
*
* @param psdcScene 实例对象
* @param scenes 实例对象
* @return 实例对象
*/
PsdcScene update(PsdcScene psdcScene);
Boolean update(List<SceneVo> scenes);
/**
* 通过主键删除数据
*
* @param sceneId 主键
* 通过策略名称删除数据
* @param sceneName
* @return 是否成功
*/
boolean deleteById(Integer sceneId);
Boolean deleteBySceneName(String sceneName);
List<Map<String, Object>> getStrategyList();

@ -153,7 +153,6 @@ public class PsdcDeviceServiceImpl implements IPsdcDeviceService {
pd.setDeviceType(2);
// 新导入的设备默认运行状态为: 关闭
pd.setDeviceRunstatus(2);
System.out.println("设备Infos: " + pd + "\n");
}
psdcDeviceMapper.saveDevicesData(devices);
return true;

@ -1,21 +1,29 @@
package com.psdc.service.impl;
import com.psdc.entity.PsdcDevice;
import com.psdc.entity.PsdcScene;
import com.psdc.entity.vo.SceneVo;
import com.psdc.mapper.PsdcSceneMapper;
import com.psdc.service.IPsdcSceneService;
import com.psdc.utils.SecurityUtils;
import com.psdc.utils.poi.ExcelUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.InputStream;
import java.util.*;
import java.util.stream.Collectors;
import static org.springframework.transaction.annotation.Propagation.REQUIRES_NEW;
/**
* 场景设定;(psdc_scene)表服务实现类
* @date : 2023-5-10
*/
@Slf4j
@Service
public class PsdcSceneServiceImpl implements IPsdcSceneService {
@Autowired
@ -35,13 +43,27 @@ public class PsdcSceneServiceImpl implements IPsdcSceneService {
/**
* 新增数据
*
* @param psdcScene 实例对象
* @return 实例对象
* @param scenes 实例对象集合
* @return Boolean
*/
public PsdcScene insert(PsdcScene psdcScene){
psdcSceneMapper.insert(psdcScene);
return psdcScene;
@Override
@Transactional(propagation = REQUIRES_NEW)
public Boolean insert(List<SceneVo> scenes){
Date date = new Date();
long timestamp = getSecondTimestampTwo(date);
long userId = SecurityUtils.getUserId();
try {
for (SceneVo sc : scenes){
sc.setSceneCode(timestamp);
sc.setUserId(userId);
}
psdcSceneMapper.InsertSceneData(scenes);
return true;
} catch (Exception e) {
e.printStackTrace();
log.info("Sorry,新增场景策略失败!+ 错误原因: {}", e.getMessage());
return false;
}
}
@Override
@ -50,28 +72,41 @@ public class PsdcSceneServiceImpl implements IPsdcSceneService {
return psdcSceneMapper.sceneList(userId);
}
/**
/**
* 更新数据
*
* @param psdcScene 实例对象
* @param scenes 实例对象
* @return 实例对象
*/
public PsdcScene update(PsdcScene psdcScene){
psdcSceneMapper.update(psdcScene);
return queryById(psdcScene.getSceneId());
@Override
@Transactional(propagation = REQUIRES_NEW)
public Boolean update(List<SceneVo> scenes) {
try {
psdcSceneMapper.UpdateSceneData(scenes);
return true;
} catch (Exception e) {
e.printStackTrace();
log.info("Sorry,修改场景策略失败!+ 错误原因: {}", e.getMessage());
return false;
}
}
/**
* 通过主键删除数据
*
* @param sceneId 主键
/**
* 通过策略名称删除数据
* @param sceneName
* @return 是否成功
*/
public boolean deleteById(Integer sceneId){
int total = psdcSceneMapper.deleteById(sceneId);
return total > 0;
@Override
public Boolean deleteBySceneName(String sceneName) {
int count = psdcSceneMapper.deleteBySceneName(sceneName);
if (count > 0){
return true;
} else {
return false;
}
}
@Override
public List<Map<String, Object>> getStrategyList() {
List<String> scenes = psdcSceneMapper.querySceneGroup(SecurityUtils.getUserId());
@ -103,7 +138,24 @@ public class PsdcSceneServiceImpl implements IPsdcSceneService {
@Override
public List<SceneVo> findSceneByUserAndSceneName(Integer sceneId) {
Long userId = SecurityUtils.getUserId();
String sceneName = psdcSceneMapper.queryById(sceneId).getSceneName();
String sceneName = "";
if (0 != sceneId){
psdcSceneMapper.queryById(sceneId).getSceneName();
}
return psdcSceneMapper.findSceneByUserAndSceneName(userId, sceneName);
}
/**
* 获取精确到秒的时间戳
* @param date
* @return
*/
public static long getSecondTimestampTwo(Date date){
if (null == date) {
return 0;
}
String timestamp = String.valueOf(date.getTime()/1000);
return Long.valueOf(timestamp);
}
}

@ -14,6 +14,7 @@
</resultMap>
<resultMap type="com.psdc.entity.vo.SceneVo" id="SceneVoMap">
<result property="sceneId" column="scene_id" />
<result property="sceneName" column="scene_name" />
<result property="sceneCode" column="scene_code"/>
<result property="userId" column="user_id"/>
@ -43,6 +44,40 @@
values (#{sceneName},#{sceneCode},#{userId},#{deviceId},#{deviceSn},#{sceneContext},#{sceneKey},#{sceneValue})
</insert>
<insert id="InsertSceneData" parameterType="com.psdc.entity.vo.SceneVo" useGeneratedKeys="true">
Insert into psdc_scene(scene_name,scene_code,user_id,device_id,device_sn,scene_context,scene_key,scene_value)
Values
<foreach collection="sceneRecord" item="entity" separator=",">
(#{entity.sceneName}, #{entity.sceneCode},#{entity.userId}, #{entity.deviceId}, #{entity.deviceSn}, #{entity.sceneContext}, #{entity.sceneKey}, #{entity.sceneValue})
</foreach>
</insert>
<update id="UpdateSceneData">
<foreach collection="sceneRecord" item="item" index="index" open="" close="" separator=";">
Update psdc_scene
<set>
<if test="item.sceneName != null and item.sceneName != ''">
`scene_name`= #{item.sceneName},
</if>
<if test="item.deviceSn != null and item.deviceSn != ''">
`device_sn` = #{item.deviceSn},
</if>
<if test="item.sceneContext != null and item.sceneContext != ''">
`scene_context` = #{item.sceneContext},
</if>
<if test="item.sceneKey != null and item.sceneKey != ''">
`scene_key` = ${item.sceneKey},
</if>
<if test="item.sceneValue != null and item.sceneValue != ''">
`scene_value` = ${item.sceneValue}
</if>
</set>
<where>
`scene_id` = ${item.sceneId}
</where>
</foreach>
</update>
<!-- 更新数据 -->
<update id="update">
update psdc_scene
@ -80,12 +115,17 @@
delete from psdc_scene where scene_id = #{sceneId}
</delete>
<delete id="deleteBySceneName">
Delete From psdc_scene Where scene_name = #{sceneName}
</delete>
<!-- 根据用户ID查询策略信息-->
<select id="queryByUserId" resultMap="SceneVoMap">
select ps.scene_id,ps.scene_name,ps.scene_code,ps.user_id,pd.device_name,ps.device_id,pd.device_sn,ps.scene_context,ps.scene_key,ps.scene_value
from psdc_scene ps left join sys_user su on ps.user_id = su.user_id
left join psdc_device pd on ps.device_id = pd.device_id
where su.user_id = #{userId}
Select ps.scene_id,ps.scene_name,ps.scene_code,ps.user_id,pd.device_name,ps.device_id,pd.device_sn,ps.scene_context,ps.scene_key,ps.scene_value
From psdc_scene ps
Left join sys_user su on ps.user_id = su.user_id
Left join psdc_device pd on ps.device_id = pd.device_id
Where su.user_id = #{userId}
</select>
<!-- 根据用户ID查询策略信息-->
@ -118,9 +158,9 @@
<!-- 根据策略名称查询策略信息-->
<select id="queryBySceneName" resultMap="SceneVoMap">
select ps.scene_id,ps.scene_name,ps.scene_code,ps.user_id,pd.device_name,ps.device_id,pd.device_sn,ps.scene_context,ps.scene_key,ps.scene_value
from psdc_scene ps left join psdc_device pd on ps.device_id = pd.device_id
where ps.scene_name like concat('%', #{sceneName}, '%')
Select ps.scene_id,ps.scene_name,ps.scene_code,ps.user_id,pd.device_name,ps.device_id,pd.device_sn,ps.scene_context,ps.scene_key,ps.scene_value
From psdc_scene ps Left join psdc_device pd on ps.device_id = pd.device_id
Where ps.scene_name Like concat('%', #{sceneName}, '%')
</select>
<select id="findSceneByUserAndSceneName" resultMap="SceneVoMap">

@ -35,6 +35,6 @@ export function getFrld(data) {
return request.get('/monitor/frdl/index/sel2/'+data)
}
//温度传感器
export function getWdcgq(data) {
return request.get('/monitor/wdcgq/index/sel1/'+data)
export function getWdcgq() {
return request.get('/monitor/wdcgq/index/sel1')
}

@ -2,28 +2,28 @@
<div class="app-container home">
<div class="top">
<div class="card">
<div>pic</div>
<div><img src="../../../assets/images/功率.png"></div>
<div>
<p>当前功率</p>
<h2>{{data.totp}}kW</h2>
</div>
</div>
<div class="card">
<div>pic</div>
<div><img src="../../../assets/images/用电量.png"></div>
<div>
<p>日用电量</p>
<h2>{{data.eday}}kWh</h2>
</div>
</div>
<div class="card">
<div>pic</div>
<div><img src="../../../assets/images/用电量.png"></div>
<div>
<p>月用电量</p>
<h2>{{data.emonth}}kWh</h2>
</div>
</div>
<div class="card">
<div>pic</div>
<div><img src="../../../assets/images/用电量.png"></div>
<div>
<p>累计用电量</p>
<h2>{{data.totwh}}kWh</h2>

@ -2,37 +2,37 @@
<div class="app-container home">
<div class="top">
<div class="card">
<div>pic</div>
<div><img src="../../../assets/images/用电量.png"></div>
<div>
<p>总用电量</p>
<h2>1641kWh</h2>
<h2>{{data.totwh}}kWh</h2>
</div>
</div>
<div class="card">
<div>pic</div>
<div><img src="../../../assets/images/功率.png"></div>
<div>
<p>当前功率</p>
<h2>11kW</h2>
<h2>{{data.totp}}kW</h2>
</div>
</div>
<div class="card">
<div>pic</div>
<div><img src="../../../assets/images/温度.png"></div>
<div>
<div style="display: flex; margin-bottom: 5px">
<p>进水温度:</p>
<h2>25</h2>
<h2>{{data.tempIn}}</h2>
</div>
<div style="display: flex">
<p>出水温度:</p>
<h2>85</h2>
<h2>{{data.tempOut}}</h2>
</div>
</div>
</div>
<div class="card">
<div>pic</div>
<div><img src="../../../assets/images/温度传感器.png"></div>
<div>
<p>运行状态</p>
<h2 style="color: #1ab394">开启</h2>
<h2 style="color: #1ab394">{{data.runStatus}}</h2>
</div>
</div>
</div>
@ -42,7 +42,7 @@
<div class="bottom1-1">
日用电量
</div>
<div id="myEcharts1" style="width: 100%; height: 86.7%"></div>
<div id="myEcharts" style="width: 100%; height: 86.7%"></div>
</div>
<div class="bottom1">
<div class="bottom1-1">
@ -68,249 +68,434 @@
<script name="Index">
import {getDrgl, getDcgl} from '../../../api/emonitor/api'
import { onMounted } from "vue";
import {onMounted, reactive} from "vue";
import * as echarts from 'echarts';
export default {
name: "drgl",
setup() {
let data = reactive({
totwh:'',
totp:'',
tempIn:'',
tempOut:'',
//1 2
runStatus:'',
glData:[],
glXz:[
"00:00",
"00:15",
"00:30",
"00:45",
"01:00",
"01:15",
"01:30",
"01:45",
"02:00",
"02:15",
"02:30",
"02:45",
"03:00",
"03:15",
"03:30",
"03:45",
"04:00",
"04:15",
"04:30",
"04:45",
"05:00",
"05:15",
"05:30",
"05:45",
"06:00",
"06:15",
"06:30",
"06:45",
"07:00",
"07:15",
"07:30",
"07:45",
"08:00",
"08:15",
"08:30",
"08:45",
"09:00",
"09:15",
"09:30",
"09:45",
"10:00",
"10:15",
"10:30",
"10:45",
"11:00",
"11:15",
"11:30",
"11:45",
"12:00",
"12:15",
"12:30",
"12:45",
"13:00",
"13:15",
"13:30",
"13:45",
"14:00",
"14:15",
"14:30",
"14:45",
"15:00",
"15:15",
"15:30",
"15:45",
"16:00",
"16:15",
"16:30",
"16:45",
"17:00",
"17:15",
"17:30",
"17:45",
"18:00",
"18:15",
"18:30",
"18:45",
"19:00",
"19:15",
"19:30",
"19:45",
"20:00",
"20:15",
"20:30",
"20:45",
"21:00",
"21:15",
"21:30",
"21:45",
"22:00",
"22:15",
"22:30",
"22:45",
"23:00",
"23:15",
"23:30",
"23:45"
],
dayData:[],
dayXz:[],
emonthData:[],
emonthXz:[
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31],
temIn:'',
temOut:'',
time:'',
})
onMounted(() => {//element,onMountedHook
// getDrgl(1).then((res)=>{
// console.log(res)
// })
getDcgl(1).then((res)=>{
console.log(res)
})
let myChart1 = echarts.getInstanceByDom(document.getElementById("myEcharts1"));
if (myChart1){
myChart1.dispose()
}
myChart1 = echarts.init(document.getElementById("myEcharts1"));
let myChart2 = echarts.getInstanceByDom(document.getElementById("myEcharts2"));
if (myChart2){
myChart2.dispose()
}
myChart2 = echarts.init(document.getElementById("myEcharts2"));
let myChart3 = echarts.getInstanceByDom(document.getElementById("myEcharts3"));
if (myChart3){
myChart3.dispose()
}
myChart3 = echarts.init(document.getElementById("myEcharts3"));
let myChart4 = echarts.getInstanceByDom(document.getElementById("myEcharts4"));
if (myChart4){
myChart4.dispose()
}
myChart4 = echarts.init(document.getElementById("myEcharts4"));
//
myChart1.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
//
let arr = []
let brr = []
for(let i in res.dcglqhour){
arr.push(res.dcglqhour[i].useElectric)
brr.push(res.dcglqhour[i].hour)
}
data.dayData=arr
data.dayXz=brr
let myChart = echarts.getInstanceByDom(document.getElementById("myEcharts"));
if (myChart){
myChart.dispose()
}
myChart = echarts.init(document.getElementById("myEcharts"));
myChart.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
xAxis: {
data: data.dayXz,
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
},
series: [
{
name: "日用电量",
type: "bar",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
],
});
window.onresize = function () {//
myChart.resize();
};
myChart2.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
series: [
{
name: "日用电量",
type: "bar",
data: data.dayData,
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart.resize();
};
//
let crr = []
for(let i in res.dcglqday){
crr.push(res.dcglqday[i].useElectric)
}
data.emonthData=crr
let myChart2 = echarts.getInstanceByDom(document.getElementById("myEcharts2"));
if (myChart2){
myChart2.dispose()
}
myChart2 = echarts.init(document.getElementById("myEcharts2"));
myChart2.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
xAxis: {
data: data.emonthXz,
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
},
series: [
{
name: "月用电量",
type: "bar",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
],
});
window.onresize = function () {//
myChart2.resize();
};
myChart3.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "kW",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
series: [
{
name: "月用电量",
type: "bar",
data: data.emonthData,
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart2.resize();
};
//
data.time=res.times
data.temIn=res.tempIn
data.temOut=res.tempOut
let myChart4 = echarts.getInstanceByDom(document.getElementById("myEcharts4"));
if (myChart4){
myChart4.dispose()
}
myChart4 = echarts.init(document.getElementById("myEcharts4"));
myChart4.setOption({
title: {},
tooltip: {},
legend: {
data: ['进水', '出水'],
textStyle:{
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: data.time,
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
},
series: [
{
name: "当前功率",
type: "line",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
yAxis: {
type: 'value',
name: "℃",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
],
});
window.onresize = function () {//
myChart3.resize();
};
myChart4.setOption({
title: {},
tooltip: {},
legend: {
data: ['进水', '出水'],
series: [
{
name: '进水',
type: 'line',
stack: 'Total',
itemStyle:{
color:'#2F8EE0'
},
data: data.temIn
},
{
name: '出水',
type: 'line',
stack: 'Total',
itemStyle:{
color:'#2F8EE0'
},
data: data.temOut
},
],
});
window.onresize = function () {//
myChart4.resize();
};
})
getDrgl(1).then((res)=>{
console.log('1',res)
data.tempIn=res.data.tempIn
data.tempOut=res.data.tempOut
data.totp = res.data.totp
data.totwh = res.data.totwh
if(res.data.runStatus==1){
data.runStatus = '开启'
}else if (res.data.runStatus==2){
data.runStatus = '关闭'
}
//gl
delete res.data.todayUsePowers.deviceId
delete res.data.todayUsePowers.samDate
delete res.data.todayUsePowers.userId
let arr = Object.values(res.data.todayUsePowers)
data.glData=arr
let myChart3 = echarts.getInstanceByDom(document.getElementById("myEcharts3"));
if (myChart3){
myChart3.dispose()
}
myChart3 = echarts.init(document.getElementById("myEcharts3"));
myChart3.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
}
},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "℃",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
xAxis: {
data: data.glXz,
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
},
series: [
{
name: '进水',
type: 'line',
stack: 'Total',
itemStyle:{
color:'#2F8EE0'
yAxis: {
type: 'value',
name: "kW",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
data: [120, 132, 101, 134, 90, 230, 210]
},
{
name: '出水',
type: 'line',
stack: 'Total',
itemStyle:{
color:'#2F8EE0'
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
data: [220, 182, 191, 234, 290, 330, 310]
},
],
});
window.onresize = function () {//
myChart4.resize();
};
series: [
{
name: "当前功率",
type: "line",
data: data.glData,
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart3.resize();
};
})
});
return {
data
}
},
components: {},
mounted() {},

@ -2,21 +2,21 @@
<div class="app-container home">
<div class="top">
<div class="card">
<div>pic</div>
<div><img src="../../../assets/images/用电量.png"></div>
<div>
<p>总用电量</p>
<h2>1641kWh</h2>
</div>
</div>
<div class="card">
<div>pic</div>
<div><img src="../../../assets/images/功率.png"></div>
<div>
<p>当前功率</p>
<h2>11kW</h2>
</div>
</div>
<div class="card">
<div>pic</div>
<div><img src="../../../assets/images/温度.png"></div>
<div>
<div>
<p>当前温度</p>
@ -25,7 +25,7 @@
</div>
</div>
<div class="card">
<div>pic</div>
<div><img src="../../../assets/images/温度传感器.png"></div>
<div>
<p>运行状态</p>
<h2 style="color: #1ab394">开启</h2>
@ -64,234 +64,414 @@
<script name="Index">
import {getFrdl, getFrld} from '../../../api/emonitor/api'
import { onMounted } from "vue";
import {onMounted, reactive} from "vue";
import * as echarts from 'echarts';
export default {
name: "frdl",
setup() {
let data = reactive({
totwh:'',
totp:'',
tempIn:'',
tempOut:'',
//1 2
runStatus:'',
glData:[],
glXz:[
"00:00",
"00:15",
"00:30",
"00:45",
"01:00",
"01:15",
"01:30",
"01:45",
"02:00",
"02:15",
"02:30",
"02:45",
"03:00",
"03:15",
"03:30",
"03:45",
"04:00",
"04:15",
"04:30",
"04:45",
"05:00",
"05:15",
"05:30",
"05:45",
"06:00",
"06:15",
"06:30",
"06:45",
"07:00",
"07:15",
"07:30",
"07:45",
"08:00",
"08:15",
"08:30",
"08:45",
"09:00",
"09:15",
"09:30",
"09:45",
"10:00",
"10:15",
"10:30",
"10:45",
"11:00",
"11:15",
"11:30",
"11:45",
"12:00",
"12:15",
"12:30",
"12:45",
"13:00",
"13:15",
"13:30",
"13:45",
"14:00",
"14:15",
"14:30",
"14:45",
"15:00",
"15:15",
"15:30",
"15:45",
"16:00",
"16:15",
"16:30",
"16:45",
"17:00",
"17:15",
"17:30",
"17:45",
"18:00",
"18:15",
"18:30",
"18:45",
"19:00",
"19:15",
"19:30",
"19:45",
"20:00",
"20:15",
"20:30",
"20:45",
"21:00",
"21:15",
"21:30",
"21:45",
"22:00",
"22:15",
"22:30",
"22:45",
"23:00",
"23:15",
"23:30",
"23:45"
],
dayData:[],
dayXz:[],
emonthData:[],
emonthXz:[
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31],
tem:'',
time:'',
})
onMounted(() => {//element,onMountedHook
getFrld(4).then((res)=>{
getFrld(4).then((res) => {
console.log(res)
})
// getFrdl(4).then((res)=>{
// console.log(res)
// })
let myChart = echarts.getInstanceByDom(document.getElementById("myEcharts"));
if (myChart){
myChart.dispose()
}
myChart = echarts.init(document.getElementById("myEcharts"));
let myChart2 = echarts.getInstanceByDom(document.getElementById("myEcharts2"));
if (myChart2){
myChart2.dispose()
}
myChart2 = echarts.init(document.getElementById("myEcharts2"));
let myChart3 = echarts.getInstanceByDom(document.getElementById("myEcharts3"));
if (myChart3){
myChart3.dispose()
}
myChart3 = echarts.init(document.getElementById("myEcharts3"));
let myChart4 = echarts.getInstanceByDom(document.getElementById("myEcharts4"));
if (myChart4){
myChart4.dispose()
}
myChart4 = echarts.init(document.getElementById("myEcharts4"));
//
myChart.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
//
let arr = []
let brr = []
for(let i in res.frdlqhour){
arr.push(res.frdlqhour[i].useElectric)
brr.push(res.frdlqhour[i].hour)
}
data.dayData=arr
data.dayXz=brr
let myChart = echarts.getInstanceByDom(document.getElementById("myEcharts"));
if (myChart){
myChart.dispose()
}
myChart = echarts.init(document.getElementById("myEcharts"));
myChart.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
xAxis: {
data: data.dayXz,
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
},
series: [
{
name: "日用电量",
type: "bar",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
],
});
window.onresize = function () {//
myChart.resize();
};
myChart2.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
series: [
{
name: "日用电量",
type: "bar",
data: data.dayData,
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart.resize();
};
//
let crr = []
for(let i in res.frdlqday){
crr.push(res.frdlqday[i].useElectric)
}
data.emonthData=crr
let myChart2 = echarts.getInstanceByDom(document.getElementById("myEcharts2"));
if (myChart2){
myChart2.dispose()
}
myChart2 = echarts.init(document.getElementById("myEcharts2"));
myChart2.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
xAxis: {
data: data.emonthXz,
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
},
series: [
{
name: "月用电量",
type: "bar",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
],
});
window.onresize = function () {//
myChart2.resize();
};
myChart3.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "kW",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
series: [
{
name: "月用电量",
type: "bar",
data: data.emonthData,
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart2.resize();
};
//
data.time=res.times
data.tem=res.temps
let myChart4 = echarts.getInstanceByDom(document.getElementById("myEcharts4"));
if (myChart4){
myChart4.dispose()
}
myChart4 = echarts.init(document.getElementById("myEcharts4"));
myChart4.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
xAxis: {
data: data.time,
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
},
series: [
{
name: "当前功率",
type: "line",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
yAxis: {
type: 'value',
name: "℃",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
],
});
window.onresize = function () {//
myChart3.resize();
};
myChart4.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "℃",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
series: [
{
name: '当前温度',
type: 'line',
stack: 'Total',
itemStyle:{
color:'#2F8EE0'
},
data: data.tem
},
],
});
window.onresize = function () {//
myChart4.resize();
};
})
getFrdl(4).then((res)=>{
console.log('1',res)
data.tempIn=res.data.tempIn
data.tempOut=res.data.tempOut
data.totp = res.data.totp
data.totwh = res.data.totwh
if(res.data.runStatus==1){
data.runStatus = '开启'
}else if (res.data.runStatus==2){
data.runStatus = '关闭'
}
//gl
delete res.data.todayUsePowers.deviceId
delete res.data.todayUsePowers.samDate
delete res.data.todayUsePowers.userId
let arr = Object.values(res.data.todayUsePowers)
data.glData=arr
let myChart3 = echarts.getInstanceByDom(document.getElementById("myEcharts3"));
if (myChart3){
myChart3.dispose()
}
myChart3 = echarts.init(document.getElementById("myEcharts3"));
myChart3.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
xAxis: {
data: data.glXz,
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
},
series: [
{
name: '当前温度',
type: 'line',
stack: 'Total',
itemStyle:{
color:'#2F8EE0'
yAxis: {
type: 'value',
name: "kW",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
data: [120, 132, 101, 134, 90, 230, 210]
},
],
});
window.onresize = function () {//
myChart4.resize();
};
});
series: [
{
name: "当前功率",
type: "line",
data: data.glData,
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart3.resize();
};
})
})
return{
data
}
},
components: {},
mounted() {},

@ -2,37 +2,37 @@
<div class="app-container home">
<div class="top">
<div class="card">
<div>pic</div>
<div><img src="../../../assets/images/用电量.png"></div>
<div>
<p>总用电量</p>
<h2>1641kWh</h2>
<h2>{{data.totwh}}kWh</h2>
</div>
</div>
<div class="card">
<div>pic</div>
<div><img src="../../../assets/images/功率.png"></div>
<div>
<p>当前功率</p>
<h2>11kW</h2>
<h2>{{data.totp}}kW</h2>
</div>
</div>
<div class="card">
<div>pic</div>
<div><img src="../../../assets/images/温度.png"></div>
<div>
<div style="display: flex; margin-bottom: 5px">
<p>进水温度:</p>
<h2>25</h2>
<h2>{{data.tempIn}}</h2>
</div>
<div style="display: flex">
<p>出水温度:</p>
<h2>85</h2>
<h2>{{data.tempOut}}</h2>
</div>
</div>
</div>
<div class="card">
<div>pic</div>
<div><img src="../../../assets/images/温度传感器.png"></div>
<div>
<p>运行状态</p>
<h2 style="color: #1ab394">开启</h2>
<h2 style="color: #1ab394">{{data.runStatus}}</h2>
</div>
</div>
</div>
@ -68,248 +68,431 @@
<script name="Index">
import {getKqryb, getKqyrb} from '../../../api/emonitor/api'
import { onMounted } from "vue";
import {onMounted, reactive} from "vue";
import * as echarts from 'echarts';
export default {
name: "kqyrb",
setup() {
let data = reactive({
totwh:'',
totp:'',
tempIn:'',
tempOut:'',
//1 2
runStatus:'',
glData:[],
glXz:[
"00:00",
"00:15",
"00:30",
"00:45",
"01:00",
"01:15",
"01:30",
"01:45",
"02:00",
"02:15",
"02:30",
"02:45",
"03:00",
"03:15",
"03:30",
"03:45",
"04:00",
"04:15",
"04:30",
"04:45",
"05:00",
"05:15",
"05:30",
"05:45",
"06:00",
"06:15",
"06:30",
"06:45",
"07:00",
"07:15",
"07:30",
"07:45",
"08:00",
"08:15",
"08:30",
"08:45",
"09:00",
"09:15",
"09:30",
"09:45",
"10:00",
"10:15",
"10:30",
"10:45",
"11:00",
"11:15",
"11:30",
"11:45",
"12:00",
"12:15",
"12:30",
"12:45",
"13:00",
"13:15",
"13:30",
"13:45",
"14:00",
"14:15",
"14:30",
"14:45",
"15:00",
"15:15",
"15:30",
"15:45",
"16:00",
"16:15",
"16:30",
"16:45",
"17:00",
"17:15",
"17:30",
"17:45",
"18:00",
"18:15",
"18:30",
"18:45",
"19:00",
"19:15",
"19:30",
"19:45",
"20:00",
"20:15",
"20:30",
"20:45",
"21:00",
"21:15",
"21:30",
"21:45",
"22:00",
"22:15",
"22:30",
"22:45",
"23:00",
"23:15",
"23:30",
"23:45"
],
dayData:[],
dayXz:[],
emonthData:[],
emonthXz:[
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31],
temIn:'',
temOut:'',
time:'',
})
onMounted(() => {//element,onMountedHook
getKqyrb(3).then((res)=>{
console.log(res)
})
// getKqryb(3).then((res)=>{
// console.log(res)
// })
let myChart = echarts.getInstanceByDom(document.getElementById("myEcharts"));
if (myChart){
myChart.dispose()
}
myChart = echarts.init(document.getElementById("myEcharts"));
let myChart2 = echarts.getInstanceByDom(document.getElementById("myEcharts2"));
if (myChart2){
myChart2.dispose()
}
myChart2 = echarts.init(document.getElementById("myEcharts2"));
let myChart3 = echarts.getInstanceByDom(document.getElementById("myEcharts3"));
if (myChart3){
myChart3.dispose()
}
myChart3 = echarts.init(document.getElementById("myEcharts3"));
let myChart4 = echarts.getInstanceByDom(document.getElementById("myEcharts4"));
if (myChart4){
myChart4.dispose()
}
myChart4 = echarts.init(document.getElementById("myEcharts4"));
//
myChart.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
//
let arr = []
let brr = []
for(let i in res.kqyrbqhour){
arr.push(res.kqyrbqhour[i].useElectric)
brr.push(res.kqyrbqhour[i].hour)
}
data.dayData=arr
data.dayXz=brr
let myChart = echarts.getInstanceByDom(document.getElementById("myEcharts"));
if (myChart){
myChart.dispose()
}
myChart = echarts.init(document.getElementById("myEcharts"));
myChart.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
xAxis: {
data: data.dayXz,
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
},
series: [
{
name: "日用电量",
type: "bar",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
],
});
window.onresize = function () {//
myChart.resize();
};
myChart2.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
series: [
{
name: "日用电量",
type: "bar",
data: data.dayData,
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart.resize();
};
//
let crr = []
for(let i in res.kqyrbqday){
crr.push(res.kqyrbqday[i].useElectric)
}
data.emonthData=crr
let myChart2 = echarts.getInstanceByDom(document.getElementById("myEcharts2"));
if (myChart2){
myChart2.dispose()
}
myChart2 = echarts.init(document.getElementById("myEcharts2"));
myChart2.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
xAxis: {
data: data.emonthXz,
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
},
series: [
{
name: "月用电量",
type: "bar",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
],
});
window.onresize = function () {//
myChart2.resize();
};
myChart3.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "kW",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
series: [
{
name: "月用电量",
type: "bar",
data: data.emonthData,
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart2.resize();
};
//
data.time=res.times
data.temIn=res.tempIn
data.temOut=res.tempOut
let myChart4 = echarts.getInstanceByDom(document.getElementById("myEcharts4"));
if (myChart4){
myChart4.dispose()
}
myChart4 = echarts.init(document.getElementById("myEcharts4"));
myChart4.setOption({
title: {},
tooltip: {},
legend: {
data: ['进水', '出水'],
textStyle:{
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: data.time,
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
},
series: [
{
name: "当前功率",
type: "line",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
yAxis: {
type: 'value',
name: "℃",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
],
});
window.onresize = function () {//
myChart3.resize();
};
myChart4.setOption({
title: {},
tooltip: {},
legend: {
data: ['进水', '出水'],
series: [
{
name: '进水',
type: 'line',
stack: 'Total',
itemStyle:{
color:'#2F8EE0'
},
data: data.temIn
},
{
name: '出水',
type: 'line',
stack: 'Total',
itemStyle:{
color:'#2F8EE0'
},
data: data.temOut
},
],
});
window.onresize = function () {//
myChart4.resize();
};
})
getKqryb(3).then((res)=>{
console.log('1',res)
data.tempIn=res.data.tempIn
data.tempOut=res.data.tempOut
data.totp = res.data.totp
data.totwh = res.data.totwh
if(res.data.runStatus==1){
data.runStatus = '开启'
}else if (res.data.runStatus==2){
data.runStatus = '关闭'
}
//gl
delete res.data.todayUsePowers.deviceId
delete res.data.todayUsePowers.samDate
delete res.data.todayUsePowers.userId
let arr = Object.values(res.data.todayUsePowers)
data.glData=arr
let myChart3 = echarts.getInstanceByDom(document.getElementById("myEcharts3"));
if (myChart3){
myChart3.dispose()
}
myChart3 = echarts.init(document.getElementById("myEcharts3"));
myChart3.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
}
},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "℃",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
xAxis: {
data: data.glXz,
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
},
series: [
{
name: '进水',
type: 'line',
stack: 'Total',
itemStyle:{
color:'#2F8EE0'
yAxis: {
type: 'value',
name: "kW",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
data: [120, 132, 101, 134, 90, 230, 210]
},
{
name: '出水',
type: 'line',
stack: 'Total',
itemStyle:{
color:'#2F8EE0'
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
data: [220, 182, 191, 234, 290, 330, 310]
},
],
});
window.onresize = function () {//
myChart4.resize();
};
series: [
{
name: "当前功率",
type: "line",
data: data.glData,
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart3.resize();
};
})
});
return{
data
}
},
components: {},
mounted() {},

@ -1,60 +1,11 @@
<template>
<div class="app-container home">
<div class="top">
<div class="card">
<div>pic</div>
<div class="card" v-for="(item,index) in data.info ">
<div><img src="../../../assets/images/温度.png"></div>
<div>
<p>温度传感器1</p>
<h2>40</h2>
</div>
</div>
<div class="card">
<div>pic</div>
<div>
<p>温度传感器2</p>
<h2>41</h2>
</div>
</div>
<div class="card">
<div>pic</div>
<div>
<p>温度传感器3</p>
<h2>33</h2>
</div>
</div>
<div class="card">
<div>pic</div>
<div>
<p>温度传感器4</p>
<h2>36</h2>
</div>
</div>
<div class="card">
<div>pic</div>
<div>
<p>温度传感器5</p>
<h2>35</h2>
</div>
</div>
<div class="card">
<div>pic</div>
<div>
<p>温度传感器6</p>
<h2>37</h2>
</div>
</div>
<div class="card">
<div>pic</div>
<div>
<p>温度传感器7</p>
<h2>38</h2>
</div>
</div>
<div class="card">
<div>pic</div>
<div>
<p>温度传感器8</p>
<h2>32</h2>
<p>{{item.name}}</p>
<h2>{{item.temp}}</h2>
</div>
</div>
</div>
@ -72,76 +23,203 @@
<script name="Index">
import {getWdcgq} from '../../../api/emonitor/api'
import { onMounted } from "vue";
import {onMounted, reactive} from "vue";
import * as echarts from 'echarts';
export default {
name: "wdcgq",
setup() {
let data = reactive({
info:[],
xinfo:[],
infos: [
{
name: "温度传感器1",
type: "line",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
},
},
{
name: "温度传感器2",
type: "line",
data: [25, 40, 66, 80, 120, 50],
itemStyle:{
color:'#2F8EE0'
},
},
],
})
onMounted(() => {//element,onMountedHook
//1-8 id 5-12
getWdcgq().then((res)=>{
console.log(res)
let arr = []
let brr = []
let crr = []
for (let i in res.data){
arr.push({name:res.data[i].deviceName,temp:res.data[i].deviceTemp})
brr.push({name:res.data[i].deviceName,type: "line",data:res.data[i].temps,itemStyle:{color:'#2F8EE0'}})
crr.push(res.data[i].times)
}
console.log(crr)
data.info=arr
data.infos=brr
data.xinfo=crr
let myChart = echarts.getInstanceByDom(document.getElementById("myEcharts"));
if (myChart){
myChart.dispose()
}
myChart = echarts.init(document.getElementById("myEcharts"));
//
myChart.setOption({
title: {},
tooltip: {},
legend: {
data: ['温度传感器1','温度传感器2'],
textStyle:{
color:'#BEC3DA'
}
},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "℃",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
let myChart = echarts.getInstanceByDom(document.getElementById("myEcharts"));
if (myChart){
myChart.dispose()
}
myChart = echarts.init(document.getElementById("myEcharts"));
//
myChart.setOption({
title: {},
tooltip: {},
legend: {
selectedMode: 'single',
textStyle:{
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: [
"00:00",
"00:15",
"00:30",
"00:45",
"01:00",
"01:15",
"01:30",
"01:45",
"02:00",
"02:15",
"02:30",
"02:45",
"03:00",
"03:15",
"03:30",
"03:45",
"04:00",
"04:15",
"04:30",
"04:45",
"05:00",
"05:15",
"05:30",
"05:45",
"06:00",
"06:15",
"06:30",
"06:45",
"07:00",
"07:15",
"07:30",
"07:45",
"08:00",
"08:15",
"08:30",
"08:45",
"09:00",
"09:15",
"09:30",
"09:45",
"10:00",
"10:15",
"10:30",
"10:45",
"11:00",
"11:15",
"11:30",
"11:45",
"12:00",
"12:15",
"12:30",
"12:45",
"13:00",
"13:15",
"13:30",
"13:45",
"14:00",
"14:15",
"14:30",
"14:45",
"15:00",
"15:15",
"15:30",
"15:45",
"16:00",
"16:15",
"16:30",
"16:45",
"17:00",
"17:15",
"17:30",
"17:45",
"18:00",
"18:15",
"18:30",
"18:45",
"19:00",
"19:15",
"19:30",
"19:45",
"20:00",
"20:15",
"20:30",
"20:45",
"21:00",
"21:15",
"21:30",
"21:45",
"22:00",
"22:15",
"22:30",
"22:45",
"23:00",
"23:15",
"23:30",
"23:45"
],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
},
series: [
{
name: "温度传感器1",
type: "line",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
yAxis: {
type: 'value',
name: "℃",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
],
});
window.onresize = function () {//
myChart.resize();
};
series:data.infos,
});
window.onresize = function () {//
myChart.resize();
};
})
});
return{
data
}
},
components: {},
mounted() {},

@ -2,21 +2,21 @@
<div class="app-container home">
<div class="top">
<div class="card">
<div>pic</div>
<div><img src="../../../assets/images/用电量.png"></div>
<div>
<p>总用电量</p>
<h2>{{data.totwh}}kWh</h2>
</div>
</div>
<div class="card">
<div>pic</div>
<div><img src="../../../assets/images/功率.png"></div>
<div>
<p>当前功率</p>
<h2>{{data.totp}}kW</h2>
</div>
</div>
<div class="card">
<div>pic</div>
<div><img src="../../../assets/images/温度.png"></div>
<div>
<div style="display: flex; margin-bottom: 5px">
<p>进水温度:</p>
@ -29,7 +29,7 @@
</div>
</div>
<div class="card">
<div>pic</div>
<div><img src="../../../assets/images/温度传感器.png"></div>
<div>
<p>运行状态</p>
<h2 style="color: #1ab394">{{data.runStatus}}</h2>
@ -429,7 +429,6 @@ export default {
title: {},
tooltip: {},
legend: {
data: ['进水', '出水'],
textStyle:{
color:'#BEC3DA'
}
@ -490,14 +489,6 @@ export default {
};
})
});
return{
data

@ -1,17 +1,17 @@
package com.psdc.controller.manager;
import com.psdc.annotation.Log;
import com.psdc.core.controller.BaseController;
import com.psdc.core.domain.AjaxResult;
import com.psdc.core.page.TableDataInfo;
import com.psdc.entity.PsdcScene;
import com.psdc.entity.vo.SceneVo;
import com.psdc.enums.BusinessType;
import com.psdc.service.IPsdcSceneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
@ -55,4 +55,34 @@ public class PsdcSceneController extends BaseController {
return getDataTable(list);
}
/**
* 新增场景策略
*/
@PreAuthorize("@ss.hasPermi('system:cl:list')")
@Log(title = "策略管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody List<SceneVo> scenes) {
return toAjax(psdcSceneService.insert(scenes));
}
/**
* 修改场景策略
*/
@PreAuthorize("@ss.hasPermi('system:cl:list')")
@Log(title = "策略管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody List<SceneVo> scenes) {
return toAjax(psdcSceneService.update(scenes));
}
/**
* 删除场景策略
*/
@PreAuthorize("@ss.hasPermi('system:cl:list')")
@Log(title = "策略管理", businessType = BusinessType.DELETE)
@DeleteMapping()
public AjaxResult remove(@RequestParam String sceneName) {
return toAjax(psdcSceneService.deleteBySceneName(sceneName));
}
}

Loading…
Cancel
Save