数据记录查询条件和导出
This commit is contained in:
parent
defad5d8c2
commit
756358ad3d
@ -2,7 +2,10 @@ package com.inspur.web.controller.ipc;
|
||||
|
||||
import com.inspur.common.core.controller.BaseController;
|
||||
import com.inspur.common.core.domain.AjaxResult;
|
||||
import com.inspur.common.utils.poi.ExcelUtil;
|
||||
import com.inspur.ipc.domain.IpcPlcData;
|
||||
import com.inspur.ipc.domain.IpcQueryParams;
|
||||
import com.inspur.ipc.domain.IpcSensorData;
|
||||
import com.inspur.ipc.service.IIpcDataLogService;
|
||||
import com.inspur.ipc.service.IIpcDataShowService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -10,6 +13,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 数据展示界面
|
||||
@ -21,22 +26,22 @@ import javax.servlet.http.HttpServletResponse;
|
||||
public class IpcDataLogController extends BaseController {
|
||||
@Autowired
|
||||
private IIpcDataLogService iIpcDataLogService;
|
||||
|
||||
/**
|
||||
* 查询plc数据记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ipc:dataLog:query')")
|
||||
@GetMapping(value = "/plc")
|
||||
public AjaxResult queryPlcDataLog(@RequestBody IpcQueryParams ipcQueryParams)
|
||||
{
|
||||
public AjaxResult queryPlcDataLog(IpcQueryParams ipcQueryParams) {
|
||||
return AjaxResult.success(iIpcDataLogService.queryPlcDataLog(ipcQueryParams));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询传感器温振数据记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ipc:dataLog:query')")
|
||||
@GetMapping(value = "/sensor")
|
||||
public AjaxResult querySensorDataLog(@RequestBody IpcQueryParams ipcQueryParams)
|
||||
{
|
||||
public AjaxResult querySensorDataLog(IpcQueryParams ipcQueryParams) {
|
||||
return AjaxResult.success(iIpcDataLogService.querySensorDataLog(ipcQueryParams));
|
||||
}
|
||||
|
||||
@ -44,19 +49,26 @@ public class IpcDataLogController extends BaseController {
|
||||
* 导出plc数据记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ipc:dataLog:query')")
|
||||
@GetMapping(value = "/plcExport")
|
||||
public AjaxResult exportPlcDataLog(HttpServletResponse response, @RequestBody IpcQueryParams ipcQueryParams)
|
||||
{
|
||||
return AjaxResult.success(iIpcDataLogService.queryPlcDataLog(ipcQueryParams));
|
||||
@PostMapping(value = "/plcExport")
|
||||
public void exportPlcDataLog(HttpServletResponse response, IpcQueryParams ipcQueryParams) {
|
||||
ipcQueryParams.setPageNum(0);
|
||||
ipcQueryParams.setPageSize(0);
|
||||
Map<String, Object> resMap = iIpcDataLogService.queryPlcDataLog(ipcQueryParams);
|
||||
ExcelUtil<IpcPlcData> util = new ExcelUtil<IpcPlcData>(IpcPlcData.class);
|
||||
util.exportExcel(response, (List<IpcPlcData>)resMap.get("rows"), "plc温压数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出传感器温振数据记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ipc:dataLog:query')")
|
||||
@GetMapping(value = "/sensorExport")
|
||||
public AjaxResult exportSensorDataLog(HttpServletResponse response,@RequestBody IpcQueryParams ipcQueryParams)
|
||||
{
|
||||
return AjaxResult.success(iIpcDataLogService.querySensorDataLog(ipcQueryParams));
|
||||
@PostMapping(value = "/sensorExport")
|
||||
public void exportSensorDataLog(HttpServletResponse response, IpcQueryParams ipcQueryParams) {
|
||||
ipcQueryParams.setPageNum(0);
|
||||
ipcQueryParams.setPageSize(0);
|
||||
Map<String, Object> resMap = iIpcDataLogService.querySensorDataLog(ipcQueryParams);
|
||||
ExcelUtil<IpcSensorData> util = new ExcelUtil<IpcSensorData>(IpcSensorData.class);
|
||||
util.exportExcel(response, (List<IpcSensorData>)resMap.get("rows"), "传感器温振数据");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -64,8 +76,7 @@ public class IpcDataLogController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ipc:dataShow:query')")
|
||||
@GetMapping(value = "/getTendencyData")
|
||||
public AjaxResult getTendencyData(@RequestBody IpcQueryParams ipcQueryParams)
|
||||
{
|
||||
public AjaxResult getTendencyData(@RequestBody IpcQueryParams ipcQueryParams) {
|
||||
return AjaxResult.success(iIpcDataLogService.getTendencyData(ipcQueryParams));
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ public class IPCPlcDataSyncThread implements Runnable {
|
||||
// fields.put("vz", (float) 0 + Math.random());
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
|
||||
String format = simpleDateFormat.format(new Date());
|
||||
tags.put("insertTime", format);
|
||||
fields.put("insertTime", format);
|
||||
// TODO 根据报警规则校验
|
||||
// 根据运行状态获取规则
|
||||
List<IpcAlarmRulesConfig> rulesConfigList = iIpcAlarmRulesConfigService.selectIpcAlarmRulesConfigList(tags.get("part"));
|
||||
|
@ -57,7 +57,7 @@ public class IPCSensorDataSyncThread implements Runnable {
|
||||
fields.put(field.getFieldValue(), getData());
|
||||
}
|
||||
}
|
||||
tags.put("insertTime", format);
|
||||
fields.put("insertTime", format);
|
||||
InfluxDBService i = SpringUtils.getBean(InfluxDBService.class);
|
||||
i.insert(IpcConstant.SENSOR_MEASUREMENT, tags, fields);
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ import com.inspur.common.annotation.Excel;
|
||||
|
||||
public class IpcPlcData {
|
||||
|
||||
@Excel(name = "时间")
|
||||
private String insertTime ;
|
||||
@Excel(name = "运行状态")
|
||||
private String rstatus ;
|
||||
@Excel(name = "字段排序")
|
||||
@ -28,7 +30,8 @@ public class IpcPlcData {
|
||||
public IpcPlcData() {
|
||||
}
|
||||
|
||||
public IpcPlcData(String rstatus,String pz4, String pz6, String pz14, String pz21, String owc, String ov, String rot, String oip, String od) {
|
||||
public IpcPlcData(String insertTime, String rstatus, String pz4, String pz6, String pz14, String pz21, String owc, String ov, String rot, String oip, String od) {
|
||||
this.insertTime = insertTime;
|
||||
this.rstatus = rstatus;
|
||||
this.pz4 = pz4;
|
||||
this.pz6 = pz6;
|
||||
@ -41,6 +44,14 @@ public class IpcPlcData {
|
||||
this.od = od;
|
||||
}
|
||||
|
||||
public String getInsertTime() {
|
||||
return insertTime;
|
||||
}
|
||||
|
||||
public void setInsertTime(String insertTime) {
|
||||
this.insertTime = insertTime;
|
||||
}
|
||||
|
||||
public String getRstatus() {
|
||||
return rstatus;
|
||||
}
|
||||
@ -124,7 +135,8 @@ public class IpcPlcData {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "IpcPlcData{" +
|
||||
"rstatus='" + rstatus + '\'' +
|
||||
"insertTime='" + insertTime + '\'' +
|
||||
", rstatus='" + rstatus + '\'' +
|
||||
", pz4='" + pz4 + '\'' +
|
||||
", pz6='" + pz6 + '\'' +
|
||||
", pz14='" + pz14 + '\'' +
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.inspur.ipc.domain;
|
||||
|
||||
public class IpcQueryParams {
|
||||
import com.inspur.common.core.domain.BaseEntity;
|
||||
|
||||
public class IpcQueryParams extends BaseEntity {
|
||||
/**
|
||||
* 监测部位
|
||||
*/
|
||||
|
@ -3,6 +3,8 @@ package com.inspur.ipc.domain;
|
||||
import com.inspur.common.annotation.Excel;
|
||||
|
||||
public class IpcSensorData {
|
||||
@Excel(name = "时间")
|
||||
private String insertTime ;
|
||||
@Excel(name = "时间")
|
||||
private String stime ;
|
||||
@Excel(name = "轴套区温度")
|
||||
@ -17,7 +19,8 @@ public class IpcSensorData {
|
||||
public IpcSensorData() {
|
||||
}
|
||||
|
||||
public IpcSensorData(String stime, String ssat, String vx, String vy, String vz) {
|
||||
public IpcSensorData(String insertTime, String stime, String ssat, String vx, String vy, String vz) {
|
||||
this.insertTime = insertTime;
|
||||
this.stime = stime;
|
||||
this.ssat = ssat;
|
||||
this.vx = vx;
|
||||
@ -25,6 +28,14 @@ public class IpcSensorData {
|
||||
this.vz = vz;
|
||||
}
|
||||
|
||||
public String getInsertTime() {
|
||||
return insertTime;
|
||||
}
|
||||
|
||||
public void setInsertTime(String insertTime) {
|
||||
this.insertTime = insertTime;
|
||||
}
|
||||
|
||||
public String getStime() {
|
||||
return stime;
|
||||
}
|
||||
@ -68,7 +79,8 @@ public class IpcSensorData {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "IpcSensorData{" +
|
||||
"stime='" + stime + '\'' +
|
||||
"insertTime='" + insertTime + '\'' +
|
||||
", stime='" + stime + '\'' +
|
||||
", ssat='" + ssat + '\'' +
|
||||
", vx='" + vx + '\'' +
|
||||
", vy='" + vy + '\'' +
|
||||
|
@ -30,17 +30,13 @@ public class IpcDataLogServiceImpl implements IIpcDataLogService {
|
||||
@Override
|
||||
public Map<String, Object> queryPlcDataLog(IpcQueryParams ipcQueryParams) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String tableName = IpcConstant.PLC_MEASUREMENT;
|
||||
String part = ipcQueryParams.getPart();
|
||||
String startTime = InfluxdbTimeUtil.cstToUtc(ipcQueryParams.getStartTime());
|
||||
String endTime = InfluxdbTimeUtil.cstToUtc(ipcQueryParams.getEndTime());
|
||||
// 查询总数
|
||||
int total = countInfluxdbList(IpcConstant.PLC_MEASUREMENT, ipcQueryParams.getPart(), ipcQueryParams.getIsAlarm(),startTime,endTime);
|
||||
int total = countInfluxdbList(IpcConstant.PLC_MEASUREMENT, ipcQueryParams.getPart(), ipcQueryParams.getIsAlarm(), ipcQueryParams.getStartTime(), ipcQueryParams.getEndTime());
|
||||
// 查询数据
|
||||
List<Map<String, Object>> maps = selectAllDataByPart(IpcConstant.PLC_MEASUREMENT, ipcQueryParams.getPart(), ipcQueryParams.getIsAlarm(),startTime,endTime,ipcQueryParams.getPageSize(),ipcQueryParams.getPageNum());
|
||||
List<IpcPlcData> list = JSON.parseArray(JSON.toJSONString(maps), IpcPlcData.class);
|
||||
map.put("total",total);
|
||||
map.put("rows",list);
|
||||
List<Map<String, Object>> maps = selectAllDataByPart(IpcConstant.PLC_MEASUREMENT, ipcQueryParams.getPart(), ipcQueryParams.getIsAlarm(), ipcQueryParams.getStartTime(), ipcQueryParams.getEndTime(), ipcQueryParams.getPageSize(), ipcQueryParams.getPageNum());
|
||||
List<IpcPlcData> list = JSON.parseArray(JSON.toJSONString(maps), IpcPlcData.class);
|
||||
map.put("total", total);
|
||||
map.put("rows", list);
|
||||
return map;
|
||||
}
|
||||
|
||||
@ -51,12 +47,12 @@ public class IpcDataLogServiceImpl implements IIpcDataLogService {
|
||||
public Map<String, Object> querySensorDataLog(IpcQueryParams ipcQueryParams) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// 查询总数
|
||||
int total = countInfluxdbList(IpcConstant.SENSOR_MEASUREMENT, ipcQueryParams.getPart(), ipcQueryParams.getIsAlarm(),ipcQueryParams.getStartTime(), ipcQueryParams.getEndTime());
|
||||
int total = countInfluxdbList(IpcConstant.SENSOR_MEASUREMENT, ipcQueryParams.getPart(), ipcQueryParams.getIsAlarm(), ipcQueryParams.getStartTime(), ipcQueryParams.getEndTime());
|
||||
// 查询数据
|
||||
List<Map<String, Object>> maps = selectAllDataByPart(IpcConstant.SENSOR_MEASUREMENT, ipcQueryParams.getPart(), ipcQueryParams.getIsAlarm(),ipcQueryParams.getStartTime(), ipcQueryParams.getEndTime(),ipcQueryParams.getPageSize(),ipcQueryParams.getPageNum());
|
||||
List<IpcPlcData> list = JSON.parseArray(JSON.toJSONString(maps), IpcPlcData.class);
|
||||
map.put("total",total);
|
||||
map.put("rows",list);
|
||||
List<Map<String, Object>> maps = selectAllDataByPart(IpcConstant.SENSOR_MEASUREMENT, ipcQueryParams.getPart(), ipcQueryParams.getIsAlarm(), ipcQueryParams.getStartTime(), ipcQueryParams.getEndTime(), ipcQueryParams.getPageSize(), ipcQueryParams.getPageNum());
|
||||
List<IpcSensorData> list = JSON.parseArray(JSON.toJSONString(maps), IpcSensorData.class);
|
||||
map.put("total", total);
|
||||
map.put("rows", list);
|
||||
return map;
|
||||
}
|
||||
|
||||
@ -64,8 +60,8 @@ public class IpcDataLogServiceImpl implements IIpcDataLogService {
|
||||
* 趋势数据获取
|
||||
*/
|
||||
@Override
|
||||
public Map<String,Object> getTendencyData(IpcQueryParams ipcQueryParams){
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
public Map<String, Object> getTendencyData(IpcQueryParams ipcQueryParams) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String utcStartTime = InfluxdbTimeUtil.cstToUtc(ipcQueryParams.getStartTime());
|
||||
String utcEndTime = InfluxdbTimeUtil.cstToUtc(ipcQueryParams.getEndTime());
|
||||
|
||||
@ -74,79 +70,88 @@ public class IpcDataLogServiceImpl implements IIpcDataLogService {
|
||||
LocalDateTime etime = LocalDateTime.parse(ipcQueryParams.getEndTime());
|
||||
long intervalHours = ChronoUnit.HOURS.between(stime, etime);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
if(intervalHours <= 6){//6小时内全查
|
||||
list = selectDataByParamNameandDate(IpcConstant.SENSOR_MEASUREMENT, ipcQueryParams.getPart(),ipcQueryParams.getParam(), utcStartTime, utcEndTime);
|
||||
}else if(intervalHours <= 7*24 ){//7天内,每30s一个
|
||||
list = selectLongTimeDataByParamNameandDate(IpcConstant.SENSOR_MEASUREMENT, ipcQueryParams.getPart(),ipcQueryParams.getParam(), utcStartTime, utcEndTime, "30s");
|
||||
}else if(intervalHours <= 30*24 ){//30天内,每2min一个
|
||||
list = selectLongTimeDataByParamNameandDate(IpcConstant.SENSOR_MEASUREMENT, ipcQueryParams.getPart(),ipcQueryParams.getParam(), utcStartTime, utcEndTime, "2m");
|
||||
}else if (intervalHours <= 90*24){//90天以上,每4h一个
|
||||
list = selectLongTimeDataByParamNameandDate(IpcConstant.SENSOR_MEASUREMENT, ipcQueryParams.getPart(),ipcQueryParams.getParam(), utcStartTime, utcEndTime, "6m");
|
||||
if (intervalHours <= 6) {//6小时内全查
|
||||
list = selectDataByParamNameandDate(IpcConstant.SENSOR_MEASUREMENT, ipcQueryParams.getPart(), ipcQueryParams.getParam(), utcStartTime, utcEndTime);
|
||||
} else if (intervalHours <= 7 * 24) {//7天内,每30s一个
|
||||
list = selectLongTimeDataByParamNameandDate(IpcConstant.SENSOR_MEASUREMENT, ipcQueryParams.getPart(), ipcQueryParams.getParam(), utcStartTime, utcEndTime, "30s");
|
||||
} else if (intervalHours <= 30 * 24) {//30天内,每2min一个
|
||||
list = selectLongTimeDataByParamNameandDate(IpcConstant.SENSOR_MEASUREMENT, ipcQueryParams.getPart(), ipcQueryParams.getParam(), utcStartTime, utcEndTime, "2m");
|
||||
} else if (intervalHours <= 90 * 24) {//90天以上,每4h一个
|
||||
list = selectLongTimeDataByParamNameandDate(IpcConstant.SENSOR_MEASUREMENT, ipcQueryParams.getPart(), ipcQueryParams.getParam(), utcStartTime, utcEndTime, "6m");
|
||||
}
|
||||
|
||||
Map<String, Object> resMap = new HashMap<>();
|
||||
if (list.size() == 0){
|
||||
if (list.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
return map;
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字段名称和起止时间查询数据
|
||||
*
|
||||
* @param tableName 表名
|
||||
* @param part 监测部位
|
||||
* @param param 参数
|
||||
* @param part 监测部位
|
||||
* @param param 参数
|
||||
* @param startTime 起始时间
|
||||
* @param endTime 结束时间
|
||||
* @param endTime 结束时间
|
||||
* @return 数据
|
||||
*/
|
||||
private List<Map<String, Object>> selectDataByParamNameandDate(String tableName, String part,String param, String startTime, String endTime){
|
||||
private List<Map<String, Object>> selectDataByParamNameandDate(String tableName, String part, String param, String startTime, String endTime) {
|
||||
String sql = "select time," + param + " from " + tableName + " where part = '" + part + "' time >= '" + startTime + "' and time <= '" + endTime + "'";
|
||||
return influxDBService.queryResultProcess(influxDBService.query(sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询长时间数据,每分钟取一条展示(最长3个月)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private List<Map<String, Object>> selectLongTimeDataByParamNameandDate(String tableName, String part,String param, String startTime, String endTime, String interval){
|
||||
String sql = "select time, mean(" + param + ") from " + tableName + " where part = '" + part + "' time >= '" + startTime + "' and time <= '" + endTime + "' group by time(" + interval +")";
|
||||
private List<Map<String, Object>> selectLongTimeDataByParamNameandDate(String tableName, String part, String param, String startTime, String endTime, String interval) {
|
||||
String sql = "select time, mean(" + param + ") from " + tableName + " where part = '" + part + "' time >= '" + startTime + "' and time <= '" + endTime + "' group by time(" + interval + ")";
|
||||
return influxDBService.queryResultProcess(influxDBService.query(sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据监测部位查询最近num条数据
|
||||
*
|
||||
* @param tableName 表名
|
||||
* @param part 监测部位
|
||||
* @param part 监测部位
|
||||
* @return 数据
|
||||
*/
|
||||
private List<Map<String, Object>> selectAllDataByPart(String tableName, String part,String isAlarm,String startTime, String endTime, int pageSize, int pageNum){
|
||||
String sql = "select * from " + tableName + " where equ_id = '" + part + "'";
|
||||
if(isAlarm != null){
|
||||
private List<Map<String, Object>> selectAllDataByPart(String tableName, String part, String isAlarm, String startTime, String endTime, int pageSize, int pageNum) {
|
||||
String sql = "select * from " + tableName + " where part = '" + part + "'";
|
||||
if (isAlarm != null) {
|
||||
sql += " and isAlarm = '" + isAlarm + "'";
|
||||
}
|
||||
if(startTime != null){
|
||||
if (startTime != null) {
|
||||
startTime = InfluxdbTimeUtil.cstToUtc(startTime);
|
||||
sql += " and time >= '" + startTime + "'";
|
||||
}
|
||||
if(endTime != null){
|
||||
if (endTime != null) {
|
||||
endTime = InfluxdbTimeUtil.cstToUtc(endTime);
|
||||
sql += " and time <= '" + endTime + "'";
|
||||
}
|
||||
sql += " order by time desc limit " + pageSize + " offset " +(pageNum - 1)*pageSize;
|
||||
sql += " order by time desc limit " + pageSize + " offset " + (pageNum - 1) * pageSize;
|
||||
System.out.println(sql);
|
||||
return influxDBService.queryResultProcess(influxDBService.query(sql));
|
||||
}
|
||||
|
||||
private int countInfluxdbList(String tableName, String part,String isAlarm,String startTime, String endTime){
|
||||
String sql = "select count(isAlarm) from " + tableName + " where part = '" + part + "'";
|
||||
if(isAlarm != null){
|
||||
private int countInfluxdbList(String tableName, String part, String isAlarm, String startTime, String endTime) {
|
||||
String sql = "select count(insertTime) from " + tableName + " where part = '" + part + "'";
|
||||
if (isAlarm != null) {
|
||||
sql += " and isAlarm = '" + isAlarm + "'";
|
||||
}
|
||||
if(startTime != null){
|
||||
if (startTime != null) {
|
||||
startTime = InfluxdbTimeUtil.cstToUtc(startTime);
|
||||
sql += " and time >= '" + startTime + "'";
|
||||
}
|
||||
if(endTime != null){
|
||||
if (endTime != null) {
|
||||
endTime = InfluxdbTimeUtil.cstToUtc(endTime);
|
||||
sql += " and time <= '" + endTime + "'";
|
||||
}
|
||||
List<Map<String, Object>> list = influxDBService.queryResultProcess(influxDBService.query(sql));
|
||||
return list.size() == 0 ? 0 : ((Double)list.get(0).get("count")).intValue();
|
||||
System.out.println(sql);
|
||||
return list.size() == 0 ? 0 : ((Double) list.get(0).get("count")).intValue();
|
||||
}
|
||||
}
|
||||
|
@ -39,11 +39,11 @@ public class IpcConstant {
|
||||
/**
|
||||
* plc数据表名
|
||||
*/
|
||||
public static final String PLC_MEASUREMENT = "tz_ipc_plc_monitor_data_list";
|
||||
public static final String PLC_MEASUREMENT = "tz_ipc_plc_monitor_data_list1";
|
||||
/**
|
||||
* 温振传感器数据表名
|
||||
*/
|
||||
public static final String SENSOR_MEASUREMENT = "tz_ipc_sensor_monitor_data_list";
|
||||
public static final String SENSOR_MEASUREMENT = "tz_ipc_sensor_monitor_data_list1";
|
||||
/**
|
||||
* 操作侧简写
|
||||
*/
|
||||
|
@ -5,7 +5,6 @@
|
||||
ref="queryForm"
|
||||
size="small"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item
|
||||
@ -27,7 +26,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="是否报警"
|
||||
prop="alarmLevel"
|
||||
prop="isAlarm"
|
||||
>
|
||||
<el-select
|
||||
v-model="queryParams.isAlarm"
|
||||
@ -57,6 +56,24 @@
|
||||
>
|
||||
</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-button
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="exportData"
|
||||
>导出</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <div class="content-but">
|
||||
<div
|
||||
@ -95,16 +112,18 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="颗粒度4μm"
|
||||
label="运行状态"
|
||||
align="center"
|
||||
key="rstatus"
|
||||
prop="rstatus"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<dict-tag
|
||||
:options="dict.type.running_status"
|
||||
:value="scope.row.rstatus"
|
||||
/>
|
||||
<template slot-scope="scope">
|
||||
<dict-tag
|
||||
:options="dict.type.running_status"
|
||||
:value="scope.row.rstatus"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="颗粒度4μm"
|
||||
@ -155,13 +174,6 @@
|
||||
prop="rot"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="轴套区温度"
|
||||
align="center"
|
||||
key="ssat"
|
||||
prop="ssat"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="进油压力"
|
||||
align="center"
|
||||
@ -270,12 +282,41 @@ export default {
|
||||
this.getMonitorPartList();
|
||||
},
|
||||
methods: {
|
||||
/** 导出数据 */
|
||||
exportData() {
|
||||
if (this.total > 10000) {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: "数据量过大,请联系管理员进行导出!",
|
||||
type: "warning",
|
||||
});
|
||||
} else {
|
||||
this.download(
|
||||
"/ipc/dataLog/plcExport",
|
||||
{
|
||||
...this.queryParams,
|
||||
},
|
||||
`传感器温振数据_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
}
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams.part = this.monitorPartList[0].fieldValue;
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 查询监测部位列表 */
|
||||
getMonitorPartList() {
|
||||
getFields("monitor_part")
|
||||
.then((res) => {
|
||||
this.monitorPartList = res.data;
|
||||
this.part = this.monitorPartList[0].fieldValue;
|
||||
this.queryParams.part = this.monitorPartList[0].fieldValue;
|
||||
this.getList();
|
||||
})
|
||||
.catch((error) => {
|
||||
@ -293,11 +334,26 @@ export default {
|
||||
);
|
||||
}
|
||||
this.loading = true;
|
||||
getPlcDataLog(this.part).then((response) => {
|
||||
this.dataList = response.data;
|
||||
getPlcDataLog(this.queryParams).then((response) => {
|
||||
this.dataList = response.data.rows;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
dateToStr(date) {
|
||||
var y = date.getFullYear();
|
||||
var m = date.getMonth() + 1;
|
||||
m = m < 10 ? "0" + m : m;
|
||||
var d = date.getDate();
|
||||
d = d < 10 ? "0" + d : d;
|
||||
var h = date.getHours();
|
||||
h = h < 10 ? "0" + h : h;
|
||||
var minute = date.getMinutes();
|
||||
minute = minute < 10 ? "0" + minute : minute;
|
||||
var second = date.getSeconds();
|
||||
second = second < 10 ? "0" + second : second;
|
||||
return y + "-" + m + "-" + d + "T" + h + ":" + minute + ":" + second;
|
||||
},
|
||||
tableRowClassName({ row, rowIndex }) {
|
||||
if (rowIndex % 2 === 0) {
|
||||
return "color-row";
|
||||
|
Loading…
Reference in New Issue
Block a user