73dcbb117684ab86210639dd230146c303a876eb.svn-base 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. var compId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  2. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
  3. var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  4. var g;
  5. var classes={"list":[
  6. {value:"1",key:"企业公文",suggest:""},
  7. {value:"2",key:"企业制度",suggest:""},
  8. {value:"3",key:"其它",suggest:""}]};
  9. var level={"list":[
  10. {value:"1",key:"公开",suggest:""},
  11. {value:"2",key:"密件",suggest:""}]};
  12. function initGrid(data){
  13. g = $("#maingrid").quiGrid({
  14. columns: [
  15. { display: '分类', name: 'CLASSES_241', align: 'center', width: "10%" ,
  16. editor: { type: 'select',data:classes,selWidth:150 },render:function (item){
  17. for (var i = 0; i < classes["list"].length; i++)
  18. {
  19. if (classes["list"][i]['value'] == item.CLASSES_241)
  20. return classes["list"][i]['key'];
  21. }
  22. return item.CLASSES_241;
  23. }
  24. },
  25. { display: '发文单位', name: 'DISPATCH_UNIT_241', align: 'center', width: "10%" ,editor: { type: 'text'}},
  26. { display: '主办部门', name: 'AUSPICE_DEPT_241', align: 'center', width: "10%" ,editor: { type: 'text'}},
  27. { display: '公文名称', name: 'DOCUMENT_NAME_241', align: 'center', width: "10%",editor: { type: 'text'} },
  28. { display: '发文字号', name: 'DISPATCH_WORD_SIZE_241', align: 'center', width: "10%" ,editor: { type: 'text'}},
  29. { display: '印发日期', name: 'PRINT_DATE_241', align: 'center', width: "10%" ,editor: { type: 'date',dateFmt:'yyyy-MM-dd'}},
  30. { display: '实施日期', name: 'IMPLEMENT_DATE_241', align: 'center' , width: "10%" ,editor: { type: 'date',dateFmt:'yyyy-MM-dd'}},
  31. { display: '保密级别', name: 'SECRECY_LEVEL_241', align: 'center', width: "10%" ,
  32. editor: { type: 'select',data:level,selWidth:150 },render:function (item){
  33. for (var i = 0; i < level["list"].length; i++)
  34. {
  35. if (level["list"][i]['value'] == item.SECRECY_LEVEL_241)
  36. return level["list"][i]['key'];
  37. }
  38. return item.SECRECY_LEVEL_241;
  39. }
  40. },
  41. { display: '简要说明', name: 'DESCRIPTION_241', align: 'center', width: "20%" ,editor: { type: 'text'}}
  42. ],
  43. data:data,
  44. sortName : '',
  45. sortOrder : '',
  46. rownumbers:true,
  47. checkbox:true,
  48. height: 'auto',
  49. width:"100%",
  50. usePager : false,
  51. enabledEdit: true, //编辑用
  52. percentWidthMode:true,
  53. //顶部图标按钮栏
  54. toolbar:{
  55. items:[
  56. {text: '批量保存', click: saveAll, iconClass: 'icon_add'},
  57. { line : true }
  58. ]
  59. }
  60. });
  61. //监听页面显示的下拉框
  62. $("select[name=rp]").bind("change",function(){
  63. $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  64. });
  65. //下拉框高度自适应
  66. $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  67. }
  68. function saveAll(){
  69. var PatternsDict=/^(\d{4})-(0\d{1}|1[0-2])-(0\d{1}|[12]\d{1}|3[01])$/;//日期验证
  70. var PatternsDict1= new RegExp("[%@~!%#$*&',;=?$\x22]+");//特殊字符验证
  71. var rows=g.getSelectedRows();
  72. var rowsLength = rows.length;
  73. if (rowsLength == 0) {
  74. top.Dialog.alert("请选中要导入的信息!");
  75. return;
  76. }
  77. var json=JSON.stringify(rows);
  78. var myobj=eval(json);
  79. for(var i=0;i<myobj.length;i++){
  80. var CLASSES_241 = myobj[i].CLASSES_241;//分类*
  81. var DISPATCH_UNIT_241 = myobj[i].DISPATCH_UNIT_241;//发文单位*
  82. var AUSPICE_DEPT_241 = myobj[i].AUSPICE_DEPT_241;//主办部门
  83. var DOCUMENT_NAME_241 = myobj[i].DOCUMENT_NAME_241;//公文名称*
  84. var DISPATCH_WORD_SIZE_241 = myobj[i].DISPATCH_WORD_SIZE_241;//发文字号*
  85. var PRINT_DATE_241 = myobj[i].PRINT_DATE_241;//印发日期*
  86. var IMPLEMENT_DATE_241 = myobj[i].IMPLEMENT_DATE_241;//实施日期*
  87. var SECRECY_LEVEL_241 = myobj[i].SECRECY_LEVEL_241;//保密级别*
  88. var DESCRIPTION_241 = myobj[i].DESCRIPTION_241;//简要说明
  89. var fff =1;
  90. fff = fff+i;
  91. if(CLASSES_241.length==0){
  92. top.Dialog.alert("第"+ fff + "行的分类不能为空,请检查!");
  93. return;
  94. }
  95. if(DISPATCH_UNIT_241.length==0){
  96. top.Dialog.alert("第"+ fff + "行的发文单位不能为空,请检查!");
  97. return;
  98. }else if(DISPATCH_UNIT_241.length>20){
  99. top.Dialog.alert("第"+fff + "行的发文单位长度超长,请检查!(20个汉字以内)");
  100. return;
  101. }else if(PatternsDict1.test(DISPATCH_UNIT_241)){
  102. top.Dialog.alert("第"+ fff + "行的发文单位输入不合法,请检查!(20个汉字以内)");
  103. return;
  104. }
  105. if(AUSPICE_DEPT_241.length>20){
  106. top.Dialog.alert("第"+fff + "行的主办部门长度超长,请检查!(20个汉字以内)");
  107. return;
  108. }else if(PatternsDict1.test(AUSPICE_DEPT_241)){
  109. top.Dialog.alert("第"+ fff + "行的主办部门输入不合法,请检查!(20个汉字以内)");
  110. return;
  111. }
  112. if(DOCUMENT_NAME_241.length==0){
  113. top.Dialog.alert("第"+ fff + "行的公文名称不能为空,请检查!");
  114. return;
  115. }else if(DOCUMENT_NAME_241.length>20){
  116. top.Dialog.alert("第"+fff + "行的公文名称长度超长,请检查!(20个汉字以内)");
  117. return;
  118. }else if(PatternsDict1.test(DOCUMENT_NAME_241)){
  119. top.Dialog.alert("第"+ fff + "行的公文名称输入不合法,请检查!(20个汉字以内)");
  120. return;
  121. }
  122. if(DISPATCH_WORD_SIZE_241.length==0){
  123. top.Dialog.alert("第"+ fff + "行的发文字号不能为空,请检查!");
  124. return;
  125. }else if(DISPATCH_WORD_SIZE_241.length>20){
  126. top.Dialog.alert("第"+fff + "行的发文字号长度超长,请检查!(20个字符以内)");
  127. return;
  128. }
  129. if(PRINT_DATE_241.length==0){
  130. top.Dialog.alert("第"+ fff + "行的印发日期不能为空,请检查!");
  131. return;
  132. }
  133. if(PatternsDict.test(PRINT_DATE_241)){
  134. }else{
  135. top.Dialog.alert("第"+ fff + "行的印发日期不合法,请检查!");
  136. return;
  137. }
  138. if(CLASSES_241=="2"||CLASSES_241=="3"){
  139. if(IMPLEMENT_DATE_241.length==0){
  140. top.Dialog.alert("第"+fff + "行的实施日期不能为空,请检查!");
  141. return;
  142. }
  143. if(PatternsDict.test(IMPLEMENT_DATE_241)){
  144. }else{
  145. top.Dialog.alert("第"+fff + "行的实施日期不合法,请检查!");
  146. return;
  147. }
  148. if(PRINT_DATE_241>IMPLEMENT_DATE_241){
  149. top.Dialog.alert("第"+fff + "行的印发日期不能晚于实施日期,请检查!");
  150. return;
  151. }
  152. if(SECRECY_LEVEL_241.length!=0){
  153. top.Dialog.alert("第"+fff + "行的保密级别应该为空,请检查!");
  154. return;
  155. }
  156. }else if(CLASSES_241=="1"){
  157. if(IMPLEMENT_DATE_241.length!=0){
  158. top.Dialog.alert("第"+fff + "行的实施日期应该为空,请检查!");
  159. return;
  160. }
  161. if(SECRECY_LEVEL_241.length==0){
  162. top.Dialog.alert("第"+fff + "行的保密级别不能为空,请检查!");
  163. return;
  164. }
  165. }
  166. if(DESCRIPTION_241.length>300){
  167. top.Dialog.alert("第"+fff + "行的简要说明长度超长,请检查!(长度不要超过300个中文)");
  168. return;
  169. }
  170. }
  171. var url = $.pathname() + "/ws/DocumentExcel/DocumentExcelToDBTableTool/documentToDb";
  172. var params = {
  173. classId : '241',
  174. compid:compId,
  175. deptId:deptId,
  176. userId:userId,
  177. json:json
  178. };
  179. $.ajax({
  180. url : url,
  181. type : 'post',
  182. timeout : 15000,
  183. data : params,
  184. dataType : 'json',
  185. success : function(data) {
  186. $.messager.alert('保存成功');
  187. window.location.href="document.jsp";
  188. },
  189. error : function(e) {
  190. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  191. }
  192. });
  193. }
  194. //下模板
  195. function xiazai(){
  196. window.open("/nwyj/excels/documentgongwen.xls");
  197. }
  198. //返回
  199. function goBack() {
  200. window.location.href="document.jsp";
  201. }
  202. $.messager = top.Dialog;