change - 设备监控页面监控单元模块参数配置修改

main
wenjy 3 years ago
parent c4e0a7c130
commit f7d1233057

@ -4,10 +4,12 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.json.JsonUtils;
import com.ruoyi.system.domain.BaseDeviceParam;
import com.ruoyi.system.domain.BaseMonitorunitInfo;
import com.ruoyi.system.domain.BaseSensorInfo;
import com.ruoyi.system.domain.dto.BaseMonitorunitInfoDto;
import com.ruoyi.system.domain.dto.BaseSensorInfoDto;
import com.ruoyi.system.service.IBaseDeviceParamService;
import com.ruoyi.system.service.IBaseMonitorunitInfoService;
import com.ruoyi.system.service.IBaseSensorInfoService;
import lombok.Data;
@ -39,6 +41,9 @@ public class DeviceMonitorController {
@Autowired private StringRedisTemplate redisTemplate;
@Autowired
private IBaseDeviceParamService baseDeviceParamService;
private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
/**
@ -119,8 +124,15 @@ public class DeviceMonitorController {
@ResponseBody
public String getMonitorUnitInfo(String monitorunitId) {
List<BaseMonitorunitInfoDto> baseMonitorunitInfoDtos =
baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(
new BaseMonitorunitInfo(monitorunitId));
baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(new BaseMonitorunitInfo(monitorunitId));
baseMonitorunitInfoDtos.forEach(x->{
List<BaseDeviceParam> baseDeviceParams = baseDeviceParamService.selectBaseDeviceParamList(new BaseDeviceParam(x.getMonitorunitId(), 0L));
BaseDeviceParam[] deviceParams = new BaseDeviceParam[baseDeviceParams.size()];
for (int i = 0; i < baseDeviceParams.size(); i++){
deviceParams[i] = baseDeviceParams.get(i);
}
x.setDeviceParams(deviceParams);
});
return JSONArray.toJSONString(baseMonitorunitInfoDtos);
}

@ -416,12 +416,12 @@
</div>
<div class="sensor-Text" id="sensor-text">
<p>设备编号:<span>10kv 主变压器001</span></p>
<!--<p>设备编号:<span>10kv 主变压器001</span></p>
<p>设备型号:<span>SC(B)10型干式电力变压器</span></p>
<p>启用时间:<span>2020年1月20日</span></p>
<p>所属变电站:<span>新疆某某变电站</span></p>
<p>测试参数-1<span>xxxxx</span></p>
<p>测试参数-2<span>xxxxx</span></p>
<p>测试参数-2<span>xxxxx</span></p>-->
</div>
@ -469,7 +469,7 @@
multiSelect: $('#chk-select-multi').is(':checked'),
onNodeSelected: function (event, node) {
$('#selectable-output').prepend('<p>' + node.text + ' was selected</p>');
if(node.nodeId > 0){
if (node.nodeId > 0) {
monitorUnitModule(node.href);
sensorCollectionRefresh(node.href);
}
@ -500,10 +500,10 @@
<script type="text/javascript">
$(() => {
let unitId = getParams("id");
if( unitId != null) {
if (unitId != null) {
monitorUnitModule(unitId)
sensorCollectionRefresh(unitId);
}else{
} else {
$.ajax({
url: "/iot/deviceMonitor/getFirstMonitorUnit",
type: "get",
@ -523,15 +523,19 @@
type: "get",
dataType: 'JSON',
success: (res) => {
console.log("监控单元信息:" + res[0].deviceParams)
$('#transformer-model').html("");
let e = '<img src="' + res[0].monitorunitImage + '" >';
$("#transformer-model").append(e);
$('#sensor-text').html("");
let html = '<p>设备编号:<span>' + res[0].monitorunitName + '</span></p>\n' +
' <p>设备型号:<span>' + res[0].monitorunitName + '</span></p>\n' +
' <p>启用时间:<span>' + formatter(res[0].createTime, "yyyy-MM-dd") + '</span></p>\n' +
' <p>所属变电站:<span>' + res[0].substationName + '</span></p>';
let html = '<p>设备编号:<span>' + res[0].monitorunitName + '</span></p>';
if(res[0].deviceParams.length > 0){
res[0].deviceParams.map(x => {
html += '<p>' + x.paramTitle + '<span>' + x.paramValue + '</span></p>';
});
}
html += ' <p>所属变电站:<span>' + res[0].substationName + '</span></p>';
$("#sensor-text").append(html);
},
error: () => {
@ -585,10 +589,10 @@
console.log(result);
switch (result.type) {
case "CMD_REPORTDATA":
reportData(result);
reportData(result);
break;
case "CMD_SENSORSTATUS":
reportStatus(result);
reportStatus(result);
break;
default:
break;
@ -634,7 +638,7 @@
document.getElementById(result.sensorId + "collectTime").innerHTML = result['collectTime'] == null ? "-" : collectTime(result['collectTime']);
}
//上报设备状态
const reportStatus = function(result) {
const reportStatus = function (result) {
document.getElementById(result.sensorId + "sensorStatus").innerHTML = result['sensorStatus'] == null ? "-" : sensorStatus(result['sensorStatus']);
}
</script>

Loading…
Cancel
Save