数据记录模块提交

This commit is contained in:
zhanghan11 2024-04-02 14:37:01 +08:00
parent b7f331946c
commit 549a753b2e
16 changed files with 962 additions and 12 deletions

View File

@ -0,0 +1,42 @@
package com.inspur.web.controller.ipc;
import com.inspur.common.core.controller.BaseController;
import com.inspur.common.core.domain.AjaxResult;
import com.inspur.ipc.service.IIpcDataLogService;
import com.inspur.ipc.service.IIpcDataShowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 数据展示界面
*
* @author inspur
*/
@RestController
@RequestMapping("/ipc/dataLog")
public class IpcDataLogController extends BaseController {
@Autowired
private IIpcDataLogService iIpcDataLogService;
/**
* 查询plc数据记录
*/
@PreAuthorize("@ss.hasPermi('ipc:dataLog:query')")
@GetMapping(value = "/plc/{part}")
public AjaxResult queryPlcDataLog(@PathVariable String part)
{
return AjaxResult.success(iIpcDataLogService.queryPlcDataLog(part));
}
/**
* 查询传感器温振数据记录
*/
@PreAuthorize("@ss.hasPermi('ipc:dataLog:query')")
@GetMapping(value = "/sensor/{part}")
public AjaxResult querySensorDataLog(@PathVariable String part)
{
return AjaxResult.success(iIpcDataLogService.querySensorDataLog(part));
}
}

View File

@ -0,0 +1,32 @@
package com.inspur.web.controller.ipc;
import com.inspur.common.core.controller.BaseController;
import com.inspur.common.core.domain.AjaxResult;
import com.inspur.ipc.service.IIpcDataShowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 数据展示界面
*
* @author inspur
*/
@RestController
@RequestMapping("ipc/dataShow")
public class IpcDataShowController extends BaseController {
@Autowired
private IIpcDataShowService iIpcDataShowService;
/**
* 获取展示数据
*/
// @PreAuthorize("@ss.hasPermi('ipc:dataShow:query')")
@GetMapping(value = "/byPart/{parts}")
public AjaxResult getShowData(@PathVariable("parts") String[] parts)
{
return AjaxResult.success(iIpcDataShowService.getShowData(parts));
}
}

View File

