You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

321 lines
14 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>校历</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="../../static/css/font.css">
<link rel="stylesheet" href="../../static/css/weadmin.css">
<link rel="stylesheet" href="../../lib/layui/css/layui.css">
<script src="../../lib/jquery-1.12.4.min.js"></script>
<script src="../../lib/ztree/jquery.ztree.core-3.5.min.js"></script>
<!-- 让IE8/9支持媒体查询从而兼容栅格 -->
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
.font {
font-size: 18px
}
th {
height: 34px;
}
</style>
</head>
<body>
<div class="weadmin-body">
<div class="layui-form-item" id="showTitle">
</div>
<div class="layui-form-item" style="float:right">
<span id="importAcc">
<div class="layui-btn layui-btn-primary" type="button" id="prePage" onclick="prePage();">
<span class="layui-icon layui-icon-shrink-right"></span>返回
</div>
</span>
</div>
<div class="layui-form-item">
<div id="tab" style="float:left;width: 55%;"></div>
<div id="memo" style="float:left;width: 40%;margin-left: 5%"></div>
</div>
</div>
<script src="../../lib/layui/layui.js"></script>
<script src="../../lib/template.js"></script>
<script src="../../lib/base64.js"></script>
<script src="../../lib/layuiExtend.js"></script>
<script src="../../lib/JqueryExtend.js"></script>
<!--引入tip组件 -->
<link rel="stylesheet" type="text/css" href="../../lib/poshytip/tip-darkgray/tip-darkgray.css"/>
<script type="text/javascript" src="../../lib/poshytip/jquery.poshytip.min.js"></script>
<script>
//调用
var start_date = GetQueryString("ksrq");
var end_date = GetQueryString('jsrq');
//学期
var xq_id=GetQueryString("xq_id");
layui.extend({
admin: '{/}../../static/js/admin'
});
layui.use(['form', 'jquery', 'laytpl', 'admin', 'layer', 'table'], function () {
var form = layui.form,
$ = layui.jquery,
admin = layui.admin,
layer = layui.layer,
table = layui.table,
laytpl = layui.laytpl;
//提示信息
$("#showTitle").html("您正在维护的是:"+decode64(GetQueryString("xqmc"))+"校历");
//获取内容
$.ajax({
type: "GET",
async: false,
dataType: "json",
url: "/baseService/base/getXiaoLiMemo?xq_id=" + xq_id,
success: function (data) {
//设置内容
if(data.memo==="")
{
$("#memo").html("暂未配置");
}
else
{
$("#memo").html(data.memo);
}
}
});
//表头颜色
var thColor = "#278ec9";
//放假的颜色
var freeBackgroundColor = "#ffe0b3";
//鼠标经过的颜色
var mouseOverColor = "#edffc8";
//正常的背景色
var normalColor = "#ffffff";
//隔行背景色
var normalOddColor = "#eeeeee";
//小字的颜色
var smallColor = "#a52a2a";
//画表格
window.drawTable = function (startDate, endDate) {
//10列年份月份教学周星期1-7
var str = "<table width='100%' border='1' class='font'>";
//表头
str += "<th width='10%' bgcolor='" + thColor + "'><font color='#FFFFFF'>年份</font></th>";
str += "<th width='10%' bgcolor='" + thColor + "'><font color='#FFFFFF'>月份</font></th>";
str += "<th width='10%' bgcolor='" + thColor + "'><font color='#FFFFFF'>教学周</font></th>";
str += "<th width='10%' bgcolor='" + thColor + "'><font color='#FFFFFF'>一</font></th>";
str += "<th width='10%' bgcolor='" + thColor + "'><font color='#FFFFFF'>二</font></th>";
str += "<th width='10%' bgcolor='" + thColor + "'><font color='#FFFFFF'>三</font></th>";
str += "<th width='10%' bgcolor='" + thColor + "'><font color='#FFFFFF'>四</font></th>";
str += "<th width='10%' bgcolor='" + thColor + "'><font color='#FFFFFF'>五</font></th>";
str += "<th width='10%' bgcolor='" + thColor + "'><font color='#FFFFFF'>六</font></th>";
str += "<th width='10%' bgcolor='" + thColor + "'><font color='#FFFFFF'>日</font></th>";
//开始准备循环
var v_currentDate = convertStrToDate(startDate);
var v_endDate = convertStrToDate(endDate);
//行
var lines = 0;
while (true) {
//需要让几个空格出来,周一放第四个格子里,周二放第五个格子里,。。。周日放第十个格子里
if (v_currentDate <= v_endDate) {
//第几个单元格
// 是否需要填写前导的零,一般都是从1号开始或者从周一开始,注意判断两个日期是不是相等要用getTime
if (v_currentDate.getDay() == 1 || v_currentDate.getTime() == convertStrToDate(startDate).getTime()) {
str += "<tr>";
var blank_count = 0;
//周日?
if (v_currentDate.getDay() == 0) {
blank_count = 6;
} else {
blank_count = v_currentDate.getDay() - 1;
}
//写入年和月份+教学周
str += "<td align='center'>" + v_currentDate.getFullYear() + "</td>";
//计算v_currentDate+6 是不是还在这一行中?
var d = new Date(v_currentDate);
d.setDate(d.getDate() + 6);
if (d.getMonth() > v_currentDate.getMonth()) {
str += "<td align='center'>" + (v_currentDate.getMonth() + 1) + "-" + (v_currentDate.getMonth() + 2) + "</td>";
} else {
str += "<td align='center'>" + (v_currentDate.getMonth() + 1) + "</td>";
}
str += "<td align='center'>" + lines + "</td>";
lines++;
//填充空格
for (var i = 0; i < blank_count; i++) {
str += "<td></td>";
}
}
//输出当前的日期
str += "<td align='center' class='date' id='" + v_currentDate.getFullYear() + "-" + padding1((v_currentDate.getMonth() + 1), 2) + "-" + padding1(v_currentDate.getDate(), 2) + "'>" + v_currentDate.getDate() + "</td>";
//判断是不是本月最后一个日子,是否需要向后面填充空的格子
// if (getLastDay(v_currentDate.getFullYear(), v_currentDate.getMonth() + 1) == v_currentDate.getDate()) {
// //周几?
// if (v_currentDate.getDay() > 0) {
// for (var i = 0; i < 7 - v_currentDate.getDay(); i++) {
// str += "<td></td>";
// }
// }
// }
//准备下一个日期
v_currentDate.setDate(v_currentDate.getDate() + 1);
//是不是需要换行
if (v_currentDate.getDay() == 1) {
//下一行
str += "</tr>";
}
} else {
break;
}
}
//收口
str += "</table>";
return str;
};
var str = drawTable(start_date, end_date);
$("#tab").html(str);
//隔行变色
$("table tr:nth-child(odd)").css("background-color", normalOddColor);
//鼠标变色
var beforeEnterColor;
$("tr").bind("mouseover", function () {
//进去之前取出原来的颜色
beforeEnterColor = $(this).css("background-color");
//修改为新的颜色
$(this).css("background-color", mouseOverColor);
})
$("tr").bind("mouseout", function () {
$(this).css("background-color", beforeEnterColor.colorHex());
});
//绑定提示语句
window.bindTips = function (id, content) {
$("#" + id).poshytip(
{
className: 'tip-darkgray',
content: function (updateCallback) {
return content;
},
showOn: 'hover',
alignY: 'bottom',
showTimeout: 100,
}
);
};
//移除绑定
window.unbindTips = function (id) {
$("#" + id).poshytip('destroy');
};
// 设置指定td的小字
window.setSmallInfo = function (id, date, nongli, v_short, v_short_name) {
if (v_short === "" || v_short == null) {
$("#" + id).html(date + "<br><font color='#00000' size='2'>" + nongli + "</font>");
//移除绑定
unbindTips(id);
} else {
$("#" + id).html(date + "<font color='" + smallColor + "' size='1'>" + v_short + "</font>" + "<br><font color='#00000' size='2'>" + nongli + "</font>");
//绑定提示
bindTips(id, v_short_name);
}
};
//显示数据
$.ajax({
type: "GET",
async: false,
dataType: "json",
url: "/baseService/teachbase/getHoliday?start_date=" + start_date + "&end_date=" + end_date,
success: function (data) {
for (var i = 0; i < data.length; i++) {
//设置休息日的颜色
if (parseInt(data[i]["v_data"]) == 1 || parseInt(data[i]["v_data"]) == 3|| parseInt(data[i]["v_data"]) == 5) {
$("#" + data[i]["v_date_str"]).css("background-color", freeBackgroundColor);
}
//显示农历
if (data[i]["memo"] != null) {
$("#" + data[i]["v_date_str"]).html(data[i]["v_date"] + "<br><font color='#00000' size='2'>" + data[i]["memo"] + "</font>");
}
//显示小字
if (data[i]["short"] != null) {
setSmallInfo(data[i]["v_date_str"], data[i]["v_date"], data[i]["memo"], data[i]["short"], data[i]["short_memo"]);
}
}
}
});
//屏蔽鼠标右键
$('body').bind('contextmenu', function () {
return false;
});
//职务与分管工作,决定是不是可以维护,还是只能看看
$.ajax({
type: "GET",
dataType: "json",
async: false,
url: "/baseService/base/isInDutyList?ids=225,226",
success: function (data) {
if (data.success) {
//注册鼠标右键
$("td").bind("contextmenu", function () {
//返回数据:正常工作日对应结果为 0, 法定节假日对应结果为 1, 节假日调休补班对应的结果为 2休息日对应结果为 3
//扩展: 手工设置的上班结果为4手工设置的休息结果为5
if (this.className == "date") {
//做一个变色的测试//设置点击td的颜色
var data = 0;
if ($(this).css("background-color").colorHex() == freeBackgroundColor) {
data = 4;
if (parseInt($(this).parent().children()[2].innerText) % 2 == 0) {
$(this).css("background-color", normalColor);
} else {
$(this).css("background-color", normalOddColor);
}
} else {
data = 5;
$(this).css("background-color", freeBackgroundColor);
}
//保存
$.ajax({
type: "POST",
async: false,
dataType: "json",
url: "/baseService/teachbase/updateHoliday?date=" + this.id + "&data=" + data,
success: function (d) {
var message = "设置休息日成功!";
if (data == 0 || data==4) {
message = "取消休息日成功!";
}
layer.msg(message, {icon: 1, time: 1000, shade: 0.1});
}
});
}
return false;
});
//注册鼠标左键
$("td").bind("click", function () {
if (this.className == "date") {
WeAdminShow('维护', './xiaoli_oneday_update.html?date=' + this.id, 350, 240);
}
return false;
});
}
}
});
//返回
window.prePage=function () {
window.location.href = "termList.html";
}
});
</script>
</body>
</html>