123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- function getList(page){
- page = page || 1;
- var type = $("#type option:selected").val();
- var pageSize = 10, data = {
- "platformName" : $("#platformName").val(),
- "type" : ( type == "" ? "" : type),
- "pageNo" : page,
- "pageSize" : pageSize
- }, html = "";
- $("#page, #list,#count").empty();
- ajax("ajax_program_schedule_list.do", data, function(res){
- if (res.code == 1 && res.list.length > 0){
- $.each(res.list, function(index, item){
- html += '<tr>'+
- '<td><input type="checkbox" class="checkbox {click:itemCheck}" name="chk" value="'+item.id+'" /><label></label></td>'+
- '<td>'+item.platformName+'</td>'+
- '<td>'+(item.updDate ? new Date(item.updDate.time).Format("yyyy年MM月dd日"):"")+'</td>'+
- '<td>'+ (item.type == 1 ? "剧编及备播" :item.type == 2 ? "剧排进程" : item.type == 3 ? "节目编排" : "-") + '</td>'+
- '<td class="nop">'+(item.imgUrl ? '<img id="'+item.imgUrl+'" src="'+item.imgUrl.toNull()+'" onclick="showimg(\''+item.imgUrl+'\')" width="98" height="58" valign="middle" onerror="this.src=\'static/img/noimg.jpg\';" />':' ')+'</td>'+
- '<td>'+(item.crtTime ? new Date(item.crtTime.time).Format("yyyy年MM月dd日 hh:mm"):"")+'</td>'+
- '<td>'+item.sortNum.toString().decode("","-",item.sortNum)+'</td>'+
- '<td><a href="'+item.associatedFile+'" style="color: #65AAFF" target="_blank">'+item.associatedFileName+'</a></td>'+
- '<td>'+item.crtUname.toString().decode("","-",item.crtUname)+'</td>'+
- '<td class="edit">'+
- (update_flag == 1 ? '<a href="javascript:platformModfiy(\'edit\',\'节目编排信息\','+item.id+');">编辑</a> ' : '<br />') +
- (delete_flag == 1 ? '<a href="javascript:delRecord('+item.id+');">删除</a>' : '<br />' ) +
- '</td>'+
- '</tr>';
- });
- $("#list").html(html);
- $.checkbox();
- $("#count").text(res.count);
- $("#curPage").val(page);
- var newpage = new createPage(res.count, page, pageSize, 3);
- $("#page").html(newpage.pageHtml);
- } else {
- $("#list").info("暂无数据。");
- }
- });
- }
- pageGo = getList;
- // 删除单个
- function delRecord(id){
- confirm("确定删除该条记录吗?", function(){
- ajax("delete_program_schedule.do", {"id" : id}, function(res){
- if (res.code == 1){
- alert("删除成功。", 1, function(){
- window.location.href = "program_schedule_list.do";
- });
- } else {
- alert(res.msg);
- }
- });
- });
- }
- // 删除多个
- function delRecordBatch(){
- var arr = document.getElementsByName("chk");
- var ids = "";
- for (i=0; i<arr.length; i++){
- if (arr[i].checked){
- ids += ("," + arr[i].value);
- }
- }
- if (ids.isEmpty()){
- alert("请至少选择一条记录");
- return false;
- }
- confirm("确定删除这些记录吗?", function(){
- ajax("batch_del_for_program_schedule.do", {"ids" : ids.substring(1,ids.length)}, function(res){
- if (res.code == 1){
- alert("删除成功。", 1, function(){
- top.getList(1);
- });
- } else {
- alert(res.msg);
- }
- });
- });
- }
- // 导入表格数据
- function importExcel(obj){
- $("#fileForm").submit();
- }
- // 导入结果
- function excelCallback(code, msg) {
- if (code == 1) {
- // 导入成功
- alert("导入成功。", 1, function(){
- location.reload();
- });
- } else {
- // 导入失败
- alert(msg);
- }
- }
- function fileCallback(code,msg,name,url){
- if (code == 1) {
- // 上传成功
- top.alert("上传成功。", 1, function(){
- window.top.minWindow.$("#fileName").text(name);
- window.top.minWindow.$("#associatedFileName").val(name);
- window.top.minWindow.$("#associatedFile").val(url);
- });
- } else {
- // 上传失败
- top.alert(msg);
- }
- }
- // 保存资源信息
- function save(){
- // 得到数据
- var data = $('#dataForm').serializeJSON();
- data.id = $.getParam("id");
- data.type = $("select[name='type']>option:selected").val();
- data.imgUrl = $("#imgUrl")[0].src;
- data.associatedFile = $("#associatedFile").val();
- data.associatedFileName = $("#associatedFileName").val();
- console.log(data);
- // 数据是否完整
- if (data['type'].isEmpty()){
- top.alert("请选择类型", 0, function(){
- $("input[name='type']").focus();
- });
- return false;
- }
- if (data['imgUrl'].isEmpty() || data['imgUrl'].indexOf("ylcm_sys") > 1){
- top.alert("请上传编排图");
- return false;
- }
- if (data['platformName'].isEmpty()){
- top.alert("请填写资源名称", 0, function(){
- $("input[name='platformName']").focus();
- });
- return false;
- }
- if (data['updDate'].isEmpty()){
- top.alert("请选择更新时间", 0, function(){
- $("input[name='updDate']").focus();
- });
- return false;
- }
- if (data['sortNum'].isEmpty()){
- top.alert("请填写排序号", 0, function(){
- $("input[name='sortNum']").focus();
- });
- return false;
- }
- if(isNaN(data['sortNum'])){
- top.alert("排序号请输入数字");
- return false;
- }
- // 提交数据
- top.ajax("save_program_schedule_info.do", data, function(res){
- if (res.code == 1){
- top.alert("保存成功。", 1, function(){
- top.getList($("#curPage").val());
- top.$.closeWindow();
- });
- } else {
- top.alert(res.msg);
- }
- });
- }
- // 弹窗
- function platformModfiy(act, title, id){
- title = title || "";
- id = id || "";
- $.openWindow(act.decode("add","新增","edit","修改","")+title, "program_schedule_info.do?id="+id, 500, 470, true);
- }
- function showimg(imgurl){
- var url = document.getElementById(imgurl).src;
- if(url!='' && url!='http://localhost:8080/ylcm_sys/static/img/noimg.jpg' && url != "http://121.41.17.212:8080/ylcm_sys/static/img/noimg.jpg"){
- var newwin=window.open();
- var w = document.documentElement.scrollWidth || document.body.scrollWidth ;
- var h = document.documentElement.scrollHeight || document.body.scrollHeight ;
- newwin.document.write("<img src="+url+" width='"+w+"' height='"+h+"' />");
- // var html = '<img src='+url+' width="480px" height="380px" />';
- // $.openWindow(" ",html,500,380,false);
- }
- }
- //确认覆盖
- function confirmCallback(repeat, msg) {
- if (repeat == 1){
- confirm(msg, function(){
- top.$("#isSure").val("sure");
- top.$("#fileForm").submit();
- });
- }
- }
|