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

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

上级 4056ec42
...@@ -29,26 +29,18 @@ layui.config({ ...@@ -29,26 +29,18 @@ layui.config({
var checkTimeList = []; var checkTimeList = [];
// 加载我的考勤班次 // 获取当前登陆人的考勤班次
showGrid({ checkWorkUtil.getCurrentUserCheckWorkTimeList(function (json) {
id: "checkTime", $("#checkTime").html(getDataUseHandlebars($("#workTimeTemplate").html(), json));
url: flowableBasePath + "checkworktime007", checkTimeList = json.rows;
params: {}, matchingLanguage();
pagination: false, form.render('select');
template: $("#workTimeTemplate").html(), // 加载工作日
ajaxSendLoadBefore: function(hdb){ loadWorkDays();
}, // 加载考勤打卡日历
ajaxSendAfter:function(json){ loadCheckWorkRl();
checkTimeList = json.rows; });
matchingLanguage();
form.render('select');
// 加载工作日
loadWorkDays();
// 加载考勤打卡日历
loadCheckWorkRl();
}
});
form.on('select(checkTime)', function (data) { form.on('select(checkTime)', function (data) {
// 重新加载今日打卡状态信息 // 重新加载今日打卡状态信息
initIsCheck(function(){ initIsCheck(function(){
...@@ -264,13 +256,13 @@ layui.config({ ...@@ -264,13 +256,13 @@ layui.config({
}); });
// 下班打卡 // 下班打卡
$("body").on("click", "#clockOutBtn", function(){ $("body").on("click", "#clockOutBtn", function () {
if(compare_HHmmss(clockOut, getHMSFormatDate())){ if (compare_HHmmss(clockOut, getHMSFormatDate())) {
var msg = '当前时间为<span class="state-down">' + getHMSFormatDate() +'</span>,确定现在打下班卡吗?'; var msg = '当前时间为<span class="state-down">' + getHMSFormatDate() + '</span>,确定现在打下班卡吗?';
layer.confirm(msg, { icon: 3, title: '下班打卡' }, function (index) { layer.confirm(msg, {icon: 3, title: '下班打卡'}, function (index) {
checkOutRequest(); checkOutRequest();
}); });
}else{ } else {
checkOutRequest(); checkOutRequest();
} }
}); });
......
...@@ -10,26 +10,19 @@ layui.config({ ...@@ -10,26 +10,19 @@ layui.config({
laydate = layui.laydate; laydate = layui.laydate;
winui.renderColor(); winui.renderColor();
showGrid({ // 获取当前登陆人的考勤班次
id: "checkTime", checkWorkUtil.getCurrentUserCheckWorkTimeList(function (json) {
url: flowableBasePath + "checkworktime007", $("#checkTime").html(getDataUseHandlebars($("#workTimeTemplate").html(), json));
params: {}, });
pagination: false, form.on('select(checkTime)', function (data) {
template: $("#workTimeTemplate").html(), calendar.fullCalendar('refetchEvents');
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(json){
initUserSchedule();
form.on('select(checkTime)', function (data) {
var value = data.value;
calendar.fullCalendar('refetchEvents');
});
}
}); });
/** /**
* 初始化日程 * 初始化日程
*/ */
var calendar; var calendar;
initUserSchedule();
function initUserSchedule(){ function initUserSchedule(){
layui.link(basePath + '../../lib/layui/lay/modules/jqueryui/jquery-ui.min.css'); layui.link(basePath + '../../lib/layui/lay/modules/jqueryui/jquery-ui.min.css');
var scheduleStartTime = laydate.render({ var scheduleStartTime = laydate.render({
...@@ -67,7 +60,6 @@ layui.config({ ...@@ -67,7 +60,6 @@ layui.config({
}); });
form.render(); form.render();
calendar = $('#scheduleCalendar').fullCalendar({ calendar = $('#scheduleCalendar').fullCalendar({
theme: true, theme: true,
header: { header: {
...@@ -128,20 +120,21 @@ layui.config({ ...@@ -128,20 +120,21 @@ layui.config({
callBack: function(refreshCode){ callBack: function(refreshCode){
if(refreshCode == '0') { if(refreshCode == '0') {
winui.window.msg('日程创建成功', { shift: 6, skin: 'msg-skin-message'}); winui.window.msg('日程创建成功', { shift: 6, skin: 'msg-skin-message'});
joinCalendar(childParams); calendar.fullCalendar('refetchEvents');
joinTodaySchedule(childParams); joinTodaySchedule(childParams);
} }
}}); }});
}, },
eventDrop: function(event, dayDelta, minuteDelta, allDay, revertFunc) {//拖动事件 eventDrop: function(event, dayDelta, revertFunc) {//拖动事件
if(allDay){ debugger
if(new Date(event.start.format("yyyy-MM-dd")) < new Date(getYMDFormatDate().replace("-", "/").replace("-", "/"))){ 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'}); winui.window.msg('即将重置的日期不能早于当前日期。', { shift: 6, skin: 'msg-skin-message'});
revertFunc(); revertFunc();
return false; return false;
} }
}else{ }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'}); winui.window.msg('即将重置的日期不能早于当前日期。', { shift: 6, skin: 'msg-skin-message'});
revertFunc(); revertFunc();
return false; return false;
...@@ -150,12 +143,12 @@ layui.config({ ...@@ -150,12 +143,12 @@ layui.config({
$('div[rowid="' + event.id + '"]').parent().remove(); $('div[rowid="' + event.id + '"]').parent().remove();
var params = { var params = {
scheduleTitle: event.title, scheduleTitle: event.title,
scheduleStartTime: event.start.format("yyyy-MM-dd hh:mm:ss"), scheduleStartTime: event.start._d.format("yyyy-MM-dd hh:mm:ss"),
scheduleEndTime: event.end.format("yyyy-MM-dd hh:mm:ss"), scheduleEndTime: event.end._d.format("yyyy-MM-dd hh:mm:ss"),
id: event.id, id: event.id,
rowId: 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){ if(json.returnCode == 0){
joinTodaySchedule(params); joinTodaySchedule(params);
}else{ }else{
...@@ -218,8 +211,7 @@ layui.config({ ...@@ -218,8 +211,7 @@ layui.config({
callBack: function(refreshCode){ callBack: function(refreshCode){
if(refreshCode == '0') { if(refreshCode == '0') {
winui.window.msg('日程创建成功', { shift: 6, skin: 'msg-skin-message'}); winui.window.msg('日程创建成功', { shift: 6, skin: 'msg-skin-message'});
joinFolderList(childParams); calendar.fullCalendar('refetchEvents');
joinCalendar(childParams);
joinTodaySchedule(childParams); joinTodaySchedule(childParams);
} }
}}); }});
...@@ -262,36 +254,6 @@ layui.config({ ...@@ -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){ function joinTodaySchedule(bean){
var day = bean.scheduleStartTime.split(' ')[0]; var day = bean.scheduleStartTime.split(' ')[0];
......
...@@ -33,6 +33,7 @@ var customerJS = { ...@@ -33,6 +33,7 @@ var customerJS = {
"threeUtil": "../../assets/lib/layui/customer/threeUtil.js", // 3D编辑器相关工具类 "threeUtil": "../../assets/lib/layui/customer/threeUtil.js", // 3D编辑器相关工具类
"reportModelTypeUtil": "../../assets/lib/layui/customer/reportModelTypeUtil.js", // 模型分类工具类 "reportModelTypeUtil": "../../assets/lib/layui/customer/reportModelTypeUtil.js", // 模型分类工具类
"schoolUtil": "../../assets/lib/layui/customer/schoolUtil.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.
先完成此消息的编辑!
想要评论请 注册