c53ab0c58904aebfc2fb18d965c186cb83723318.svn-base 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. var compId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  2. var userid = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  3. var g;
  4. var classes={"list":[
  5. {value:"1",key:"国家",suggest:""},
  6. {value:"2",key:"地方政府",suggest:""},
  7. {value:"3",key:"南网系统单位",suggest:""},
  8. {value:"4",key:"分子公司",suggest:""},
  9. {value:"5",key:"地市局",suggest:""},
  10. {value:"6",key:"行政规章",suggest:""}]};
  11. var level={"list":[
  12. {value:"1",key:"一般",suggest:""},
  13. {value:"2",key:"系统内公开",suggest:""},
  14. {value:"3",key:"秘密",suggest:""},
  15. {value:"4",key:"机密",suggest:""},
  16. {value:"5",key:"绝密",suggest:""}]};
  17. function initGrid(data){
  18. g = $("#maingrid").quiGrid({
  19. columns: [
  20. { display: '文件标题', name: 'FILE_TITLE_231', align: 'center', width: "20%" ,editor: { type: 'text',maxlength:20}},
  21. { display: '文件分类', name: 'FILE_CLASSIFY_231', align: 'center', width: "20%" ,
  22. editor: { type: 'select',data:classes },render:function (item){
  23. for (var i = 0; i < classes["list"].length; i++)
  24. {
  25. if (classes["list"][i]['value'] == item.FILE_CLASSIFY_231)
  26. return classes["list"][i]['key'];
  27. }
  28. return item.FILE_CLASSIFY_231;
  29. }
  30. },
  31. { display: '发文日期', name: 'FILE_ADD_DATE_231', align: 'center', width: "20%" ,editor: { type: 'date',dateFmt:'yyyy-MM-dd'}},
  32. { display: '保密等级', name: 'COLUMN_2_231', align: 'center', width: "20%" ,
  33. editor: { type: 'select',data:level },render:function (item){
  34. for (var i = 0; i < level["list"].length; i++)
  35. {
  36. if (level["list"][i]['value'] == item.COLUMN_2_231)
  37. return level["list"][i]['key'];
  38. }
  39. return item.COLUMN_2_231;
  40. }
  41. },
  42. { display: '文件摘要', name: 'FILE_CONTENT_231', align: 'center', width: "20%" ,editor: { type: 'text',maxlength:300}}
  43. ],
  44. data:data,
  45. sortName : '',
  46. sortOrder : '',
  47. rownumbers:true,
  48. checkbox:true,
  49. // height: '100%',
  50. width:"100%",
  51. pageSize: 1000,
  52. enabledEdit: true, //编辑用
  53. percentWidthMode:true,
  54. //顶部图标按钮栏
  55. toolbar:{
  56. items:[
  57. {text: '批量保存', click: saveAll, iconClass: 'icon_add'},
  58. { line : true }
  59. ]
  60. }
  61. });
  62. //监听页面显示的下拉框
  63. $("select[name=rp]").bind("change",function(){
  64. $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  65. });
  66. //下拉框高度自适应
  67. $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  68. }
  69. function saveAll(){
  70. var PatternsDict=/^(\d{4})-(0\d{1}|1[0-2])-(0\d{1}|[12]\d{1}|3[01])$/;
  71. var rows=g.getSelectedRows();
  72. var rowsLength = rows.length;
  73. if (rowsLength == 0) {
  74. top.Dialog.alert("请选中要导入的信息!");
  75. return;
  76. }
  77. // alert(JSON.stringify(rows));
  78. var json=JSON.stringify(rows);
  79. var myobj=eval(json);
  80. //FILE_CLASSIFY_231 文件分类
  81. //FILE_ADD_DATE_231 发文日期
  82. //FILE_TITLE_231 文件标题
  83. //FILE_CONTENT_231 摘要
  84. //COLUMN_2_231 保密等级
  85. for(var i=0;i<myobj.length;i++){
  86. var FILE_CLASSIFY_231 = myobj[i].FILE_CLASSIFY_231;
  87. var FILE_ADD_DATE_231 = myobj[i].FILE_ADD_DATE_231;
  88. var FILE_TITLE_231 = myobj[i].FILE_TITLE_231;
  89. var FILE_CONTENT_231 = myobj[i].FILE_CONTENT_231;
  90. var COLUMN_2_231 = myobj[i].COLUMN_2_231;
  91. var fff =1;
  92. fff = fff+i;
  93. if(FILE_TITLE_231.length==0){
  94. top.Dialog.alert("第"+ fff + "文件标题不能为空,请检查!");
  95. return;
  96. }else if(FILE_TITLE_231.length>20){
  97. top.Dialog.alert("第"+ fff + "文件标题长度超长,请检查!(长度不要超过20个汉字)");
  98. return;
  99. }
  100. if(FILE_CLASSIFY_231.length==0){
  101. top.Dialog.alert("第"+ fff + "文件分类不能为空,请检查!");
  102. return;
  103. }
  104. if(PatternsDict.test(FILE_ADD_DATE_231)){
  105. }else{
  106. top.Dialog.alert("第"+ fff + "行的发文日期不合法,请检查!");
  107. return;
  108. }
  109. if(COLUMN_2_231.length==0){
  110. top.Dialog.alert("第"+ fff + "保密等级不能为空,请检查!");
  111. return;
  112. }
  113. if(FILE_CONTENT_231.length==0){
  114. top.Dialog.alert("第"+ fff + "文件摘要不能为空,请检查!");
  115. return;
  116. }else if(FILE_CONTENT_231.length>300){
  117. top.Dialog.alert("第"+ fff + "文件摘要长度超长,请检查!(长度不要超过300个汉字)");
  118. return;
  119. }
  120. }
  121. var url = $.pathname() + "/ws/FileEMExcel/FileEMExcelToDBTableTool/fileEMToDb";
  122. var params = {
  123. classId : '231',
  124. compid:compId,
  125. userId:userid,
  126. json:json
  127. };
  128. $.ajax({
  129. url : url,
  130. type : 'post',
  131. timeout : 15000,
  132. data : params,
  133. dataType : 'json',
  134. success : function(data) {
  135. $.messager.alert('保存成功');
  136. var url = "/nwyj/page/business/am/PPSFile/"+"FileList_EM.jsp";
  137. top.parent.document.getElementById("frmright").setAttribute("src", ""+encodeURI(url));
  138. },
  139. error : function(e) {
  140. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  141. }
  142. });
  143. }
  144. //下模板
  145. function xiazai(){
  146. window.open("/nwyj/excels/fileembaogongdian.xls");
  147. }
  148. $.messager = top.Dialog;