fc21a359932b53e0509860161ef4206fa01932da.svn-base 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. governmentDocEdit = function(){
  2. /**定义变量**/
  3. var _this = this;
  4. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
  5. /**私有方法**/
  6. /***新增信息***/
  7. _this.save = function(){
  8. //1、取系统时间
  9. // var getSysTime = getTime();
  10. //没有附件上传,直接修改信息,调用修改的方法。
  11. /***********保存文件版本值(附件名称+时间)start**************/
  12. /* $("#VERSION_240").val("");
  13. //取上传文件的名称
  14. var file = $("#uploaderFileName").val();
  15. //alert("file"+file);
  16. // var file = $("#fileDiv").val();
  17. if(file!=null && file!=""){
  18. version=file+getSysTime;
  19. }else{
  20. version="";
  21. }
  22. $("#VERSION_240").val(version);*/
  23. //取系统时间:年月日时分秒
  24. var date = allGetServerTime();
  25. var seperator1 = "";
  26. var month = date.getMonth() + 1;
  27. var strDate = date.getDate();
  28. if (month >= 1 && month <= 9) {
  29. month = "0" + month;
  30. }
  31. if (strDate >= 0 && strDate <= 9) {
  32. strDate = "0" + strDate;
  33. }
  34. var dataNow= date.getFullYear() + seperator1 + month + seperator1 + strDate;
  35. var filename = $("#DOCUMENT_NAME_240").val();
  36. //判断是否上传附件
  37. if(hasFile()==true){
  38. $("#VERSION_240").val(filename+dataNow+"版");
  39. }
  40. //***********************************修改方法,将is_del状态改为1,信息的状态字段改为废止。****************************************//*
  41. //修改方法
  42. /* function edit111(id0){
  43. //设置状态字段为废止 formReset
  44. $("#STATE_240").setValue("4");
  45. $form = $('#editForm');
  46. var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
  47. var formValue = $form.serialize();
  48. $.request.add(url,formValue,function(data){
  49. closeProgress();
  50. top.Dialog.alert(data.Msg.info);
  51. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/am/fileManager/governmentDoc/governmentDoc.jsp");
  52. });
  53. }
  54. */
  55. /***********保存文件版本值(附件名称+时间)end****************/
  56. var id0=$("#FD_OBJECTID240").val();
  57. $('#editForm input[name="classid"]').val('240');
  58. $form = $('#editForm');
  59. //表单验证
  60. var valid = $form.validationEngine({returnIsValid: true});
  61. if(!valid){
  62. top.Dialog.alert("请检查标红的输入空!");
  63. }
  64. if(valid){
  65. showProgressBar("正在提交中...");
  66. //2通过状态的字段来判断是否需要顶掉上一个版本。调用删除方法 ( 修订-2、修正-3 两种选择需要顶掉上一个版本)删除成功后,调用新增方法。
  67. var stat = $("#STATE_240").val();
  68. if(stat==2 || stat==3){//如果状态为修订-2或修正-3,删除原记录,重新生成新记录
  69. //删除上一个版本
  70. del(id0);
  71. //新增一条记录
  72. add();
  73. }else if(stat=="4"){
  74. top.Dialog.confirm("确定要废止吗?|废止", function() {
  75. // 删除记录
  76. $.post($.pathname() +"/ws/crud/CRUDService/delete/", {
  77. "objectIDs" : id0,
  78. classid : 240
  79. }, function(result) {
  80. if (result.Msg.sucsess == true) {
  81. top.Dialog.alert("废止成功",null,null,null,-1);
  82. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/am/fileManager/governmentDoc/governmentDoc.jsp");
  83. } else {
  84. top.Dialog.alert("废止失败!");
  85. }
  86. }, "json");
  87. });
  88. }else if(stat=="5"){
  89. top.Dialog.confirm("确定要撤销吗?|撤销", function() {
  90. // 删除记录
  91. $.post($.pathname() +"/ws/crud/CRUDService/delete/", {
  92. "objectIDs" : id0,
  93. classid : 240
  94. }, function(result) {
  95. if (result.Msg.sucsess == true) {
  96. top.Dialog.alert("撤销成功",null,null,null,-1);
  97. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/am/fileManager/governmentDoc/governmentDoc.jsp");
  98. } else {
  99. top.Dialog.alert("撤销失败!");
  100. }
  101. }, "json");
  102. });
  103. }else{//否则仅修改
  104. edit();
  105. }
  106. }
  107. };
  108. //删除方法XXXXXXXXXXXXXXX
  109. function del(id0){
  110. $.post($.pathname() +"/ws/crud/CRUDService/delete/", {
  111. "objectIDs" : id0,
  112. classid : 240
  113. }, function(result) {
  114. if (result.Msg.sucsess == true) {
  115. //$.messager.alert("删除成功",null,null,null,-1);
  116. // 刷新表格数据
  117. //g.rend();
  118. } else {
  119. //top.Dialog.alert("删除失败!");
  120. }
  121. }, "json");
  122. }
  123. /***********************************修改方法,将is_del状态改为1,信息的状态字段改为废止。****************************************/
  124. //修改方法
  125. function edit111(){
  126. //设置状态字段为废止 formReset
  127. $("#STATE_240").setValue("4");
  128. $("#IS_del_240").val("1");
  129. var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
  130. var formValue = $form.serialize();
  131. $.request.add(url,formValue,function(data){
  132. closeProgress();
  133. top.Dialog.alert(data.Msg.info);
  134. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/am/fileManager/governmentDoc/governmentDoc.jsp");
  135. });
  136. }
  137. //修改方法
  138. function edit(){
  139. //alert("修改方法");
  140. //var url = $.pathname() +"/ws/crud/CRUDService/update/";
  141. var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
  142. var formValue = $form.serialize();
  143. $.request.add(url,formValue,function(data){
  144. closeProgress();
  145. top.Dialog.alert(data.Msg.info);
  146. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/am/fileManager/governmentDoc/governmentDoc.jsp");
  147. });
  148. }
  149. //新增方法
  150. function add(){
  151. //alert("新增方法");
  152. var date = allGetServerTime();
  153. var seperator1 = "";
  154. var month = date.getMonth() + 1;
  155. var strDate = date.getDate();
  156. if (month >= 1 && month <= 9) {
  157. month = "0" + month;
  158. }
  159. if (strDate >= 0 && strDate <= 9) {
  160. strDate = "0" + strDate;
  161. }
  162. var dataNow1= date.getFullYear() + seperator1 +"-" + month +"-" + seperator1 + strDate;
  163. $('#TYPEIN_TIME_240').val(dataNow1);
  164. //删除上个版本的附件
  165. var fdobj = document.getElementsByName("uploaderFileObjectid");
  166. for(var i=fdobj.length; i>0; i--){
  167. var id = fdobj[0].id;
  168. id = id.replace("uploaderFileObjectid","");
  169. //大于30说明是从数据库查出来的附件
  170. if(id.length==30){
  171. $("#uploaderFileObjectid"+id).remove();
  172. $("#uploaderFileRealName"+id).remove();
  173. $("#uploaderFileName"+id).remove();
  174. $("#uploaderFileExt"+id).remove();
  175. }
  176. }
  177. //需要将上一个文件的主键ID清空
  178. $("#FD_OBJECTID240").val("");
  179. //取表单所有元素的值
  180. var formValue = $form.serialize();
  181. //将上一个文件信息的主键ID存入OBJ_FIRST这个字段(主页面已经完成)
  182. // var url = $.pathname() +"/ws/crud/CRUDService/update/";
  183. //
  184. // var formValue = $form.serialize();
  185. // $.request.add(url,formValue,function(data){
  186. /*closeProgress();
  187. top.Dialog.alert(data.Msg.info);
  188. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/am/fileManager/governmentDoc/governmentDoc.jsp");*/
  189. // });
  190. //新增
  191. //url = $.pathname() + '/ws/crud/CRUDService/create/';
  192. url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
  193. //var formValue = $form.serialize();
  194. //alert(formValue);
  195. $.request.add(url,formValue,function(data){
  196. closeProgress();
  197. top.Dialog.alert(data.Msg.info);
  198. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/am/fileManager/governmentDoc/governmentDoc.jsp");
  199. });
  200. //之前发布状态重新更新
  201. }
  202. //取系统时间:年月日时分秒
  203. function getTime(){
  204. var date = allGetServerTime();
  205. var seperator1 = "";
  206. var seperator2 = "";
  207. var month = date.getMonth() + 1;
  208. var strDate = date.getDate();
  209. if (month >= 1 && month <= 9) {
  210. month = "0" + month;
  211. }
  212. if (strDate >= 0 && strDate <= 9) {
  213. strDate = "0" + strDate;
  214. }
  215. var time = date.getFullYear() + seperator1 + month + seperator1 + strDate
  216. + "" + date.getHours() + seperator2 + date.getMinutes()
  217. + seperator2 + date.getSeconds();
  218. return time;
  219. }
  220. // 创建报表填报计划he报告填报要求
  221. return {
  222. init : function() {
  223. $('#save').bind('click',function(){
  224. $form = $('#editForm');
  225. var valid = $form.validationEngine({returnIsValid: true});//表单验证
  226. if(!valid){
  227. top.Dialog.alert("请检查标红输入框!");
  228. return ;
  229. }
  230. var level = $("#SECRECY_LEVEL_240").val();
  231. var flag = false;
  232. var obj = document.getElementsByName("uploaderFileName");
  233. for(var i =0;i<obj.length;i++){
  234. if(obj[i].id.length<30){
  235. flag = true;
  236. }
  237. }
  238. var STATE = $("#STATE_240").val();
  239. //判断是否上传附件
  240. if((level==1)&&(!flag)&&(STATE=="2"||STATE=="3")){
  241. top.Dialog.alert("请选择上传的文件!");
  242. return;
  243. }
  244. top.Dialog.confirm("是否要保存?|政府公文",function(){//点击确定
  245. _this.save();
  246. }/*,function(){//点击取消
  247. //alert("bbbbbb");
  248. }*/);
  249. });
  250. /** 保存并发布 **/
  251. $("#saveAndIssue").bind("click",function(){
  252. var level = $("#SECRECY_LEVEL_240").val();
  253. var flag = false;
  254. var obj = document.getElementsByName("uploaderFileName");
  255. for(var i =0;i<obj.length;i++){
  256. if(obj[i].id.length<30){
  257. flag = true;
  258. }
  259. }
  260. var STATE = $("#STATE_240").val();
  261. //判断是否上传附件
  262. if((level==1)&&(!flag)&&(STATE=="2"||STATE=="3")){
  263. top.Dialog.alert("请选择上传的文件!");
  264. return;
  265. }
  266. top.Dialog.confirm("是否要发布?|政府公文",function(){//点击确定
  267. $("#IS_ISSUE_240").val("1");
  268. //alert($("#IS_ISSUE_240").val());//1
  269. _this.save();
  270. }/*,function(){//点击取消
  271. //alert("bbbbbb");
  272. }*/);
  273. //_this.saveAndIssue();
  274. });
  275. $('#back').bind('click',function(){
  276. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/am/fileManager/governmentDoc/governmentDoc.jsp");
  277. });
  278. }
  279. };
  280. }();
  281. /***************************************历史信息************************************************************/
  282. /* var g;
  283. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
  284. //点击主键跳转详细信息页面
  285. this.openDetail = function(rowindex) {
  286. var row = g.getRow(rowindex);
  287. var fd_id = row.FD_OBJECTID240;
  288. // alert(fd_id);
  289. // window.location.href="governmentDocView.jsp?fd_id="+fd_id;
  290. // window.open("governmentDocView.jsp?"+fd_id);
  291. window.open("/nwyj/page/business/am/fileManager/governmentDoc/governmentDocView.jsp?fd_id="+fd_id);
  292. //$('#frmright', window.parent.document).attr('src',$.pathname()+'/page/business/gps/programManagement/detailProgramManagement.jsp?fd_id='+fd_id);
  293. };
  294. //初始化列表
  295. function initVersion(){
  296. //alert("历史信息");
  297. var condition = " FD_OBJECTID='"+obj_old+"' or OBJ_FIRST='"+obj_old+"' ";
  298. // var condition = "is_del = '0'";
  299. var loadParams = {"listId" : '240',"condition" : condition,direction:'DESC',sort: 'UPDATEDATE'};
  300. //双视图不支持getRow()取行号的方法。
  301. // 工具条
  302. var roleCons = roleButtonArr();
  303. var toolBarOpt1 = {
  304. items : [{ text: '下载' ,click:"onDownload",iconClass: 'download_tem',id:"10007" }],
  305. roleCons:roleCons
  306. };
  307. //树形列
  308. var grid_option1 = {
  309. columns: [
  310. {display : '发布单位',name : 'DISPATCH_UNIT_240', align : 'center',width : '12%',isPrimaryKey:true,
  311. render : function(rowdata, rowindex, value, column) {
  312. return "<a href='javascript:;' style='width:100%;height:100%;display:block' title='" + value + "' onclick='openDetail(" + rowindex + ")'>" + value + "</a>";
  313. }
  314. },
  315. {display : '公文名称', name : 'DOCUMENT_NAME_240', align : 'center', width : '10%'},
  316. {display : '发文字号', name : 'DISPATCH_WORD_SIZE_240', align : 'center', width : '6%'},
  317. {display : '状态', name : 'STATE_240_SHOW', align : 'center', width : '7%'},
  318. {display : '保密级别', name : 'SECRECY_LEVEL_240_SHOW', align : 'center', width : '7%'},
  319. {display : '录入人', name : 'TYPEIN_PEOPLE_240', align : 'center', width : '8%'},
  320. {display : '录入人联系方式', name : 'TYPEIN_PEOPLE_PHONE_NUM_240', align : 'center', width : '10%'},
  321. {display : '录入时间', name : 'TYPEIN_TIME_240', align : 'center', width : '10%'},
  322. {display : '单位', name : 'UNITE_240_SHOW', align : 'center', width : '8%'},
  323. {display : '部门', name : 'DEPT_240_SHOW', align : 'center', width : '8%'},
  324. {display : '文件版本', name : 'VERSION_240', align : 'center', width : '14%'},
  325. ],
  326. rownumbers : true,
  327. checkbox : true,
  328. width:"100%",
  329. pageSize : 10,
  330. percentWidthMode : true
  331. };
  332. var options1={
  333. url :'/nwyj/ws/crud/CRUDService/queryQui',
  334. params:loadParams,
  335. gridOptions:grid_option1,
  336. singleRecodeOptions:{a:"aa"},
  337. paperOpration:{showInput:"true"},
  338. toolBarOptions:toolBarOpt1
  339. };
  340. g=gridAndSingleRecode=$("#historyMsg").quickgridAndSingleRecode(options1);
  341. }
  342. //下载
  343. function onDownload(){
  344. var rows = g.getSelectedRows();
  345. if (rows.length == 0) {
  346. top.Dialog.alert("请选择一条记录");
  347. return;
  348. }
  349. if (rows.length > 1) {
  350. top.Dialog.alert("只能选择一条记录");
  351. return;
  352. }
  353. var fd_id = rows[0].FD_OBJECTID240;
  354. //showFile(fd_id);
  355. // }
  356. // function showFile(fd_id){
  357. var diag = new top.Dialog();// 定义一个窗口对象
  358. diag.Title = "下载";// 窗口标题
  359. //diag.URL = $.pathname() +"/page/business/am/base/showDownloadFile.html?fd_id="+fd_id;// 窗口对应的页面
  360. diag.URL = $.pathname() +"/page/business/am/fileManager/governmentDoc/showDownloadFile.html?fd_id="+fd_id;// 窗口对应的页面
  361. diag.Height = 400;
  362. diag.ShowOkButton=false;// 不显示确认按钮
  363. diag.ShowCancelButton=false;// 不显示取消按钮
  364. diag.ButtonAlign="center";// 按钮居中
  365. diag.show();// 显示窗口
  366. }*/
  367. $(function() {
  368. governmentDocEdit.init();
  369. });