var compId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids(); var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids(); 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:""}]}; var level={"list":[ {value:"1",key:"公开",suggest:""}, {value:"2",key:"密件",suggest:""}]}; function initGrid(data){ g = $("#maingrid").quiGrid({ columns: [ { display: '分类', name: 'CLASSES_241', align: 'center', width: "10%" , editor: { type: 'select',data:classes,selWidth:150 },render:function (item){ for (var i = 0; i < classes["list"].length; i++) { if (classes["list"][i]['value'] == item.CLASSES_241) return classes["list"][i]['key']; } return item.CLASSES_241; } }, { display: '发文单位', name: 'DISPATCH_UNIT_241', align: 'center', width: "10%" ,editor: { type: 'text'}}, { display: '主办部门', name: 'AUSPICE_DEPT_241', align: 'center', width: "10%" ,editor: { type: 'text'}}, { display: '公文名称', name: 'DOCUMENT_NAME_241', align: 'center', width: "10%",editor: { type: 'text'} }, { display: '发文字号', name: 'DISPATCH_WORD_SIZE_241', align: 'center', width: "10%" ,editor: { type: 'text'}}, { display: '印发日期', name: 'PRINT_DATE_241', align: 'center', width: "10%" ,editor: { type: 'date',dateFmt:'yyyy-MM-dd'}}, { display: '实施日期', name: 'IMPLEMENT_DATE_241', align: 'center' , width: "10%" ,editor: { type: 'date',dateFmt:'yyyy-MM-dd'}}, { display: '保密级别', name: 'SECRECY_LEVEL_241', align: 'center', width: "10%" , editor: { type: 'select',data:level,selWidth:150 },render:function (item){ for (var i = 0; i < level["list"].length; i++) { if (level["list"][i]['value'] == item.SECRECY_LEVEL_241) return level["list"][i]['key']; } return item.SECRECY_LEVEL_241; } }, { display: '简要说明', name: 'DESCRIPTION_241', align: 'center', width: "20%" ,editor: { type: 'text'}} ], data:data, sortName : '', sortOrder : '', rownumbers:true, checkbox:true, height: 'auto', width:"100%", usePager : false, 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 PatternsDict1= new RegExp("[%@~!%#$*&',;=?$\x22]+");//特殊字符验证 var rows=g.getSelectedRows(); var rowsLength = rows.length; if (rowsLength == 0) { top.Dialog.alert("请选中要导入的信息!"); return; } var json=JSON.stringify(rows); var myobj=eval(json); for(var i=0;i20){ top.Dialog.alert("第"+fff + "行的发文单位长度超长,请检查!(20个汉字以内)"); return; }else if(PatternsDict1.test(DISPATCH_UNIT_241)){ top.Dialog.alert("第"+ fff + "行的发文单位输入不合法,请检查!(20个汉字以内)"); return; } if(AUSPICE_DEPT_241.length>20){ top.Dialog.alert("第"+fff + "行的主办部门长度超长,请检查!(20个汉字以内)"); return; }else if(PatternsDict1.test(AUSPICE_DEPT_241)){ top.Dialog.alert("第"+ fff + "行的主办部门输入不合法,请检查!(20个汉字以内)"); return; } if(DOCUMENT_NAME_241.length==0){ top.Dialog.alert("第"+ fff + "行的公文名称不能为空,请检查!"); return; }else if(DOCUMENT_NAME_241.length>20){ top.Dialog.alert("第"+fff + "行的公文名称长度超长,请检查!(20个汉字以内)"); return; }else if(PatternsDict1.test(DOCUMENT_NAME_241)){ top.Dialog.alert("第"+ fff + "行的公文名称输入不合法,请检查!(20个汉字以内)"); return; } if(DISPATCH_WORD_SIZE_241.length==0){ top.Dialog.alert("第"+ fff + "行的发文字号不能为空,请检查!"); return; }else if(DISPATCH_WORD_SIZE_241.length>20){ top.Dialog.alert("第"+fff + "行的发文字号长度超长,请检查!(20个字符以内)"); return; } if(PRINT_DATE_241.length==0){ top.Dialog.alert("第"+ fff + "行的印发日期不能为空,请检查!"); return; } if(PatternsDict.test(PRINT_DATE_241)){ }else{ top.Dialog.alert("第"+ fff + "行的印发日期不合法,请检查!"); return; } if(CLASSES_241=="2"||CLASSES_241=="3"){ if(IMPLEMENT_DATE_241.length==0){ top.Dialog.alert("第"+fff + "行的实施日期不能为空,请检查!"); return; } if(PatternsDict.test(IMPLEMENT_DATE_241)){ }else{ top.Dialog.alert("第"+fff + "行的实施日期不合法,请检查!"); return; } if(PRINT_DATE_241>IMPLEMENT_DATE_241){ top.Dialog.alert("第"+fff + "行的印发日期不能晚于实施日期,请检查!"); return; } if(SECRECY_LEVEL_241.length!=0){ top.Dialog.alert("第"+fff + "行的保密级别应该为空,请检查!"); return; } }else if(CLASSES_241=="1"){ if(IMPLEMENT_DATE_241.length!=0){ top.Dialog.alert("第"+fff + "行的实施日期应该为空,请检查!"); return; } if(SECRECY_LEVEL_241.length==0){ top.Dialog.alert("第"+fff + "行的保密级别不能为空,请检查!"); return; } } if(DESCRIPTION_241.length>300){ top.Dialog.alert("第"+fff + "行的简要说明长度超长,请检查!(长度不要超过300个中文)"); return; } } var url = $.pathname() + "/ws/DocumentExcel/DocumentExcelToDBTableTool/documentToDb"; var params = { classId : '241', compid:compId, deptId:deptId, userId:userId, json:json }; $.ajax({ url : url, type : 'post', timeout : 15000, data : params, dataType : 'json', success : function(data) { $.messager.alert('保存成功'); window.location.href="document.jsp"; }, error : function(e) { $.messager.alert('系统提示信息', '访问服务失败!', 'error'); } }); } //下模板 function xiazai(){ window.open("/nwyj/excels/documentgongwen.xls"); } //返回 function goBack() { window.location.href="document.jsp"; } $.messager = top.Dialog;