0e5973e101a4575ed92ad76b6115227cb3439305.svn-base 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  2. var role_id = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
  3. $(function(){
  4. fileShare();
  5. $searchOne = $("#searchOne");//查询图标绑定查询事件
  6. $searchOne.bind('click', function() {
  7. searchHandler();
  8. });
  9. });
  10. var BUSINE_ID1 ="";
  11. var BUSINE_ID ="";
  12. var temp1 = new Array();
  13. var temp = new Array();
  14. function fileShare(){
  15. var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/fileShare/';
  16. var params = {
  17. units : deptId,
  18. receiveMan:role_id,
  19. type:"1"
  20. };
  21. $.ajax({
  22. url : url,
  23. type : 'post',
  24. timeout : 60000,
  25. data : params,
  26. dataType : 'json',
  27. success : function(data){
  28. if(JSON.stringify(data).length>11){
  29. BUSINE_ID1 = data.rows[0].BUSINE_ID;//取业务ID
  30. BUSINE_ID=BUSINE_ID1.substring(0,BUSINE_ID1.length-1);
  31. temp = BUSINE_ID.split(",");
  32. for(var i=0; i<temp.length;i++){
  33. temp1.push("'" + temp[i] +"'");
  34. }
  35. }
  36. if(temp1.length>0){
  37. initComplete111();
  38. }else{
  39. temp1="'0'";
  40. initComplete111();
  41. }
  42. },
  43. error : function(e){
  44. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  45. }
  46. });
  47. }
  48. var g;
  49. /**定义变量**/
  50. var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+""; //登录人ID
  51. //var condition = "IS_DEL='0' and (PLAN_STAT='1' or PLAN_STAT1='1' or REMARK1='"+ getUser_id +"') and (UNITS='"+deptId+"' or UNITS IN(SELECT A.ID FROM EMC_AM_ORG_DEPARTMENT_TEST A WHERE A.PARENT_ID='"+deptId+"'))";
  52. //列表加载参数
  53. function initComplete111(){
  54. var condition = "IS_DEL='0' and FD_OBJECTID IN("+temp1+")";
  55. var loadParams = {
  56. "listId" : '230',
  57. "condition" : condition,
  58. direction:'DESC',
  59. sort: 'UPDATEDATE'
  60. };
  61. /**
  62. * 工具条
  63. */
  64. var roleCons = roleButtonArr();
  65. var toolBarOpt1 = {
  66. items : [
  67. {text: '下载', click: "onDownload", iconClass: 'download_tem',id:"10007"}],
  68. roleCons:roleCons
  69. };
  70. /**
  71. * 树形列
  72. */
  73. var grid_option1 = {
  74. columns: [
  75. // {name : 'FD_OBJECTID',hide : true},
  76. {display : '文件标题',name : 'FILE_TITLE_230', align : 'center',width : '20%',isPrimaryKey:true,
  77. render : function(rowdata, value) {
  78. return '<a href="javascript:void(0)" '
  79. + 'onclick=jumpPage("'
  80. + rowdata.FD_OBJECTID230
  81. +'")>'+ rowdata.FILE_TITLE_230 +'</a>';
  82. }
  83. },
  84. {display : '文件分类',name : 'FILE_CLASSIFY_230_SHOW', align : 'center',width : '10%'},
  85. // {display : '发布状态',name : 'FILE_STATUS_230_SHOW', align : 'center',width : '10%'},
  86. // {display : '上报状态',name : 'SHANGBAO_230_SHOW', align : 'center',width : '10%'},
  87. {display : '发文日期',name : 'FILE_ADD_DATE_230', align : 'center',width : '10%'},
  88. {display : '归档人',name : 'PIGEONHOLE_MAN_ID_230_SHOW', align : 'center',width : '10%'},
  89. {display : '归档日期',name : 'PIGEONHOLE_DATE_230', align : 'center',width : '10%'},
  90. {display : '变更说明',name : 'CHANGE_DETAIL_230', align : 'center',width : '15%'},
  91. {display : '变更类型',name : 'CHANGE_TYPE_230_SHOW', align : 'center',width : '10%'},
  92. {display : '文件摘要',name : 'FILE_CONTENT_230', align : 'center',width : '15%'}
  93. ],
  94. rownumbers : true,
  95. checkbox : true,
  96. width:"100%",
  97. pageSize : 10,
  98. percentWidthMode : true
  99. };
  100. var options1={
  101. url :'/nwyj/ws/crud/CRUDService/queryQui',
  102. params:loadParams,
  103. gridOptions:grid_option1,
  104. singleRecodeOptions:{a:"aa"},
  105. paperOpration:{showInput:"true"},
  106. toolBarOptions:toolBarOpt1
  107. };
  108. g=gridAndSingleRecode=$("#maingrid").quickgridAndSingleRecode(options1);
  109. }
  110. //查询
  111. function searchHandler() {
  112. var title = $('#FILE_TITLE_230').val();//标题
  113. var condition = "IS_DEL='0' and FD_OBJECTID IN("+BUSINE_ID+")";
  114. if(title!=""&&title!="请输入文件名称"){
  115. condition += " AND FILE_TITLE LIKE '%" +title+"%'";
  116. }
  117. g.setOptions({// 重置加载列表的参数
  118. params : {
  119. "listId" : '230',
  120. "condition" : condition
  121. }
  122. });
  123. g.rend();
  124. }
  125. //点击查看
  126. function jumpPage(id){
  127. window.location.href="/nwyj/page/business/am/file/FileAMInfo.jsp?"+id;
  128. }
  129. //下载
  130. function onDownload(){
  131. //批量打包下载
  132. var FD_OBJECTID = "";
  133. var rows = g.getSelectedRows();
  134. var rowsLength = rows.length;
  135. if (rowsLength == 0) {
  136. top.Dialog.alert("请选中要下载的文件!");
  137. return;
  138. }
  139. for (var i = 0; i < rows.length; i++) {
  140. var FD_OBJECTID1= rows[i].FD_OBJECTID230;//预案的主键
  141. var COLUMN_1_230 =rows[i].COLUMN_1_230;//预案的标识位(新的预案还是旧的预案)
  142. var COLUMN_3_230 =rows[i].COLUMN_3_230;//上传标识
  143. var COLUMN_4_230 =rows[i].COLUMN_4_230;//修改预案后新增预案的情况,也必有附件
  144. //新增文件,控制必传附件 纯新增
  145. if(COLUMN_1_230=="0"&&COLUMN_4_230=="0"&&COLUMN_3_230=="1"){
  146. //getFileList(fd_id,1);
  147. FD_OBJECTID += "'"+FD_OBJECTID1 +"'"+ ",";//文件的主键
  148. }
  149. //修改文件后新增预案的情况,也必有附件 纯修编
  150. if(COLUMN_1_230!="0"&&COLUMN_4_230!="0"&&COLUMN_3_230=="1"){
  151. //getFileList(fd_bojectid,1);
  152. FD_OBJECTID += "'"+FD_OBJECTID1+"'" + ",";//文件的主键
  153. }
  154. //纯修改
  155. if(COLUMN_1_230=="0"&&COLUMN_4_230!="0"&&COLUMN_3_230=="0"){
  156. //getFileList(PLAN_VERSION_REMARK,1);
  157. FD_OBJECTID += "'"+COLUMN_4_230+"'" + ",";//文件的主键
  158. }
  159. //修编修改
  160. if(COLUMN_1_230!="0"&&COLUMN_4_230!="0"&&COLUMN_3_230=="0"){
  161. //getFileList(PLAN_VERSION_REMARK,1);
  162. FD_OBJECTID += "'"+COLUMN_4_230+"'" + ",";//文件的主键
  163. }
  164. }
  165. var temp = FD_OBJECTID.substring(0,FD_OBJECTID.length-1);
  166. //发送请求,获取文件名的集合。
  167. var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/getPlanFile/';
  168. var params = {
  169. fileId : temp
  170. };
  171. var SAVENAME1="";
  172. var NAME1 = "";
  173. var FILEEXT1="";
  174. $.ajax({
  175. url : url,
  176. type : 'post',
  177. timeout : 60000,
  178. data : params,
  179. dataType : 'json',
  180. success : function(data){
  181. var dataLenth = data.rows.length;
  182. var filenames="";
  183. var downfilename = "";
  184. for (var i = 0; i < dataLenth; i++) {
  185. SAVENAME1= data.rows[i].SAVENAME;
  186. NAME1= data.rows[i].NAME;
  187. FILEEXT1= data.rows[i].FILEEXT;
  188. filenames +=SAVENAME1 + "." + FILEEXT1 + ";";
  189. downfilename+=NAME1 + "." + FILEEXT1 + ";";
  190. }
  191. var filenames1 = filenames.substring(0,filenames.length-1);
  192. filenames = decodeURI(filenames1);
  193. var downfilename1 = downfilename.substring(0,downfilename.length-1);
  194. downfilename = decodeURI(downfilename1);
  195. showFile(filenames1,downfilename1);
  196. //alert(downfilename1+"============"+filenames1);
  197. //返回回调打包下载的函数,拼传给回调函数的filenames,downfilename
  198. },
  199. error : function(e){
  200. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  201. }
  202. });
  203. }
  204. function showFile(downfilename,filenames){
  205. var url = "/nwyj/page/business/am/org/query/getZipFile.jsp?downfilename="+downfilename+"&filenames="+filenames;
  206. window.open(url);
  207. }
  208. $.messager=top.Dialog;