255 lines
10 KiB
Plaintext
255 lines
10 KiB
Plaintext
<%@ page language="java" pageEncoding="UTF-8" %>
|
||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
|
||
<% request.setAttribute("PatrolPlan_Weekly", com.sipai.entity.timeefficiency.TimeEfficiencyCommStr.PatrolPlan_Weekly); %>
|
||
<% request.setAttribute("PatrolPlan_Daily", com.sipai.entity.timeefficiency.TimeEfficiencyCommStr.PatrolPlan_Daily); %>
|
||
<% request.setAttribute("PatrolPlan_Monthly", com.sipai.entity.timeefficiency.TimeEfficiencyCommStr.PatrolPlan_Monthly); %>
|
||
<!-- bootstrap switch -->
|
||
<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 patrolPointId = '${param.patrolPointId}';
|
||
var patrolPlanId = '${param.patrolPlanId}';
|
||
var unitId = '${param.unitId}';
|
||
|
||
/*function doupdateforconfigure() {
|
||
var checkedtree1 = $('#tree1').treeview('getChecked');
|
||
var params = [];
|
||
$.each(checkedtree1, function (index, item) {
|
||
//datas+=item.id+",";
|
||
var param = {};
|
||
param.id = item.id;
|
||
param.text = item.text;
|
||
param.type = item.type;
|
||
if (item.data != undefined) {
|
||
param.data = item.data;
|
||
}
|
||
params.push(param);
|
||
});
|
||
|
||
$.ajax({
|
||
url: ext.contextPath + "/timeEfficiency/patrolContentsPlan/saveByPatrolPlan.do",
|
||
type: "post",
|
||
data: {"jsonStr": JSON.stringify(params), "patrolPlanId": patrolPlanId, "patrolPointId": patrolPointId},
|
||
dataType: "json",
|
||
async: false,
|
||
success: function (data) {
|
||
//不刷新避免计算过早 下面保存完填报内容后刷新
|
||
// $("#table_patrolPoint").bootstrapTable('refresh');
|
||
}
|
||
});
|
||
|
||
|
||
var checkedtree2 = $('#tree2').treeview('getChecked');
|
||
var params2 = [];
|
||
$.each(checkedtree2, function (index, item) {
|
||
var param2 = {};
|
||
param2.id = item.id;
|
||
param2.text = item.text;
|
||
param2.type = item.type;
|
||
if (item.data != undefined) {
|
||
param2.data = item.data;
|
||
}
|
||
params2.push(param2);
|
||
});
|
||
|
||
$.ajax({
|
||
url: ext.contextPath + "/timeEfficiency/patrolMeasurePointPlan/saveByPatrolPlan.do",
|
||
type: "post",
|
||
data: {
|
||
"jsonStr": JSON.stringify(params2),
|
||
"patrolPlanId": patrolPlanId,
|
||
"patrolPointId": patrolPointId,
|
||
"unitId": unitId
|
||
},
|
||
dataType: "json",
|
||
async: false,
|
||
success: function (data) {
|
||
$("#table_patrolPoint").bootstrapTable('refresh');
|
||
}
|
||
});
|
||
|
||
closeModal('subModalConfigure')
|
||
$("#table_patrolPoint").bootstrapTable('refresh');
|
||
// doRefreshPatrolPoints();
|
||
}*/
|
||
|
||
$("#table_equipmentCard").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/timeEfficiency/patrolPlan/getEquipmentCards4Safe.do', // 获取表格数据的url
|
||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||
striped: true, //表格显示条纹,默认为false
|
||
pagination: true, // 在表格底部显示分页组件,默认false
|
||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||
pageSize: 10, // 页面数据条数
|
||
pageNumber: 1, // 首页页码
|
||
sidePagination: 'server', // 设置为服务器端分页
|
||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||
return {
|
||
rows: params.limit, // 每页要显示的数据条数
|
||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||
sort: params.sort, // 要排序的字段
|
||
order: params.order,
|
||
patrolPlanId: '${param.patrolPlanId}',
|
||
patrolPointId: '${param.patrolPointId}'
|
||
}
|
||
},
|
||
sortName: 'id', // 要排序的字段
|
||
sortOrder: 'desc', // 排序规则
|
||
columns: [
|
||
{
|
||
checkbox: true, // 显示一个勾选框
|
||
width: '40px'
|
||
}, {
|
||
field: 'equipmentcardid', // 返回json数据中的name
|
||
title: '设备编号', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '40%',
|
||
formatter: function (value, row, index) {
|
||
if (row.equipmentCard != null && row.equipmentCard != '') {
|
||
return row.equipmentCard.equipmentcardid;
|
||
} else {
|
||
return '该设备已删除';
|
||
}
|
||
}
|
||
}, {
|
||
field: 'equipmentname', // 返回json数据中的name
|
||
title: '设备名称', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '60%',
|
||
formatter: function (value, row, index) {
|
||
if (row.equipmentCard != null && row.equipmentCard != '') {
|
||
return row.equipmentCard.equipmentname;
|
||
} else {
|
||
return '该设备已删除';
|
||
}
|
||
}
|
||
}
|
||
],
|
||
onLoadSuccess: function () { //加载成功时执行
|
||
adjustBootstrapTableView("table_equipmentCard");
|
||
|
||
//刷新 父页面关联巡检点列表
|
||
$("#table_patrolPoint").bootstrapTable('refresh');
|
||
},
|
||
onLoadError: function () { //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
|
||
})
|
||
|
||
//弹窗选择(设备)
|
||
function doEditEquipmentCard() {
|
||
var allTableData = $("#table_equipmentCard").bootstrapTable('getData');
|
||
var equipmentCardIds = "";
|
||
$.each(allTableData, function (index, item) {
|
||
if (equipmentCardIds != "") {
|
||
equipmentCardIds += ",";
|
||
}
|
||
if (item.equipmentCard != null) {
|
||
equipmentCardIds += item.equipmentCard.id;
|
||
}
|
||
})
|
||
$.post(ext.contextPath + '/equipment/selectEquipmentCard4Choice.do', {
|
||
equipmentIds: equipmentCardIds,
|
||
unitId: '${param.unitId}',
|
||
processSectionId: ''
|
||
}, function (data) {
|
||
$("#subDiv_PatroPoint").html(data);
|
||
openModal("equipment4SelectModal");
|
||
});
|
||
}
|
||
|
||
//删除设备
|
||
var doDeletesEquipmentCard = function () {
|
||
var checkedItems = $("#table_equipmentCard").bootstrapTable('getSelections');
|
||
var datas = "";
|
||
$.each(checkedItems, function (index, item) {
|
||
datas += item.id + ",";
|
||
});
|
||
if (datas == "") {
|
||
showAlert('d', '请先选择记录', 'mainAlertdiv');
|
||
} else {
|
||
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) {
|
||
$.post(ext.contextPath + '/timeEfficiency/patrolPlan/deletesEquipment4patrolPlanPatrolPoint.do', {ids: datas}, function (data) {
|
||
if (data > 0) {
|
||
$("#table_equipmentCard").bootstrapTable('refresh');
|
||
} else {
|
||
showAlert('d', '删除失败', 'mainAlertdiv');
|
||
}
|
||
});
|
||
}
|
||
});
|
||
}
|
||
};
|
||
|
||
//刷新列表(设备)
|
||
var doRefreshEquipmentCards = function () {
|
||
$("#table_equipmentCard").bootstrapTable('refresh');
|
||
};
|
||
|
||
//保存(设备)
|
||
var doFinishSelectEquipment = function (data) {
|
||
$.post(ext.contextPath + '/timeEfficiency/patrolPlan/updateEquipmentCards4PatrollPlanSafe.do', {
|
||
patrolPlanId: '${param.patrolPlanId}',
|
||
patrolPointId: '${param.patrolPointId}',
|
||
equipmentCardIds: data + ''
|
||
}, function (data) {
|
||
closeModal("equipment4SelectModal");
|
||
if (data.res) {
|
||
doRefreshEquipmentCards();
|
||
}
|
||
}, 'json');
|
||
};
|
||
|
||
</script>
|
||
|
||
<div class="modal fade" id="subModalConfigure">
|
||
<div class="modal-dialog modal-lg">
|
||
<div class="modal-content">
|
||
<div class="modal-body">
|
||
<div class="box-header with-border">
|
||
<h4 class="modal-title">关联设备列表</h4>
|
||
<div class="box-tools pull-right">
|
||
<a onclick="doEditEquipmentCard()" class="btn btn-box-tool" data-toggle="tooltip"
|
||
title="新增"><i class="fa fa-plus"></i></a>
|
||
<a onclick="doDeletesEquipmentCard()" class="btn btn-box-tool" data-toggle="tooltip"
|
||
title="删除"><i class="fa fa-minus"></i></a>
|
||
</div>
|
||
</div>
|
||
<div class="box-body ">
|
||
<table id="table_equipmentCard"></table>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div> |