d0ca49c67323459ed0b1366bff6de3a904bc120c.svn-base 7.8 KB

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