能源管理修改添加

master
maxw@mesnac.com 2 months ago
parent b00960a565
commit 269142336a

@ -58,6 +58,12 @@ public class RecordAlarmRuleController extends BaseController {
public AjaxResult getInfo(@PathVariable("objId") Long objId) {
return success(recordAlarmRuleService.selectRecordAlarmRuleByObjId(objId));
}
@GetMapping(value = "/energyType/{energyType}")
public AjaxResult getInfoList(@PathVariable("energyType") Long energyType) {
RecordAlarmRule rule = new RecordAlarmRule();
rule.setEnergyType(energyType);
return success(recordAlarmRuleService.selectRecordAlarmRuleList(rule));
}
/**
*

@ -77,6 +77,15 @@ public class RecordDnbInstantController extends BaseController {
return getDataTable(list);
}
@PostMapping("/listLine")
@ResponseBody
public List<RecordDnbInstant> listLine(@RequestBody RecordDnbInstant recordDnbInstant)
{
// startPage();
List<RecordDnbInstant> list = recordDnbInstantService.selectRecordDnbInstantList(recordDnbInstant);
return list;
}
/**
*
*/

@ -6,6 +6,7 @@ import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.web.page.TableDataInfo;
import com.hw.ems.base.domain.BaseLineLoss;
import com.hw.ems.base.utils.ExportExcelUtil;
import com.hw.ems.record.domain.RecordDnbInstant;
import com.hw.ems.report.domain.ExportReport;
import com.hw.ems.report.service.IDataAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
@ -57,6 +58,12 @@ public class dataAnalysisController extends BaseController
Map<String, Object> result = dataAnalysisService.energyMomAnalysisData(paramMap);
return AjaxResult.success(result);
}
// @ResponseBody
@GetMapping("/queryData")
public AjaxResult queryData(@RequestParam(required = false) Map paramMap){
List<RecordDnbInstant> list = dataAnalysisService.queryData(paramMap);
return AjaxResult.success(list);
}
/**
*

@ -1,6 +1,7 @@
package com.hw.ems.report.mapper;
import com.hw.ems.record.domain.RecordDnbInstant;
import com.hw.ems.report.domain.ReportPointDnb;
import com.hw.ems.report.domain.ReportPointDnbDTO;
@ -78,6 +79,8 @@ public interface ReportPointDnbMapper
*/
List<Map<String, String>> energyStatisticsData(Map map);
List<RecordDnbInstant> queryData(Map paramMap);
/**
*
* @param map

@ -13,6 +13,7 @@ import com.hw.ems.base.mapper.BaseLineMonitorMapper;
import com.hw.ems.base.mapper.BaseMonitorInfo1Mapper;
import com.hw.ems.base.mapper.BaseTypeRelationMapper;
import com.hw.ems.base.service.IBaseMonitorInfoService;
import com.hw.ems.record.domain.RecordDnbInstant;
import com.hw.ems.report.domain.ExportReport;
import com.hw.ems.report.domain.ReportPointDnb;
import com.hw.ems.report.domain.ReportPointWater;
@ -955,6 +956,11 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService {
return result;
}
@Override
public List<RecordDnbInstant> queryData(Map paramMap) {
return reportPointDnbMapper.queryData(paramMap);
}
/**
*
* @param paramMap

@ -397,6 +397,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) ert
group by pointTime, priceType
</select>
<select id="queryData" resultType="com.hw.ems.record.domain.RecordDnbInstant"
parameterType="java.util.Map">
select
x.*
from
`hwjy-cloud`.record_dnb_instant x
where
x.monitor_id = #{monitorId}
and record_time between #{startTime}
and #{endTime}
</select>

@ -9,6 +9,13 @@ export function dnbCountingData(query) {
params: query
})
}
export function queryData1(query) {
return request({
url: '/ems/report/analysis/queryData',
method: 'get',
params: query
})
}
// 查询部门下拉树结构
export function deptTreeSelect() {

@ -8,6 +8,12 @@ export function listRule(query) {
params: query
})
}
export function energyType(energyType) {
return request({
url: '/ems/record/alarmRule/energyType/' + energyType,
method: 'get'
})
}
// 查询异常告警规则详细
export function getRule(objId) {

@ -85,16 +85,16 @@
>筛选计量设备</el-button
>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- >导出</el-button-->
<!-- >-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button
>
</el-col>
<div class="total">
<div class="number">合计电量:</div>
<div class="alltotal">
@ -639,7 +639,10 @@ export default {
/** 导出按钮操作 */
handleExport() {
handleExport("bootstrap-table", "能耗统计", true);
// handleExport("bootstrap-table", "", true);
this.download('ems/report/analysis/classificationExport', {
...this.queryParams
}, `energyStatistics${new Date().getTime()}.xlsx`)
},
},
};

