534 lines
22 KiB
Plaintext
534 lines
22 KiB
Plaintext
<%@ page language="java" pageEncoding="UTF-8" %>
|
||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
|
||
<%@page import="com.sipai.tools.CommString" %>
|
||
<%@page import="com.sipai.entity.maintenance.MaintenanceCommString" %>
|
||
<%request.setAttribute("Active_False", CommString.Active_False); %>
|
||
<%request.setAttribute("Active_True", CommString.Active_True); %>
|
||
<%request.setAttribute("MAINTAIN", MaintenanceCommString.MAINTENANCE_TYPE_MAINTAIN); %>
|
||
<%request.setAttribute("INTER_MAINTENANCE", MaintenanceCommString.INTER_MAINTENANCE); %>
|
||
<%request.setAttribute("EXTERANL_MAINTENANCE", MaintenanceCommString.EXTERANL_MAINTENANCE); %>
|
||
<%request.setAttribute("COMMON_MAINTENANCE", MaintenanceCommString.COMMON_MAINTENANCE); %>
|
||
<%request.setAttribute("MAINTAIN_YEAR", MaintenanceCommString.MAINTAIN_YEAR); %>
|
||
<%request.setAttribute("MAINTAIN_MONTH", MaintenanceCommString.MAINTAIN_MONTH); %>
|
||
<%request.setAttribute("MAINTAIN_HALFYEAR", MaintenanceCommString.MAINTAIN_HALFYEAR); %>
|
||
<%request.setAttribute("START", MaintenanceCommString.PLAN_START); %>
|
||
<%request.setAttribute("SUBMIT", MaintenanceCommString.PLAN_SUBMIT); %>
|
||
<style type="text/css">
|
||
.select2-container .select2-selection--single {
|
||
height: 34px;
|
||
line-height: 34px;
|
||
}
|
||
|
||
.select2-selection__arrow {
|
||
margin-top: 3px;
|
||
}
|
||
|
||
/* .file-border{
|
||
padding-top :10px;
|
||
padding-bottom :1px;
|
||
margin-left :17%;
|
||
padding-right :0px;
|
||
padding-left :0px;
|
||
border-color :#D2D6DE;
|
||
border-style: solid;
|
||
border-width: 1px 1px 1px 1px;
|
||
border-top-left-radius:10px;
|
||
border-top-right-radius:10px;
|
||
border-bottom-left-radius:10px;
|
||
border-bottom-right-radius:10px;
|
||
} */
|
||
</style>
|
||
<script type="text/javascript">
|
||
//流程审核文件上传所需参数
|
||
var masterId_process = '${equipmentPlanMainYear.id}';//业务Id
|
||
var tbName_process = 'TB_Process_UploadFile'; //数据表
|
||
var nameSpace_process = 'ProcessUploadFile';//保存文件夹
|
||
var status = 'delete';//有删除权限
|
||
var deleteFun1 = function (id) {
|
||
stopBubbleDefaultEvent();
|
||
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(willDelete => {
|
||
if (willDelete) {
|
||
$.post(ext.contextPath + '/maintenance/equipmentPlanMainYear/detaildelete.do', {id: id}, function (data) {
|
||
if (data == 1) {
|
||
$("#table1").bootstrapTable('refresh');
|
||
} else {
|
||
showAlert('d', '删除失败', 'mainAlertdiv');
|
||
}
|
||
});
|
||
|
||
}
|
||
});
|
||
};
|
||
|
||
function deleteSubscribeDetailFun() {
|
||
var checkedItems = $("#table1").bootstrapTable('getSelections');
|
||
var datas = "";
|
||
$.each(checkedItems, function (index, item) {
|
||
datas += item.id + ",";
|
||
});
|
||
if (datas == "") {
|
||
showAlert('d', '请先选择记录', 'mainAlertDetaildiv');
|
||
} else {
|
||
if (confirm("信息删除后不能恢复,请问要执行删除操作吗?")) {
|
||
$.post(ext.contextPath + '/maintenance/equipmentPlanMainYear/detaildeletes.do', {ids: datas}, function (data) {
|
||
if (data > 0) {
|
||
$("#table1").bootstrapTable('refresh');
|
||
} else {
|
||
showAlert('d', '删除失败', 'mainAlertDetaildiv');
|
||
}
|
||
});
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
function doupdate() {
|
||
$('#subForm').data('bootstrapValidator')
|
||
.updateStatus('equipmentNumber', 'NOT_VALIDATED', null)
|
||
.validateField('equipmentNumber');
|
||
$('#subForm').data('bootstrapValidator')
|
||
.updateStatus('equipname', 'NOT_VALIDATED', null)
|
||
.validateField('equipname');
|
||
$('#subForm').data('bootstrapValidator')
|
||
.updateStatus('particularYear', 'NOT_VALIDATED', null)
|
||
.validateField('particularYear');
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
//setTimeout(function(){
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/maintenance/equipmentPlanMainYear/doupdate.do", $("#subForm").serialize(), function (data) {
|
||
if (data.res == 1) {
|
||
$("#table").bootstrapTable('refresh');
|
||
closeModal("subModal");
|
||
} else if (data.res == 0) {
|
||
showAlert('d', '保存失败');
|
||
} else {
|
||
showAlert('d', data.res);
|
||
}
|
||
}, 'json');
|
||
}
|
||
//}, 100);
|
||
}
|
||
|
||
//保养计划提交审核
|
||
function dosubmit() {
|
||
|
||
$('#subForm').data('bootstrapValidator')
|
||
.updateStatus('auditMan', 'NOT_VALIDATED', null)
|
||
.validateField('auditMan');
|
||
/* $('#subForm').data('bootstrapValidator')
|
||
.updateStatus('equipname', 'NOT_VALIDATED',null)
|
||
.validateField('equipname'); */
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
//setTimeout(function(){
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/maintenance/equipmentPlanMainYear/startPlanAudit.do", $("#subForm").serialize(), function (data) {
|
||
if (data.res == 1) {
|
||
$("#table").bootstrapTable('refresh');
|
||
closeModal('subModal');
|
||
} else if (data.res == 0) {
|
||
showAlert('d', '保存失败');
|
||
} else if (data.res == 2) {
|
||
showAlert('d', '未检测到保养计划审核流程,请先部署流程!');
|
||
} else {
|
||
showAlert('d', data.res);
|
||
}
|
||
}, 'json');
|
||
}
|
||
//}, 100);
|
||
}
|
||
|
||
//提交时先验证审核人不能为空,保存时审核人可以为空
|
||
function submitFun() {
|
||
//新增的输入框添加验证
|
||
$("#subForm").data('bootstrapValidator').addField('auditMan', {
|
||
equipmentId: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '设备不能为空'
|
||
}
|
||
}
|
||
}
|
||
});
|
||
dosubmit();
|
||
}
|
||
|
||
var initTable = function (id) {
|
||
$("#table1").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/maintenance/equipmentPlanMainYear/getDetailList.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, // 排序规则
|
||
search_name: $('#search_name').val(),
|
||
planid: id
|
||
}
|
||
|
||
},
|
||
sortName: 'month', // 要排序的字段
|
||
sortOrder: 'asc', // 排序规则
|
||
onClickRow: function (row) {//单击行事件,执行查看功能
|
||
viewFun(row.id);
|
||
},
|
||
columns: [
|
||
{
|
||
checkbox: true, // 显示一个勾选框
|
||
},
|
||
{
|
||
field: 'month', // 返回json数据中的name
|
||
title: '月份', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
formatter: function (value, row, index) {
|
||
return value;
|
||
}
|
||
}, {
|
||
field: 'mainType', // 返回json数据中的name
|
||
title: '周期', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
formatter: function (value, row, index) {
|
||
return value;
|
||
}
|
||
}, {
|
||
title: "操作",
|
||
field: 'resourceId',
|
||
align: 'center',
|
||
valign: 'middle',
|
||
width: 120, // 定义列的宽度,单位为像素px
|
||
formatter: function (value, row, index) {
|
||
var buts = '';
|
||
buts += '<security:authorize buttonUrl="sparepart/supplierQualification/delete.do">';
|
||
buts += '<button class="btn btn-default btn-sm" title="删除" onclick="deleteFun1(\'' + row.id + '\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button';
|
||
buts += '</security:authorize>';
|
||
|
||
buts = '<div class="btn-group" >' + buts + '</div>';
|
||
return buts;
|
||
/* return '<i class="fa fa-edit" onclick="editFun()(\'' + row.id + '\')></i>'; */
|
||
}
|
||
}
|
||
],
|
||
onLoadSuccess: function () { //加载成功时执行
|
||
adjustBootstrapTableView("table1");
|
||
$("#table1").bootstrapTable("hideRow", 1)
|
||
},
|
||
onLoadError: function () { //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
|
||
})
|
||
|
||
};
|
||
|
||
$("#subForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
equipmentNumber: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '设备编号不能为空'
|
||
}
|
||
}
|
||
},
|
||
equipname: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '设备名称不能为空'
|
||
}
|
||
}
|
||
},
|
||
particularYear: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '计划日期不能为空'
|
||
}
|
||
}
|
||
},
|
||
type: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '类型不能为空'
|
||
}
|
||
}
|
||
},
|
||
contents: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '计划内容不能为空'
|
||
}
|
||
}
|
||
}
|
||
}
|
||
});
|
||
|
||
var companyId = unitId;
|
||
|
||
var planid = $("#id").val();
|
||
var addSubscribeDetailFun = function () {
|
||
|
||
var usid1 = $("#id").val();
|
||
$.post(ext.contextPath + '/maintenance/equipmentPlanMainYear/detailadd.do', {planid: planid},
|
||
function (data) {
|
||
$("#detailFunadd").html(data);
|
||
openModal('subModal3');
|
||
});
|
||
}
|
||
|
||
initTable(planid);
|
||
|
||
$(function () {
|
||
|
||
initTable(planid);
|
||
//初始化文件显示
|
||
//getFileList_process();
|
||
//计划保养费用保留两位小数
|
||
// //选择时间
|
||
$('#particularYear').datepicker({
|
||
language: 'zh-CN',
|
||
autoclose: true,
|
||
todayHighlight: true,
|
||
format: 'yyyy',
|
||
minViewMode: 2,
|
||
maxViewMode: 2
|
||
}).on('hide', function (e) {
|
||
//当日期选择框关闭时,执行刷新校验
|
||
$('#subForm').data('bootstrapValidator')
|
||
.updateStatus('particularYear', 'NOT_VALIDATED', null)
|
||
.validateField('particularYear');
|
||
});
|
||
//选择保养类型
|
||
var selectType = $("#type").select2({
|
||
minimumResultsForSearch: 10
|
||
})
|
||
selectType.val('${equipmentPlanMainYear.type}').trigger("change");
|
||
|
||
$.post(ext.contextPath + "/maintenance/equipmentPlanType/getSelectList4Code.do", {code: '${param.planType}'}, function (data) {
|
||
$("#type").empty();
|
||
var selelct_ = $("#type").select2({
|
||
data: data,
|
||
cache: false,
|
||
placeholder: '请选择',//默认文字提示
|
||
allowClear: true,//允许清空
|
||
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('${equipmentPlanMainYear.type}').trigger("change");
|
||
selelct_.on("change", function (e) {
|
||
// dosearchTab();
|
||
});
|
||
}, 'json');
|
||
|
||
});
|
||
//选择设备,根据厂区id选择厂内设备
|
||
var selectEquipmentCard = function () {
|
||
/*$.post(ext.contextPath + '/equipment/showEquipmentCardForSelect2.do', {
|
||
companyId: companyId,
|
||
equipmentId: $("#equipmentId").val()
|
||
}, function (data) {
|
||
$("#emSubDiv").html(data);
|
||
openModal('emSubModal');
|
||
});*/
|
||
$.post(ext.contextPath + '/equipment/selectEquipmentCard4Choice.do', {
|
||
unitId: unitId,
|
||
equPlanId: '${id}',
|
||
choiceType: 'main'//通过保养模块过来的,需要筛选近期需要保养的功能
|
||
}, function (data) {
|
||
$("#emSubDiv").html(data);
|
||
openModal("equipment4SelectModal");
|
||
});
|
||
};
|
||
|
||
//保存选择设备 datas为id
|
||
var doFinishSelectEquipment = function (datas_id, datas_name, datas_cardId) {
|
||
var array = datas_id.split(',');
|
||
if(array.length>1){
|
||
alert('只能选择一台设备');
|
||
}else{
|
||
$('#equipmentId').val(datas_id);
|
||
$('#equipname').val(datas_name);
|
||
$('#equipmentNumber').val(datas_cardId);
|
||
closeModal("equipment4SelectModal");
|
||
}
|
||
}
|
||
|
||
//选择审核人
|
||
var showUser4AuditSelectsFun = function () {
|
||
var userIds = $("#auditId").val();
|
||
$.post(ext.contextPath + '/user/userForSelect.do', {
|
||
formId: "subForm",
|
||
hiddenId: "auditId",
|
||
textId: "auditMan",
|
||
userIds: userIds
|
||
}, function (data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal("user4SelectModal");
|
||
});
|
||
};
|
||
|
||
//弹出人员列表
|
||
var showUser4Handle = function () {
|
||
var userIds = $("#receiveUserId").val();
|
||
var jobIds = $("#targetjobs").val();
|
||
$.post(ext.contextPath + '/user/userForSelectByCompany.do', {
|
||
formId: "subForm",
|
||
hiddenId: "receiveUserId",
|
||
textId: "targetUsersName",
|
||
userIds: userIds,
|
||
jobIds: jobIds
|
||
}, function (data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal("user4SelectModal");
|
||
});
|
||
};
|
||
|
||
</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">
|
||
<!-- 界面提醒div强制id为alertDiv -->
|
||
<div id="alertDiv"></div>
|
||
<input type="hidden" id="id" name="id" value="${equipmentPlanMainYear.id}">
|
||
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*设备名称</label>
|
||
<div class="col-sm-4">
|
||
<input id="equipmentId" name="equipmentId" type="hidden"
|
||
value="${equipmentPlanMainYear.equipmentId}"/>
|
||
<input class="form-control" id="equipname" autocomplete="off"
|
||
value="${equipmentPlanMainYear.equipmentCard.equipmentname}"
|
||
onclick="selectEquipmentCard()" onclick="selectEquipmentCard()" placeholder="设备编号" readonly>
|
||
</div>
|
||
<label class="col-sm-2 control-label">*设备编号</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="equipmentNumber" name="equipmentNumber"
|
||
value="${equipmentPlanMainYear.equipmentCard.equipmentcardid}"
|
||
readonly>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">费用/元</label>
|
||
<div class="col-sm-4">
|
||
<input type="number" class="form-control" id="planMoney" name="planMoney"
|
||
value="${equipmentPlanMainYear.planMoney}" step="50.01" placeholder="计划费用">
|
||
</div>
|
||
<!-- <div id="issueDate"> -->
|
||
<label class="col-sm-2 control-label">*计划日期</label>
|
||
<div class="col-sm-4">
|
||
<div class="input-group date">
|
||
<div class="input-group-addon">
|
||
<i class="fa fa-calendar"></i>
|
||
</div>
|
||
<input type="text" class="form-control" id="particularYear" name="particularYear"
|
||
style="width: 132px;" placeholder="请选择"
|
||
value="${equipmentPlanMainYear.particularYear}"/>
|
||
</div>
|
||
</div>
|
||
<!-- </div> -->
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*类型</label>
|
||
<div class="col-sm-4">
|
||
<select class="form-control select2" id="type" name="type" style="width: 170px;">
|
||
</select>
|
||
</div>
|
||
<label class="col-sm-2 control-label">实施人员</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="targetUsersName" name="targetUsersName"
|
||
placeholder="请选择实施人员" onclick="showUser4Handle();" autocomplete="off"
|
||
value="${equipmentPlanMainYear.receiveUser.caption}">
|
||
<input id="receiveUserId" name="receiveUserId" type="hidden"
|
||
value="${equipmentPlanMainYear.receiveUserId}"/>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*计划内容</label>
|
||
<div class="col-sm-10">
|
||
<textarea class="form-control " id="contents" name="contents"
|
||
rows="2">${equipmentPlanMainYear.contents}</textarea>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">备注</label>
|
||
<div class="col-sm-10">
|
||
<textarea class="form-control " id="remark" name="remark"
|
||
rows="2">${equipmentPlanMainYear.remark}</textarea>
|
||
</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="addSubscribeDetailFun()" class="btn btn-box-tool" data-toggle="tooltip"
|
||
title="新增"><i class="glyphicon glyphicon-plus"></i></a>
|
||
<a onclick="deleteSubscribeDetailFun()" class="btn btn-box-tool" data-toggle="tooltip"
|
||
title="删除"><i class="glyphicon glyphicon-minus"></i></a></div>
|
||
|
||
</div>
|
||
<div class="box-body ">
|
||
<table id="table1"></table>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||
<button type="button" class="btn btn-primary" onclick="doupdate()" id="btn_update">保存</button>
|
||
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|