// 获取表格数据-电视硬广
function getList(page){
page = page || 1;
var pageSize = 10, data = {
"name" : $("#name").val(),
"type" : $("#type option:selected").val(),
"showTime" : $("#showTime").val(),
"saleStatus" : $("#saleStatus option:selected").val(),
"pageNo" : page,
"pageSize" : pageSize
}, html = "";
$("#page, #list, #count").empty();
ajax("ajax_resource_list_by_advertise.do", data, function(res){
if (res.code == 1 && res.list.length > 0){
$.each(res.list, function(index, item){
var length = item.theaterAttribute.toNull().length;
html += '
'+
' | '+
''+item.name.toNull()+' | '+
''+item.showTime.toNull()+' | '+
''+item.type.toString().decode("1","央视", "2","卫视","3","省级地面","4","其它","") +' | '+
((length>25)?''+item.theaterAttribute.substring(0,22)+'…… | ':''+item.theaterAttribute.toNull()+' | ')+
''+(item.ratings ? item.ratings+'%' : '')+' | '+
''+(item.share ? item.share+'%' : '')+' | '+
''+item.versions+' | '+
''+item.price+' | '+
''+(item.discount ? item.discount+'%' : '')+' | '+
''+item.saleStatus.toString().decode("0","在售", "1","已售","")+' | '+
''+item.customer.toNull()+' | '+
''+item.remarks.toNull()+' | '+
''+
(update_flag == 1 ? '编辑 ' : '') +
(delete_flag == 1 ? '删除' : '' ) +
' | '+
'
';
});
$("#list").html(html);
$("#count").text(res.count);
var newpage = new createPage(res.count, page, pageSize, 3);
$("#page").html(newpage.pageHtml);
$(".table").hoverTable(true);
$.checkbox();
} else {
$("#list").info("暂无数据。");
}
});
}
pageGo = function(page){
resetCheckAll();
getList(page);
}
// 删除单个
function delAdvertise(id){
confirm("确定删除该条记录吗?", function(){
ajax("del_resource_by_advertise.do", {"id" : id}, function(res){
if (res.code == 1){
alert("删除成功。", 1, function(){
window.location.reload();
});
} else {
alert(res.msg);
}
});
});
}
//删除多个
function delRecordBatch(){
var arr = document.getElementsByName("chk");
var ids = "";
for (i=0; i 20){
top.alert("“已售客户”长度不可超过20");
return false;
}
if (!data['remarks'].isEmpty() && data['remarks'].length > 20){
top.alert("“备注”长度不可超过20");
return false;
}
// 提交数据
top.ajax("save_resource_by_advertise.do", data, function(res){
if (res.code == 1){
top.alert("保存成功。", 1, function(){
top.getList(1);
top.$.closeWindow();
});
} else {
top.alert(res.msg);
}
});
}
//确认覆盖
function confirmCallback(repeat, msg) {
if (repeat == 1){
confirm(msg, function(){
top.$("#isSure").val("sure");
top.$("#fileForm").submit();
});
}
}