var compId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids(); var userid = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id(); var g; var classes={"list":[ {value:"1",key:"国家",suggest:""}, {value:"2",key:"地方政府",suggest:""}, {value:"3",key:"南网系统单位",suggest:""}, {value:"4",key:"分子公司",suggest:""}, {value:"5",key:"地市局",suggest:""}, {value:"6",key:"行政规章",suggest:""}]}; var level={"list":[ {value:"1",key:"一般",suggest:""}, {value:"2",key:"系统内公开",suggest:""}, {value:"3",key:"秘密",suggest:""}, {value:"4",key:"机密",suggest:""}, {value:"5",key:"绝密",suggest:""}]}; function initGrid(data){ g = $("#maingrid").quiGrid({ columns: [ { display: '文件标题', name: 'FILE_TITLE_231', align: 'center', width: "20%" ,editor: { type: 'text',maxlength:20}}, { display: '文件分类', name: 'FILE_CLASSIFY_231', align: 'center', width: "20%" , editor: { type: 'select',data:classes },render:function (item){ for (var i = 0; i < classes["list"].length; i++) { if (classes["list"][i]['value'] == item.FILE_CLASSIFY_231) return classes["list"][i]['key']; } return item.FILE_CLASSIFY_231; } }, { display: '发文日期', name: 'FILE_ADD_DATE_231', align: 'center', width: "20%" ,editor: { type: 'date',dateFmt:'yyyy-MM-dd'}}, { display: '保密等级', name: 'COLUMN_2_231', align: 'center', width: "20%" , editor: { type: 'select',data:level },render:function (item){ for (var i = 0; i < level["list"].length; i++) { if (level["list"][i]['value'] == item.COLUMN_2_231) return level["list"][i]['key']; } return item.COLUMN_2_231; } }, { display: '文件摘要', name: 'FILE_CONTENT_231', align: 'center', width: "20%" ,editor: { type: 'text',maxlength:300}} ], data:data, sortName : '', sortOrder : '', rownumbers:true, checkbox:true, // height: '100%', width:"100%", pageSize: 1000, enabledEdit: true, //编辑用 percentWidthMode:true, //顶部图标按钮栏 toolbar:{ items:[ {text: '批量保存', click: saveAll, iconClass: 'icon_add'}, { line : true } ] } }); //监听页面显示的下拉框 $("select[name=rp]").bind("change",function(){ $(parent.document.body).find("#frmright").height($(window.document.body).height()+30); }); //下拉框高度自适应 $(parent.document.body).find("#frmright").height($(window.document.body).height()+30); } function saveAll(){ var PatternsDict=/^(\d{4})-(0\d{1}|1[0-2])-(0\d{1}|[12]\d{1}|3[01])$/; var rows=g.getSelectedRows(); var rowsLength = rows.length; if (rowsLength == 0) { top.Dialog.alert("请选中要导入的信息!"); return; } // alert(JSON.stringify(rows)); var json=JSON.stringify(rows); var myobj=eval(json); //FILE_CLASSIFY_231 文件分类 //FILE_ADD_DATE_231 发文日期 //FILE_TITLE_231 文件标题 //FILE_CONTENT_231 摘要 //COLUMN_2_231 保密等级 for(var i=0;i20){ top.Dialog.alert("第"+ fff + "文件标题长度超长,请检查!(长度不要超过20个汉字)"); return; } if(FILE_CLASSIFY_231.length==0){ top.Dialog.alert("第"+ fff + "文件分类不能为空,请检查!"); return; } if(PatternsDict.test(FILE_ADD_DATE_231)){ }else{ top.Dialog.alert("第"+ fff + "行的发文日期不合法,请检查!"); return; } if(COLUMN_2_231.length==0){ top.Dialog.alert("第"+ fff + "保密等级不能为空,请检查!"); return; } if(FILE_CONTENT_231.length==0){ top.Dialog.alert("第"+ fff + "文件摘要不能为空,请检查!"); return; }else if(FILE_CONTENT_231.length>300){ top.Dialog.alert("第"+ fff + "文件摘要长度超长,请检查!(长度不要超过300个汉字)"); return; } } var url = $.pathname() + "/ws/FileEMExcel/FileEMExcelToDBTableTool/fileEMToDb"; var params = { classId : '231', compid:compId, userId:userid, json:json }; $.ajax({ url : url, type : 'post', timeout : 15000, data : params, dataType : 'json', success : function(data) { $.messager.alert('保存成功'); var url = "/nwyj/page/business/am/PPSFile/"+"FileList_EM.jsp"; top.parent.document.getElementById("frmright").setAttribute("src", ""+encodeURI(url)); }, error : function(e) { $.messager.alert('系统提示信息', '访问服务失败!', 'error'); } }); } //下模板 function xiazai(){ window.open("/nwyj/excels/fileembaogongdian.xls"); } $.messager = top.Dialog;