Files

502 lines
23 KiB
Plaintext
Raw Permalink Normal View History

2026-01-16 14:13:44 +08:00
<%@ 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); %>
<% request.setAttribute("Last_Day", com.sipai.entity.timeefficiency.PatrolPlan.Last_Day); %>
<!-- 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 doEditPatrolPoint = function () {
var allTableData = $("#table_patrolPoint").bootstrapTable('getData');
var patrolPointIds = "";
$.each(allTableData, function (index, item) {
if (patrolPointIds != "") {
patrolPointIds += ",";
}
patrolPointIds += item.patrolPointId;
})
$.post(ext.contextPath + '/timeEfficiency/patrolPoint/patrolPointForSelect.do', {
patrolPointIds: patrolPointIds,
bizId: '${param.bizId}', processSectionId: $('#processSectionId').val()
}, function (data) {
$("#subDiv_PatroPoint").html(data);
openModal('patroPointModal');
});
};
var doFinishSelectPatrolPoint = function (data) {
$.post(ext.contextPath + '/timeEfficiency/patrolPlan/updatePatrolPoints.do', {
patrolPlanId: '${patrolPlanId}',
patrolPointIds: data
}, function (data) {
if (data.res) {
doRefreshPatrolPoints();
}
}, 'json');
};
var doRefreshPatrolPoints = function () {
$("#table_patrolPoint").bootstrapTable('refresh');
};
function dosave() {
//保存前先赋值班组
var val = $('#_deptIds').val();
var rolestr = "";
if (val != null && val != '') {
$.each(val, function (index, value, array) {
if (rolestr != "") {
rolestr += ","
}
rolestr += value;
})
$('#deptIds').val(rolestr);//赋值班组
}
//保存前先赋值班组
var val2 = $('#patrolAreaName').val();
var rolestr2 = "";
if (val2 != null && val2 != '') {
$.each(val2, function (index, value, array) {
if (rolestr2 != "") {
rolestr2 += ","
}
rolestr2 += value;
})
$('#patrolAreaId').val(rolestr2);//赋值班组
}
$("#subForm").bootstrapValidator('validate');//提交验证
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
var param = $("#subForm").serialize() + '&releaseModal=' + releaseModal;
$.post(ext.contextPath + "/timeEfficiency/patrolPlan/save.do", param, 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: '名称不能为空'
}
}
},
duration: {
validators: {
notEmpty: {
message: '巡检时长不能为空'
}
}
},
timeInterval: {
validators: {
notEmpty: {
message: '巡检间隔不能为空'
}
}
},
patrolContent: {
validators: {
notEmpty: {
message: '巡检内容不能为空'
}
}
},
}
});
var releaseModal = '${PatrolPlan_Daily}';//默认每日下发
$(function () {
//初始化班组
refreshSelect('');
//初始化区域
refreshSelect2();
$('#colorContainer').colorpicker({format: null});
$('#sdt').timepicker({
showMeridian: false
}).on('hide', function (e) {
//当日期选择框关闭时,执行刷新校验
$('#subForm').data('bootstrapValidator')
.updateStatus('sdt', 'NOT_VALIDATED', null)
.validateField('sdt');
});
//日期格式需对齐,不然会不准
$('#edt').timepicker({
showMeridian: false
}).on('hide', function (e) {
//当日期选择框关闭时,执行刷新校验
$('#subForm').data('bootstrapValidator')
.updateStatus('edt', 'NOT_VALIDATED', null)
.validateField('edt');
});
$("#weekRegister").select2({
placeholder: '请选择',//默认文字提示
allowClear: true,//允许清空
escapeMarkup: function (markup) {
return markup;
}, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框
multiple: true,
formatResult: function formatRepo(repo) {
return repo.text;
}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo) {
return repo.text;
} // 函数用于呈现当前的选择
});
document.getElementById('weekDiv').style.display = 'none';
document.getElementById('monthDiv').style.display = 'none';
$('input[type=radio][name=optionsRadiosinline]').change(function () {
if (this.value == '${PatrolPlan_Weekly}') {
document.getElementById('weekDiv').style.display = 'block';
document.getElementById('monthDiv').style.display = 'none';
releaseModal = '${PatrolPlan_Weekly}';
} else if (this.value == '${PatrolPlan_Monthly}') {
document.getElementById('weekDiv').style.display = 'none';
document.getElementById('monthDiv').style.display = 'block';
releaseModal = '${PatrolPlan_Monthly}';
} else {
document.getElementById('weekDiv').style.display = 'none';
document.getElementById('monthDiv').style.display = 'none';
releaseModal = '${PatrolPlan_Daily}';
}
});
})
//初始化班组
function refreshSelect(groupTypeId) {
$.post(ext.contextPath + "/work/groupDetail/getlistForSelect2.do", {
unitId: unitId,
grouptype: groupTypeId
}, function (data) {
//先清空下拉选项 避免数据叠加
$("#_deptIds").empty();
//加载下拉选项
var selelct = $("#_deptIds").select2({
data: data,
placeholder: '请选择',//默认文字提示
allowClear: false,//允许清空
escapeMarkup: function (markup) {
return markup;
}, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框
multiple: true,
formatResult: function formatRepo(repo) {
return repo.text;
}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo) {
return repo.text;
} // 函数用于呈现当前的选择
});
var roleitems = new Array();
var roles = JSON.parse(decodeURIComponent('${patrolPlanDept}'));
for (var i = 0; i < roles.length; i++) {
roleitems.push(roles[i].id);
}
selelct.val(roleitems).trigger("change");
}, 'json');
};
//初始化区域
function refreshSelect2() {
$.post(ext.contextPath + "/timeEfficiency/patrolArea/getPatrolArea4Select.do", {bizId: unitId}, function (data) {
console.log(data);
// $.post(ext.contextPath + "/work/groupType/getGroupTypeTree.do", {unitId: unitId}, function (data) {
var selelct = $("#patrolAreaName").select2({
data: data,
placeholder: '请选择',//默认文字提示
allowClear: false,//允许清空
escapeMarkup: function (markup) {
return markup;
}, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框
multiple: true,
formatResult: function formatRepo(repo) {
return repo.text;
}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo) {
return repo.text;
} // 函数用于呈现当前的选择
});
var roleitems = new Array();
var roles = JSON.parse('${patrolPlanArea}');
for (var i = 0; i < roles.length; i++) {
roleitems.push(roles[i].id);
}
selelct.val(roleitems).trigger("change");
}, 'json');
};
//勾选每月最后一天
function dolastday() {
//定义一个空数组
var arr = [];
$("input[name='lastday']:checked").each(function (i) {
//把所有被选中的复选框的值存入数组
arr[i] = $(this).val();
})
if (arr != null && arr == '${Last_Day}') {
$("#monthRegister").val('${Last_Day}');
$("#monthRegister").attr("readOnly", true);//将第几天设置为不可修改
$("#lastDiv1").attr("style","display:none;");
$("#lastDiv2").attr("style","display:block;");
} else {
$("#monthRegister").attr("readOnly", false);//将第几天设置为可修改
$("#monthRegister").val(1);//设置为1号
$("#lastDiv2").attr("style","display:none;");
$("#lastDiv1").attr("style","display:block;");
}
}
var selectType = $("#sheetName").select2({minimumResultsForSearch: 10});
$.post(ext.contextPath + "/work/groupType/getGroupTypeTree.do", {unitId: unitId}, function (data) {
$("#groupTypeName").empty();
var selelct_ = $("#groupTypeName").select2({
data: data,
placeholder: '请选择',//默认文字提示
allowClear: false,//允许清空
escapeMarkup: function (markup) {
return markup;
}, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 5,//数据超过5个启用搜索框
formatResult: function formatRepo(repo) {
return repo.text;
}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo) {
return repo.text;
} // 函数用于呈现当前的选择
});
selelct_.val('${patrolPlan.groupTypeId}').trigger("change");
selelct_.on('change', function (e) {
$('#groupTypeId').val(e.target.value);
$('#deptIds').val('');
$('#_deptIds').val('');
refreshSelect(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">&times;</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>
<div class="form-group">
<input name="id" type="hidden" value="${patrolPlanId}"/>
<input name="type" type="hidden" value="${param.type}"/>
<input name="bizId" type="hidden" value="${param.bizId}"/>
<input name="unitId" type="hidden" value="${param.bizId}"/>
<input name="patrolModelId" type="hidden" value="${param.patrolModelId}"/>
<label class="col-sm-2 control-label">*巡检名称</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="name" name="name" placeholder="名称"
autocomplete="off">
</div>
<label class="col-sm-2 control-label">启用状态</label>
<div class="col-sm-4">
<select class="form-control select2" id="active" 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-4">
<input type="number" class="form-control" id="duration" name="duration" min="0" step="5"
placeholder="分钟" value="60">
</div>
<label class="col-sm-2 control-label">*巡检间隔/分钟</label>
<div class="col-sm-4">
<input type="number" class="form-control" id="timeInterval" name="timeInterval" min="0"
step="5" placeholder="分钟" value="0">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">每日起始时间</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="sdt" name="sdt" placeholder="起始时间">
</div>
<label class="col-sm-2 control-label">每日结束时间</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="edt" name="edt" placeholder="结束时间">
</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="groupTypeName" name="groupTypeName"
style="width: 100%;">
</select>
<input type="hidden" name="groupTypeId" id="groupTypeId">
</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="_deptIds" name="_deptIds" style="width: 100%;">
</select>
<input type="hidden" name="deptIds" id="deptIds" value="">
</div>
<label class="col-sm-2 control-label">任务区域</label>
<div class="col-sm-4">
<select class="form-control select2" id="patrolAreaName" name="patrolAreaName"
style="width: 100%;">
</select>
<input type="hidden" name="patrolAreaId" id="patrolAreaId" value="">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">下发方式</label>
<div class="col-sm-4">
<label class="radio-inline">
<input type="radio" name="optionsRadiosinline" id="optionsRadios1"
value="${PatrolPlan_Daily}" checked> 每日下发
</label>
<label class="radio-inline">
<input type="radio" name="optionsRadiosinline" id="optionsRadios2"
value="${PatrolPlan_Weekly}"> 每周下发
</label>
<label class="radio-inline">
<input type="radio" name="optionsRadiosinline" id="optionsRadios3"
value="${PatrolPlan_Monthly}"> 每月下发
</label>
</div>
<label class="col-sm-2 control-label">标记颜色</label>
<div class="col-sm-4">
<div class="input-group " id="colorContainer">
<input name="color" type="text" class="form-control">
<div class="input-group-addon">
<i></i>
</div>
</div>
</div>
</div>
<!--每周下发方式-->
<div class="form-group" id="weekDiv"
style="border-radius:4px;border:2px solid cadetblue;padding-top:4px;padding-bottom:4px;margin-left:4px;margin-right:4px">
<label class="col-sm-2 control-label">周间隔</label>
<div class="col-sm-2">
<input type="number" class="form-control" id="weekInterval" name="weekInterval"
placeholder="周间隔" min="0"
value="0" style="border-radius:4px;">
</select>
</div>
<label class="col-sm-1 control-label">在</label>
<div class="col-sm-7">
<select class="form-control select2" id="weekRegister" name="weekRegister"
style="width:260px;">
<option value="2">周一</option>
<option value="3">周二</option>
<option value="4">周三</option>
<option value="5">周四</option>
<option value="6">周五</option>
<option value="7">周六</option>
<option value="1">周日</option>
</select>
<label class="control-label">按住Ctrl可连续多选</label>
</div>
</div>
<!--每月下发方式-->
<div class="form-group" id="monthDiv"
style="border-radius:4px;border:2px solid rgb(204, 155, 20);padding-top:4px;padding-bottom:4px;margin-left:4px;margin-right:4px">
<label class="col-sm-2 control-label">每月第</label>
<div class="col-sm-4" id="lastDiv1">
<input type="number" class="form-control" id="monthRegister" name="monthRegister" min="1" max="28"
style="border-radius:4px;width:100%;" value="${patrolPlan.monthRegister }">
</select>
</div>
<div class="col-sm-4" id="lastDiv2" style="display: none;">
<input type="text" class="form-control"
style="border-radius:4px;width:100%;" value="最后一天" readonly>
</select>
</div>
<label class="col-sm-2 control-label" style="text-align: left">天下发</label>
<label class="col-sm-4 control-label" style="text-align: left">
<input type="checkbox" name="lastday" id="lastday" onchange="dolastday();" value="99">&nbsp;&nbsp;最后一天
</label>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">*巡检内容</label>
<div class="col-sm-10">
<textarea class="form-control" id="patrolContent" name="patrolContent" rows="3"
placeholder="名称"></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="doEditPatrolPoint()" class="btn btn-box-tool" data-toggle="tooltip" title="编辑"><i class="glyphicon glyphicon-edit"></i></a>
</div>
</div>
/.box-header
<div class="box-body ">
<table id="table_patrolPoint"></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()" id="btn_save">保存</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>