@ -8,6 +8,7 @@ import com.inspur.ipc.domain.IpcMonitorField;
import com.inspur.ipc.service.IIpcAlarmRecordService; import com.inspur.ipc.service.IIpcAlarmRecordService;
import com.inspur.ipc.service.IIpcMonitorFieldService; import com.inspur.ipc.service.IIpcMonitorFieldService;
import com.inspur.ipc.utils.GetBeanUtil; import com.inspur.ipc.utils.GetBeanUtil;
import com.inspur.ipc.utils.IpcConstant;
import com.inspur.ipc.utils.IpcUtil; import com.inspur.ipc.utils.IpcUtil;
import com.inspur.system.service.influx.InfluxDBService; import com.inspur.system.service.influx.InfluxDBService;
import com.serotonin.modbus4j.BatchRead; import com.serotonin.modbus4j.BatchRead;
@ -73,7 +74,6 @@ public class IPCData2SyncThread implements Runnable {
List<IpcMonitorField> partList = iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.MONITOR_PART_KEY); List<IpcMonitorField> partList = iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.MONITOR_PART_KEY);
List<IpcMonitorField> sensorList = iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.SENSOR_MONITOR_PARAMS_KEY); List<IpcMonitorField> sensorList = iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.SENSOR_MONITOR_PARAMS_KEY);
List<IpcAlarmRecord> alarmRecordList = new ArrayList<>(); List<IpcAlarmRecord> alarmRecordList = new ArrayList<>();
String measurement = "tzipc_sensor_monitor_data_list";
// 字典数据列表集合 // 字典数据列表集合
for (IpcMonitorField part : partList) { for (IpcMonitorField part : partList) {
Map<String, String> tags = new TreeMap(); Map<String, String> tags = new TreeMap();
@ -116,7 +116,7 @@ public class IPCData2SyncThread implements Runnable {
InfluxDBService i = SpringUtils.getBean(InfluxDBService.class); InfluxDBService i = SpringUtils.getBean(InfluxDBService.class);
// 根据报警规则校验 // 根据报警规则校验
alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields,tags.get("part"),CacheConstants.SENSOR_MONITOR_PARAMS_KEY)); alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields,tags.get("part"),CacheConstants.SENSOR_MONITOR_PARAMS_KEY));
i.insert(measurement, tags, fields); i.insert(IpcConstant.SENSOR_MEASUREMENT, tags, fields);
} }
// 批量保存报警数据 // 批量保存报警数据
if(!alarmRecordList.isEmpty()){ if(!alarmRecordList.isEmpty()){

View File

@ -9,6 +9,7 @@ import com.inspur.ipc.domain.IpcMonitorField;
import com.inspur.ipc.service.IIpcAlarmRecordService; import com.inspur.ipc.service.IIpcAlarmRecordService;
import com.inspur.ipc.service.IIpcMonitorFieldService; import com.inspur.ipc.service.IIpcMonitorFieldService;
import com.inspur.ipc.utils.GetBeanUtil; import com.inspur.ipc.utils.GetBeanUtil;
import com.inspur.ipc.utils.IpcConstant;
import com.inspur.ipc.utils.IpcUtil; import com.inspur.ipc.utils.IpcUtil;
import com.inspur.system.service.ISysDictDataService; import com.inspur.system.service.ISysDictDataService;
import com.inspur.system.service.influx.InfluxDBService; import com.inspur.system.service.influx.InfluxDBService;
@ -77,7 +78,6 @@ public class IPCDataSyncThread implements Runnable {
List<IpcMonitorField> partList = iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.MONITOR_PART_KEY); List<IpcMonitorField> partList = iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.MONITOR_PART_KEY);
List<IpcMonitorField> plcList = iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.PLC_MONITOR_PARAMS_KEY); List<IpcMonitorField> plcList = iIpcMonitorFieldService.selectFieldDataByType(CacheConstants.PLC_MONITOR_PARAMS_KEY);
List<IpcAlarmRecord> alarmRecordList = new ArrayList<>(); List<IpcAlarmRecord> alarmRecordList = new ArrayList<>();
String measurement = "tzipc_plc_monitor_data_list";
// 字典数据列表集合 // 字典数据列表集合
for (IpcMonitorField part : partList) { for (IpcMonitorField part : partList) {
Map<String, String> tags = new TreeMap(); Map<String, String> tags = new TreeMap();
@ -120,7 +120,7 @@ public class IPCDataSyncThread implements Runnable {
InfluxDBService i = SpringUtils.getBean(InfluxDBService.class); InfluxDBService i = SpringUtils.getBean(InfluxDBService.class);
// 根据报警规则校验 // 根据报警规则校验
alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields,tags.get("part"),CacheConstants.PLC_MONITOR_PARAMS_KEY)); alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields,tags.get("part"),CacheConstants.PLC_MONITOR_PARAMS_KEY));
i.insert(measurement, tags, fields); i.insert(IpcConstant.PLC_MEASUREMENT, tags, fields);
} }
// 批量保存报警数据 // 批量保存报警数据
if(!alarmRecordList.isEmpty()){ if(!alarmRecordList.isEmpty()){

View File

@ -22,7 +22,7 @@ import com.inspur.framework.security.handle.LogoutSuccessHandlerImpl;
/** /**
* spring security配置 * spring security配置
* *
* @author inspur * @author inspur
*/ */
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
@ -33,7 +33,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
*/ */
@Autowired @Autowired
private UserDetailsService userDetailsService; private UserDetailsService userDetailsService;
/** /**
* 认证失败处理类 * 认证失败处理类
*/ */
@ -51,7 +51,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
*/ */
@Autowired @Autowired
private JwtAuthenticationTokenFilter authenticationTokenFilter; private JwtAuthenticationTokenFilter authenticationTokenFilter;
/** /**
* 跨域过滤器 * 跨域过滤器
*/ */
@ -109,7 +109,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求 // 过滤请求
.authorizeRequests() .authorizeRequests()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
.antMatchers("/login", "/register", "/captchaImage").anonymous() .antMatchers("/login", "/register", "/captchaImage","/data/show/byPart/**").anonymous()
// 静态资源可匿名访问 // 静态资源可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

View File

@ -0,0 +1,21 @@
package com.inspur.ipc.service;
import java.util.List;
import java.util.Map;
/**
* 数据展示界面Service接口
*
* @author inspur
*/
public interface IIpcDataLogService {
/**
* plc数据记录接口
*/
public List<Map<String,Object>> queryPlcDataLog(String part);
/**
* 温振传感器数据记录接口
*/
public List<Map<String,Object>> querySensorDataLog(String part);
}

View File

@ -0,0 +1,15 @@
package com.inspur.ipc.service;
import java.util.Map;
/**
* 数据展示界面Service接口
*
* @author inspur
*/
public interface IIpcDataShowService {
/**
* 展示数据获取
*/
public Map<String,Object> getShowData(String [] parts);
}

View File

@ -0,0 +1,37 @@
package com.inspur.ipc.service.impl;
import com.inspur.ipc.service.IIpcDataLogService;
import com.inspur.ipc.utils.IpcConstant;
import com.inspur.system.service.influx.InfluxDBService;
import org.influxdb.dto.QueryResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class IpcDataLogServiceImpl implements IIpcDataLogService {
@Autowired
private InfluxDBService influxDBService;
/**
* plc数据记录接口
*/
@Override
public List<Map<String, Object>> queryPlcDataLog(String part) {
QueryResult query = influxDBService.query("select * from "+ IpcConstant.PLC_MEASUREMENT +" where part = '" + part + "' order by time desc limit 20");
List<Map<String, Object>> maps = influxDBService.queryResultProcess(query);
return maps;
}
/**
* 温振传感器数据记录接口
*/
@Override
public List<Map<String, Object>> querySensorDataLog(String part) {
QueryResult query = influxDBService.query("select * from "+ IpcConstant.SENSOR_MEASUREMENT +" where part = '" + part + "' order by time desc limit 20");
List<Map<String, Object>> maps = influxDBService.queryResultProcess(query);
return maps;
}
}

View File

@ -0,0 +1,234 @@
package com.inspur.ipc.service.impl;
import com.inspur.ipc.service.IIpcDataShowService;
import com.inspur.ipc.utils.IpcConstant;
import com.inspur.system.service.influx.InfluxDBService;
import org.influxdb.dto.QueryResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* 数据展示界面Service业务层处理
*
* @author inspur
*/
@Service
public class IpcDataShowServiceImpl implements IIpcDataShowService {
@Autowired
private InfluxDBService influxDBService;
/**
* 展示数据获取
*/
@Override
public Map<String, Object> getShowData(String[] parts) {
Map<String, Object> dataMap = new HashMap<>();
CompletableFuture<Map<String, Map<String,Object>>> plcDataMap = CompletableFuture.supplyAsync(() -> dealPlcData(parts));
CompletableFuture<Map<String, Map<String,Object>>> sensorDataMap = CompletableFuture.supplyAsync(() -> dealSensorData(parts));
try {
plcDataMap.get().get(IpcConstant.OPERATION_NAME).putAll(sensorDataMap.get().get(IpcConstant.OPERATION_NAME));
plcDataMap.get().get(IpcConstant.DRIVE_NAME).putAll(sensorDataMap.get().get(IpcConstant.DRIVE_NAME));
dataMap.put(IpcConstant.OPERATION_NAME,plcDataMap.get().get(IpcConstant.OPERATION_NAME));
dataMap.put(IpcConstant.DRIVE_NAME,plcDataMap.get().get(IpcConstant.DRIVE_NAME));
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
return dataMap;
}
/**
* plc数据处理
* @param parts
* @return
*/
private Map<String,Map<String,Object>> dealPlcData(String[] parts){
Map<String, Map<String,Object>> dataMap = new HashMap<>();
try {
for (String part : parts) {
// 数据获取
QueryResult plcQuery = influxDBService.query("select * from " + IpcConstant.PLC_MEASUREMENT + " where part = '" + part + "' order by time desc limit 60");
List<Map<String, Object>> plcMaps = influxDBService.queryResultProcess(plcQuery);
// plc数据处理
// 横轴时间轴
List<String> xPlcData = new ArrayList<>();
//颗粒度4μm
List<Object> pz4 = new ArrayList<>();
//颗粒度6μm
List<Object> pz6 = new ArrayList<>();
//颗粒度14μm
List<Object> pz14 = new ArrayList<>();
//颗粒度21μm
List<Object> pz21 = new ArrayList<>();
//油水含量
List<Object> owc = new ArrayList<>();
//油品粘度
List<Object> ov = new ArrayList<>();
//回油温度
List<Object> rot = new ArrayList<>();
//轴套区温度
List<Object> ssat = new ArrayList<>();
//进油压力
List<Object> oip = new ArrayList<>();
//油液密度
List<Object> od = new ArrayList<>();
for (int i = plcMaps.size() - 1; i > -1; i--) {
System.out.println("1111111111111");
Map<String, Object> plcObj = plcMaps.get(i);
pz4.add(plcObj.get("pz4") == null ? 0 : plcObj.get("pz4"));
pz6.add(plcObj.get("pz6") == null ? 0 : plcObj.get("pz6"));
pz14.add(plcObj.get("pz14") == null ? 0 : plcObj.get("pz14"));
pz21.add(plcObj.get("pz21") == null ? 0 : plcObj.get("pz21"));
owc.add(plcObj.get("owc") == null ? 0 : plcObj.get("owc"));
ov.add(plcObj.get("ov") == null ? 0 : plcObj.get("ov"));
rot.add(plcObj.get("rot") == null ? 0 : plcObj.get("rot"));
ssat.add(plcObj.get("ssat") == null ? 0 : plcObj.get("ssat"));
oip.add(plcObj.get("oip") == null ? 0 : plcObj.get("oip"));
od.add(plcObj.get("od") == null ? 0 : plcObj.get("od"));
if (plcObj.containsKey("insertTime") && null != plcObj.get("insertTime")) {
xPlcData.add(this.dateTimeDeal(plcObj.get("insertTime"),"minute"));
}
}
Map<String, Object> map = new HashMap<>();
if (!xPlcData.isEmpty()) {
int plcIndex = xPlcData.size() - 1;
map.put("xPlcData", xPlcData);
map.put("pz4", pz4);
map.put("pz6", pz6);
map.put("pz14", pz14);
map.put("pz21", pz21);
map.put("owc", owc.get(plcIndex));
map.put("ov", ov.get(plcIndex));
map.put("rot", rot.get(plcIndex));
map.put("ssat", ssat.get(plcIndex));
map.put("oip", oip.get(plcIndex));
map.put("od", od.get(plcIndex));
}
// 根据位置处理
if (part.endsWith(IpcConstant.OPERATION_PROFILE)) {
// 操作侧
dataMap.put(IpcConstant.OPERATION_NAME, map);
} else if (part.endsWith(IpcConstant.DRIVE_PROFILE)) {
// 传动侧
dataMap.put(IpcConstant.DRIVE_NAME, map);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return dataMap;
}
/**
* 传感器温振数据处理
* @param parts
* @return
*/
private Map<String,Map<String,Object>> dealSensorData(String[] parts){
Map<String, Map<String,Object>> dataMap = new HashMap<>();
try {
for (String part : parts) {
// 数据获取
QueryResult sensorQuery = influxDBService.query("select * from " + IpcConstant.SENSOR_MEASUREMENT + " where part = '" + part + "' order by time desc limit 60");
List<Map<String, Object>> sensorMaps = influxDBService.queryResultProcess(sensorQuery);
// 传感器温振数据处理
// 横轴时间轴
List<String> xSensorData = new ArrayList<>();
//振动温度
List<Object> vt = new ArrayList<>();
//振动x轴
List<Object> vx = new ArrayList<>();
//振动y轴
List<Object> vy = new ArrayList<>();
//振动z轴
List<Object> vz = new ArrayList<>();
for (int i = sensorMaps.size() - 1; i > -1; i--) {
System.out.println("222222222222");
Map<String, Object> sensorObj = sensorMaps.get(i);
vt.add(sensorObj.get("vt") == null ? 0 : sensorObj.get("vt"));
vx.add(sensorObj.get("vx") == null ? 0 : sensorObj.get("vx"));
vy.add(sensorObj.get("vy") == null ? 0 : sensorObj.get("vy"));
vz.add(sensorObj.get("vz") == null ? 0 : sensorObj.get("vz"));
if (sensorObj.containsKey("insertTime") && null != sensorObj.get("insertTime")) {
xSensorData.add(this.dateTimeDeal(sensorObj.get("insertTime"),"hour"));
}
}
Map<String, Object> map = new HashMap<>();
if (!xSensorData.isEmpty()) {
int sensorIndex = xSensorData.size() - 1;
map.put("xSensorData", xSensorData);
map.put("vt", vt.get(sensorIndex));
map.put("vx", vx);
map.put("vy", vy);
map.put("vz", vz);
}
// 根据位置处理
if (part.endsWith(IpcConstant.OPERATION_PROFILE)) {
// 操作侧
dataMap.put(IpcConstant.OPERATION_NAME, map);
} else if (part.endsWith(IpcConstant.DRIVE_PROFILE)) {
// 传动侧
dataMap.put(IpcConstant.DRIVE_NAME, map);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return dataMap;
}
/**
* 时间格式处理
*
* @param obj
* @return
*/
private String dateTimeDeal(Object obj, String type) {
String dateTime = "";
//处理时间
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Date time = simpleDateFormat.parse(String.valueOf(obj));
Calendar calendar = Calendar.getInstance();
calendar.setTime(time);
int y = calendar.get(Calendar.YEAR);
String month = calendar.get(Calendar.MONTH) > 9 ? ""+calendar.get(Calendar.MONTH) : "0"+calendar.get(Calendar.MONTH);
String d = calendar.get(Calendar.DAY_OF_MONTH) > 9 ? ""+calendar.get(Calendar.DAY_OF_MONTH) : "0"+calendar.get(Calendar.DAY_OF_MONTH);
String h = calendar.get(Calendar.HOUR_OF_DAY) > 9 ? ""+calendar.get(Calendar.HOUR_OF_DAY) : "0"+calendar.get(Calendar.HOUR_OF_DAY);
String m = calendar.get(Calendar.MINUTE) > 9 ? ""+calendar.get(Calendar.MINUTE) : "0"+calendar.get(Calendar.MINUTE);
String s = calendar.get(Calendar.SECOND) > 9 ? ""+calendar.get(Calendar.SECOND) : "0"+calendar.get(Calendar.SECOND);
switch (type) {
case "year":
dateTime = y + "-" + month + "-" + d + " " + h + ":" + m + ":" + s;
break;
case "month":
dateTime = month + "-" + d + " " + h + ":" + m + ":" + s;
break;
case "day":
dateTime = d + " " + h + ":" + m + ":" + s;
break;
case "hour":
dateTime = h + ":" + m + ":" + s;
break;
case "minute":
dateTime = m + ":" + s;
break;
default:
dateTime = m + ":" + s;
break;
}
} catch (ParseException e) {
e.printStackTrace();
}
return dateTime;
}
}

View File

@ -35,4 +35,29 @@ public class IpcConstant {
* 区间外 * 区间外
*/ */
public static final String OUTSIDE_INTERVAL = "区间外"; public static final String OUTSIDE_INTERVAL = "区间外";
/**
* plc数据表名
*/
public static final String PLC_MEASUREMENT = "tzipc_plc_monitor_data_list";
/**
* 温振传感器数据表名
*/
public static final String SENSOR_MEASUREMENT = "tzipc_sensor_monitor_data_list";
/**
* 操作侧简写
*/
public static final String OPERATION_PROFILE = "o";
/**
* 传动侧简写
*/
public static final String DRIVE_PROFILE = "d";
/**
* 操作侧
*/
public static final String OPERATION_NAME = "operation";
/**
* 传动侧
*/
public static final String DRIVE_NAME = "drive";
} }

View File

@ -0,0 +1,17 @@
import request from "@/utils/request";
// 查询plc数据记录
export function getPlcDataLog(part) {
return request({
url: "/ipc/dataLog/plc/" + part,
method: "get",
});
}
// 查询传感器温振数据记录
export function getSensorDataLog(part) {
return request({
url: "/ipc/dataLog/sensor/" + part,
method: "get",
});
}

View File

@ -0,0 +1,9 @@
import request from "@/utils/request";
// 根据部位查询展示数据
export function getShowData(parts) {
return request({
url: "/ipc/dataShow/byPart/" + parts,
method: "get",
});
}

View File

@ -677,7 +677,7 @@ export default {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.color-green { .color-green {
color: greenyellow; color: green;
} }
.picker .el-picker-panel__sidebar { .picker .el-picker-panel__sidebar {
@ -686,4 +686,4 @@ export default {
.picker .el-picker-panel__footer { .picker .el-picker-panel__footer {
background-color: #051631; background-color: #051631;
} }
</style> </style>

View File

@ -0,0 +1,280 @@
<template>
<div class="app-container image-background">
<el-select
v-model="part"
placeholder="请选择监测部位"
@change="getList()"
>
<el-option
v-for="field in monitorPartList"
:key="field.fieldValue"
:label="field.fieldLabel"
:value="field.fieldValue"
/>
</el-select>
<div class="content-but">
<div
v-if="refresh"
class="button-start"
@click="stopRefresh"
>暂停刷新</div>
<div
v-else
class="button-stop"
@click="startRefresh"
>自动刷新</div>
</div>
<el-table
class="tableCss"
v-loading="loading"
:data="dataList"
:row-class-name="tableRowClassName"
header-row-class-name="header-row"
>
<el-table-column
label="序号"
type="index"
align="center"
>
<template slot-scope="scope">
<span>{{scope.$index + 1}}</span>
</template>
</el-table-column>
<el-table-column
label="时间"
align="center"
key="insertTime"
prop="insertTime"
width="200"
show-overflow-tooltip
/>
<el-table-column
label="颗粒度4μm"
align="center"
key="pz4"
prop="pz4"
show-overflow-tooltip
/>
<el-table-column
label="颗粒度6μm"
align="center"
key="pz6"
prop="pz6"
show-overflow-tooltip
/>
<el-table-column
label="颗粒度14μm"
align="center"
key="pz14"
prop="pz14"
show-overflow-tooltip
/>
<el-table-column
label="颗粒度21μm"
align="center"
key="pz21"
prop="pz21"
show-overflow-tooltip
/>
<el-table-column
label="油水含量"
align="center"
key="owc"
prop="owc"
show-overflow-tooltip
/>
<el-table-column
label="油品粘度"
align="center"
key="ov"
prop="ov"
show-overflow-tooltip
/>
<el-table-column
label="回油温度"
align="center"
key="rot"
prop="rot"
show-overflow-tooltip
/>
<el-table-column
label="轴套区温度"
align="center"
key="ssat"
prop="ssat"
show-overflow-tooltip
/>
<el-table-column
label="进油压力"
align="center"
key="oip"
prop="oip"
show-overflow-tooltip
/>
<el-table-column
label="油液密度"
align="center"
key="od"
prop="od"
show-overflow-tooltip
/>
</el-table>
</div>
</template>
<script>
import { getPlcDataLog } from "@/api/ipc/dataLog";
import { getFields } from "@/api/ipc/monitorFields";
export default {
name: "plcDataLog",
data() {
return {
//
loading: true,
//
total: 0,
//
queryParams: {
pageNum: 1,
pageSize: 10,
},
//
monitorPartList: [],
part: "",
dataList: [],
refresh: false,
};
},
created() {
this.getMonitorPartList();
},
methods: {
/** 查询监测部位列表 */
getMonitorPartList() {
getFields("monitor_part")
.then((res) => {
this.monitorPartList = res.data;
this.part = this.monitorPartList[0].fieldValue;
this.getList();
})
.catch((error) => {
console.log(error);
});
},
/** 查询列表 */
getList() {
this.loading = true;
getPlcDataLog(this.part).then((response) => {
this.dataList = response.data;
this.loading = false;
});
},
tableRowClassName({ row, rowIndex }) {
if (rowIndex % 2 === 0) {
return "color-row";
}
return "";
},
startRefresh() {
this.refresh = true;
this.getDataTimer = setInterval(() => {
this.getList();
}, 1000);
},
stopRefresh() {
clearInterval(this.getDataTimer);
this.refresh = false;
},
},
};
</script>
<style lang="scss">
@import "@/theme/index.scss";
.color-row {
background-color: #67c7ff !important;
}
.header-row {
background: linear-gradient(180deg, #0b2357 0%, #2094dc 48%, #0b2357 100%);
opacity: 1;
}
.header-row .cell {
@include font_color(fontPrimary);
}
</style>
<style scoped lang="scss">
@import "@/theme/index.scss";
.image-background {
@include background_bg(homeBackgroundImage);
height: 100%;
padding-top: 0px;
}
.content {
max-width: 1400px;
margin: auto;
}
.success {
width: 12px;
height: 12px;
margin-right: 10px;
box-shadow: 0px 0px 6px 0px #0ddf7a, 0px 0px 10px 0px #0ddf7a;
opacity: 1;
border: 2px solid #0ddf7a;
border-radius: 12px;
}
.fail {
width: 12px;
height: 12px;
margin-right: 10px;
box-shadow: 0px 0px 6px 0px #ff473e, 0px 0px 10px 0px #ff473e;
opacity: 1;
border: 2px solid #ff473e;
border-radius: 12px;
}
.data-status-wrapper {
display: flex;
justify-content: center;
align-items: center;
span {
position: relative;
top: 2px;
}
}
.content-but {
height: 40px;
display: flex;
align-items: center;
float: right;
padding-right: 50px;
}
.button-start {
width: 100px;
height: 32px;
background: linear-gradient(180deg, #f18c41 0%, #b94e00 100%);
border-radius: 2px 2px 2px 2px;
opacity: 0.9;
border: 1px solid #f1bf23;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
}
.button-stop {
width: 100px;
height: 32px;
background: linear-gradient(180deg, #3fbaff 0%, #0a4e83 100%);
border-radius: 2px 2px 2px 2px;
opacity: 0.9;
border: 1px solid #3fbaff;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
}
</style>

View File

@ -0,0 +1,238 @@
<template>
<div class="app-container image-background">
<el-select
v-model="part"
placeholder="请选择监测部位"
@change="getList()"
>
<el-option
v-for="field in monitorPartList"
:key="field.fieldValue"
:label="field.fieldLabel"
:value="field.fieldValue"
/>
</el-select>
<div class="content-but">
<div
v-if="refresh"
class="button-start"
@click="stopRefresh"
>暂停刷新</div>
<div
v-else
class="button-stop"
@click="startRefresh"
>自动刷新</div>
</div>
<el-table
class="tableCss"
v-loading="loading"
:data="dataList"
:row-class-name="tableRowClassName"
header-row-class-name="header-row"
>
<el-table-column
label="序号"
type="index"
align="center"
>
<template slot-scope="scope">
<span>{{scope.$index + 1}}</span>
</template>
</el-table-column>
<el-table-column
label="时间"
align="center"
key="insertTime"
prop="insertTime"
width="200"
show-overflow-tooltip
/>
<el-table-column
label="振动温度"
align="center"
key="vt"
prop="vt"
show-overflow-tooltip
/>
<el-table-column
label="振动x轴"
align="center"
key="vx"
prop="vx"
show-overflow-tooltip
/>
<el-table-column
label="振动y轴"
align="center"
key="vy"
prop="vy"
show-overflow-tooltip
/>
<el-table-column
label="振动z轴"
align="center"
key="vz"
prop="vz"
show-overflow-tooltip
/>
</el-table>
</div>
</template>
<script>
import { getSensorDataLog } from "@/api/ipc/dataLog";
import { getFields } from "@/api/ipc/monitorFields";
export default {
name: "sensolrDataLog",
data() {
return {
//
loading: true,
//
total: 0,
//
queryParams: {
pageNum: 1,
pageSize: 10,
},
//
monitorPartList: [],
part: "",
dataList: [],
refresh: false,
};
},
created() {
this.getMonitorPartList();
},
methods: {
/** 查询监测部位列表 */
getMonitorPartList() {
getFields("monitor_part")
.then((res) => {
this.monitorPartList = res.data;
this.part = this.monitorPartList[0].fieldValue;
this.getList();
})
.catch((error) => {
console.log(error);
});
},
/** 查询列表 */
getList() {
this.loading = true;
getSensorDataLog(this.part).then((response) => {
this.dataList = response.data;
this.loading = false;
});
},
tableRowClassName({ row, rowIndex }) {
if (rowIndex % 2 === 0) {
return "color-row";
}
return "";
},
startRefresh() {
this.refresh = true;
this.getDataTimer = setInterval(() => {
this.getList();
}, 1000);
},
stopRefresh() {
clearInterval(this.getDataTimer);
this.refresh = false;
},
},
};
</script>
<style lang="scss">
@import "@/theme/index.scss";
.color-row {
background-color: #67c7ff !important;
}
.header-row {
background: linear-gradient(180deg, #0b2357 0%, #2094dc 48%, #0b2357 100%);
opacity: 1;
}
.header-row .cell {
@include font_color(fontPrimary);
}
</style>
<style scoped lang="scss">
@import "@/theme/index.scss";
.image-background {
@include background_bg(homeBackgroundImage);
height: 100%;
padding-top: 0px;
}
.content {
max-width: 1400px;
margin: auto;
}
.success {
width: 12px;
height: 12px;
margin-right: 10px;
box-shadow: 0px 0px 6px 0px #0ddf7a, 0px 0px 10px 0px #0ddf7a;
opacity: 1;
border: 2px solid #0ddf7a;
border-radius: 12px;
}
.fail {
width: 12px;
height: 12px;
margin-right: 10px;
box-shadow: 0px 0px 6px 0px #ff473e, 0px 0px 10px 0px #ff473e;
opacity: 1;
border: 2px solid #ff473e;
border-radius: 12px;
}
.data-status-wrapper {
display: flex;
justify-content: center;
align-items: center;
span {
position: relative;
top: 2px;
}
}
.content-but {
height: 40px;
display: flex;
align-items: center;
float: right;
padding-right: 50px;
}
.button-start {
width: 100px;
height: 32px;
background: linear-gradient(180deg, #f18c41 0%, #b94e00 100%);
border-radius: 2px 2px 2px 2px;
opacity: 0.9;
border: 1px solid #f1bf23;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
}
.button-stop {
width: 100px;
height: 32px;
background: linear-gradient(180deg, #3fbaff 0%, #0a4e83 100%);
border-radius: 2px 2px 2px 2px;
opacity: 0.9;
border: 1px solid #3fbaff;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
}
</style>

View File

@ -673,6 +673,6 @@ export default {
width: 100%; width: 100%;
} }
.color-green { .color-green {
color: greenyellow; color: green;
} }
</style> </style>