a2d7a37c1a158a986de90a6d98c32c91ef583142.svn-base 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. $(function(){
  2. //应急制度文件分类FILE_CLASSIFY_230
  3. $("#FILE_CLASSIFY_230").initCanstSelect('BM_FILE_CLASSIFY');
  4. //$('#fileDiv').getUploadFileContent();旧的上传控件
  5. //新的上传控件
  6. var opts = {
  7. //swf: 'baiduUpload/Uploader.swf',
  8. //server: 'Upload',
  9. fileNumLimit: 1,
  10. fileSizeLimit: 200 * 1024 * 1024, // 200 M
  11. fileSingleSizeLimit: 50 * 1024 * 1024, // 50 M
  12. pick: {
  13. id: '#filePicker',
  14. label: '点击选择文件',
  15. name : 'file'
  16. },
  17. dnd: '#dndArea',
  18. paste: '#uploader',
  19. chunked: false,
  20. chunkSize: 512 * 1024,
  21. disableGlobalDnd: true
  22. };
  23. $('#fileDiv').getAsyncUploadFileContent(opts);
  24. var bodyheight = $(window.document.body).height();
  25. $(parent.document.body).find("#iframeChild2").height(bodyheight);
  26. $(top.document.body).find("#frmright").height(bodyheight);
  27. //记录当前页面的值
  28. InitformValue = $('#fillForm').serialize();
  29. });
  30. //记录当前页面的值
  31. var InitformValue="";
  32. //取复选框勾选的值
  33. var strRO="";
  34. //取系统时间:年月日时分秒
  35. var date = allGetServerTime();
  36. var seperator1 = "";
  37. var seperator2 = "";
  38. var month = date.getMonth() + 1;
  39. var strDate = date.getDate();
  40. if (month >= 1 && month <= 9) {
  41. month = "0" + month;
  42. }
  43. if (strDate >= 0 && strDate <= 9) {
  44. strDate = "0" + strDate;
  45. }
  46. var time = date.getFullYear() + seperator1 + month + seperator1 + strDate
  47. + "" + date.getHours() + seperator2 + date.getMinutes()
  48. + seperator2 + date.getSeconds();
  49. var dataNow= date.getFullYear() + seperator1 +"-" + month + "-"+seperator1 + strDate;
  50. //单位ID
  51. var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
  52. var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+""; //登录人ID
  53. var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
  54. var parent_id = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  55. //新增
  56. function add(containerId){
  57. var title = $("#FILE_TITLE_230").val();
  58. var classify = $("#FILE_CLASSIFY_230").val();
  59. var filedate = $("#FILE_ADD_DATE_230").val();
  60. var file = $("#uploaderFileName").val();
  61. var ldot = file.lastIndexOf(".");
  62. var type ="."+ file.substring(ldot + 1);
  63. var pos=file.lastIndexOf("\\");
  64. var filename = file.substring(pos+1,ldot);
  65. var tempFile = file.split(",");
  66. if(tempFile.length>1){
  67. top.Dialog.alert("只允许上传一个附件,请检查是否只上传了一个附件。");
  68. return;
  69. }
  70. if(file.length>300){
  71. top.Dialog.alert("您上传的附件名称太长,请重命名后上传。");
  72. return;
  73. }
  74. var valid = $(containerId).validationEngine({returnIsValid: true});
  75. if(valid == true){
  76. //文件标题FILE_TITLE_230
  77. //文件分类FILE_CLASSIFY_230
  78. //发文日期FILE_ADD_DATE_230
  79. //电子文件ELECTRONIC_FILE_230
  80. //文件摘要FILE_CONTENT_230
  81. //变更说明CHANGE_DETAIL_230
  82. //当前登录人ID getUser_id
  83. $("#PIGEONHOLE_MAN_ID_230").val(getUser_id);
  84. //文件版本
  85. $("#VERSION_ID_230").val(filename+time+type);
  86. //变更类型:0新增 1、更新 2、撤销
  87. //归档日期
  88. $("#PIGEONHOLE_DATE_230").val(dataNow);
  89. //发布单位ID PUBLISH_COMP_ID_230
  90. $("#PUBLISH_COMP_ID_230").val(parent_id);
  91. //上级单位ID
  92. $("#REPORT_COMP_ID_230").val(parentId);
  93. var $form=$("#fillForm");
  94. var formValue = $form.serialize();
  95. var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
  96. $.request.add(url,formValue,function(data){
  97. closeProgress();
  98. top.Dialog.alert(data.Msg.info);
  99. var url = "/nwyj/page/business/am/file/"+"FileList_AM.jsp";
  100. top.document.getElementById("frmright").setAttribute("src", ""+encodeURI(url));
  101. });
  102. }else{
  103. // top.Dialog.alert('请检查标红输入框!');
  104. if(title==""){
  105. top.Dialog.alert('文件标题填写不正确,请按要求填写!');
  106. return;
  107. }
  108. if(classify==""){
  109. top.Dialog.alert('文件分类填写不正确,请按要求填写!');
  110. return;
  111. }
  112. if(filedate==""){
  113. top.Dialog.alert('发文日期填写不正确,请按要求填写!');
  114. return;
  115. }
  116. }
  117. }
  118. //取树形下拉框的值
  119. /* function test(){
  120. var selectNodesRO = $("#selectTree5-1").data("selectedNodes");
  121. for(var i=0;i<selectNodesRO.length;i++){
  122. strRO += selectNodesRO[i].id;
  123. }
  124. }*/
  125. function fileToSave($form,listGrid,msg,url){
  126. showProgressBar("正在提交中...");
  127. //表单异步提交处理
  128. $form.ajaxSubmit({
  129. type: 'post',
  130. url:url,
  131. //表单提交成功后的回调
  132. success: function(responseText, statusText, xhr, $form){
  133. responseText = eval('('+responseText+')');
  134. closeProgress();
  135. if(msg!=undefined){
  136. if(responseText.info == 'success')
  137. top.Dialog.alert(msg+'成功!');//弹出提示
  138. else
  139. top.Dialog.alert(msg+'失败!');//弹出提示
  140. }else{
  141. if(responseText.info == 'success')
  142. top.Dialog.alert('添加成功!');//弹出提示
  143. else
  144. top.Dialog.alert('添加失败!');//弹出提示
  145. }
  146. history.back();
  147. /*var url = "/nwyj/page/business/am/file/"+"FileList_AM.jsp";
  148. window.parent.document.getElementById("iframeChild2").setAttribute("src", ""+encodeURI(url));*/
  149. }
  150. });
  151. }
  152. function goBack() {
  153. var url = "/nwyj/page/business/am/file/"+"FileList_AM.jsp";
  154. top.parent.document.getElementById("frmright").setAttribute("src", ""+encodeURI(url));
  155. /**********************退出表单时的验证判断****************************/
  156. /*var formValue = $('#fillForm').serialize();
  157. if(formValue!=InitformValue){
  158. top.Dialog.confirm("您已修改了表单,是否需要离开?|离开", function() {
  159. var url = "/nwyj/page/business/am/file/"+"FileList_AM.jsp";
  160. parent.document.getElementById("iframeChild2").setAttribute("src", ""+encodeURI(url));
  161. });
  162. }else{
  163. var url = "/nwyj/page/business/am/file/"+"FileList_AM.jsp";
  164. parent.document.getElementById("iframeChild2").setAttribute("src", ""+encodeURI(url));
  165. }*/
  166. }
  167. function redPlanDeptp(data){
  168. diag = new top.Dialog();// 定义一个窗口对象
  169. diag.Title = "选择关联的专项预案";// 窗口标题
  170. diag.URL = $.pathname() +"/page/business/am/contingencyPlan/PlanGuanlian.jsp?"+data;// 窗口对应的页面
  171. diag.Height = 500;
  172. diag.Width =600;
  173. diag.ShowOkButton=false;// 不显示确认按钮
  174. diag.ShowCancelButton=false;// 不显示取消按钮
  175. diag.ButtonAlign="center";// 按钮居中
  176. diag.show();// 显示窗口
  177. }
  178. //重置
  179. function resetSearch(){
  180. document.location.reload();
  181. }
  182. $.messager=top.Dialog;