@ -459,9 +459,9 @@ export default {
let paramsexport = JSON.parse(JSON.stringify(this.queryParams));
delete paramsexport.pageSize;
delete paramsexport.pageNum;
this.download('/energy/record/dnbInstant/export', {
this.download('/ems/record/dnbInstant/export', {
...paramsexport
}, `user_${new Date().getTime()}.xlsx`)
}, `historyElectricity_${new Date().getTime()}.xlsx`)
},
}
};

@ -0,0 +1,577 @@
<template>
<div class="app-container">
<el-row :gutter="20">
<!--左侧部门数据-->
<el-col :span="6" :xs="24">
<div class="head-container">
<el-input
v-model="deptName"
placeholder="请输入计量设备名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</div>
<div class="head-container tree">
<el-tree
:data="deptOptions"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
node-key="id"
:default-expanded-keys="[deptOptions[0].id]"
highlight-current
@node-click="handleNodeClick"
/>
</div>
</el-col>
<!--右侧用户数据-->
<el-col :span="18" :xs="24">
<!--头部搜索条件输入框 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="采集时间">
<el-date-picker
v-model="dateRangeone"
style="width: 240px"
type="datetime"
placeholder="选择日期时间"
value-format="yyyy-MM-dd HH:mm:ss"
></el-date-picker>
</el-form-item>
<el-form-item><div>-</div></el-form-item>
<el-form-item><el-date-picker
v-model="dateRangetwo"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 240px"
type="datetime"
placeholder="选择日期时间"
></el-date-picker></el-form-item>
<!-- <el-form-item label="记录时间">-->
<!-- <el-date-picker-->
<!-- v-model="daterangeRecordTime"-->
<!-- style="width: 340px"-->
<!-- value-format="yyyy-MM-dd HH:mm:ss"-->
<!-- type="datetimerange"-->
<!-- range-separator="-"-->
<!-- start-placeholder="开始时间"-->
<!-- end-placeholder="结束时间"-->
<!-- ></el-date-picker>-->
<!-- </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>
<!-- 新增等功能按钮 -->
<!-- 用户表格 -->
<Chart ref="Chart1" class="chart1"/>
<!-- 分页 -->
</el-col>
</el-row>
</div>
</template>
<script>
import { listLine,listUser, treeDat,delDnbRemoveInstant,deptTreeSelect } from "@/api/ems/powerUse/HistoryElectricity";
import { getToken } from "@/utils/auth";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import Chart from '@/components/Charts/Chart'
import * as echarts from 'echarts';
import {iotInstantList} from "@/api/ems/record/recordIOTInstant";
export default {
name: "User",
dicts: ['sys_normal_disable', 'sys_user_sex'],
components: { Chart,Treeselect },
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
userList: null,
//
title: "",
//
deptOptions: [{id: 2}],
//
open: false,
//
deptName: undefined,
//
initPassword: undefined,
//
dateRange: [],
dateRangeone:'',
dateRangetwo:'',
//
postOptions: [],
//
roleOptions: [],
//
form: {},
defaultProps: {
children: "children",
label: "lable"
},
//
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,
orderByColumn: 'collectTime',
isAsc: 'desc',
collectType: '',
monitorSubset:'',
params:{
beginCollectTime:'',
endCollectTime:''
}
},
daterangeRecordTime: [],
//
columns: [
{ key: 0, label: `计量设备编号`, visible: true },
{ key: 1, label: `计量设备名称`, visible: true },
{ key: 2, label: `采集时间`, visible: true },
{ key: 3, label: `A项电压(V)`, visible: true },
{ key: 4, label: `B项电压(V)`, visible: true },
{ key: 5, label: `C项电压(V)`, visible: true },
{ key: 6, label: `A项电流(A)`, visible: true },
{ key: 7, label: `B项电流(A)`, visible: true },
{ key: 8, label: `C项电流(A)`, visible: true },
{ key: 9, label: `功率因数`, visible: true },
{ key: 10, label: `仪表值(kW·h)`, visible: true },
{ key: 11, label: `采集方式`, visible: true },
{ key: 12, label: `记录时间`, visible: true }
],
//
rules: {
userName: [
{ 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' }
],
email: [
{
type: "email",
message: "请输入正确的邮箱地址",
trigger: ["blur", "change"]
}
],
phonenumber: [
{
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码",
trigger: "blur"
}
]
},
//
dict:[
{label:'手动',value:'0'},
{label:'自动',value:'1'},
{label:'抄表',value:'2'},
],
};
},
watch: {
//
deptName(val) {
this.$refs.tree.filter(val);
}
},
mounted() {
this.dateRangeone=new Date(new Date().setHours(0, 0, 0, 0));
var d = new Date(this.dateRangeone);
let m = ('0'+(d.getMonth()+1)).slice(-2);;
let tian = ('0'+d.getDate()).slice(-2);
let h = ('0'+d.getHours()).slice(-2);
let M = ('0'+d.getMinutes()).slice(-2);
let s = ('0'+d.getSeconds()).slice(-2);
console.log('d',d)
this.dateRangeone = d.getFullYear()+ '-'+m+ '-'+tian+ ' '+ h+ ':'+M+':'+s;
this.dateRangetwo=new Date(new Date().setHours(0, 0, 0, 0) + 24 * 60 * 60 * 1000 - 1);
var d1 = new Date(this.dateRangetwo);
let m1 = ('0'+(d1.getMonth()+1)).slice(-2);
let tian1 = ('0'+d1.getDate()).slice(-2);
let h1 = ('0'+d1.getHours()).slice(-2);
let M1 = ('0'+d1.getMinutes()).slice(-2);
let s1 = ('0'+d1.getSeconds()).slice(-2);
console.log('tian1.length',tian1)
this.dateRangetwo = d1.getFullYear()+ '-'+m1+ '-'+tian1+ ' '+ h1+ ':'+M1+':'+s1;
//this.dateRangetwo = d1.getFullYear()+ '-'+m1+ '-'+tian1+ ' '+ h1+ ':'+M1+':'+s1;
this.getDeptTree();
this.getList();
},
methods: {
getList() {
this.loading = true;
this.queryParams.params = {};
this.queryParams.params.beginCollectTime = this.dateRangeone;
this.queryParams.params.endCollectTime = this.dateRangetwo;
if (null != this.daterangeRecordTime && '' != this.daterangeRecordTime) {
this.queryParams.params["beginRecordTime"] = this.daterangeRecordTime[0];
this.queryParams.params["endRecordTime"] = this.daterangeRecordTime[1];
}
console.log('this.datatimeone',this.queryParams)
listLine(this.queryParams).then(response => {
this.userList = response;
this.total = response.total;
this.loading = false;
this.getChart()
}
);
},
//
tranListToTreeData(list) {
//
const treeList = []
// 使
const map = {}
// id
list.forEach(item => {
if (!item.children) {
item.children = []
}
map[item.id] = item
})
list.forEach(item => {
//
// children
// treeList
const parent = map[item.pId]
// item
if (parent) {
parent.children.push(item)
} else {
//
treeList.push(item)
}
})
//
return treeList
},
/** 真查询部门下拉树结构 */
getDeptTree() {
treeDat().then(response => {
response.map((item,index)=>{
item,
item.oid=item.id,
item.lable = item.name
})
this.deptOptions = this.tranListToTreeData(response);
});
},
//
filterNode(value, data) {
if (!value) return true;
return data.lable.indexOf(value) !== -1;
},
//
handleNodeClick(data) {
this.queryParams.monitorSubset = data.monitorId;
console.log(data.monitorId)
this.getList();
},
//
cancel() {
this.open = false;
this.reset();
},
/** 删除按钮操作 */
handleDelete(row) {
const objids = row.objid || this.ids;
this.$modal.confirm('是否确认删除电实时数据编号为"' + objids + '"的数据项?').then(function() {
return delDnbRemoveInstant(objids)
}) .then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
}).catch(() => {
})
},
//
reset() {
this.form = {
userId: undefined,
deptId: undefined,
userName: undefined,
nickName: undefined,
password: undefined,
phonenumber: 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.queryParams.collectType = '';
this.dateRangeone = '';
this.dateRangetwo = '';
this.resetForm("queryForm");
//this.queryParams.deptId = undefined;
//this.$refs.tree.setCurrentKey(null);
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.objid)
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;
}
},
/** 导出按钮操作 */
handleExport() {
let paramsexport = JSON.parse(JSON.stringify(this.queryParams));
delete paramsexport.pageSize;
delete paramsexport.pageNum;
this.download('/energy/record/dnbInstant/export', {
...paramsexport
}, `user_${new Date().getTime()}.xlsx`)
},
async getChart() {
console.log(this.userList.map(e => e.collectTime))
console.log(this.userList.map(e => e.ia))
console.log(this.userList.map(e => e.ib))
console.log(this.userList.map(e => e.ic))
// let query = JSON.parse(JSON.stringify(this.queryParams))
// const {data} = await iotInstantList(query)
let option1 = {
title: {
text: '电流曲线',
// this.selectMonitorName
x: 'center'
},
legend:{
right:0
},
grid: {
top: '15%',
bottom: '10%',
left: '3%',
right: '3%'
},
tooltip: {
trigger: 'axis',
// axisPointer: {
// type: 'shadow',
// label: {
// show: true
// }
// }
},
dataZoom: [{
type: 'slider'
}],
xAxis: {
data: this.userList.map(e => e.collectTime),
axisLine: {
show: true, //X线
lineStyle: {
color: '#000'
}
},
// axisTick: {
// show: true //X
// },
axisLabel: {
show: true,
textStyle: {
color: '#000' //X
}
}
},
yAxis: [
{
type: 'value',
name: '数值',
nameTextStyle: {
color: '#000'
},
splitLine: {
show: false
},
axisTick: {
show: true
},
axisLine: {
show: true,
lineStyle: {
color: '#000'
}
},
axisLabel: {
show: true,
textStyle: {
color: '#000'
}
}
}
],
series: [
{
tooltip: {
show: true
},
name: 'ia',
type: "line",
smooth: true, //线
showAllSymbol: true, //
symbol: 'circle', //
symbolSize: 2, //
// itemStyle: {
// //线
// color: "#058cff",
// },
// lineStyle: {
// color: "#058cff",
// },
// areaStyle: {
// color: "rgba(5,140,255, 0.2)",
// },
data: this.userList.map(e => e.ia)
},
{
tooltip: {
show: true
},
name: 'ib',
type: "line",
smooth: true, //线
showAllSymbol: true, //
symbol: 'circle', //
symbolSize: 2, //
// itemStyle: {
// //线
// color: "#058cff",
// },
// lineStyle: {
// color: "#058cff",
// },
// areaStyle: {
// color: "rgba(5,140,255, 0.2)",
// },
data: this.userList.map(e => e.ib)
},
{
tooltip: {
show: true
},
name: 'ic',
type: "line",
smooth: true, //线
showAllSymbol: true, //
symbol: 'circle', //
symbolSize: 2, //
// itemStyle: {
// //线
// color: "#058cff",
// },
// lineStyle: {
// color: "#058cff",
// },
// areaStyle: {
// color: "rgba(5,140,255, 0.2)",
// },
data: this.userList.map(e => e.ic)
}
]
}
console.log(option1)
this.$refs.Chart1.setData(option1)
// echarts.connect(this.$refs.Chart1.chart)
// , this.$refs.Chart2.chart
// this.$refs.Chart1.chart.on('datazoom', (e) => {
// option1.dataZoom[0].start = e.start
// option1.dataZoom[0].end = e.end
// this.$refs.Chart1.setData(option1)
// })
}
}
};
</script>
<style lang="scss" scoped>
.tree {
width:220px;
::v-deep .el-tree-node {
white-space: normal;//!!!!!!!!!
.el-tree-node__content {
height: 100%;
align-items: start;
}
}
}
.chart1 {
width: 100%;
height: 75vh;
}
</style>

