//查询 function getList(page){ page = page || 1; var pageSize = 10, data = $("#tvFrom").serializeJSON(), html = ""; data['tvPlatform'] = $("#tv").val(); data['projectId'] = $("#projectId").val(); data['pageSize'] = pageSize; data['pageNo'] = page; $("#list").empty(); $("#count").text(0); $("#totalCount").text(0); $("#totalPrice").text(0); $("#extraPrice").text(0); $("#equity").text(0); $("#totalEquity").text(0); ajax("get_project_info_list.do",data,function(res){ if(res.code == 1 && res.data.length > 0){ $.each(res.data, function(index, item){ html += ''+ ''+item.tvPlatform.toNull()+''+ ''+item.periodName.toNull() +''+ ''+item.periodTime.toNull() +''+ ''+item.adVersion.toNull() +''+ ''+ item.adLength+''+ ''+ item.adPosition +''+ ''+ item.month+''+ ''+ '' + item.count + '' +''+ ''+ item.price + ''+ ''+ item.rebate + ''+ ''+ item.extraPrice + ''+ ''+ item.equity + ''+ ''+ item.totalEquity + ''+ ''+ '编辑  ' + '删除' + ''+ ''; }); $("#list").html(html); $("#count").text(res.total.count); $("#totalCount").text(res.total.totalCount); $("#totalPrice").text(res.total.price); $("#extraPrice").text(res.total.extraPrice); $("#equity").text(res.total.equity); $("#totalEquity").text(res.total.totalEquity); $("#curPage").val(page); var newpage = new createPage(res.total.count, page, pageSize, 3); $("#page").html(newpage.pageHtml); $(".table").hoverTable(true); $.checkbox(); }else{ $("#list").info("暂无信息。"); } }); } pageGo = function(page){ getList(page); } function showNumber(month, id){ $.openWindow(month+" 广告明细","project_ad_detail.do?id="+id, 790, 540, true); } function editProject(){ var data = $("#projectDetailFrom").serializeJSON(); ajax("save_project.do", data, function(res){ if(res.code == 1){ top.alert("修改成功", 1, function(){ getList(1); }) } }) } //导入表格数据 function importExcel(obj){ var url = "import_excel_for_project.do"; $("#excelInfo").attr("action",url).submit(); } function excelCallback(code, msg, projectId) { if (code == 1) { alert("导入成功。", 1, function(){ location.href = "resource_project_info.do?projectId=" + projectId; }); } else { alert(msg, 0, function(){ location.reload(); }); } } //确认覆盖 function confirmCallback(repeat, msg) { if (repeat == 1){ confirm(msg, function(){ $("#isSure").val("sure"); var url = "import_excel_for_project.do"; $("#excelInfo").attr("action",url).submit(); }); } } function delTvPlatform(){ var data = $("#tvFrom").serializeJSON(); data['tvPlatform'] = $("#tv").val(); data['projectId'] = $("#projectId").val(); confirm("您确定需要删除该电视台记录吗?",function(){ top.ajax("del_tv_platform.do",data,function(res){ if(res.code == 1){ alert("电视台删除成功。", 1, function(){ location.href = "resource_project_info.do?projectId=" + data.projectId; }); }else{ alert("删除失败"); } }); }); } // 弹窗 function projectInfoModfiy(act, title, id){ var projectId = $("#projectId").val() || ""; title = title || ""; id = id || ""; $.openWindow(act.decode("add","新增","edit","修改","")+title, "open_project_info.do?id="+id+"&projectId="+projectId+"&curPage="+$("#curPage").val(), 900, 540, true, null, true); } // 新增修改 function saveProjectDetailInfo() { var data = $('#infoForm').serializeJSON(); data.id = $.getParam("id"); data.projectId = $.getParam("projectId"); data.curPage = $.getParam("curPage"); var name = document.getElementsByName("day_"); for (var i in name) { if (!isNaN(parseInt(i))) { data["day_" + (parseInt(i) + 1)] = name[i].value; } } // 必填验证 if (data['tvPlatform'].isEmpty()){ top.alert("请输入电视台名称", 0, function(){ $("input[name='tvPlatform']").focus(); }); return ; } if (data['periodName'].isEmpty()){ top.alert("请输入时段名称", 0, function(){ $("input[name='periodName']").focus(); }); return ; } if (data['month'].isEmpty()){ top.alert("请输入月份", 0, function(){ $("input[name='month']").focus(); }); return ; } if (!isNaN(data['count'])){ if (parseInt(data['count']) < 0 || parseInt(data['count']) > 99999.999){ top.alert("数据范围错误!累计次数应为 0~99999"); return ; } }else if(isNaN(data['count'])){ top.alert("请输入累计次数"); return ; } if (!isNaN(data['price'])){ if (parseInt(data['price']) < 0 || parseInt(data['price']) > 99999.999){ top.alert("数据范围错误!刊例价应为 0~99999"); return ; } } if (!isNaN(data['rebate'])){ if (parseInt(data['rebate']) < 0 || parseInt(data['rebate']) > 99.999){ top.alert("数据范围错误!折扣应为 0~100"); return ; } } if (!isNaN(data['extraPrice'])){ if (parseInt(data['extraPrice']) < 0 || parseInt(data['extraPrice']) > 99999.999){ top.alert("数据范围错误!加价应为 0~99999"); return ; } } if (!isNaN(data['equity'])){ if (parseInt(data['equity']) < 0 || parseInt(data['equity']) > 99999.999){ top.alert("数据范围错误!净价应为 0~99999"); return ; } } if (!isNaN(data['totalEquity'])){ if (parseInt(data['totalEquity']) < 0 || parseInt(data['totalEquity']) > 99999.999){ top.alert("数据范围错误!总净价应为 0~99999"); return ; } } top.ajax("save_project_info.do", data, function(res){ if (res.code == 1){ top.alert("保存成功。", 1, function(){ if(res.curPage==1){ top.getList(1); }else { top.getList($.getParam("curPage")); } top.$.closeWindow(); }); } else { top.alert(res.msg); } }); } // 删除单个 function delProjectInfo(id){ confirm("确定删除该条记录吗?", function(){ ajax("del_project_info.do", {"id" : id}, function(res){ if (res.code == 1){ alert("删除成功。", 1, function(){ window.location.reload(); }); } else { alert(res.msg); } }); }); }