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

540 lines
20 KiB
Plaintext
Raw 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"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ page import="com.sipai.entity.base.ServerObject"%>
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
<%@page import="com.sipai.entity.timeefficiency.TimeEfficiencyCommStr"%>
<%request.setAttribute("PatrolType_Product", TimeEfficiencyCommStr.PatrolType_Product);%>
<%request.setAttribute("PatrolType_Equipment", TimeEfficiencyCommStr.PatrolType_Equipment);%>
<%request.setAttribute("PatrolModel_TempTask", TimeEfficiencyCommStr.PatrolModel_TempTask);%>
<% request.setAttribute("PatrolPlan_Weekly", TimeEfficiencyCommStr.PatrolPlan_Weekly); %>
<% request.setAttribute("PatrolPlan_Daily", TimeEfficiencyCommStr.PatrolPlan_Daily); %>
<% request.setAttribute("PatrolPlan_Monthly", TimeEfficiencyCommStr.PatrolPlan_Monthly); %>
<!DOCTYPE html>
<!-- <html lang="zh-CN"> -->
<!-- BEGIN HEAD -->
<head>
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
<!-- 引用页头及CSS页-->
<jsp:include page="/jsp/inc.jsp"></jsp:include>
<!-- 颜色选择器-->
<link rel="stylesheet"
href="<%=request.getContextPath()%>/plugins/bootstrap-colorpicker/dist/css/bootstrap-colorpicker.min.css"
type="text/css" rel="stylesheet" />
<script type="text/javascript"
src="<%=request.getContextPath()%>/plugins/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.min.js"
charset="utf-8"></script>
<script type="text/javascript">
var exportTestFun = function (id) {
window.location.href = ext.contextPath + '/timeEfficiency/patrolPlan/exportTest.do?bizId=' + unitId + '&type=${type}';
/* $.post(ext.contextPath + '/timeEfficiency/patrolPlan/exportTest.do', {bizId:bizId,type:'${type}'} , function(data) {
}); */
};
var showReportTestFun = function (id) {
//window.location.href =ext.contextPath + '/timeEfficiency/patrolPlan/showReportTest.do?bizId='+bizId+'&type=${type}';
$.post(ext.contextPath + '/timeEfficiency/patrolPlan/showPatrolListReport.do', { bizId: unitId, type: '${type}' }, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
var addFun = function () {
$("#searchForm").bootstrapValidator('validate');//提交验证
if ($("#searchForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
var patrolModelId = $('#patrolModel').val();
$.post(ext.contextPath + '/timeEfficiency/patrolPlan/add.do', { bizId: unitId, patrolModelId: patrolModelId, type: '${type}' }, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
}
};
var editFun = function (id) {
var patrolModelId = $('#patrolModel').val();
$.post(ext.contextPath + '/timeEfficiency/patrolPlan/edit.do', { id: id }, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
var editRouteFun = function (id, unitId) {
$.post(ext.contextPath + '/timeEfficiency/patrolPlan/editRoute.do', { id: id, unitId: unitId }, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
var issueFun = function () {
var checkedItems = $("#table").bootstrapTable('getSelections');
var datas = "";
$.each(checkedItems, function (index, item) {
datas += item.id + ",";
});
if (datas == "") {
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) {
$("#searchForm").bootstrapValidator('validate');//提交验证
if ($("#searchForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
$.post(ext.contextPath + '/timeEfficiency/patrolPlan/addTemp.do', { bizId: unitId, patrolModelId: '${PatrolModel_TempTask}', type: '${type}' }, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
}
} else {
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/issueTask.do', { ids: datas }, function (data) {
if (data.res > 0) {
showAlert('s', '成功下发' + data.res + '条任务', 'mainAlertdiv');
} else {
showAlert('d', '下发失败', 'mainAlertdiv');
}
}, 'json');
}
});
}
};
var cancelFun = function () {
var checkedItems = $("#table").bootstrapTable('getSelections');
var datas = "";
$.each(checkedItems, function (index, item) {
if (datas != "") {
datas += ",";
}
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/patrolRecord/cancelRecord.do', { ids: datas }, function (data) {
if (data > 0) {
showAlert('s', '成功撤销条' + data + '任务', 'mainAlertdiv');
} else {
showAlert('d', '撤销失败', 'mainAlertdiv');
}
});
}
});
}
};
var deletesFun = function () {
var checkedItems = $("#table").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/deletes.do', { ids: datas }, function (data) {
if (data > 0) {
$("#table").bootstrapTable('refresh');
} else {
showAlert('d', '删除失败', 'mainAlertdiv');
}
});
}
});
}
};
var setDefaultModel = function () {
var id = $("#patrolModel").val();
var text = $("#patrolModel option:selected").text();
if (id == "") {
showAlert('d', '请先选择巡检模式', 'mainAlertdiv');
} else {
swal({
text: "您确定将“" + 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/patrolModel/setDefaultModel.do', { id: id }, function (data) {
if (data.res) {
showAlert('s', '修改默认模式成功', 'mainAlertdiv');
} else {
showAlert('d', '修改默认模式失败', 'mainAlertdiv');
}
}, 'json');
}
});
}
};
var dosearch = function () {
initFun();
};
var refreshTable = function () {
$("#table").bootstrapTable('refresh');
};
//巡检模式select2 和 table刷新方法。(页面加载时table额外刷新一次)
var initFun = function () {
$.post(ext.contextPath + "/timeEfficiency/patrolModel/getPatrolModel4Select.do", { unitId: unitId, type: "${type}" }, function (data) {
//模式添加临时任务
var tempTask = {
"id": "${PatrolModel_TempTask}",
"text": "临时任务"
}
data.push(tempTask);
$("#patrolModel").empty();
$("#patrolModel").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; } // 函数用于呈现当前的选择
});
$('#searchForm').data('bootstrapValidator')
.updateStatus('patrolModel', 'NOT_VALIDATED', null)
.validateField('patrolModel');
//默认选中默认模式
var flag = false;
$.each(data, function (index, item) {
if (item.defaultFlag) {
flag = true;
$("#patrolModel").val(item.id).trigger("change");
}
})
if (!flag) {
$("#patrolModel").val('').trigger("change");
}
fixSelect2ToTool('patrolModel');
}, 'json');
}
$(function () {
initFun();
$("#searchForm").bootstrapValidator({
live: 'disabled',//验证时机enabled是内容有变化就验证默认disabled和submitted是提交再验证
fields: {
cname_input: {
validators: {
notEmpty: {
message: '公司不能为空'
}
}
},
patrolModel: {
validators: {
notEmpty: {
message: '模式不能为空'
}
}
},
}
});
//简易公司combotree
$.post(ext.contextPath + "/user/showCompanySelectTree.do", {}, function (data) {
$('#companySelectTree').html(data);
});
//巡检模式触发方法
$("#patrolModel").on("change", function (e) {
refreshTable();
});
$("#table").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/timeEfficiency/patrolPlan/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,
type: "${type}",
unitId: unitId,
//search_name: $('#search_name').val(),
patrolModelId: $('#patrolModel').val()
}
},
sortName: 'id', // 要排序的字段
sortOrder: 'desc', // 排序规则
columns: [
{
checkbox: true, // 显示一个勾选框
},
{
field: 'name', // 返回json数据中的name
title: '姓名', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '15%'
},
{
field: 'name', // 返回json数据中的name
title: '工号', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '15%',
formatter: function (value, row, index) {
if(index == 0){
return 'A00001';
}
if(index == 1){
return 'A00002';
}
}
}
,
{
field: 'name', // 返回json数据中的name
title: '部门', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '10%',
formatter: function (value, row, index) {
return '运行班';
}
}
,
{
field: 'patrolContent', // 返回json数据中的name
title: '职务', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '10%'
}
,
{
field: 'patrolAreaName', // 返回json数据中的name
title: '周期', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '10%',
formatter: function (value, row, index) {
return '季度';
}
}, {
field: 'duration', // 返回json数据中的name
title: '考核类型', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '10%',
formatter: function (value, row, index) {
return '基层考核';
}
},{
field: 'timeInterval', // 返回json数据中的name
title: '直接上级', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '10%',
formatter: function (value, row, index) {
return "李四";
}
}, {
field: 'releaseModal', // 返回json数据中的name
title: '隔级上级', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '10%',
formatter: function (value, row, index) {
return "王五";
}
},
{
title: "操作",
align: 'center',
valign: 'middle',
width: '10%',
formatter: function (value, row, index) {
var buts = '';
buts += '<button class="btn btn-default btn-sm" onclick="editFun(\'' + row.id + '\')" data-toggle="tooltip" title="编辑"><i class="fa fa-edit "></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
buts = '<div class = "btn-group">' + buts + '</div>';
return buts;
}
}
],
onLoadSuccess: function () { //加载成功时执行
adjustBootstrapTableView("table");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
})
});
</script>
</head>
<body onload="initMenu()" class="hold-transition ${cu.themeclass} sidebar-mini">
<div class="wrapper">
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<!-- Main content -->
<section class="content container-fluid">
<div id="mainAlertdiv"></div>
<div id="subDiv"></div>
<div id="subDiv_Configure"></div>
<div id="subDiv_PatroPoint"></div>
<div id="subDiv_Equipment"></div>
<form id="searchForm">
<div>
<div class="btn-group" style="width: 100%;padding-bottom:10px;">
<button type="button" id="button1" class="btn btn-primary btn-sm" onclick="choiceGenerate();"><i
class="fa fa-file-text-o"></i>
绩效方案
</button>
<button type="button" id="button2" class="btn btn-default btn-sm" onclick="choiceCheck();"><i
class="fa fa-check-square"></i>
计划编制
</button>
<button type="button" id="button3" class="btn btn-default btn-sm" onclick="choiceCheck();"><i
class="fa fa-check-square"></i>
计划审核
</button>
<button type="button" id="button4" class="btn btn-default btn-sm" onclick="choiceCheck();"><i
class="fa fa-paper-plane"></i>
计划下发
</button>
<div class="form-group pull-right form-inline">
<div class="btn-group">
<button type="button" class="btn btn-default btn-sm" onclick="addFun();"><i class="fa fa-plus"></i>
新增</button>
<button type="button" class="btn btn-default btn-sm" onclick="deletesFun();"><i class="fa fa-trash-o"></i>
删除</button>
</div>
</div>
</div>
</div>
</form>
<table id="table"></table>
<a id="report">
<p></p>
</a>
</section>
<!-- /.content -->
</div>
</div>
</body>
</html>