// 获取表格数据 function getAppList(page){ page = page || 1; var pageSize = 10, data = { "name" : $("#appName").val(), "showTime" : $("#appShowTime").val(), "pageNo" : page, "pageSize" : pageSize }, html = ""; $("#appPage, #appList,#appCount").empty(); ajax("ajax_resource_app_list.do", data, function(res){ if (res.code == 1 && res.list.length > 0){ $.each(res.list, function(index, item){ html += ''+ ''+ ''+item.name.toNull()+''+ ''+item.showTime.toNull()+''+ ''+item.registeredUser.toString().decode("0","-",item.registeredUser)+''+ ''+item.downloads.toString().decode("0","-",item.downloads)+''+ ''+item.dailyActivity.toString().decode("0","-",item.dailyActivity)+''+ ''+item.monthlyActivity.toString().decode("0","-",item.monthlyActivity)+''+ ''+item.mediaLabel.toString().decode("","-",item.mediaLabel)+''+ ''+item.advertisementForm.toString().decode("","-",item.advertisementForm)+''+ ''+item.systemPlatform.toString().decode("","-",item.systemPlatform)+''+ ''+item.displayMode.toString().decode("","-",item.displayMode)+''+ ''+item.cpx.toString().decode("","-",item.cpx)+''+ ''+item.price+''+ ''+item.saleStatus.toString().decode("0","在售", "1","已售","")+''+ ''+item.customer.toString().decode("","-",item.customer)+''+ ''+item.remarks.toString().decode("","-",item.remarks)+''+ ''+ (update_flag == 1 ? '编辑  ' : '') + (delete_flag == 1 ? '删除' : '' ) + ''+ ''; }); $("#appList").html(html); $.checkbox(); $("#appCount").text(res.count); $("#curAppPage").val(page); var newpage = new createPage(res.count, page, pageSize, 3); $("#appPage").html(newpage.pageHtml); } else { $("#appList").info("暂无数据"); } }); } pageGo = function(page){ resetCheckAll(); getAppList(page); } // 删除单个 function delRecord(id){ confirm("确定删除该条记录吗?", function(){ ajax("delete_resource_app.do", {"id" : id}, function(res){ if (res.code == 1){ alert("删除成功。", 1, function(){ window.location.reload(); }); } else { alert(res.msg); } }); }); } // 导入表格数据 function importAppExcel(obj){ $("#appFileForm").submit(); } // 导入结果 function excelCallback(code, msg) { if (code == 1) { // 导入成功 alert("导入成功。", 1, function(){ location.reload(); }); } else { // 导入失败 alert(msg, 0, function(){ location.reload(); }); } } // 保存App资源信息 function saveApp(){ // 得到数据 var data = $('#dataForm').serializeJSON(); data.id = $.getParam("id"); // 数据是否完整 if (data['name'].isEmpty()){ top.alert("请输入资源名称", 0, function(){ $("input[name='name']").focus(); }); return; } if (data['showTime'].isEmpty()){ top.alert("请输入时间", 0, function(){ $("input[name='showTime']").focus(); }); return; } if (!isNaN(data['registeredUser'])){ if (parseInt(data['registeredUser']) < 0 || parseInt(data['registeredUser']) > 99999.999){ top.alert("数据范围错误!注册用户应为 0~99999.999"); return; } }else if(isNaN(data['registeredUser'])){ top.alert("注册用户请输入数字"); return; } if (!isNaN(data['downloads'])){ if (parseInt(data['downloads']) < 0 || parseInt(data['downloads']) > 99999.999){ top.alert("数据范围错误!下载量应为 0~99999.999"); return; } }else if(isNaN(data['downloads'])){ top.alert("下载量请输入数字"); return; } if (!isNaN(data['dailyActivity'])){ if (parseInt(data['dailyActivity']) < 0 || parseInt(data['dailyActivity']) > 99999.999){ top.alert("数据范围错误!日活应为 0~99999.999"); return; } }else if(isNaN(data['dailyActivity'])){ top.alert("日活请输入数字"); return; } if (!isNaN(data['monthlyActivity'])){ if (parseInt(data['monthlyActivity']) < 0 || parseInt(data['monthlyActivity']) > 99999.999){ top.alert("数据范围错误!月活应为 0~99999.999"); return; } }else if(isNaN(data['monthlyActivity'])){ top.alert("月活请输入数字"); return; } if (data['price'].isEmpty()){ top.alert("请输入刊例价格", 0, function(){ $("input[name='price']").focus(); }); return; } if(isNaN(data['price'])){ top.alert("刊例价铬请输入数字"); return; } if (!isNaN(data['price'])){ if (parseInt(data['price']) < 0 || parseInt(data['price']) > 99999999.99){ top.alert("数据范围错误!刊例价格应为 0~99999999.99"); return; } } if(!document.getElementById("saleStatus1").checked&& !document.getElementById("saleStatus2").checked){ top.alert("请选择售卖状态") return; } // 提交数据 top.ajax("save_resource_app_info.do", data, function(res){ if (res.code == 1){ top.alert("保存成功。", 1, function(){ if(res.curPage==1){ top.getAppList(1); }else { top.getAppList($.getParam("curPage")); } top.$.closeWindow(); }); } else { top.alert(res.msg); } }); } // 弹窗 function platformModfiy(act, title, id){ title = title || ""; id = id || ""; $.openWindow(act.decode("add","新增","edit","修改","")+title, "ad_resources_app_info.do?id="+id+"&curPage="+$("#curAppPage").val(), 500, 470, true, null, true); } //确认覆盖 function confirmCallback(repeat, msg) { if (repeat == 1){ confirm(msg, function(){ top.$("#isSure").val("sure"); top.$("#appFileForm").submit(); }); } } //删除多个 function delAppBatch(){ var arr = document.getElementsByName("chk"); var ids = ""; for (i=0; i