Commit 4044c143 by liuyang

2024-05-20 设备监控

parent 35b67767
package com.baosight.hggp.common;
import com.baosight.iplat4j.core.ei.EiBlock;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/5/21
*/
public enum RunStatusEnum {
KJ(1,"开机"),
TJ(0,"停机");
private Integer code;
private String value;
RunStatusEnum(Integer code, String value) {
this.code = code;
this.value = value;
}
public static EiBlock generatorEiBlock() {
EiBlock block = new EiBlock("run_status_block_id");
List<Map<String, Object>> rows = new ArrayList<Map<String, Object>>() {{
add(new HashMap<String, Object>() {{
put(HGConstants.TEXT_FIELD, KJ.value);
put(HGConstants.VALUE_FIELD, KJ.code);
}});
add(new HashMap<String, Object>() {{
put(HGConstants.TEXT_FIELD, TJ.value);
put(HGConstants.VALUE_FIELD, TJ.code);
}});
}};
block.setRows(rows);
return block;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
package com.baosight.hggp.hg.sb.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.RunStatusEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.hg.sb.domain.HGSB008;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays;
/**
* @author LiuYang
* @version 1.0 2024/5/20
*/
public class ServiceHGSB008 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGSB008.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
inInfo = super.query(inInfo,HGSB008.QUERY,new HGSB008());
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID,DdynamicEnum.DEVICE_CODE_BOX_BLOCK_ID),null
);
inInfo.setBlock(RunStatusEnum.generatorEiBlock());
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
String logDate = inInfo.getCellStr(EiConstant.queryBlock,ACConstants.ROW_CODE_0,HGSB008.FIELD_LOG_DATE);
if (StringUtils.isNotEmpty(logDate)) {
inInfo.setCell(EiConstant.queryBlock,ACConstants.ROW_CODE_0,HGSB008.FIELD_LOG_DATE, DateUtils.formatShort(logDate));
}
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGSB008.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo,HGSB008.QUERY,new HGSB008());
}
}
$(function () {
$(".row").children().attr("class", "col-md-3");
/* 页面查询框的尺寸设置 */
$.extend(true, IPLATUI.Config, {
EFGrid: {
height: $(document).height() - $("#inqu").height() - $("#ef_form_head").height() - 100,
}
});
IPLATUI.EFGrid = {
"result": {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 100],
},
columns: [{
field: "status",
template: function (item) {
let template = '';
if (item.status == 1){
template = "<span style='color: #67c20b;font-weight: bold'>开机</span>";
}else if (item.status == 0){
template = "<span style='color: red;font-weight: bold'>关机</span>";
}
return template;
}
}
],
exportGrid: {
exportFileName: function (gridInstance) {
// 导出的文件名包含时间戳 yyyy-MM-dd HH:mm:ss
return "设备监控_" + kendo.toString(new Date(), IPLAT.FORMAT.DATE_14_PR);
},
exportFileType: "xls", // 默认值是xls,可选值为pdf[规划中]
exportBlockId: "result", // 默认值和blockId相同,导出的EiInfo中的指定数据块被导出
},
loadComplete: function(grid) {
// 此 grid 对象
$("#QUERY").on("click", function () {
grid.dataSource.page(1);
});
}
}
}
});
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/5/20
Time: 17:13
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="设备监控">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFSelect blockId="inqu_status" row="0" ename="companyCode" cname="公司名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="companyBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="logDate" cname="日期" role="date"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="deviceName" cname="设备名称" placeholder="模糊查询" colWidth="3"/>
<EF:EFSelect blockId="inqu_status" row="0" ename="status" cname="运行状态" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="run_status_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="设备监控">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="accountCode" cname="账套" hidden="true"/>
<EF:EFComboColumn ename="companyCode" cname="公司名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="companyBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="logDate" cname="日期" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="true" required="true"/>
<EF:EFComboColumn ename="deviceCode" cname="设备名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="deviceCodeBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="status" cname="运行状态"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="run_status_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="latelyStartTime" cname="最近开始日期" width="120" align="center" editType="datetime"
dateFormat="yyyy-MM-dd hh:mm:ss " parseFormats="['yyyyMMddHHmmss']" readonly="true" required="true"/>
<EF:EFColumn ename="startDura" cname="开机时长" width="120" align="center" editType="date"
dateFormat="hh时mm分" parseFormats="['hhmmss']" readonly="true" required="true"/>
<EF:EFColumn ename="latelyEntTime" cname="最近停机日期" width="120" align="center" editType="datetime"
dateFormat="yyyy-MM-dd hh:mm:ss " parseFormats="['yyyyMMddHHmmss']" readonly="true" required="true"/>
<EF:EFColumn ename="endDura" cname="关机时长" width="120" align="center" editType="date"
dateFormat="hh时mm分" parseFormats="['hhmmss']" readonly="true" required="true"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
<style>
.my-head {
display: flex;
padding-right: 12px;
background: #ffffff;
box-shadow: 0px 1px 6px 0px rgba(0, 0, 0, 0.12);
margin-bottom: 3px;
}
#my-front {
width: 50%;
display: flex;
align-items: center;
text-align: center;
justify-content: flex-start;
}
#my-behind {
width: 50%;
display: flex;
align-items: center;
text-align: center;
justify-content: flex-end;
padding-right: 4px;
}
.my-button {
border: none;
background: transparent;
margin-bottom: 2px;
margin-left: 16px;
}
.my-text {
font-size: .875rem;
height: 1.75rem;
line-height: 1;
letter-spacing: 0;
font-weight: 500;
overflow: hidden;
box-sizing: border-box;
display: inline-flex;
align-items: center;
}
#my-text1 {
color: #3088F4;
}
#my-text2 {
color: rgba(0, 0, 0, 0.85);
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment