494 lines
23 KiB
Plaintext
494 lines
23 KiB
Plaintext
<%@ page language="java" pageEncoding="UTF-8"%>
|
||
<style type="text/css">
|
||
.select2-container .select2-selection--single {
|
||
height: 34px;
|
||
line-height: 34px;
|
||
}
|
||
|
||
.select2-selection__arrow {
|
||
margin-top: 3px;
|
||
}
|
||
|
||
</style>
|
||
<link rel="stylesheet"
|
||
href="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css" />
|
||
<script type="text/javascript"
|
||
src="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/js/bootstrap-switch.min.js"
|
||
charset="utf-8"></script>
|
||
<script type="text/javascript">
|
||
//测量点页面跳转
|
||
var doEditMPoint = function () {
|
||
var allTableData = $("#table_mPoint").bootstrapTable('getData');
|
||
var mPointIds = "";
|
||
$.each(allTableData, function (index, item) {
|
||
if (mPointIds != "") {
|
||
mPointIds += ",";
|
||
}
|
||
mPointIds += item.mPoint.mpointcode;
|
||
})
|
||
$.post(ext.contextPath + '/work/mpoint/patroPointMPointForSelect.do', {
|
||
mPointIds: mPointIds,
|
||
bizId: '${param.bizId}', processSectionId: $('#processSectionId').val()
|
||
}, function (data) {
|
||
$("#subDiv_PatroPoint").html(data);
|
||
openModal('patroPointModal');
|
||
});
|
||
};
|
||
var doFinishSelectMPoint = function (data) {
|
||
$.post(ext.contextPath + '/timeEfficiency/patrolPoint/updateMPoints.do', {
|
||
patrolPointId: '${patrolPointId}',
|
||
mPointIds: data
|
||
}, function (data) {
|
||
if (data.res) {
|
||
doRefreshMPoints();
|
||
}
|
||
}, 'json');
|
||
};
|
||
var doRefreshMPoints = function () {
|
||
$("#table_mPoint").bootstrapTable('refresh');
|
||
};
|
||
//设备页面跳转
|
||
var doEditEquipmentCard = function () {
|
||
var allTableData = $("#table_equipmentCard").bootstrapTable('getData');
|
||
var equipmentCardIds = "";
|
||
$.each(allTableData, function (index, item) {
|
||
if (equipmentCardIds != "") {
|
||
equipmentCardIds += ",";
|
||
}
|
||
equipmentCardIds += item.equipmentCard.id;
|
||
})
|
||
$.post(ext.contextPath + '/equipment/patroPointEquipmentCardForSelect.do', {
|
||
equipmentCardIds: equipmentCardIds,
|
||
bizId: '${param.bizId}', processSectionId: $('#processSectionId').val()
|
||
}, function (data) {
|
||
$("#subDiv_PatroPoint").html(data);
|
||
openModal('patroPointModal');
|
||
});
|
||
};
|
||
var doFinishSelectEquipmentCard = function (data) {
|
||
$.post(ext.contextPath + '/timeEfficiency/patrolPoint/updateEquipmentCards.do', {
|
||
patrolPointId: '${patrolPointId}',
|
||
equipmentCardIds: data
|
||
}, function (data) {
|
||
if (data.res) {
|
||
doRefreshEquipmentCards();
|
||
}
|
||
}, 'json');
|
||
};
|
||
var doRefreshEquipmentCards = function () {
|
||
$("#table_equipmentCard").bootstrapTable('refresh');
|
||
};
|
||
|
||
function dosave() {
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/timeEfficiency/patrolPoint/save.do", $("#subForm").serialize(), function (data) {
|
||
if (data.res == 1) {
|
||
closeModal('subModal')
|
||
$("#table").bootstrapTable('refresh');
|
||
} else if (data.res == 0) {
|
||
showAlert('d', '保存失败');
|
||
} else {
|
||
showAlert('d', data.res);
|
||
}
|
||
}, 'json');
|
||
}
|
||
}
|
||
$("#subForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
name: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '名称不能为空'
|
||
}
|
||
}
|
||
},
|
||
/*processSectionId: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '所属工艺段不能为空'
|
||
}
|
||
}
|
||
},*/
|
||
latitude: {
|
||
validators: {
|
||
// notEmpty: {
|
||
// message: '纬度不能为空'
|
||
// },
|
||
regexp: {
|
||
regexp: /^(([^0][0-9]+|0)\.([0-9]{1,10})$)|^([^0][0-9]+|0)$/,
|
||
message: '请输入正确的纬度'
|
||
}
|
||
}
|
||
},
|
||
longitude: {
|
||
validators: {
|
||
// notEmpty: {
|
||
// message: '经度不能为空'
|
||
// },
|
||
regexp: {
|
||
regexp: /^(([^0][0-9]+|0)\.([0-9]{1,10})$)|^([^0][0-9]+|0)$/,
|
||
message: '请输入正确的经度'
|
||
}
|
||
}
|
||
},
|
||
morder: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '顺序不能为空'
|
||
}
|
||
}
|
||
},
|
||
patrolContent: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '巡检内容不能为空'
|
||
}
|
||
}
|
||
},
|
||
|
||
}
|
||
});
|
||
$(function () {
|
||
|
||
//document.getElementById("test").readOnly=false;
|
||
|
||
//var inputs = document.getElementsByTagName("input");
|
||
// for (var i = 0; i < inputs.length; i++) {
|
||
// //判断这个元素是不是按钮
|
||
// if (inputs[i].type != "button") {
|
||
// inputs[i].value = "其实,qqqqqq";
|
||
// }
|
||
// }
|
||
|
||
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", { companyId: '${param.bizId}' }, function (data) {
|
||
$("#processSectionId").empty();
|
||
var selelct_ = $("#processSectionId").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; } // 函数用于呈现当前的选择
|
||
});
|
||
selelct_.val('${patrolPoint.processSectionId}').trigger("change");
|
||
}, 'json');
|
||
<%--console.info('${param.bizId}')--%>
|
||
<%--console.info('${patrolPointId}')--%>
|
||
//日期格式需对齐,不然会不准
|
||
$("#table_mPoint").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/timeEfficiency/patrolPoint/getMPoints.do', // 获取表格数据的url
|
||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||
striped: true, //表格显示条纹,默认为false
|
||
pagination: true, // 在表格底部显示分页组件,默认false
|
||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||
pageSize: 50, // 页面数据条数
|
||
pageNumber: 1, // 首页页码
|
||
sidePagination: 'server', // 设置为服务器端分页
|
||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||
return {
|
||
rows: params.limit, // 每页要显示的数据条数
|
||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||
sort: params.sort, // 要排序的字段
|
||
order: params.order,
|
||
patrolPointId: '${patrolPointId}',
|
||
bizId: '${param.bizId}'
|
||
}
|
||
},
|
||
sortName: 'id', // 要排序的字段
|
||
sortOrder: 'desc', // 排序规则
|
||
columns: [
|
||
{
|
||
field: 'parmname', // 返回json数据中的name
|
||
title: '名称', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
formatter: function (value, row, index) {
|
||
return row.mPoint.parmname;
|
||
|
||
}
|
||
}, {
|
||
field: 'mpointcode', // 返回json数据中的name
|
||
title: '测量点Code', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
formatter: function (value, row, index) {
|
||
return row.mPoint.mpointcode;
|
||
}
|
||
}
|
||
],
|
||
onLoadSuccess: function () { //加载成功时执行
|
||
adjustBootstrapTableView("table_mPoint");
|
||
},
|
||
onLoadError: function () { //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
|
||
})
|
||
|
||
//日期格式需对齐,不然会不准
|
||
$("#table_equipmentCard").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/timeEfficiency/patrolPoint/getEquipmentCards.do', // 获取表格数据的url
|
||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||
striped: true, //表格显示条纹,默认为false
|
||
pagination: true, // 在表格底部显示分页组件,默认false
|
||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||
pageSize: 50, // 页面数据条数
|
||
pageNumber: 1, // 首页页码
|
||
sidePagination: 'server', // 设置为服务器端分页
|
||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||
return {
|
||
rows: params.limit, // 每页要显示的数据条数
|
||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||
sort: params.sort, // 要排序的字段
|
||
order: params.order,
|
||
patrolPointId: '${patrolPointId}',
|
||
bizId: '${param.bizId}'
|
||
}
|
||
},
|
||
sortName: 'id', // 要排序的字段
|
||
sortOrder: 'desc', // 排序规则
|
||
columns: [
|
||
{
|
||
field: 'equipmentcardid', // 返回json数据中的name
|
||
title: '编号', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
formatter: function (value, row, index) {
|
||
return row.equipmentCard.equipmentcardid;
|
||
|
||
}
|
||
}, {
|
||
field: 'equipmentname', // 返回json数据中的name
|
||
title: '名称', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
formatter: function (value, row, index) {
|
||
return row.equipmentCard.equipmentname;
|
||
}
|
||
}
|
||
],
|
||
onLoadSuccess: function () { //加载成功时执行
|
||
adjustBootstrapTableView("table_equipmentCard");
|
||
},
|
||
onLoadError: function () { //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
|
||
})
|
||
|
||
|
||
$.post(ext.contextPath + "/work/modbusfig/getModbusFig4Select.do", {}, function (data) {
|
||
|
||
var selelct = $("#modbusFigId").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; } // 函数用于呈现当前的选择
|
||
});
|
||
|
||
if (data.length == 1) {
|
||
selelct.val(data[0].id).trigger("change");
|
||
} else {
|
||
selelct.val("").trigger("change");
|
||
}
|
||
}, 'json');
|
||
|
||
//巡检楼层下拉数据
|
||
var selectType = $("#floorName").select2({minimumResultsForSearch: 10})
|
||
$.post(ext.contextPath + "/timeEfficiency/patrolArea/getPatrolAreaFloor4Select.do", {unitId:unitId}, function(data) {
|
||
$("#floorName").empty();
|
||
var selelct_ =$("#floorName").select2({
|
||
data: data,
|
||
placeholder:'请选择',//默认文字提示
|
||
allowClear: false,//允许清空
|
||
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
||
language: "zh-CN",
|
||
minimumInputLength: 0,
|
||
minimumResultsForSearch: 10,//数据超过10个启用搜索框
|
||
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
|
||
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
|
||
});
|
||
selelct_.val('${patrolPoint.floorId}').trigger("change");
|
||
selelct_.on('change',function(e){
|
||
$('#floorId').val(e.target.value);
|
||
})
|
||
},'json');
|
||
|
||
})
|
||
</script>
|
||
<div class="modal fade" id="subModal">
|
||
<div class="modal-dialog modal-lg">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||
<span aria-hidden="true">×</span></button>
|
||
<h4 class="modal-title">新增巡检点</h4>
|
||
</div>
|
||
<div class="modal-body">
|
||
<!-- 新增界面formid强制为subForm -->
|
||
<form class="form-horizontal" id="subForm" enctype="multipart/form-data">
|
||
<!-- 界面提醒div强制id为alertDiv -->
|
||
<div id="alertDiv"></div>
|
||
<input name="id" type="hidden" value="${patrolPointId}" />
|
||
<input name="bizId" type="hidden" value="${param.bizId}" />
|
||
<input name="unitId" type="hidden" value="${param.bizId}" />
|
||
<input name="type" type="hidden" value="${param.patrolType}" />
|
||
<input type="hidden" class="form-control" id="bizid0" name="bizid0" value="${bizid0}">
|
||
<input type="hidden" class="form-control" id="status" name="status" value="${Status_Edit}">
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*名称</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" id="name" name="name" class="form-control pull-right" placeholder="名称">
|
||
</div>
|
||
<label class="col-sm-2 control-label">所属工艺段</label>
|
||
<div class="col-sm-4">
|
||
<select class="form-control select2" id="processSectionId" name="processSectionId"
|
||
style="width: 100%"></select>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">所属厂区</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" id="companyName" name="companyName" class="form-control pull-right" placeholder="所属厂区"
|
||
value="${companyName}" readonly="true"></input>
|
||
</div>
|
||
|
||
<label class="col-sm-2 control-label">所属楼层</label>
|
||
<div class="col-sm-4">
|
||
<select class="form-control select2" id="floorName" name ="floorName" style="width: 170px;"></select>
|
||
<input type="hidden" class="form-control" id="floorId" name="floorId" value="${patrolPoint.floorId}"/>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">纬度</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" id="latitude" name="latitude" class="form-control pull-right"
|
||
placeholder="纬度">
|
||
</div>
|
||
<label class="col-sm-2 control-label">经度</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" id="longitude" name="longitude" class="form-control pull-right"
|
||
placeholder="经度">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">编号</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" id="pointCode" name="pointCode" class="form-control pull-right"
|
||
placeholder="编号"
|
||
value="${patrolPoint.pointCode}"></input>
|
||
</div>
|
||
<label class="col-sm-2 control-label">*顺序</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" id="morder" name="morder" class="form-control pull-right"
|
||
placeholder="顺序">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">modbus配置</label>
|
||
<div class="col-sm-4">
|
||
<select class="form-control select2" id="modbusFigId" name="modbusFigId"
|
||
style="width: 100%"></select>
|
||
</div>
|
||
<label class="col-sm-2 control-label">寄存器</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" id="register" name="register" class="form-control pull-right"
|
||
placeholder="寄存器">
|
||
</div>
|
||
|
||
</div>
|
||
<div class="form-group">
|
||
<!-- <input name="type" type="hidden" value="1" /> -->
|
||
<!-- <label class="col-sm-2 control-label">巡检分类(生产/设备)</label>
|
||
<div class="col-sm-4">
|
||
<select type="text" id="type" class="form-control pull-right" name="type" >
|
||
<option value="1">生产</option>
|
||
<option value="0">设备</option>
|
||
</select>
|
||
</div> -->
|
||
<label class="col-sm-2 control-label">读写方式</label>
|
||
<div class="col-sm-4">
|
||
<select type="text" id="readOrWrite" class="form-control pull-right" name="readOrWrite">
|
||
<option value="1">只读</option>
|
||
<option value="0">只写</option>
|
||
</select>
|
||
</div>
|
||
<label class="col-sm-2 control-label">启用状态</label>
|
||
<div class="col-sm-4">
|
||
<select type="text" id="active" class="form-control pull-right" name="active">
|
||
<option value="1">启用</option>
|
||
<option value="0">禁用</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*巡检内容</label>
|
||
<div class="col-sm-10">
|
||
<textarea class="form-control" rows="3" id="patrolContent" name="patrolContent"
|
||
placeholder="巡检内容..."></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">备注</label>
|
||
<div class="col-sm-10">
|
||
<textarea class="form-control" rows="3" id="remark" name="remark"
|
||
placeholder="备注..."></textarea>
|
||
</div>
|
||
</div>
|
||
<!-- <div class="form-group" style="margin:8px">
|
||
<button type="button" class="btn btn-default btn-file" onclick="fileinput()" id="btn_save"><i class="fa fa-paperclip"></i>上传图片</button>
|
||
<button type="button" class="btn btn-default btn-file" onclick="showFaultLibrary4SelectFun()" id="btn_save"><i class="fa fa-file-o"></i>问题库</button>
|
||
</div> -->
|
||
|
||
</form>
|
||
|
||
<!-- <div class="box box-primary">
|
||
<div class="box-header with-border">
|
||
<h3 class="box-title">关联测量点</h3>
|
||
|
||
<div class="box-tools pull-right">
|
||
<a onclick="doEditMPoint()" class="btn btn-box-tool" data-toggle="tooltip" title="编辑"><i
|
||
class="glyphicon glyphicon-edit"></i></a>
|
||
</div>
|
||
</div>
|
||
<div class="box-body ">
|
||
<table id="table_mPoint"></table>
|
||
</div>
|
||
</div>
|
||
<div class="box box-primary">
|
||
<div class="box-header with-border">
|
||
<h3 class="box-title">关联设备</h3>
|
||
|
||
<div class="box-tools pull-right">
|
||
<a onclick="doEditEquipmentCard()" class="btn btn-box-tool" data-toggle="tooltip"
|
||
title="编辑"><i class="glyphicon glyphicon-edit"></i></a>
|
||
</div>
|
||
</div>
|
||
<div class="box-body ">
|
||
<table id="table_equipmentCard"></table>
|
||
</div>
|
||
</div> -->
|
||
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
|
||
<button type="button" class="btn btn-primary" onclick="dosave()">保存</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div> |