@ -0,0 +1,577 @@
<template>
<div class="app-container">
<el-row :gutter="20">
<!--左侧部门数据-->
<el-col :span="6" :xs="24">
<div class="head-container">
<el-input
v-model="deptName"
placeholder="请输入计量设备名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</div>
<div class="head-container tree">
<el-tree
:data="deptOptions"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
node-key="id"
:default-expanded-keys="[deptOptions[0].id]"
highlight-current
@node-click="handleNodeClick"
/>
</div>
</el-col>
<!--右侧用户数据-->
<el-col :span="18" :xs="24">
<!--头部搜索条件输入框 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="采集时间">
<el-date-picker
v-model="dateRangeone"
style="width: 240px"
type="datetime"
placeholder="选择日期时间"
value-format="yyyy-MM-dd HH:mm:ss"
></el-date-picker>
</el-form-item>
<el-form-item><div>-</div></el-form-item>
<el-form-item><el-date-picker
v-model="dateRangetwo"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 240px"
type="datetime"
placeholder="选择日期时间"
></el-date-picker></el-form-item>
<!-- <el-form-item label="记录时间">-->
<!-- <el-date-picker-->
<!-- v-model="daterangeRecordTime"-->
<!-- style="width: 340px"-->
<!-- value-format="yyyy-MM-dd HH:mm:ss"-->
<!-- type="datetimerange"-->
<!-- range-separator="-"-->
<!-- start-placeholder="开始时间"-->
<!-- end-placeholder="结束时间"-->
<!-- ></el-date-picker>-->
<!-- </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>
<!-- 新增等功能按钮 -->
<!-- 用户表格 -->
<Chart ref="Chart1" class="chart1"/>
<!-- 分页 -->
</el-col>
</el-row>
</div>
</template>
<script>
import { listLine,listUser, treeDat,delDnbRemoveInstant,deptTreeSelect } from "@/api/ems/powerUse/HistoryElectricity";
import { getToken } from "@/utils/auth";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import Chart from '@/components/Charts/Chart'
import * as echarts from 'echarts';
import {iotInstantList} from "@/api/ems/record/recordIOTInstant";
export default {
name: "User",
dicts: ['sys_normal_disable', 'sys_user_sex'],
components: { Chart,Treeselect },
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
userList: null,
//
title: "",
//
deptOptions: [{id: 2}],
//
open: false,
//
deptName: undefined,
//
initPassword: undefined,
//
dateRange: [],
dateRangeone:'',
dateRangetwo:'',
//
postOptions: [],
//
roleOptions: [],
//
form: {},
defaultProps: {
children: "children",
label: "lable"
},
//
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,
orderByColumn: 'collectTime',
isAsc: 'desc',
collectType: '',
monitorSubset:'',
params:{
beginCollectTime:'',
endCollectTime:''
}
},
daterangeRecordTime: [],
//
columns: [
{ key: 0, label: `计量设备编号`, visible: true },
{ key: 1, label: `计量设备名称`, visible: true },
{ key: 2, label: `采集时间`, visible: true },
{ key: 3, label: `A项电压(V)`, visible: true },
{ key: 4, label: `B项电压(V)`, visible: true },
{ key: 5, label: `C项电压(V)`, visible: true },
{ key: 6, label: `A项电流(A)`, visible: true },
{ key: 7, label: `B项电流(A)`, visible: true },
{ key: 8, label: `C项电流(A)`, visible: true },
{ key: 9, label: `功率因数`, visible: true },
{ key: 10, label: `仪表值(kW·h)`, visible: true },
{ key: 11, label: `采集方式`, visible: true },
{ key: 12, label: `记录时间`, visible: true }
],
//
rules: {
userName: [
{ 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' }
],
email: [
{
type: "email",
message: "请输入正确的邮箱地址",
trigger: ["blur", "change"]
}
],
phonenumber: [
{
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码",
trigger: "blur"
}
]
},
//
dict:[
{label:'手动',value:'0'},
{label:'自动',value:'1'},
{label:'抄表',value:'2'},
],
};
},
watch: {
//
deptName(val) {
this.$refs.tree.filter(val);
}
},
mounted() {
this.dateRangeone=new Date(new Date().setHours(0, 0, 0, 0));
var d = new Date(this.dateRangeone);
let m = ('0'+(d.getMonth()+1)).slice(-2);;
let tian = ('0'+d.getDate()).slice(-2);
let h = ('0'+d.getHours()).slice(-2);
let M = ('0'+d.getMinutes()).slice(-2);
let s = ('0'+d.getSeconds()).slice(-2);
console.log('d',d)
this.dateRangeone = d.getFullYear()+ '-'+m+ '-'+tian+ ' '+ h+ ':'+M+':'+s;
this.dateRangetwo=new Date(new Date().setHours(0, 0, 0, 0) + 24 * 60 * 60 * 1000 - 1);
var d1 = new Date(this.dateRangetwo);
let m1 = ('0'+(d1.getMonth()+1)).slice(-2);
let tian1 = ('0'+d1.getDate()).slice(-2);
let h1 = ('0'+d1.getHours()).slice(-2);
let M1 = ('0'+d1.getMinutes()).slice(-2);
let s1 = ('0'+d1.getSeconds()).slice(-2);
console.log('tian1.length',tian1)
this.dateRangetwo = d1.getFullYear()+ '-'+m1+ '-'+tian1+ ' '+ h1+ ':'+M1+':'+s1;
//this.dateRangetwo = d1.getFullYear()+ '-'+m1+ '-'+tian1+ ' '+ h1+ ':'+M1+':'+s1;
this.getDeptTree();
this.getList();
},
methods: {
getList() {
this.loading = true;
this.queryParams.params = {};
this.queryParams.params.beginCollectTime = this.dateRangeone;
this.queryParams.params.endCollectTime = this.dateRangetwo;
if (null != this.daterangeRecordTime && '' != this.daterangeRecordTime) {
this.queryParams.params["beginRecordTime"] = this.daterangeRecordTime[0];
this.queryParams.params["endRecordTime"] = this.daterangeRecordTime[1];
}
console.log('this.datatimeone',this.queryParams)
listLine(this.queryParams).then(response => {
this.userList = response;
this.total = response.total;
this.loading = false;
this.getChart()
}
);
},
//
tranListToTreeData(list) {
//
const treeList = []
// 使
const map = {}
// id
list.forEach(item => {
if (!item.children) {
item.children = []
}
map[item.id] = item
})
list.forEach(item => {
//
// children
// treeList
const parent = map[item.pId]
// item
if (parent) {
parent.children.push(item)
} else {
//
treeList.push(item)
}
})
//
return treeList
},
/** 真查询部门下拉树结构 */
getDeptTree() {
treeDat().then(response => {
response.map((item,index)=>{
item,
item.oid=item.id,
item.lable = item.name
})
this.deptOptions = this.tranListToTreeData(response);
});
},
//
filterNode(value, data) {
if (!value) return true;
return data.lable.indexOf(value) !== -1;
},
//
handleNodeClick(data) {
this.queryParams.monitorSubset = data.monitorId;
console.log(data.monitorId)
this.getList();
},
//
cancel() {
this.open = false;
this.reset();
},
/** 删除按钮操作 */
handleDelete(row) {
const objids = row.objid || this.ids;
this.$modal.confirm('是否确认删除电实时数据编号为"' + objids + '"的数据项?').then(function() {
return delDnbRemoveInstant(objids)
}) .then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
}).catch(() => {
})
},
//
reset() {
this.form = {
userId: undefined,
deptId: undefined,
userName: undefined,
nickName: undefined,
password: undefined,
phonenumber: 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.queryParams.collectType = '';
this.dateRangeone = '';
this.dateRangetwo = '';
this.resetForm("queryForm");
//this.queryParams.deptId = undefined;
//this.$refs.tree.setCurrentKey(null);
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.objid)
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;
}
},
/** 导出按钮操作 */
handleExport() {
let paramsexport = JSON.parse(JSON.stringify(this.queryParams));
delete paramsexport.pageSize;
delete paramsexport.pageNum;
this.download('/energy/record/dnbInstant/export', {
...paramsexport
}, `user_${new Date().getTime()}.xlsx`)
},
async getChart() {
console.log(this.userList.map(e => e.collectTime))
console.log(this.userList.map(e => e.ia))
console.log(this.userList.map(e => e.ib))
console.log(this.userList.map(e => e.ic))
// let query = JSON.parse(JSON.stringify(this.queryParams))
// const {data} = await iotInstantList(query)
let option1 = {
title: {
text: '电流曲线',
// this.selectMonitorName
x: 'center'
},
legend:{
right:0
},
grid: {
top: '15%',
bottom: '10%',
left: '3%',
right: '3%'
},
tooltip: {
trigger: 'axis',
// axisPointer: {
// type: 'shadow',
// label: {
// show: true
// }
// }
},
dataZoom: [{
type: 'slider'
}],
xAxis: {
data: this.userList.map(e => e.collectTime),
axisLine: {
show: true, //X线
lineStyle: {
color: '#000'
}
},
// axisTick: {
// show: true //X
// },
axisLabel: {
show: true,
textStyle: {
color: '#000' //X
}
}
},
yAxis: [
{
type: 'value',
name: '数值',
nameTextStyle: {
color: '#000'
},
splitLine: {
show: false
},
axisTick: {
show: true
},
axisLine: {
show: true,
lineStyle: {
color: '#000'
}
},
axisLabel: {
show: true,
textStyle: {
color: '#000'
}
}
}
],
series: [
{
tooltip: {
show: true
},
name: 'va',
type: "line",
smooth: true, //线
showAllSymbol: true, //
symbol: 'circle', //
symbolSize: 2, //
// itemStyle: {
// //线
// color: "#058cff",
// },
// lineStyle: {
// color: "#058cff",
// },
// areaStyle: {
// color: "rgba(5,140,255, 0.2)",
// },
data: this.userList.map(e => e.va)
},
{
tooltip: {
show: true
},
name: 'vb',
type: "line",
smooth: true, //线
showAllSymbol: true, //
symbol: 'circle', //
symbolSize: 2, //
// itemStyle: {
// //线
// color: "#058cff",
// },
// lineStyle: {
// color: "#058cff",
// },
// areaStyle: {
// color: "rgba(5,140,255, 0.2)",
// },
data: this.userList.map(e => e.vb)
},
{
tooltip: {
show: true
},
name: 'vc',
type: "line",
smooth: true, //线
showAllSymbol: true, //
symbol: 'circle', //
symbolSize: 2, //
// itemStyle: {
// //线
// color: "#058cff",
// },
// lineStyle: {
// color: "#058cff",
// },
// areaStyle: {
// color: "rgba(5,140,255, 0.2)",
// },
data: this.userList.map(e => e.vc)
}
]
}
console.log(option1)
this.$refs.Chart1.setData(option1)
// echarts.connect(this.$refs.Chart1.chart)
// , this.$refs.Chart2.chart
// this.$refs.Chart1.chart.on('datazoom', (e) => {
// option1.dataZoom[0].start = e.start
// option1.dataZoom[0].end = e.end
// this.$refs.Chart1.setData(option1)
// })
}
}
};
</script>
<style lang="scss" scoped>
.tree {
width:220px;
::v-deep .el-tree-node {
white-space: normal;//!!!!!!!!!
.el-tree-node__content {
height: 100%;
align-items: start;
}
}
}
.chart1 {
width: 100%;
height: 75vh;
}
</style>

