// 一级行业select控件初始化 var firstIndSelect = $('select[name="firstInd"]').select2({ placeholder: "请输入一级行业", allowClear: true, width:'120px', ajax:{ url: _PUBLIC_ +'ad-select/top_category_by_type.do', dataType:'json', quietMillis:100, data:function(params){ return { name : params.term, type : 0, //栏目管理 pageNo : params.page || 1, pageSize : 20 } }, processResults: function (data, params) { params.page = params.page || 1; return { results: data.results, pagination: { more: (params.page * 20) < data.total } }; }, cache: true } }); //解绑二级行业select控件初始化 $('select[name="firstInd"]').live('change',function(){ $('select[name="secondInd"]').html(''); }); // 二级行业select控件初始化 var secondIndSelect = $('select[name="secondInd"]').select2({ placeholder: "请输入二级行业", allowClear: true, width:'120px', ajax:{ url: _PUBLIC_ +'ad-select/second_category_by_type.do', dataType:'json', quietMillis:100, data:function(params){ return { name : params.term, type : 0, //栏目管理, parentName : $('#firstInd').val(), pageNo : params.page || 1, pageSize : 20 } }, processResults: function (data, params) { params.page = params.page || 1; return { results: data.results, pagination: { more: (params.page * 20) < data.total } }; }, cache: true } }); // 获取表格数据 function getList(page){ page = page || 1; var pageSize = 10, data = { "platformName" : $("#platformName").val(), "firstInd" : $("#firstInd").val(), "secondInd" : $("#secondInd").val(), "pageNo" : page, "pageSize" : pageSize }, html = ""; $("#page, #list").empty(); ajax("ajax_list.do", data, function(res){ if (res.code == 1 && res.list.records.length > 0){ $.each(res.list.records, function(index, item){ html += ''+ ''+ ''+ (item.platformName == undefined || item.platformName == null ? '' : item.platformName ) +''+ ''+(item.imgUrl ? '':' ')+''+ ''+ (item.firstInd == undefined || item.firstInd == null ? '' : item.firstInd ) +''+ ''+ (item.secondInd == undefined || item.secondInd == null ? '' : item.secondInd ) +''+ ''+ (update_flag == 1 ? '编辑  ' : '') + (delete_flag == 1 ? '删除' : '' ) + ''+ ''; }); $("#list").html(html); $.checkbox(); $("#count").text(res.list.total); var newpage = new createPage(res.list.total, page, pageSize, 3); $("#page").html(newpage.pageHtml); } else { $("#list").info("暂无数据。"); $("#count").text(0); } }); } pageGo = function(page){ resetCheckAll(); getList(page); } // 删除单个 function delRecord(id){ confirm("确定删除该条记录吗?", function(){ ajax("del.do", {"id" : id}, function(res){ if (res.code == 1){ alert("删除成功。", 1, function(){ window.location.href = "index.do"; }); } else { alert(res.msg); } }); }); } // 删除多个 function delRecordBatch(){ var arr = document.getElementsByName("chk"); var ids = ""; for (i=0; i 1){ top.alert("请上传栏目LOGO"); return false; } if (data['firstInd'].isEmpty()){ top.alert("请选择一级行业"); return false; } if (data['secondInd'].isEmpty()){ top.alert("请选择二级行业"); return false; } // 提交数据 top.ajax("save.do", data, function(res){ if (res.code == 1){ top.alert("保存成功。", 1, function(){ top.getList(1); top.$.closeWindow(); }); } else { top.alert(res.msg); } }); } // 弹窗 function platformModfiy(act, title, id){ title = title || ""; id = id || ""; $.openWindow(act.decode("add","新增","edit","修改","")+title, "detail.do?id="+id, 500, 370, true); }