Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/data/curveRemarkView.jsp
2026-01-16 14:13:44 +08:00

532 lines
29 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!-- 文件上传-->
<link rel="stylesheet" href="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/css/fileinput.min.css"/>
<script type="text/javascript"
src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/fileinput.min.js"
charset="utf-8"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/locales/zh.js"
charset="utf-8"></script>
<%--文件上传 minio--%>
<script type="text/javascript" src="<%=request.getContextPath()%>/JS/commonFile.js" charset="utf-8"></script>
<script type="text/javascript">
let nowMpid = "";
let nowUnitId = "";
let inSdt = "${param.sdt}";
let inEdt = "${param.edt}";
let firstIn = 0;
let top_remarkMps;
$(function () {
let iHeight = $(window).height() * 0.8;
$('#viewShow').css('height', iHeight);
<%--console.log('${param.sdt}');--%>
<%--console.log('${param.edt}');--%>
let remarkMpidsContent = '${param.remarkMpidsContent}'; // 测量点:厂id:测量点名称
let remarkMps = (remarkMpidsContent.substring(0, remarkMpidsContent.length - 1)).split(",");
// console.log(remarkMps);
top_remarkMps = remarkMps;
let mpids = "";
for (let i = 0; i < remarkMps.length; i++) {
let content = remarkMps[i].split(":");
mpids += content[0] + ",";
if (i == 0) {
getTab(content[0], content[1], content[2], "block");
} else {
getTab(content[0], content[1], content[2], "none");
}
}
$.post(ext.contextPath + "/work/mpoint/getMpointSelectTree.do", {
mpids: mpids
}, function (data) {
var selecttype = $("#mpidsSelect").select2({
data: data,
placeholder: '请选择',//默认文字提示
allowClear: false,//允许清空
escapeMarkup: function (markup) {
return markup;
}, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框
formatResult: function formatRepo(repo) {
return repo.text;
}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo) {
return repo.text;
} // 函数用于呈现当前的选择
});
selecttype.on("change", function (e) {
// let mySelect = document.getElementById("mpidsSelect");
// let index = mySelect.selectedIndex;
// console.log(data)
// $('#dataTab').html("");
// console.log($(this).val());
if (Number(firstIn) > 0) {
for (let i = 0; i < remarkMps.length; i++) {
let content = remarkMps[i].split(":");
// console.log(content[0])
if (content[0] == $(this).val()) {
$("#" + content[0] + "_dataTabDiv").css("display", "block");
$("#" + content[0] + "_contentRemarkDiv").css("display", "block");
$("#" + content[0] + "_hisDataDiv").css("display", "block");
} else {
$("#" + content[0] + "_dataTabDiv").css("display", "none");
$("#" + content[0] + "_contentRemarkDiv").css("display", "none");
$("#" + content[0] + "_hisDataDiv").css("display", "none");
}
}
}
});
if (data.length > 0) {
selecttype.val(data[0].id).trigger("change");//设置选中
} else {
selecttype.val('').trigger("change");//设置选中
}
}, 'json');
// let contents = remarkMps[0];
// let content = contents.split(":");
// getTab(content[0], content[1], content[2]);
});
function getTab(mpid, unitId, mpname, st) {
$.post(ext.contextPath + "/work/mpoint/getMpointJsonFormpids.do", {
unitId: unitId,
mpids: mpid,
func: "",
mpname: mpname,
sdt: '${param.sdt}',
edt: '${param.edt}'
// dataAaccuracy: dataAaccuracy
}, function (data) {
var datas = eval('(' + data + ')');
// console.log(datas)
let html = "";
if (st == 'block') {
html += "<div id='" + mpid + "_dataTabDiv' style='float: left;width: 100%;height: 100%;display: block;'>";
} else {
html += "<div id='" + mpid + "_dataTabDiv' style='float: left;width: 100%;height: 100%;display: none;'>";
}
html += "<table id='" + mpid + "_dataTab' style='width: 100%;table-layout:fixed;text-align: center;overflow: auto;' border='2' cellspacing='0'>";
html += "<tbody style='width: 100%;'>";
html += "<tr style='width: 100%;height: 45px;'>";
html += "<td style='width: 60%;'>日期</td>";
html += "<td style='width: 40%;'>值</td>";
html += "</tr>";
html += "</tbody>";
for (let i = 0; i < datas[0].data.length; i++) {
let showContenet = datas[0].data[i];
if (i == 0 || i == (datas[0].data.length - 1)) {
html += "<tr id='" + mpid + "_" + (i + 1) + "' style='width: 100%;height: 30px;cursor: pointer;background:rgba(191,219,255,1);' onclick=\"tdClick(this,'" + mpid + "');\">";
} else {
html += "<tr id='" + mpid + "_" + (i + 1) + "' style='width: 100%;height: 30px;cursor: pointer;background:rgba(191,219,255,0.5);' onclick=\"tdClick(this,'" + mpid + "');\">";
}
html += "<td style='white-space: nowrap;overflow: hidden;text-overflow: ellipsis;'>" + getLocalTime2(showContenet[0] / 1000).substring(0, 19) + "</td>";
html += "<td style='white-space: nowrap;overflow: hidden;text-overflow: ellipsis;'>" + showContenet[1] + "</td>";
html += "</tr>";
}
html += "</table>";
html += "</div>";
$('#dataDiv').append(html);
let html2 = "";
if (st == 'block') {
html2 += "<div id='" + mpid + "_contentRemarkDiv' style='float: left;width: 100%;display: block;'>";
} else {
html2 += "<div id='" + mpid + "_contentRemarkDiv' style='float: left;width: 100%;display: none;'>";
}
html2 += "<div style='width:100%;float:left;margin-top: 0px;'>";
html2 += "<div style='width:50%;float:left;'>";
html2 += "<div class='input-group' style='margin-left: 10px;'>";
html2 += "<span class='input-group-addon' style='height:31px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold'>起始时间:</span>";
html2 += "<input type='hidden' id='" + mpid + "_remarkSdtHidden' readonly />";
html2 += "<input class='form-control ' id='" + mpid + "_remarkSdt' name='remarkSdt' value='${param.sdt}' readonly style='height:31px;width: 190px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;cursor:pointer;' />";
html2 += "</div>";
html2 += "</div>";
html2 += "<div style='width:50%;float:left;'>";
html2 += "<div class='input-group' style='margin-left: 10px;'>";
html2 += "<span class='input-group-addon' style='height:31px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold'>结束时间:</span>";
html2 += "<input type='hidden' id='" + mpid + "_remarkEdtHidden' readonly />";
html2 += "<input class='form-control ' id='" + mpid + "_remarkEdt' name='remarkEdt' value='${param.edt}' readonly style='height:31px;width: 190px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;cursor:pointer;'/>";
html2 += "</div>";
html2 += "</div>";
html2 += " <div style='width:100%;float:left;margin-top: 20px;'>";
html2 += "<div class='form-group' style='height:100px;'>";
html2 += "<label class='col-sm-2 control-label' style='line-height: 100px;vertical-align:middle;'>拐点备注</label>";
html2 += "<div class='col-sm-10'>";
html2 += "<textarea class='form-control' style='height: 100px;' id='" + mpid + "_remarkContent' name='remarkContent' placeholder='备注...'></textarea>";
html2 += "</div>";
html2 += "</div>";
html2 += "</div>";
html2 += "</div>";
$('#contentRemark').append(html2);
// hisData
let html3 = "";
if (st == 'block') {
html3 += "<div id='" + mpid + "_hisDataDiv' style='float: left;width: 100%;height: 100%;display: block;'>";
} else {
html3 += "<div id='" + mpid + "_hisDataDiv' style='float: left;width: 100%;height: 100%;display: none;'>";
}
html3 += "<table id='" + mpid + "_hisDataTab' >";
html3 += "</table>";
html3 += "</div>";
$('#hisData').append(html3);
$("#" + mpid + "_hisDataTab").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/data/getHisRemarkTab.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [15], // 设置页面可以显示的数据条数
pageSize: 15, // 页面数据条数
pageNumber: 1, // 首页页码
paginationDetailHAlign: ' hidden',//去除分页的显示
sidePagination: "client", //分页方式client客户端分页server服务端分页*
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
sdt: inSdt,
edt: inEdt,
mpid: mpid + ":" + unitId
}
},
columns: [
{
field: 'sdt', // 返回json数据中的name
title: '开始时间', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
width: '160px',
formatter: function (value, row, index) {
return value.substring(0, 19);
}
}, {
field: 'edt', // 返回json数据中的name
title: '结束时间', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
width: '160px',
formatter: function (value, row, index) {
return value.substring(0, 19);
}
}, {
field: 'content', // 返回json数据中的name
title: '备注内容', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
}, {
title: "操作",
align: 'center',
valign: 'middle',
width: 120, // 定义列的宽度单位为像素px
formatter: function (value, row, index) {
var buts = "";
buts += '<button type="button" class="btn btn-default btn-sm" title="附件查看" onclick="fileViewFun(\'' + row.id + '\')"><i class="fa fa-eye"></i><span class="hidden-md hidden-lg">附件查看</span></button>';
buts += '<button type="button" class="btn btn-default btn-sm" title="附件上传" onclick="fileOpenFun(\'' + row.id + '\')"><i class="fa fa-cloud-upload"></i><span class="hidden-md hidden-lg">附件上传</span></button>';
buts += '<button type="button" class="btn btn-default btn-sm" title="删除" onclick="deleteCurveRemark(\'' + row.id + '\',\'' + row.mpointId + '\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button>';
buts = '<div class="btn-group" >' + buts + '</div>';
return buts;
}
}
],
onLoadSuccess: function () { //加载成功时执行
adjustBootstrapTableView(mpid + "_hisDataTab");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
});
});
firstIn = 1;
}
// let firstNum = 0;
// let endNum = 0;
function tdClick(object, mpid) {
if ($("#" + mpid + "_remarkSdt").val() != '' && $("#" + mpid + "_remarkEdt").val() != '') {
showAlert('d', '请先重置选择时间');
} else {
event.stopPropagation();
let time = $(object).text().substring(0, 16);
// console.log(time);
if ($("#" + mpid + "_remarkSdt").val() == '' && $("#" + mpid + "_remarkEdt").val() == '') {
$("#" + mpid + "_remarkSdt").val(time);
$(object).css("background", "rgba(191,219,255,1)");
$("#" + mpid + "_remarkSdtHidden").val($(object).attr("id").replace(mpid + "_", ""));
} else if ($("#" + mpid + "_remarkSdt").val() != '' && $("#" + mpid + "_remarkEdt").val() == '') {
$("#" + mpid + "_remarkEdt").val(time);
$(object).css("background", "rgba(191,219,255,1)");
$("#" + mpid + "_remarkEdtHidden").val($(object).attr("id").replace(mpid + "_", ""));
$("#" + mpid + "_dataTab tbody").find("tr").each(function () {
if ($(this).attr("id") != null && $(this).attr("id") != '') {
let nowNum = $(this).attr("id").replace(mpid + "_", "");
if (Number(nowNum) > Number($("#" + mpid + "_remarkSdtHidden").val()) && Number(nowNum) < Number($("#" + mpid + "_remarkEdtHidden").val())) {
$(this).css("background", "rgba(191,219,255,0.5)");
}
}
});
}
}
}
function doRemarkRetime() {
let nowMpid = $("#mpidsSelect").val();
$('#' + nowMpid + '_remarkSdt').val('');
$('#' + nowMpid + '_remarkEdt').val('');
$("#" + nowMpid + "_remarkSdtHidden").val('');
$("#" + nowMpid + "_remarkEdtHidden").val('');
$("#" + nowMpid + "_dataTab tbody").find("tr").each(function () {
$(this).css("background", "#ffffff");
});
}
function doRemark() {
for (let i = 0; i < top_remarkMps.length; i++) {
let content = top_remarkMps[i].split(":");
if ($('#' + content[0] + '_remarkSdt').val() == '' || $('#' + content[0] + '_remarkEdt').val() == '') {
showAlert('d', content[2] + '未选择时间');
return;
} else {
if ($('#' + content[0] + '_remarkContent').val() == '') {
showAlert('d', content[2] + '未填写备注内容');
return;
} else {
// console.log(123)
}
}
}
for (let i = 0; i < top_remarkMps.length; i++) {
let content = top_remarkMps[i].split(":");
$.post(ext.contextPath + "/data/saveCurveRemark.do", {
sdt: $('#' + content[0] + '_remarkSdt').val().substring(0, 16),
edt: $('#' + content[0] + '_remarkEdt').val().substring(0, 16),
content: $('#' + content[0] + '_remarkContent').val(),
mpids: content[0] + ":" + content[1]
}, function (data) {
if (data.code == 1) {
closeModal("curveRemarkSubModal");
$('#showRemarkPoint').val('0');
// $("#" + content[0] + "_hisDataTab").bootstrapTable('refresh');
dosearch();
} else if (data.code == 0) {
showAlert('d', '保存失败');
} else {
showAlert('d', data.msg);
}
}, 'json');
}
}
function deleteCurveRemark(id, mpointId) {
swal({
text: "您确定要删除此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
let mpid = mpointId.split(":");
$.post(ext.contextPath + '/data/deleteCurveRemark2.do', {id: id}, function (data) {
if (data == "1") {
$('#showRemarkPoint').val('0');
$("#" + mpid[0] + "_hisDataTab").bootstrapTable('refresh');
dosearch();
} else {
showAlert('d', '删除失败');
}
}, 'json');
}
});
}
function doRemarkSame() {
let nowMpid = $("#mpidsSelect").val();
for (let i = 0; i < top_remarkMps.length; i++) {
let content = top_remarkMps[i].split(":");
if (content[0] != nowMpid) {
$('#' + content[0] + '_remarkContent').val($('#' + nowMpid + '_remarkContent').val())
}
}
}
function fileOpenFun(id) {
$.post(ext.contextPath + '/data/curveRemarkFileUp.do', {
masterId: id,
tbName: 'TB_Data_Curve_Remark_File',
nameSpace: 'curve'
}, function (data) {
$("#fileInputDiv").html(data);
openModal('fileInputModal');
});
}
function fileViewFun(id) {
$.post(ext.contextPath + '/data/curveRemarkFileView.do', {
masterId: id,
tbName: 'TB_Data_Curve_Remark_File',
nameSpace: 'curve'
}, function (data) {
$("#fileInputDiv").html(data);
openModal('fileInputModal');
});
}
function closeRemark() {
// $('#showRemarkPoint').val('0');
closeModal('curveRemarkSubModal');
}
</script>
<div class="modal fade" id="curveRemarkSubModal">
<div class="modal-dialog modal-md" style="width: 80%;">
<div class="modal-content">
<div class="modal-header">
<%-- <button type="button" class="close" data-dismiss="modal" aria-label="Close">--%>
<%-- <span aria-hidden="true">&times;</span></button>--%>
<h4 class="modal-title">曲线备注</h4>
</div>
<!-- 界面提醒div强制id为alertDiv -->
<div id="alertDiv"></div>
<div id="viewShow" class="modal-body">
<div style="width: 100%;height: calc(100% - 45px);">
<div id="left" style="width: 40%;height: 100%;float: left;overflow: auto;">
<div style="float: left;width: 100%;height: 45px;">
<div class="form-group">
<div style="float: left;width: 45px;line-height: 28px;">点位:</div>
<div style="float: left;width: 180px;">
<select class="form-control select2 " id="mpidsSelect" name="mpidsSelect"
style="width: 170px;"></select>
</div>
</div>
</div>
<div id="dataDiv" style="float: left;width: 100%;height: calc(100% - 45px);"></div>
</div>
<div id="right" style="width: 60%;height: 100%;float: left;padding-left: 10px;">
<div id="contentRemark" style="float: left;width: 100%;height: 180px;">
<%-- <div style="width:100%;float:left;margin-top: 0px;">--%>
<%-- <div style="width:50%;float:left;">--%>
<%-- <div class="input-group" style="margin-left: 10px;">--%>
<%-- <span class="input-group-addon"--%>
<%-- style="height:31px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold">起始时间:</span>--%>
<%-- <input class="form-control " id="remarkSdt" name="remarkSdt"--%>
<%-- value="${param.sdt}"--%>
<%-- readonly--%>
<%-- style="height:31px;width: 190px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;cursor:pointer;"--%>
<%-- />--%>
<%-- </div>--%>
<%-- </div>--%>
<%-- <div style="width:50%;float:left;">--%>
<%-- <div class="input-group" style="margin-left: 10px;">--%>
<%-- <span class="input-group-addon"--%>
<%-- style="height:31px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold">结束时间:</span>--%>
<%-- <input class="form-control " id="remarkEdt" name="remarkEdt"--%>
<%-- value="${param.edt}"--%>
<%-- readonly--%>
<%-- style="height:31px;width: 190px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;cursor:pointer;"--%>
<%-- />--%>
<%-- </div>--%>
<%-- </div>--%>
<%-- </div>--%>
<%-- <div style="width:100%;float:left;margin-top: 20px;">--%>
<%-- <div class="form-group" style="height:100px;">--%>
<%-- <label class="col-sm-2 control-label"--%>
<%-- style="line-height: 100px;vertical-align:middle;">拐点备注</label>--%>
<%-- <div class="col-sm-10">--%>
<%-- <textarea class="form-control"--%>
<%-- style="height: 100px;" id="remarkContent"--%>
<%-- name="remarkContent"--%>
<%-- placeholder="备注..."></textarea>--%>
<%-- </div>--%>
<%-- </div>--%>
<%-- </div>--%>
</div>
<%-- <div style="width:100%;float:left;height: 35px;padding-left: 15px;">--%>
<%-- <button type="button" class="btn btn-default" onclick="fileinput();"><i--%>
<%-- class="fa fa-upload"></i>--%>
<%-- 附件上传--%>
<%-- </button>--%>
<%-- </div>--%>
<div style="width:100%;float:left;height: 30px;">
<%-- <div class="pull-right"--%>
<%-- style="width:50px;height:25px;border-radius: 4px;background: #3c8dbc;margin-right: 10px;">--%>
<%-- <div style="text-align:center;line-height:25px;font-size:12px;color:#ffffff;font-weight:700;font-family: MicrosoftYaHei, MicrosoftYaHei-Bold;cursor: pointer;"--%>
<%-- onclick="deleteCurveRemark();">删除--%>
<%-- </div>--%>
<%-- </div>--%>
<div class="pull-right"
style="width:50px;height:25px;border-radius: 4px;background: #3c8dbc;margin-right: 10px;">
<div style="text-align:center;line-height:25px;font-size:12px;color:#ffffff;font-weight:700;font-family: MicrosoftYaHei, MicrosoftYaHei-Bold;cursor: pointer;"
onclick="doRemark();">确认
</div>
</div>
<div class="pull-right"
style="width:50px;height:25px;border-radius: 4px;background: #3c8dbc;margin-right: 10px;">
<div style="text-align:center;line-height:25px;font-size:12px;color:#ffffff;font-weight:700;font-family: MicrosoftYaHei, MicrosoftYaHei-Bold;cursor: pointer;"
onclick="doRemarkRetime();">重置
</div>
</div>
<div class="pull-right"
style="width:60px;height:25px;border-radius: 4px;background: #3c8dbc;margin-right: 10px;">
<div style="text-align:center;line-height:25px;font-size:12px;color:#ffffff;font-weight:700;font-family: MicrosoftYaHei, MicrosoftYaHei-Bold;cursor: pointer;"
onclick="doRemarkSame();">备注同步
</div>
</div>
</div>
<div style="width:100%;float:left;height:calc(100% - 210px);">
<div class="box-header with-border">
<h3 class="box-title">备注列表</h3>
</div>
<div id="hisData" class="box-body" style="height:calc(100% - 40px);overflow: auto;">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-right" data-dismiss="modal"
onclick="closeRemark();">关闭
</button>
</div>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>