// 获取表格数据
function getList(page){
page = page || 1;
var pageSize = 10, data = {
"name" : $("#name").val(),
"showTime" : $("#showTime").val(),
"pageNo" : page,
"pageSize" : pageSize
}, html = "";
$("#page, #list,#count").empty();
ajax("ajaxSearchAdResourcesOtherList.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+' | '+
''+item.downloads+' | '+
''+item.dailyActivity+' | '+
''+item.monthlyActivity+' | '+
''+item.mediaLabel.toNull()+' | '+
''+item.advertisementForm.toNull()+' | '+
''+item.systemPlatform.toNull()+' | '+
''+item.displayMode.toNull()+' | '+
''+item.cpx.toNull()+' | '+
''+item.price+' | '+
''+item.saleStatus.toString().decode("0","在售", "1","已售","")+' | '+
''+item.customer.toNull()+' | '+
''+item.remarks.toNull()+' | '+
''+
(update_flag == 1 ? '编辑 ' : '') +
(delete_flag == 1 ? '删除' : '' ) +
' | '+
'
';
});
$("#list").html(html);
$.checkbox();
$("#count").text(res.count);
$("#curOtherPage").val(page);
var newpage = new createPage(res.count, page, pageSize, 3);
$("#page").html(newpage.pageHtml);
} else {
$("#count").text(0);
$("#curOtherPage").val(page);
var newpage = new createPage(res.count, page, pageSize, 3);
$("#page").html(newpage.pageHtml);
$("#list").info("暂无数据");
}
});
}
pageGo = function(page){
getList(page);
}
// 删除单个
function delRecord(id){
confirm("确定删除该条记录吗?", function(){
ajax("del_ad_resource_other.do", {"id" : id}, function(res){
if (res.code == 1){
alert("删除成功。", 1, function(){
window.location.reload();
});
} else {
alert(res.msg);
}
});
});
}
// 导入表格数据
function importExcel(obj){
$("#otherFileForm").submit();
}
// 导入结果
function excelCallback(code, msg) {
if (code == 1) {
// 导入成功
alert("导入成功。", 1, function(){
window.location.reload();
});
} else {
// 导入失败
alert(msg, 0, function(){
location.reload();
});
}
}
// 保存网络其他资源信息
function save(){
// 得到数据
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_ad_resource_other.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 platformModfiy(act, title, id){
title = title || "";
id = id || "";
$.openWindow(act.decode("add","新增","edit","修改","")+title, "adResourcesOtherInfo.do?id="+id+"&curPage="+$("#curOtherPage").val(), 500, 470, true, null, true);
}
//确认覆盖
function confirmCallback(repeat, msg) {
if (repeat == 1){
confirm(msg, function(){
top.$("#isSure").val("sure");
top.$("#otherFileForm").submit();
});
}
}
//删除多个
function delOtherBatch(){
var arr = document.getElementsByName("chk");
var ids = "";
for (i=0; i