提交 ea067446 编写于 作者: Skyeye云's avatar Skyeye云

解决新增日程无法自动加载的问题

上级 4056ec42
......@@ -29,26 +29,18 @@ layui.config({
var checkTimeList = [];
// 加载我的考勤班次
showGrid({
id: "checkTime",
url: flowableBasePath + "checkworktime007",
params: {},
pagination: false,
template: $("#workTimeTemplate").html(),
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(json){
checkTimeList = json.rows;
matchingLanguage();
form.render('select');
// 加载工作日
loadWorkDays();
// 加载考勤打卡日历
loadCheckWorkRl();
}
});
// 获取当前登陆人的考勤班次
checkWorkUtil.getCurrentUserCheckWorkTimeList(function (json) {
$("#checkTime").html(getDataUseHandlebars($("#workTimeTemplate").html(), json));
checkTimeList = json.rows;
matchingLanguage();
form.render('select');
// 加载工作日
loadWorkDays();
// 加载考勤打卡日历
loadCheckWorkRl();
});
form.on('select(checkTime)', function (data) {
// 重新加载今日打卡状态信息
initIsCheck(function(){
......@@ -264,13 +256,13 @@ layui.config({
});
// 下班打卡
$("body").on("click", "#clockOutBtn", function(){
if(compare_HHmmss(clockOut, getHMSFormatDate())){
var msg = '当前时间为<span class="state-down">' + getHMSFormatDate() +'</span>,确定现在打下班卡吗?';
layer.confirm(msg, { icon: 3, title: '下班打卡' }, function (index) {
$("body").on("click", "#clockOutBtn", function () {
if (compare_HHmmss(clockOut, getHMSFormatDate())) {
var msg = '当前时间为<span class="state-down">' + getHMSFormatDate() + '</span>,确定现在打下班卡吗?';
layer.confirm(msg, {icon: 3, title: '下班打卡'}, function (index) {
checkOutRequest();
});
}else{
} else {
checkOutRequest();
}
});
......
......@@ -10,26 +10,19 @@ layui.config({
laydate = layui.laydate;
winui.renderColor();
showGrid({
id: "checkTime",
url: flowableBasePath + "checkworktime007",
params: {},
pagination: false,
template: $("#workTimeTemplate").html(),
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(json){
initUserSchedule();
form.on('select(checkTime)', function (data) {
var value = data.value;
calendar.fullCalendar('refetchEvents');
});
}
// 获取当前登陆人的考勤班次
checkWorkUtil.getCurrentUserCheckWorkTimeList(function (json) {
$("#checkTime").html(getDataUseHandlebars($("#workTimeTemplate").html(), json));
});
form.on('select(checkTime)', function (data) {
calendar.fullCalendar('refetchEvents');
});
/**
* 初始化日程
*/
var calendar;
initUserSchedule();
function initUserSchedule(){
layui.link(basePath + '../../lib/layui/lay/modules/jqueryui/jquery-ui.min.css');
var scheduleStartTime = laydate.render({
......@@ -67,7 +60,6 @@ layui.config({
});
form.render();
calendar = $('#scheduleCalendar').fullCalendar({
theme: true,
header: {
......@@ -128,20 +120,21 @@ layui.config({
callBack: function(refreshCode){
if(refreshCode == '0') {
winui.window.msg('日程创建成功', { shift: 6, skin: 'msg-skin-message'});
joinCalendar(childParams);
calendar.fullCalendar('refetchEvents');
joinTodaySchedule(childParams);
}
}});
},
eventDrop: function(event, dayDelta, minuteDelta, allDay, revertFunc) {//拖动事件
if(allDay){
if(new Date(event.start.format("yyyy-MM-dd")) < new Date(getYMDFormatDate().replace("-", "/").replace("-", "/"))){
eventDrop: function(event, dayDelta, revertFunc) {//拖动事件
debugger
if(event.allDay){
if(new Date(event.start._d.format("yyyy-MM-dd")) < new Date(getYMDFormatDate().replace("-", "/").replace("-", "/"))){
winui.window.msg('即将重置的日期不能早于当前日期。', { shift: 6, skin: 'msg-skin-message'});
revertFunc();
return false;
}
}else{
if(event.start < new Date(getFormatDate().replace("-", "/").replace("-", "/"))){
if(event.start._d < new Date(getFormatDate().replace("-", "/").replace("-", "/"))){
winui.window.msg('即将重置的日期不能早于当前日期。', { shift: 6, skin: 'msg-skin-message'});
revertFunc();
return false;
......@@ -150,12 +143,12 @@ layui.config({
$('div[rowid="' + event.id + '"]').parent().remove();
var params = {
scheduleTitle: event.title,
scheduleStartTime: event.start.format("yyyy-MM-dd hh:mm:ss"),
scheduleEndTime: event.end.format("yyyy-MM-dd hh:mm:ss"),
scheduleStartTime: event.start._d.format("yyyy-MM-dd hh:mm:ss"),
scheduleEndTime: event.end._d.format("yyyy-MM-dd hh:mm:ss"),
id: event.id,
rowId: event.id
};
AjaxPostUtil.request({url:reqBasePath + "syseveschedule005", params:params, type: 'json', callback: function(json){
AjaxPostUtil.request({url:reqBasePath + "syseveschedule005", params: params, type: 'json', callback: function(json){
if(json.returnCode == 0){
joinTodaySchedule(params);
}else{
......@@ -218,8 +211,7 @@ layui.config({
callBack: function(refreshCode){
if(refreshCode == '0') {
winui.window.msg('日程创建成功', { shift: 6, skin: 'msg-skin-message'});
joinFolderList(childParams);
joinCalendar(childParams);
calendar.fullCalendar('refetchEvents');
joinTodaySchedule(childParams);
}
}});
......@@ -262,36 +254,6 @@ layui.config({
});
});
//加入日程日历
function joinCalendar(bean){
var eventObj = new Object();
//构造每一个日历记录
eventObj.id = bean.id;
eventObj.title = bean.scheduleTitle;
eventObj.start = new Date(bean.scheduleStartTime);
eventObj.end = new Date(bean.scheduleEndTime);
eventObj.showBg = '1';
if(bean.type == '1'){//个人
eventObj.backgroundColor = '#63B8FF';
}else if(bean.type == '2'){//工作
eventObj.backgroundColor = '#CD69C9';
}else if(bean.type == '3'){//节假日
eventObj.backgroundColor = '#54FF9F';
}else if(bean.type == '4'){//生日
eventObj.backgroundColor = '#FF0000';
}else if(bean.type == '5'){//自定义
eventObj.backgroundColor = '#ADADAD';
}
var arr = [];
eventObj.className = arr;
if(bean.allDay == '1'){
eventObj.allDay = true;
}else{
eventObj.allDay = false;
}
calendar.fullCalendar('renderEvent', eventObj, true);
}
//加入今日日程
function joinTodaySchedule(bean){
var day = bean.scheduleStartTime.split(' ')[0];
......
......@@ -33,6 +33,7 @@ var customerJS = {
"threeUtil": "../../assets/lib/layui/customer/threeUtil.js", // 3D编辑器相关工具类
"reportModelTypeUtil": "../../assets/lib/layui/customer/reportModelTypeUtil.js", // 模型分类工具类
"schoolUtil": "../../assets/lib/layui/customer/schoolUtil.js", // 学校模块工具类
"checkWorkUtil": "../../assets/lib/layui/customer/checkWorkUtil.js", // 考勤模块工具类
};
//系统基础信息
......
// 考勤相关工具类
var checkWorkUtil = {
/**
* 获取当前登陆人的考勤班次
*
* @param callback 回执函数
*/
getCurrentUserCheckWorkTimeList: function (callback){
AjaxPostUtil.request({url: flowableBasePath + "checkworktime007", params: {}, type: 'json', method: "GET", callback: function(json) {
if(json.returnCode == 0) {
if(typeof(callback) == "function") {
callback(json);
}
} else {
winui.window.msg(json.returnMessage, {icon: 2, time: 2000});
}
}, async: false});
},
};
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册