357 lines
16 KiB
Plaintext
357 lines
16 KiB
Plaintext
<%@ page language="java" pageEncoding="UTF-8" %>
|
||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security" %>
|
||
<script type="text/javascript">
|
||
// var showUser4SelectsFun = function () {
|
||
// var userIds = $("#schedulingEditModal #userids").val();
|
||
// $.post(ext.contextPath + '/user/userForSelect.do', { formId: "schedulingEditModal #subForm", hiddenId: "userids", textId: "username", userIds: userIds, companyId: unitId }, function (data) {
|
||
// $("#user4SelectDiv").html(data);
|
||
// openModal('user4SelectModal');
|
||
// });
|
||
// };
|
||
|
||
function doupdate() {
|
||
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) {
|
||
let nowDate = getNowTime();
|
||
if (getCompareTime('${param.datetime}', nowDate) == 1) {
|
||
// alert(document.getElementById('id').value);
|
||
$.post(ext.contextPath + "/work/scheduling/update.do", $("#schedulingEditModal #subForm").serialize(), function (data) {
|
||
if (data.res == 1) {
|
||
//$(".modal").modal("hide");
|
||
closeModal('schedulingEditModal');
|
||
$("#table").bootstrapTable('refresh');
|
||
doReloadCalendar();
|
||
} else if (data.res == 0) {
|
||
showAlert('d', '保存失败');
|
||
} else {
|
||
showAlert('d', data.res);
|
||
}
|
||
}, 'json');
|
||
} else {
|
||
alert("已发生的日期无法修改");
|
||
}
|
||
}
|
||
});
|
||
|
||
}
|
||
|
||
var workPeoples = "";
|
||
$(function () {
|
||
<%--document.getElementById("username").value = "${scheduling._usernames}";--%>
|
||
document.getElementById("date").value = "${scheduling.stdt}".substring(0, 10);
|
||
|
||
//班次类型select2
|
||
$.post(ext.contextPath + "/work/groupTime/getlistForSelect2.do", {
|
||
unitId: unitId,
|
||
grouptype: '${param.grouptype}'
|
||
}, function (data) {
|
||
//console.log("sdata", data);
|
||
var selectGroupManage = $("#schedulingEditModal #groupmanageid").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;
|
||
} // 函数用于呈现当前的选择
|
||
});
|
||
$("#groupmanageid").on("select2:select", function (e) {
|
||
//doReloadCalendar();
|
||
});
|
||
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'});//选中元素上下居中
|
||
if (data.length != 0) {
|
||
//selectGroupManage.val(data[0].id).trigger("change");//设置选中
|
||
selectGroupManage.val("${scheduling.groupmanageid}").trigger("change");//设置选中
|
||
// console.log(selectGroupManage);
|
||
// document.getElementById("groupManagename").innerHTML = $("#groupmanageid option:checked").text();
|
||
} else {
|
||
selectGroupManage.val("").trigger("change");//设置选中
|
||
}
|
||
}, 'json');
|
||
|
||
//值班班组select2
|
||
$.post(ext.contextPath + "/work/groupDetail/getlistForSelect2.do", {
|
||
grouptype: '${param.grouptype}',
|
||
unitId: unitId
|
||
}, function (data) {
|
||
// console.log("data", data);
|
||
var selectGroupDetail = $("#schedulingEditModal #groupdetailId").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;
|
||
} // 函数用于呈现当前的选择
|
||
});
|
||
$("#groupdetailId").on("select2:select", function (e) {
|
||
//doReloadCalendar();
|
||
});
|
||
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'});//选中元素上下居中
|
||
if (data.length != 0) {
|
||
<%--selectGroupDetail.val("${scheduling.groupdetailId}".split(',')).trigger("change");//设置选中--%>
|
||
selectGroupDetail.val("${scheduling.groupdetailId}").trigger("change");//设置选中
|
||
// document.getElementById("groupdetailName").innerHTML = $("#groupdetailId option:checked").text();
|
||
} else {
|
||
selectGroupDetail.val("").trigger("change");//设置选中
|
||
}
|
||
}, 'json');
|
||
|
||
//巡检模式
|
||
$.post(ext.contextPath + "/timeEfficiency/patrolModel/getPatrolModelList4Select3.do", {
|
||
type: '${param.patroltype}',
|
||
bizId: unitId
|
||
}, function (data) {
|
||
var selectpatrolmode_edit = $("#schedulingEditModal #patrolmode").select2({
|
||
data: data,
|
||
placeholder: '请选择',//默认文字提示
|
||
allowClear: false,//允许清空
|
||
escapeMarkup: function (markup) {
|
||
return markup;
|
||
}, // 自定义格式化防止xss注入
|
||
language: "zh-CN",
|
||
minimumInputLength: 0,
|
||
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
||
formatResult: function formatRepo(repo) {
|
||
// console.log("repo", repo);
|
||
return repo.text;
|
||
}, // 函数用来渲染结果
|
||
formatSelection: function formatRepoSelection(repo) {
|
||
// console.log("repo", repo);
|
||
return repo.text;
|
||
} // 函数用于呈现当前的选择
|
||
});
|
||
// $("#patrolmode").on("select2:select", function (e) {
|
||
// //doReloadCalendar();
|
||
// });
|
||
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'});//选中元素上下居中
|
||
if (data.length != 0) {
|
||
selectpatrolmode_edit.val("${scheduling.patrolmode}").trigger("change");//设置选中
|
||
} else {
|
||
selectpatrolmode_edit.val("").trigger("change");//设置选中
|
||
}
|
||
}, 'json');
|
||
|
||
//值班成员列表
|
||
workPeoples = "${scheduling.workpeople}";
|
||
var $table = $("#workPeoplesTab").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/work/scheduling/getWorkPeopleList.do', // 获取表格数据的url
|
||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||
striped: true, //表格显示条纹,默认为false
|
||
pagination: true, // 在表格底部显示分页组件,默认false
|
||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||
pageSize: 50, // 页面数据条数
|
||
pageNumber: 1, // 首页页码
|
||
paginationDetailHAlign: ' hidden',//去除分页的显示
|
||
sidePagination: 'server', // 设置为服务器端分页
|
||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||
return {
|
||
workpeopleids: workPeoples,
|
||
groupdetailId: '${scheduling.groupdetailId}'
|
||
}
|
||
},
|
||
columns: [
|
||
{
|
||
field: 'caption', // 返回json数据中的name
|
||
title: '参与人', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle' // 上下居中
|
||
},
|
||
{
|
||
field: 'job', // 返回json数据中的name
|
||
title: '职务', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle' // 上下居中
|
||
},
|
||
{
|
||
title: "操作",
|
||
align: 'center',
|
||
valign: 'middle',
|
||
width: 120, // 定义列的宽度,单位为像素px
|
||
formatter: function (value, row, index) {
|
||
var str = '';
|
||
str += '<button type="button" class="btn btn-default btn-sm" title="换班" onclick="shiftChange(\'' + row.id + '\')"><i class="fa fa-retweet"></i></button>';
|
||
str += '<button type="button" class="btn btn-default btn-sm" title="换班" onclick="workPeopleDelete(\'' + row.id + '\')"><i class="fa fa-trash-o"></i></button>';
|
||
str = '<div class="btn-group" >' + str + '</div>';
|
||
return str;
|
||
}
|
||
}
|
||
],
|
||
onLoadSuccess: function () { //加载成功时执行
|
||
adjustBootstrapTableView("workPeoplesTab");
|
||
},
|
||
onLoadError: function () { //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
});
|
||
})
|
||
|
||
var shiftChange = function (userId) {
|
||
let nowDate = getNowTime();
|
||
if (getCompareTime('${param.datetime}', nowDate) == 1) {
|
||
$.post(ext.contextPath + '/work/scheduling/showShiftChange.do', {
|
||
olduserId: userId,
|
||
grouptype: '${param.grouptype}',
|
||
oldSchedulingId: '${scheduling.id}'
|
||
}, function (data) {
|
||
$("#shiftChangeDiv").html(data);
|
||
openModal('shiftChangeModal');
|
||
});
|
||
} else {
|
||
alert("已发生的日期无法换班");
|
||
}
|
||
};
|
||
|
||
var workPeopleDelete = function (userId) {
|
||
let nowDate = getNowTime();
|
||
if (getCompareTime('${param.datetime}', nowDate) == 1) {
|
||
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 + '/work/scheduling/workPeopleDelete.do', {
|
||
userId: userId,
|
||
schedulingId: '${scheduling.id}'
|
||
}, function (data) {
|
||
workPeoples = data;
|
||
$("#workPeoplesTab").bootstrapTable('refresh');
|
||
});
|
||
}
|
||
});
|
||
|
||
} else {
|
||
alert("已发生的日期无法删除人员");
|
||
}
|
||
};
|
||
|
||
function addWorkPeople() {
|
||
let nowDate = getNowTime();
|
||
if (getCompareTime('${param.datetime}', nowDate) == 1) {
|
||
$.post(ext.contextPath + '/work/scheduling/workPeopleAdd.do', {schedulingId: '${scheduling.id}'}, function (data) {
|
||
$("#workPeopleAddDiv").html(data);
|
||
openModal('workPeopleAddModal');
|
||
});
|
||
} else {
|
||
alert("已发生的日期无法添加人员");
|
||
}
|
||
}
|
||
|
||
</script>
|
||
|
||
<div class="modal fade" id="schedulingEditModal">
|
||
<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">
|
||
<input id="id" name="id" type="hidden" value="${scheduling.id}"/>
|
||
<input id="schedulingtype" name="schedulingtype" type="hidden"
|
||
value="${scheduling.schedulingtype}"/>
|
||
<input id="bizid" name="bizid" type="hidden" value="${scheduling.bizid}"/>
|
||
<input id="date" name="date" type="hidden" value=""/>
|
||
<!-- 界面提醒div强制id为alertDiv -->
|
||
<div id="alertDiv"></div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">班次</label>
|
||
<div class="col-sm-4">
|
||
<select class="form-control select2 " id="groupmanageid" name="groupmanageid"
|
||
style="width: 170px;"></select>
|
||
</div>
|
||
<label class="col-sm-2 control-label">巡检模式</label>
|
||
<div class="col-sm-4">
|
||
<select class="form-control select2 " id="patrolmode" name="patrolmode"
|
||
style="width: 170px;"></select>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label"><span style="color:#FE0000">*</span>值班班组</label>
|
||
<div class="col-sm-4">
|
||
<select class="form-control select2 " id="groupdetailId" name="groupdetailId"
|
||
style="width:100%;"></select>
|
||
<%-- <select class="form-control select2 " id="groupdetailId" name="groupdetailId"--%>
|
||
<%-- style="width:100%;" multiple="multiple"></select>--%>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-primary" onclick="doupdate()">保存</button>
|
||
</div>
|
||
|
||
<br>
|
||
<div class="btn-group" style="width: 280px;padding-bottom:10px;">
|
||
<button type="button" class="btn btn-default btn-sm" onclick="addWorkPeople();"><i
|
||
class="fa fa-plus"></i> 新增
|
||
</button>
|
||
</div>
|
||
<table id="workPeoplesTab"></table>
|
||
|
||
</form>
|
||
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div> |