@ -75,6 +75,7 @@ import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import {parseTime} from '@/utils/ruoyi'
import Chart from '@/components/Charts/Chart'
import * as echarts from 'echarts'
import {energyType, listRule} from "@/api/ems/base/exception/rule";
export default {
name: 'CurrentIOTCurve',
@ -130,6 +131,12 @@ export default {
reactivePower: null,
collectType: null
},
queryParamsType: {
energyType: null
},
pm:{},
noiseItem:{},
tempretureItem:{},
//
form: {},
monitorProps: {
@ -266,10 +273,37 @@ export default {
/** 物联网设备曲线 */
async getChart() {
energyType(4).then(response => {
this.pm = response.data[0];
console.log(this.pm)
this.loading = false;
});
energyType(6).then(response => {
this.noiseItem = response.data[0];
console.log(this.noiseItem)
this.loading = false;
});
energyType(7).then(response => {
this.tempretureItem = response.data[0];
this.loading = false;
});
console.log(this.queryParams.monitorId)
if (this.queryParams.monitorId == null) {
return
}
let pm1 = this.pm.pm1;
let pm2 = this.pm.pm2;
let pm10 = this.pm.pm10;
let nois = this.noiseItem.noise;
let tem = this.tempretureItem.temperature;
let hum = this.tempretureItem.humidity;
console.log(pm1);
console.log(pm2);
console.log(pm10);
console.log(nois);
console.log(tem);
console.log(hum);
let query = JSON.parse(JSON.stringify(this.queryParams))
const {data} = await iotInstantList(query)
let option1 = {
@ -366,7 +400,27 @@ export default {
// areaStyle: {
// color: "rgba(5,140,255, 0.2)",
// },
data: data.monitorTypeArr.includes('温度') ? data.dataList.map(e => e.tempreture) : []
data: data.monitorTypeArr.includes('温度') ? data.dataList.map(e => e.tempreture) : [],
markLine: {
symbol: "none",//线
label: {position: "middle",show: true,formatter:'温度告警值: '+tem,textStyle: {
fontSize: 18, //
fontWeight: 'bold' //
}},//start,"middle","end"
data: [
{
name: 'y轴为15的直线',
yAxis: tem,
// silent: true, // truefalse
lineStyle: { //线
opacity: data.monitorTypeArr.includes('温度') ? 10 : 0,
type: "solid",
width: 3,
color: "#FA3934",
},
},
]
}
},
{
tooltip: {
@ -388,7 +442,27 @@ export default {
// areaStyle: {
// color: "rgba(5,140,255, 0.2)",
// },
data: data.monitorTypeArr.includes('湿度') ? data.dataList.map(e => e.humidity) : []
data: data.monitorTypeArr.includes('湿度') ? data.dataList.map(e => e.humidity) : [],
markLine: {
symbol: "none",//线
label: {position: "middle",show: true,formatter:'湿度告警值: '+hum,textStyle: {
fontSize: 18, //
fontWeight: 'bold' //
}},//start,"middle","end"
data: [
{
name: 'y轴为15的直线',
yAxis: hum,
// silent: true, // truefalse
lineStyle: { //线
width: 3,
opacity: data.monitorTypeArr.includes('湿度') ? 10 : 0,
type: "solid",
color: "#FA3934",
},
},
]
}
},
{
tooltip: {
@ -410,7 +484,27 @@ export default {
// areaStyle: {
// color: "rgba(5,140,255, 0.2)",
// },
data: data.monitorTypeArr.includes('噪声') ? data.dataList.map(e => e.noise) : []
data: data.monitorTypeArr.includes('噪声') ? data.dataList.map(e => e.noise) : [],
markLine: {
symbol: "none",//线
label: {position: "middle",show: true,formatter:'噪声告警值: '+nois,textStyle: {
fontSize: 18, //
fontWeight: 'bold' //
}},//start,"middle","end"
data: [
{
name: 'y轴为15的直线',
yAxis: nois,
// silent: true, // truefalse
lineStyle: { //线
width: 3,
opacity: data.monitorTypeArr.includes('噪声') ? 10 : 0,
type: "solid",
color: "#FA3934",
},
},
]
}
},
{
tooltip: {
@ -475,7 +569,28 @@ export default {
// areaStyle: {
// color: "rgba(5,140,255, 0.2)",
// },
data: data.monitorTypeArr.includes('pm1') ? data.dataList.map(e => e.pm1) : []
data: data.monitorTypeArr.includes('pm1') ? data.dataList.map(e => e.pm1) : [],
markLine: {
silent: true,
symbol: "none",//线
label: {position: "middle",show: true,formatter:'pm1告警值 '+pm1,textStyle: {
fontSize: 18, //
fontWeight: 'bold' //
}},//start,"middle","end"
data: [
{
name: 'y轴为15的直线',
yAxis: pm1,
// silent: true, // truefalse
lineStyle: { //线
width: 3,
opacity: data.monitorTypeArr.includes('pm1') ? 10 : 0,
type: "solid",
color: "#FA3934",
},
},
]
}
},{
tooltip: {
show: data.monitorTypeArr.includes('pm2') ? true : false
@ -496,7 +611,27 @@ export default {
// areaStyle: {
// color: "rgba(5,140,255, 0.2)",
// },
data: data.monitorTypeArr.includes('pm2') ? data.dataList.map(e => e.pm2) : []
data: data.monitorTypeArr.includes('pm2') ? data.dataList.map(e => e.pm2) : [],
markLine: {
symbol: "none",//线
label: {position: "middle",show: true,formatter:'pm2告警值 '+pm2,textStyle: {
fontSize: 18, //
fontWeight: 'bold' //
}},//start,"middle","end"
data: [
{
name: 'y轴为15的直线',
yAxis: pm2,
// silent: true, // truefalse
lineStyle: { //线
width: 3,
opacity: data.monitorTypeArr.includes('pm2') ? 10 : 0,
type: "solid",
color: "#FA3934",
},
},
]
}
},{
tooltip: {
show: data.monitorTypeArr.includes('pm10') ? true : false
@ -517,7 +652,27 @@ export default {
// areaStyle: {
// color: "rgba(5,140,255, 0.2)",
// },
data: data.monitorTypeArr.includes('pm10') ? data.dataList.map(e => e.pm10) : []
data: data.monitorTypeArr.includes('pm10') ? data.dataList.map(e => e.pm10) : [],
markLine: {
symbol: "none",//线
label: {position: "middle",show: true,formatter:'pm10告警值'+pm10,textStyle: {
fontSize: 18, //
fontWeight: 'bold' //
}},//start,"middle","end"
data: [
{
name: 'y轴为15的直线',
yAxis: pm10,
// silent: true, // truefalse
lineStyle: { //线
width: 3,
opacity: data.monitorTypeArr.includes('pm10') ? 10 : 0,
type: "solid",
color: "#fa3434",
},
},
]
}
}
]
}

Loading…
Cancel
Save