代码:
员工周计划body
{
margin: 0;
padding: 0;
font-size: 12px;
color: #555;
background-color: #fff;
}
.table-title
{
border-collapse: collapse;
width: 100%;
border: solid 1px #ddd;
font-size: 12px;
font-weight: bold;
color: #555;
}
.table-title td
{
text-align: center;
padding: 5px;
height: 25px;
}
.table-days
{
border-collapse: collapse;
width: 100%;
}
.table-days td
{
border: solid 1px #ddd;
height: 150px;
vertical-align: top;
width: 14px;
}
.td-gray
{
color: #ccc;
background-color: #f7f7f7;
}
.div-task-item
{
background-color: #bfecff;
margin-top: 2px;
padding: 2px;
height: 14px;
cursor: default;
/* margin-left: 5px;
margin-right: 5px;*/
}
.div-task-item:hover
{
background-color: #ff5588 !important;
}
.div-no-task-item
{
margin-top: 2px;
padding: 2px;
height: 14px;
}
.td-selected
{
background-color: #e0f2f8 !important;
}
.div-day-title
{
text-align: right;
padding: 3px;
}
.td-today
{
background-color: #fcd7d7;
}
.td-today div:first-child
{
border-top: solid 2px #f72f37;
padding-top: 1px;
}
.highlight-task
{
background-color: #ff3366 !important;
color: #fff !important;
}
var data = {
empCode: '101',
list: [
//说明:id暂时无用
{ id: '01', taskCode: '001', title: '任务一', content: '测试内容', year: 2016, month: 1, day: 3 },
{ id: '02', taskCode: '001', title: '任务一', content: '测试内容', year: 2016, month: 1, day: 4 },
//{ id: '02', taskCode: '001', title: '任务一', content: '测试内容', year: 2016, month: 1, day: 5 },
{ id: '03', taskCode: '002', title: '任务二', content: '测试内容', year: 2016, month: 1, day: 4 },
//{ id: '04', taskCode: '002', title: '任务二', content: '测试内容', year: 2016, month: 1, day: 5 },
{ id: '05', taskCode: '003', title: '任务三', content: '测试内容', year: 2016, month: 1, day: 5 },
{ id: '06', taskCode: '003', title: '任务三', content: '测试内容', year: 2016, month: 1, day: 6 },
{ id: '07', taskCode: '004', title: '任务四', content: '测试内容', year: 2016, month: 1, day: 6 },
{ id: '08', taskCode: '005', title: '任务五', content: '测试内容', year: 2016, month: 1, day: 6 },
{ id: '09', taskCode: '005', title: '任务五', content: '测试内容', year: 2016, month: 1, day: 7 },
{ id: '10', taskCode: '006', title: '任务六', content: '测试内容', year: 2016, month: 1, day: 7 },
//{ id: '11', taskCode: '006', title: '任务六', content: '测试内容', year: 2016, month: 1, day: 8 },
//{ id: '12', taskCode: '006', title: '任务六', content: '测试内容', year: 2016, month: 1, day: 9 },
{ id: '13', taskCode: '007', title: '任务七', content: '测试内容', year: 2016, month: 1, day: 6 },
{ id: '13', taskCode: '007', title: '任务七', content: '测试内容', year: 2016, month: 1, day: 7 },
{ id: '14', taskCode: '007', title: '任务七', content: '测试内容', year: 2016, month: 1, day: 8 },
//{ id: '15', taskCode: '008', title: '任务八', content: '测试内容', year: 2016, month: 1, day: 6 },
//{ id: '15', taskCode: '008', title: '任务八', content: '测试内容', year: 2016, month: 1, day: 7 },
{ id: '15', taskCode: '008', title: '任务八', content: '测试内容', year: 2016, month: 1, day: 8 },
{ id: '15', taskCode: '008', title: '任务八', content: '测试内容', year: 2016, month: 1, day: 9 },
{ id: '15', taskCode: '009', title: '任务九', content: '测试内容', year: 2016, month: 1, day: 4 },
{ id: '15', taskCode: '009', title: '任务九', content: '测试内容', year: 2016, month: 1, day: 5 },
{ id: '15', taskCode: '010', title: '任务十', content: '测试内容', year: 2016, month: 1, day: 10 },
{ id: '15', taskCode: '010', title: '任务十', content: '测试内容', year: 2016, month: 1, day: 9 },
{ id: '15', taskCode: '011', title: '任务十一', content: '测试内容', year: 2015, month: 12, day: 31 },
{ id: '15', taskCode: '011', title: '任务十一', content: '测试内容', year: 2016, month: 1, day: 1 },
{ id: '15', taskCode: '011', title: '任务十一', content: '测试内容', year: 2016, month: 1, day: 2 },
{ id: '15', taskCode: '011', title: '任务十一', content: '测试内容', year: 2016, month: 1, day: 3 }
]
};
var taskCodeList = new Array();
function createTaskCodeList(data, taskCodeList) {
for (var i = 0; i < data.list.length; i++) {
var bl = true;
for (var j = 0; j < taskCodeList.length; j++) {
if (taskCodeList[j] == data.list[i].taskCode) {
bl = false;
}
}
if (bl) {
taskCodeList.push(data.list[i].taskCode);
}
}
}
createTaskCodeList(data, taskCodeList);
$(function () {
$(".table-days").parent().height($(window).height() - $(".table-days").parent().position().top - 10);
$("#year").change(function () {
var year = $("#year").val();
var month = $("#month").val();
createPlanTable(year, month);
});
$("#month").change(function () {
var year = $("#year").val();
var month = $("#month").val();