276 lines
12 KiB
Plaintext
276 lines
12 KiB
Plaintext
<%@ page language="java" pageEncoding="UTF-8" %>
|
||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
|
||
<%@page import="com.sipai.entity.maintenance.Maintenance" %>
|
||
<%request.setAttribute("Status_Launch", Maintenance.Status_Launch);%>
|
||
<!-- 文件上传-->
|
||
<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>
|
||
<script type="text/javascript">
|
||
function doupdate() {
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/timeEfficiency/patrolArea/update.do?processSectionId=" + $("#processSectionId").val(), $("#subForm").serialize(), function (data) {
|
||
if (data.res == 1) {
|
||
$(".modal").modal("hide");
|
||
$("#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: '巡检区域不能为空'
|
||
}
|
||
}
|
||
},
|
||
bizId: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '厂区不能为空'
|
||
}
|
||
}
|
||
},
|
||
processSectionId: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '所属工艺段不能为空'
|
||
}
|
||
}
|
||
}
|
||
}
|
||
});
|
||
|
||
var deleteUserFun = function (id) {
|
||
$.post(ext.contextPath + '/timeEfficiency/patrolAreaUser/dodelete.do', {id: id}, function (data) {
|
||
if (data > 0) {
|
||
$("#table_area_user").bootstrapTable('refresh');
|
||
} else {
|
||
showAlert('d', '删除失败');
|
||
}
|
||
});
|
||
};
|
||
|
||
var deletesUserFun = function () {
|
||
var checkedItems = $("#table_area_user").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/patrolAreaUser/dodeletes.do', {ids: datas}, function (data) {
|
||
if (data > 0) {
|
||
$("#table_area_user").bootstrapTable('refresh');
|
||
} else {
|
||
showAlert('d', '删除失败', 'mainAlertdiv');
|
||
}
|
||
});
|
||
|
||
}
|
||
});
|
||
}
|
||
};
|
||
|
||
/**
|
||
* 新增巡检区域关联的人员
|
||
* @param ids
|
||
*/
|
||
function addUserFun() {
|
||
$.post(ext.contextPath + '/user/layerUser.do', {
|
||
formId: "subForm",
|
||
hiddenId: "solver",
|
||
textId: "solvername",
|
||
userIds: '',
|
||
fucname: 'saveAreaUser',
|
||
unitId: unitId
|
||
}, function (data) {
|
||
$("#subDiv_floor").html(data);
|
||
openModal("user4SelectModal");
|
||
});
|
||
}
|
||
|
||
/**
|
||
* 保存巡检区域关联的人员
|
||
* @param ids
|
||
*/
|
||
function saveAreaUser(ids) {
|
||
$.post(ext.contextPath + '/timeEfficiency/patrolAreaUser/save.do', {
|
||
ids: ids,
|
||
patrolAreaId: '${patrolArea.id}'
|
||
}, function (data) {
|
||
$("#table_area_user").bootstrapTable('refresh');
|
||
});
|
||
}
|
||
|
||
$(function () {
|
||
$("#table_area_user").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/timeEfficiency/patrolAreaUser/getList.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,
|
||
patrolAreaId: '${patrolArea.id}'
|
||
}
|
||
},
|
||
sortName: 'id', // 要排序的字段
|
||
sortOrder: 'desc', // 排序规则
|
||
columns: [
|
||
{
|
||
field: 'cs',
|
||
checkbox: true, // 显示一个勾选框
|
||
width: '40px'
|
||
}, {
|
||
field: 'user.caption', // 返回json数据中的name
|
||
title: '姓名', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
}, {
|
||
title: "操作",
|
||
align: 'center',
|
||
valign: 'middle',
|
||
width: 60, // 定义列的宽度,单位为像素px
|
||
formatter: function (value, row, index) {
|
||
var str = '';
|
||
str += '<button class="btn btn-default btn-sm" onclick="deleteUserFun(\'' + row.id + '\')" data-toggle="tooltip" title="删除"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg"> 删除</span></button>';
|
||
str = '<div class="btn-group" >' + str + '</div>';
|
||
return str;
|
||
}
|
||
}
|
||
],
|
||
onLoadSuccess: function () { //加载成功时执行
|
||
adjustBootstrapTableView("table_area_user");
|
||
},
|
||
onLoadError: function () { //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
})
|
||
})
|
||
</script>
|
||
<div class="modal fade" id="subModal">
|
||
<div class="modal-dialog">
|
||
<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 type="hidden" class="form-control" id="id" name="id" value="${patrolArea.id}">
|
||
<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="巡检区域"
|
||
value="${patrolArea.name}"></input>
|
||
</div>
|
||
<label class="col-sm-2 control-label">所属厂区</label>
|
||
<div class="col-sm-4">
|
||
<p class="form-control-static">${company.name}</p>
|
||
<input type="hidden" id="hidden_bizid" name="bizid" value="${patrolArea.bizId}">
|
||
</div>
|
||
</div>
|
||
<%--<div class="form-group">
|
||
<label class="col-sm-2 control-label">*包含的工艺段</label>
|
||
<div class="col-sm-10">
|
||
<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-10">
|
||
<textarea class="form-control" rows="3" id="remark" name="remark"
|
||
placeholder="备注...">${patrolArea.remark}</textarea>
|
||
</div>
|
||
</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="addFloorFun('${patrolArea.id}')" class="btn btn-box-tool" data-toggle="tooltip"
|
||
title="新增"><i class="glyphicon glyphicon-plus"></i></a>
|
||
</div>
|
||
</div>
|
||
<div class="box-body ">
|
||
<table id="table_floor"></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="addUserFun('${patrolArea.id}')" class="btn btn-box-tool" data-toggle="tooltip"
|
||
title="新增"><i class="glyphicon glyphicon-plus"></i></a>
|
||
<a onclick="deletesUserFun('${patrolArea.id}')" class="btn btn-box-tool" data-toggle="tooltip"
|
||
title="删除"><i class="glyphicon glyphicon-minus"></i></a>
|
||
</div>
|
||
</div>
|
||
<div class="box-body ">
|
||
<table id="table_area_user"></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="doupdate()">保存</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div> |