193 lines
8.7 KiB
Plaintext
193 lines
8.7 KiB
Plaintext
<%@ 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" %>
|
||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security" %>
|
||
|
||
<%@page import="com.sipai.entity.work.Scheduling" %>
|
||
<% request.setAttribute("IsTypeSetting_False", Scheduling.IsTypeSetting_False); %>
|
||
<% request.setAttribute("IsTypeSetting_True", Scheduling.IsTypeSetting_True); %>
|
||
|
||
<script type="text/javascript">
|
||
var workPeoples = "";
|
||
var ckschedulingId = "";
|
||
var nowGroupDetailId = "";
|
||
$(function () {
|
||
inShiftChangeTab();
|
||
let nowTime = getNowTime();
|
||
$('#shiftChangeDate').datepicker({
|
||
format: 'yyyy-mm-dd',
|
||
weekStart: 1,
|
||
autoclose: true,
|
||
startView: '0',
|
||
startDate: getPlusTime(nowTime,"1","day").substring(0,10),
|
||
// minViewMode: '0',
|
||
// maxViewMode: '0',
|
||
forceParse: false,
|
||
language: 'zh-CN'
|
||
}).on('changeDate', changeDate);
|
||
});
|
||
|
||
function changeDate() {
|
||
$("#shiftChangeDetail").html("");
|
||
workPeoples = "";
|
||
$("#shiftChangeTab").bootstrapTable('refresh')
|
||
$.post(ext.contextPath + '/work/scheduling/getlist.do', {
|
||
bizid: unitId,
|
||
schedulingtype: '${param.grouptype}',
|
||
date: $('#shiftChangeDate').val(),
|
||
isTypeSetting: '${IsTypeSetting_True}'
|
||
}, function (data) {
|
||
if (data.rows.length > 0) {
|
||
let result = data.rows;
|
||
// console.log(result)
|
||
var dataTextalign = [];
|
||
for (let i = 0; i < result.length; i++) {
|
||
dataTextalign.push({
|
||
id: result[i].id,
|
||
text: result[i]._groupTimename + " " + result[i]._groupDetailName
|
||
})
|
||
}
|
||
var selectTextalign = $("#shiftChangeDetail").select2({
|
||
data: dataTextalign,
|
||
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;
|
||
} // 函数用于呈现当前的选择
|
||
});
|
||
selectTextalign.val('').trigger("change");//设置选中
|
||
$("#shiftChangeDetail").on("select2:select", function () {
|
||
var schedulingId = $(this).val();
|
||
$.post(ext.contextPath + '/work/scheduling/getScheduling.do', {schedulingId: schedulingId}, function (scheduling) {
|
||
// console.log(scheduling);
|
||
//值班成员列表
|
||
workPeoples = scheduling.workpeople;
|
||
ckschedulingId = schedulingId;
|
||
nowGroupDetailId = scheduling.groupdetailId;
|
||
$("#shiftChangeTab").bootstrapTable('refresh');
|
||
|
||
}, 'json');
|
||
})
|
||
}
|
||
}, 'json');
|
||
}
|
||
|
||
function inShiftChangeTab() {
|
||
$("#shiftChangeTab").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: nowGroupDetailId
|
||
}
|
||
},
|
||
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="doShiftChange(\'' + row.id + '\',\'' + row.groupDetailChangeSt + '\')"><i class="fa fa-retweet"></i></button>';
|
||
str = '<div class="btn-group" >' + str + '</div>';
|
||
return str;
|
||
}
|
||
}
|
||
],
|
||
onLoadSuccess: function () { //加载成功时执行
|
||
adjustBootstrapTableView("shiftChangeTab");
|
||
},
|
||
onLoadError: function () { //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
});
|
||
}
|
||
|
||
function doShiftChange(ckuserId,groupDetailChangeSt) {
|
||
let olduserId = '${param.olduserId}';
|
||
let oldSchedulingId = '${param.oldSchedulingId}';
|
||
// console.log(olduserId)
|
||
// console.log(oldSchedulingId)
|
||
// console.log(ckuserId)
|
||
// console.log(ckschedulingId)
|
||
$.post(ext.contextPath + '/work/scheduling/doShiftChange.do', {olduserId: olduserId,oldSchedulingId: oldSchedulingId,ckuserId: ckuserId,ckschedulingId: ckschedulingId,groupDetailChangeSt:groupDetailChangeSt}, function (data) {
|
||
closeModal('shiftChangeModal');
|
||
closeModal('schedulingEditModal');
|
||
doReloadCalendar();
|
||
});
|
||
|
||
|
||
}
|
||
|
||
</script>
|
||
|
||
<div class="modal fade" id="shiftChangeModal">
|
||
<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="shiftChangeForm">
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">换班日期</label>
|
||
<div class="col-sm-4">
|
||
<input class="form-control date-picker" id="shiftChangeDate" name="shiftChangeDate"
|
||
autocomplete="off" type="text"
|
||
placeholder="点击选择" value="" readonly/>
|
||
</div>
|
||
<label class="col-sm-2 control-label">换班班组</label>
|
||
<div class="col-sm-4">
|
||
<select class="form-control select2 " id="shiftChangeDetail" name="shiftChangeDetail"
|
||
style="width: 170px;"></select>
|
||
</div>
|
||
</div>
|
||
|
||
<table id="shiftChangeTab"></table>
|
||
|
||
</form>
|
||
|
||
<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>
|
||
</div> |