/** * Created by bcxin on 2017/1/14. */ $(document).ready(function(){ //限制字符个数 $(".text_overflow").each(function(){ var maxwidth=22; if($(this).text().length>maxwidth){ $(this).text($(this).text().substring(0,maxwidth)); $(this).html($(this).html()+'...'); } }); //点击删除 var ind=""; $("tbody").on("click","i",function(){ ind=$(this).parent().parent().parent().index(); ind++; }); $(".modal-footer").on("click",".sure",function(){ $("tbody tr:nth-child("+ind+")").remove(); }) $("tbody").on("mouseenter","td.col-xs-1 b",function(){ var height=parseFloat($(this).parent().parent().css("height"))-parseFloat($(this).css("height")); var top=parseFloat($(this).css("top")); if(top!=(height/2)) { $(this).css("top", height / 2 + "px"); $(this).parent().siblings("a").find("i").css("top", height / 2 + "px"); } }) $("tbody td.col-xs-1 b").trigger("mouseenter"); }); getTaskTypeList(); search(); function search(){ $('#pageNum').val("0"); getPersonListForPage("taskForm","taskArea"); } function choiseTaskType(){ var taskType = $("#type").val(); if(taskType == "2"){ $("#isRepeat").val(""); $("#isRepeat").attr("disabled",true); }else{ $("#isRepeat").attr("disabled",false); } } function initPage(){ var totalCount = Number($('#totalCount').val()) || 0; var showCount = $('#showCount').val() || 5; var limit = Number($('#numPerPage').val()) || 8; $('#callBackPager').extendPagination({ totalCount: totalCount, showCount: showCount, showPage:5, limit: limit, callback: function (curr, limit, totalCount) { $('#pageNum').val(Number($('#pageNum').val())-1); getPersonListForPage("taskForm","taskArea"); } }); } function getPersonListForPage(formId,contentId){ var index = parent.layer.load(0, {shade: [0.3,'#808080']}); var data=$("#"+formId).serialize(); $.ajax({ type : 'POST', url : restHost + "task/searchForManage.json", data : $("#"+formId).serialize(), dataType : "json", success : function(json) { if (json.successful == true || json.successful == "true") { $('#totalCount').val(json.data.totalCount); $("#"+contentId).empty(); var taskList = json.data.data; if(taskList.length>0){ $.each(taskList,function(index, obj) { var taskHtml = ""; var isrepeat = ""; if(obj.taskType.id != "2"){ isrepeat = obj.repeat ? "固定班次":"排班制"; } taskHtml = taskHtml + '
" + TaskTime + "
" taskHtml = taskHtml + '' + obj.address + '