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

154 lines
5.7 KiB
Plaintext

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>节假日设置</title>
<link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
<link href="../../Scripts/bootstrap/css/bootstrap.css" rel="stylesheet" />
<link href="../../Scripts/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<link href="../../Scripts/bootstrap/css/style.min.css" rel="stylesheet" />
<script src="../../Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="../../Scripts/QueryString.js" type="text/javascript"></script>
<script src="../../Scripts/config.js" type="text/javascript"></script>
<script src="../Gener.js" type="text/javascript"></script>
<script src="../../Scripts/layui/layui/lay/modules/layer.js"></script>
<script src="../../Scripts/bootstrap/bootstrap-table/src/bootstrap-table.js"></script>
<script type="text/javascript" language="javascript">
//枚举值
if (typeof DayOfWeek == "undefined") {
var DayOfWeek = {}
DayOfWeek.Sunday = 0,
DayOfWeek.Monday = 1,
DayOfWeek.Tuesday = 2,
DayOfWeek.Wednesday = 3,
DayOfWeek.Thursday = 4,
DayOfWeek.Friday = 5,
DayOfWeek.Saturday = 6
}
$(function () {
//系统设置
var gloVar = new Entity("BP.Sys.GloVar");
gloVar.No = "Holiday";
gloVar.RetrieveFromDBSources();
//获取当前时间
var dt = new Date();
while (dt.getDay() != DayOfWeek.Sunday)
dt.setDate(dt.getDate() - 1);
var htm = "";
var idx = 0;
while (true) {
var text = getFullMonth(dt.getMonth() + 1) + "月" + getFullDay(dt.getDate()) + "日";
var id = getFullMonth(dt.getMonth() + 1) + "-" + getFullDay(dt.getDate());
var checked = "";
if (gloVar.Val.indexOf(id) >= 0)
checked = "checked='checked'";
switch (dt.getDay()) {
case DayOfWeek.Sunday:
idx++;
htm += "<tr>";
htm += "<td>" + idx + "</td>";
htm += "<td>" + (dt.getMonth() + 1) + "月</td>";
htm += "<td ><label ><input id='" + id + "' type='checkbox' name='" + id + "'" + checked + " />" + text + "</label></td>";
break;
case DayOfWeek.Saturday:
htm += "<td><label ><input id='" + id + "' type='checkbox' name='" + id + "'" + checked + " />" + text + "</label></td>";
htm += "</tr>";
break;
default:
htm += "<td><label ><input id='" + id + "' type='checkbox' name='" + id + "'" + checked + " />" + text + "</label></td>";
break;
}
if (dt.getFullYear() != new Date().getFullYear())
break;
dt.setDate(dt.getDate() + 1);
}
$("#HolidayTab").append(htm);
$("#showMsg").html("");
});
function getFullMonth(month) {
if (month >= 1 && month <= 9) {
month = "0" + month;
}
return month;
}
function getFullDay(data) {
if (data >= 0 && data <= 9) {
data = "0" + data;
}
return data;
}
function saveData() {
var str = "";
var inputArray = $("input[type='checkbox']"); //取到所有的input 并且放到一个数组中
inputArray.each(//使用数组的循环函数 循环这个input数组
function () {
var input = $(this); //循环中的每一个input元素
if (input.is(':checked')) {
str += input.attr("id") + ","; //查看循环中的每一个input的id
}
});
var gloVar = new Entity("BP.Sys.GloVar");
gloVar.No = "Holiday";
gloVar.RetrieveFromDBSources();
gloVar.Val = str;
gloVar.Holidays = str;
if (gloVar.Save()) {
layer.msg('保存成功!', { time: 2000, icon: 1, anim: 5 });
} else {
layer.msg('保存失败!', { time: 2000, icon: 2, anim: 5 });
//Reload();
}
}
/**/</script>
</head>
<body style="padding: 15px; margin: 15px;">
<form id="cc">
<div style="float: left">
<h4>&nbsp;&nbsp;&nbsp;节假日设置(请在属于节假日的日期里打勾)</h4>
</div>
<div style="float: right; padding-right:20px;">
<input type="submit" name="Btn_Save" value="保存" onclick="saveData()" id="Btn_Save" />
</div>
<table id="HolidayTab" class='table table-hover' border=0 style='width:98%;'>
<tr>
<th>序</th>
<th>月份</th>
<th>周日</th>
<th>周一</th>
<th>周二</th>
<th>周三</th>
<th>周四</th>
<th>周五</th>
<th>周六</th>
</tr>
</table>
<br />
<center><div id="showMsg"> <img src='../../Img/loading.gif' alt="" />正在加载,请稍后。。。 </div></center>
</form>
<div align="center"></div>
</body>
</html>