104723a8681681acc8bda2c04cb796de9af0031a.svn-base 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073
  1. //部门id
  2. var dpids = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
  3. //取得用户真实姓名
  4. var realname = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
  5. //登录人ID
  6. var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+"";
  7. //登陆用户的单位名称
  8. var corp_name = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
  9. //父部门id
  10. var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
  11. //用户登录的单位ID
  12. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  13. $(function(){
  14. //下拉框加载
  15. // $("#FILE_CLASSIFY_231").initCanstSelect('BM_FILE_CLASSIFY');
  16. // $('#CHANGE_TYPE_231').initCanstSelect('BM_CHANGETYPE');
  17. // $("#COLUMN_2_231").initCanstSelect('BM_FILE_SECURITY');
  18. getChildInfo();
  19. /** 绑定更多的按钮点击事件 */
  20. $more = $("#more"); // 更多按钮
  21. $more.bind('click', function() {
  22. more();
  23. });
  24. $searchButt = $("#searchButt");// 更多查询按钮
  25. $searchButt.live('click', function() {
  26. searchHandler();
  27. });
  28. $searchOne = $("#searchOne");//查询图标绑定查询事件
  29. $searchOne.bind('click', function() {
  30. searchHandler();
  31. });
  32. });
  33. var conditionData2="";
  34. function getChildInfo(){
  35. var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/getresourXj/';///ws/PlanHuiZong/ContingencyPlanHuiZong/getChidInfo/
  36. var params = {
  37. id : deptId,
  38. value:"PUBLISH_COMP_ID"
  39. };
  40. $.ajax({
  41. url : url,
  42. type : 'post',
  43. timeout : 60000,
  44. data : params,
  45. dataType : 'json',
  46. success : function(data){
  47. // conditionData2 = JSON.stringify(data);
  48. //
  49. // conditionData2 = conditionData2.replace(/\\\"/g,"\"");
  50. // conditionData2 = conditionData2.replace(/\"{/g,"{");
  51. // conditionData2 = conditionData2.replace(/}\"/g,"}");
  52. // var test = eval("("+conditionData2+")");
  53. // if(conditionData2!='{"list":[{"name":"查询单位","className":"PUBLISH_COMP_ID","list":[]}]}'){
  54. // test.dept.list[0].equalType = "equal";
  55. // conditionData.list.push(test.dept.list[0]);
  56. // }else{
  57. // test.dept.list[0].equalType = "equal";
  58. // conditionData.list.push(test.dept.list[0]);
  59. // }
  60. //
  61. // /* if(parent_id!="1"){
  62. // conditionData.list.push(test1.list[0]);
  63. // }*/
  64. //
  65. //
  66. //
  67. // createConditionsDom(conditionData);
  68. // $(".item").unbind("click").bind("click",bindSelectOne);
  69. var conditionData3 = JSON.stringify(data);
  70. var test = eval("("+conditionData3+")");
  71. if(conditionData3!='{"list":[{"name":"查询单位","className":"PUBLISH_COMP_ID","equalType":"equal","list":[]}]}'){
  72. conditionData.list.push(test.list[0]);
  73. }
  74. createConditionsDom(conditionData);
  75. $(".item").unbind("click").bind("click",bindSelectOne);
  76. },
  77. error : function(e){
  78. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  79. }
  80. });
  81. }
  82. var g;
  83. //var condition = "IS_DEL='0' and (FABU='1' or SHANGBAO='1' or PIGEONHOLE_MAN_ID='"+ getUser_id +"') and (PUBLISH_COMP_ID='"+deptId+"' or PUBLISH_COMP_ID IN(SELECT A.ID FROM EMC_AM_ORG_DEPARTMENT_TEST A WHERE A.PARENT_ID='"+deptId+"') or PUBLISH_COMP_ID='"+parentId+"')";
  84. // var condition = "IS_DEL='0' and (FABU='1' or SHANGBAO='1' or PIGEONHOLE_MAN_ID='"+ getUser_id +"') and (PUBLISH_COMP_ID='"+deptId+"' or PUBLISH_COMP_ID='"+deptId+"' or PUBLISH_COMP_ID IN(SELECT A.ID FROM EMC_AM_ORG_DEPARTMENT_TEST A WHERE A.PARENT_ID='"+deptId+"' ) and SHANGBAO='1')";
  85. //var condition = "IS_DEL=0 and ( FABU='1' or PIGEONHOLE_MAN_ID='"+userId+"') ";
  86. var condition = "IS_DEL='0' and (FABU='1' or PIGEONHOLE_MAN_ID='"+ getUser_id +"') and (PUBLISH_COMP_ID='"+deptId+"' or PUBLISH_COMP_ID='"+parentId+"')";
  87. //列表加载参数
  88. var loadParams = {
  89. "listId" : '231',
  90. "condition" : condition,
  91. direction:'DESC',
  92. sort: 'UPDATEDATE'
  93. };
  94. //初始化列表
  95. function initComplete(){
  96. /**
  97. * 工具条
  98. */
  99. var roleCons = roleButtonArr();
  100. var toolBarOpt1 = {items: [
  101. { text: '新增' ,click:"onAdd",iconClass: 'add1_tem',id:"bgdxz"},
  102. { text: '删除' ,click:"onDelete",iconClass: 'delete_tem',id:"bgdsc"},
  103. { text: '修改' ,click:"onEdit",iconClass: 'update_tem',id:"bgdxg"},
  104. { text: '查看',click:"onView",iconClass: 'view_tem', id:"bgdck"},
  105. // { text: '历史版本' ,click:"onViewHistory",iconClass: 'history_tem',id:"10201"},
  106. { text: '导入' , click:"onImport",iconClass: 'import_tem',id:"bgddr" },
  107. { text: '导出' , click:"exportTotalData",iconClass: 'export_tem',id:"bgddc"},
  108. // { text: '下载' ,click:"onDownLoad",iconClass: 'download_tem',id:"10007"},
  109. { text: '汇总', click: "sumUnit", iconClass: 'poll_tem' ,id:"bgdhz"},
  110. { text: '共享', click: "publicShare", iconClass: 'share_tem' ,id:"bgdgx"},
  111. { text: '撤销',click: "noPublish", iconClass: 'release_tem' ,id:"bgdcx"}
  112. ],
  113. roleCons:roleCons};
  114. /**
  115. * 树形列
  116. */
  117. var grid_option1 = {
  118. columns: [
  119. {display : '文件标题',name : 'FILE_TITLE_231', align : 'center',width : '15%',isPrimaryKey:true,
  120. // render : function(rowdata, value) {
  121. // return '<a href="javascript:void(0)" '
  122. // + 'onclick=jumpPage("'
  123. // + rowdata.FD_OBJECTID231
  124. // +'")>'+ rowdata.FILE_TITLE_231 +'</a>';
  125. // }
  126. render : function(rowdata, rowindex, value, column) {
  127. return "<a href='javascript:;' style='width:100%;height:100%;display:block' title='" + value + "' onclick='openDetail(" + rowindex + ")'>" + value + "</a>";
  128. }
  129. },
  130. {display : '发布单位',name : 'PUBLISH_COMP_ID_231_SHOW', align : 'center',width : '15%'},
  131. {display : '文件分类',name : 'FILE_CLASSIFY_231_SHOW', align : 'center',width : '10%'},
  132. {display : '发文日期',name : 'FILE_ADD_DATE_231', align : 'center',width : '10%'},
  133. {display : '归档人',name : 'PIGEONHOLE_MAN_ID_231_SHOW', align : 'center',width : '10%'},
  134. {display : '归档日期',name : 'PIGEONHOLE_DATE_231', align : 'center',width : '10%'},
  135. // {display : '文件摘要',name : 'FILE_CONTENT_231', align : 'center',width : '10%'},
  136. // {display : '变更说明',name : 'CHANGE_DETAIL_231', align : 'center',width : '10%'},
  137. {display : '保密等级',name : 'COLUMN_2_231_SHOW', align : 'center',width : '10%'},
  138. {display : '状态',name : 'CHANGE_TYPE_231_SHOW', align : 'center',width : '10%'},
  139. // {display : '电子文件',name : 'ELECTRONIC_FILE_231', align : 'center',width : '7%'},
  140. { display: '操作', isAllowHide: false, align: 'center', width:'10%',
  141. render: function (rowdata, rowindex, value, column){
  142. //判断是否已经发布。取发布的状态,如果已经发布为“1”;未发布为“0”
  143. var fabu='';//fabu
  144. if(rowdata.FABU_231=="1"){
  145. fabu = '<div class="c_toolcontent"><span class="fashang_07 hand" title="发布" onclick="onPublish1()"></span></div>';
  146. }else{
  147. fabu = '<div class="c_toolcontent"><span class="fashang_06 hand" title="发布" onclick="onPublish(' + rowindex + ')"></span></div>';
  148. }
  149. //判断是否已经发布。取发布的状态,如果已经上报为“1”;未上报为“0”fashang_09
  150. var shangbao='';
  151. if(rowdata.SHANGBAO_231=="1"){
  152. shangbao = '<div class="c_toolcontent"><span class="sendup_templan hand" title="上报" onclick="shangbao1()"></span></div>';
  153. }else{
  154. shangbao = '<div class="c_toolcontent"><span class="fashang_plan hand" title="上报" onclick="onReport(' + rowindex + ')"></span></div>';
  155. }
  156. //共享
  157. var gongxiang='';
  158. if(rowdata.IS_SHARE_231=="1"){
  159. gongxiang = '<div class="c_toolcontent"><span class="share_07 hand" title="撤销共享" onclick="noShare(' + rowindex + ')"></span></div>';
  160. }else{
  161. gongxiang = '<div class="c_toolcontent"><span class="share_03 hand" title="共享" onclick="onShare(' + rowindex + ')"></span></div>';
  162. }
  163. return fabu
  164. /*+ shangbao*/ + gongxiang;
  165. }
  166. }
  167. ],
  168. rownumbers : true,
  169. checkbox : true,
  170. pageSize : 10,
  171. percentWidthMode : true
  172. };
  173. var options1={
  174. url :'/nwyj/ws/crud/CRUDService/queryQui',
  175. params:loadParams,
  176. width:'100%',
  177. sortName : 'UPDATEDATE_231',
  178. gridOptions:grid_option1,
  179. singleRecodeOptions:{a:"aa"},
  180. paperOpration:{showInput:"true"},
  181. toolBarOptions:toolBarOpt1
  182. };
  183. g=gridAndSingleRecode=$("#maingrid").quickgridAndSingleRecode(options1);
  184. /*// showAndHide();
  185. g = $("#maingrid").quiGrid({
  186. columns: [
  187. // {name : 'FD_OBJECTID',hide : true},
  188. {display : '标题',name : 'FILE_TITLE_231', align : 'center',width : '250'},
  189. {display : '分类',name : 'FILE_CLASSIFY_231_SHOW', align : 'center',width : '200'},
  190. // {display : '发布状态',name : 'FILE_STATUS_230_SHOW', align : 'center',width : '10%'},
  191. // {display : '上报状态',name : 'SHANGBAO_230_SHOW', align : 'center',width : '10%'},
  192. {display : '发布日期',name : 'FILE_ADD_DATE_231', align : 'center',width : '200'},
  193. {display : '归档人',name : 'PIGEONHOLE_MAN_ID_231_SHOW', align : 'center',width : '180'},
  194. {display : '归档日期',name : 'PIGEONHOLE_DATE_231', align : 'center',width : '220'},
  195. {display : '变更说明',name : 'CHANGE_DETAIL_231', align : 'center',width : '240'},
  196. {display : '保密等级',name : 'COLUMN_2_231_SHOW', align : 'center',width : '110'},
  197. {display : '状态',name : 'CHANGE_TYPE_231_SHOW', align : 'center',width : '133'},
  198. {display : '电子文件',name : 'ELECTRONIC_FILE_231', align : 'center',width : '110'},
  199. { display: '操作', isAllowHide: false, align: 'left', width:100,
  200. render: function (rowdata, rowindex, value, column){
  201. //判断是否已经发布。取发布的状态,如果已经发布为“1”;未发布为“0”
  202. var fabu='';//fabu
  203. if(rowdata.FABU_231=="1"){
  204. fabu = '<span class="fashang_06 hand" title="发布" onclick="onPublish1()"></span>';
  205. }else{
  206. fabu = '<span class="fashang_07 hand" title="发布" onclick="onPublish(' + rowindex + ')"></span>';
  207. }
  208. //判断是否已经发布。取发布的状态,如果已经上报为“1”;未上报为“0”fashang_09
  209. var shangbao='';
  210. if(rowdata.SHANGBAO_231=="1"){
  211. shangbao = '<span class="fashang_plan hand" title="上报" onclick="shangbao1()"></span>';
  212. }else{
  213. shangbao = '<span class="sendup_templan hand" title="上报" onclick="onReport(' + rowindex + ')"></span>';
  214. }
  215. return fabu
  216. + shangbao;
  217. }
  218. }
  219. ],
  220. url :$.pathname() + '/ws/crud/CRUDService/queryQui',
  221. params : loadParams,
  222. sortName : 'UPDATEDATE_231',
  223. sortOrder : 'desc nulls last',
  224. rownumbers:true,
  225. checkbox:true,
  226. height: '99%',
  227. width:"100%",
  228. pageSize: 10,
  229. percentWidthMode:true,
  230. //顶部图标按钮栏
  231. toolbar:
  232. {
  233. items: [
  234. { text: '新增' ,click:onAdd,iconClass: 'add1_tem', disabled: false },//OK
  235. { line: true },
  236. { text: '删除' ,click:onDelete,iconClass: 'delete_tem', disabled: false },
  237. { line: true },
  238. { text: '修改' ,click:onEdit,iconClass: 'update_tem', disabled: false },
  239. { line: true },
  240. { text: '查看详情',click:onView,iconClass: 'view_tem', disabled: false },
  241. { line: true },
  242. { text: '查看历史版本' ,click:onViewHistory,iconClass: 'icon_history', disabled: false },
  243. { line: true },
  244. { text: '导入' , click:onImport,iconClass: 'import_tem', disabled: false },
  245. { line: true },
  246. { text: '导出' , click:exportTotalData,iconClass: 'icon_export', disabled: false },
  247. { line: true },
  248. { text: '下载' ,click:onDownLoad,iconClass: 'download_tem', disabled: false },
  249. { line: true },
  250. ]
  251. }
  252. });*/
  253. }
  254. function onPublish1(){
  255. top.Dialog.alert("该文件已经发布!");
  256. }
  257. function shangbao1(){
  258. top.Dialog.alert("该文件已经上报!");
  259. }
  260. //点击查看
  261. function jumpPage(id){
  262. window.location.href="FileEMInfo.jsp?"+id;
  263. }
  264. function showPrimaryKey(obj,index){
  265. var fd_id = obj.FD_OBJECTID231;
  266. window.location.href="FileEMInfo.jsp?"+fd_id;
  267. }
  268. //导出
  269. function exportTotalData(){
  270. var rows = g.getSelectedRows();
  271. var rowsLength = rows.length;
  272. if (rowsLength == 0) {
  273. excelExport(
  274. 231,
  275. loadParams,
  276. "保供电制度文件",
  277. "IS_DEL,UPDATEDATE,FD_OBJECTID,COLUMN_1,COLUMN_3,COLUMN_4,PUBLISH_COMP_ID,FILE_STATUS,VERSION_ID,SHANGBAO,FABU,REPORT_COMP_ID"
  278. );
  279. return;
  280. }
  281. var ids = "";
  282. for ( var i = 0; i < rowsLength; i++) {
  283. ids += "'"+rows[i].FD_OBJECTID231+"'" + ",";
  284. }
  285. var temp = ids.substring(0,ids.length-1);
  286. // alert(temp);
  287. var condition = " IS_DEL='0' ";
  288. condition += " AND FD_OBJECTID IN (" + temp + ") " ; //'%" +name+"%';
  289. var sql = {
  290. "listId" :'231' ,
  291. "condition" : condition
  292. };
  293. excelExport(
  294. 231,
  295. sql,
  296. "保供电制度文件",
  297. // ['IS_DEL','UPDATEDATE','FD_OBJECTID','COLUMN_1','COLUMN_3','COLUMN_4','PUBLISH_COMP_ID','FILE_STATUS','VERSION_ID','SHANGBAO','FABU','REPORT_COMP_ID']
  298. "IS_DEL,UPDATEDATE,FD_OBJECTID,COLUMN_1,COLUMN_3,COLUMN_4,PUBLISH_COMP_ID,FILE_STATUS,VERSION_ID,SHANGBAO,FABU,REPORT_COMP_ID"
  299. );
  300. }
  301. //查询
  302. //function searchHandler() {
  303. // var title = $('#FILE_TITLE_231').val();//标题
  304. // var classify = $('#FILE_CLASSIFY_231').val();//分类
  305. // var type = $('#CHANGE_TYPE_231').val();//更新类别
  306. // //时间区间
  307. // var date1 = $('#DATE1').val();
  308. // var date2 = $('#DATE2').val();
  309. // //var userId = row.PIGEONHOLE_MAN_ID_231;
  310. // var condition = "IS_DEL=0 and ( FABU='1' or PIGEONHOLE_MAN_ID='"+getUser_id+"') ";
  311. //
  312. // var baomidengji = $("#COLUMN_2_231").val();//保密等级
  313. //
  314. // if(title!=""&&title!="请输入文件名称"){
  315. // condition += " AND FILE_TITLE LIKE '%" +title+"%'";
  316. // }
  317. // if(baomidengji!=""){
  318. // condition += " AND COLUMN_2 LIKE '%" +baomidengji+"%'";
  319. // }
  320. // if(classify!=""){
  321. // condition += " AND FILE_CLASSIFY = '" + classify + "' ";
  322. // }
  323. // if(type!=""){
  324. // condition += " AND CHANGE_TYPE = '" + type + "' ";
  325. // }
  326. // //日期
  327. // if(date1!="" && date2!=""){
  328. // condition += " AND FILE_ADD_DATE BETWEEN '" + date1 +"' AND '" + date2 + "' ";
  329. // }
  330. // if(date1!="" && date2==""){
  331. // condition += " AND FILE_ADD_DATE >= '" + date1 +"' " ;
  332. // }
  333. // if(date1=="" && date2!=""){
  334. // condition += " AND FILE_ADD_DATE <= '" + date2 + "' ";
  335. // }
  336. // g.setOptions({// 重置加载列表的参数
  337. // params : {
  338. // "listId" : '231',
  339. // "condition" : condition,
  340. // direction:'DESC',
  341. // sort: 'UPDATEDATE'
  342. // }
  343. // });
  344. // g.rend();
  345. //}
  346. // function searchHandler(){
  347. // $queryForm = $("#queryForm");
  348. // if($("#FILE_TITLE_231").val()=="请输入文件名称"){
  349. // $("#FILE_TITLE_231").val("");
  350. // }
  351. // $queryForm.serialize();
  352. // //获取选中的值
  353. // var searchCondition = getSelectCon(conditionData);
  354. // var queryParams = getQueryFormParams($queryForm);
  355. // var params=$.extend({},loadParams,queryParams);
  356. //
  357. // var startTime=$("#startTime").val();
  358. // var endTime=$("#endTime").val();
  359. // var startDate=$("#startDate").val();
  360. // var endDate=$("#endDate").val();
  361. // if(startTime != null && startTime != "" && endTime != null && endTime != ""){
  362. // /*startTime = startTime +" 00:00";
  363. // endTime = endTime +" 23:59";*/
  364. // var condition1 = " and FILE_ADD_DATE between '"+startTime+"' and '"+endTime+"'";
  365. // params.condition = params.condition + condition1;
  366. // }else if(startDate != null && startDate != "" && endDate != null && endDate != ""){
  367. // /*startDate = startDate+" 00:00";
  368. // endDate = endDate +" 23:59";*/
  369. // var condition2 = " and PIGEONHOLE_DATE between '"+startDate+"' and '"+endDate+"'";
  370. // params.condition = params.condition + condition2;
  371. // }else{
  372. // var searchCondition = getSelectCon(conditionData);
  373. // params.condition = searchCondition.condition + params.condition;
  374. // }
  375. //
  376. //// alert(params.condition);
  377. //
  378. // //与之前参数条件拼接
  379. // params.condition = searchCondition.condition + params.condition;
  380. // g.setOptions({"params":params});
  381. // //加载数据
  382. // g.rend();
  383. // }
  384. function searchHandler(){
  385. $queryForm = $("#queryForm");
  386. if($("#FILE_TITLE_231").val()=="请输入文件标题"){
  387. $("#FILE_TITLE_231").val("");
  388. }
  389. $queryForm.serialize();
  390. var $comp_id = $("#selectConditions").find(".PUBLISH_COMP_ID");
  391. var loadParams11;
  392. //判断是否有用单位做查询条件
  393. if(!!$comp_id.prop("outerHTML")){
  394. loadParams11 = {
  395. "listId" : '231',
  396. "condition" : " IS_DEL='0' and FABU='1' ",
  397. direction:'DESC',
  398. sort: 'UPDATEDATE'
  399. };
  400. }else{
  401. loadParams11 = $.extend({},loadParams,loadParams);
  402. }
  403. //获取选中的值
  404. var searchCondition = getSelectCon(conditionData);
  405. var queryParams = getQueryFormParams($queryForm);//拼接出来的条件
  406. var params=$.extend({},loadParams11,queryParams);// 默认
  407. //与之前参数条件拼接
  408. params.condition = searchCondition.condition + params.condition;
  409. // alert(JSON.stringify(params));
  410. g.setOptions({"params":params});
  411. //加载数据
  412. g.rend();
  413. }
  414. //新增
  415. function onAdd(){
  416. window.location.href="FileEMAdd.jsp";
  417. }
  418. function onDelete(){
  419. var rows = g.getSelectedRows();
  420. var rowsLength = rows.length;
  421. if (rowsLength == 0) {
  422. top.Dialog.alert("请选中要删除的记录!");
  423. return;
  424. }
  425. var ids = "";
  426. for ( var i = 0; i < rowsLength; i++) {
  427. ids += rows[i].FD_OBJECTID231 + ",";
  428. if(rows[i].FABU_231=="1"||rows[i].SHANGBAO_231=="1"){
  429. if(rows[i].FABU_231=="1"){
  430. top.Dialog.alert("您选中的文件已经发布!");
  431. }else if(rows[i].SHANGBAO_231){
  432. top.Dialog.alert("您选中的文件已经上报!");
  433. }
  434. return;
  435. }
  436. if(rows[i].PIGEONHOLE_MAN_ID_231!=getUser_id){
  437. top.Dialog.alert("只能刪除自己上传的文件!");
  438. return;
  439. }
  440. }
  441. top.Dialog.confirm("确定要删除吗?|删除", function() {
  442. // 删除记录
  443. $.post($.pathname() +"/ws/crud/CRUDService/delete/", {
  444. "objectIDs" : ids,
  445. classid : 231
  446. }, function(result) {
  447. if (result.Msg.sucsess == true) {
  448. $.messager.alert("删除成功",null,null,null,-1);
  449. // 刷新表格数据
  450. g.rend();
  451. } else {
  452. top.Dialog.alert("删除失败!");
  453. }
  454. }, "json");
  455. });
  456. }
  457. //修改
  458. function onEdit(){
  459. var rows = g.getSelectedRows();
  460. if (rows.length == 0) {
  461. top.Dialog.alert("请选择一条记录");
  462. return;
  463. }
  464. if (rows.length > 1) {
  465. top.Dialog.alert("只能选择一条记录");
  466. return;
  467. }
  468. //归档人
  469. //只能修改自己上传的文件
  470. var userIds = rows[0].PIGEONHOLE_MAN_ID_231;
  471. if(userIds!=getUser_id){
  472. top.Dialog.alert("只能修改自己上传的文件!");
  473. return;
  474. }
  475. //上报或发布的不能修改
  476. var shangbao = rows[0].SHANGBAO_231;
  477. var fabu = rows[0].FABU_231;
  478. if(shangbao=="1"){
  479. top.Dialog.alert("上报的文件不能修改!");
  480. return;
  481. }else if(fabu=="1"){
  482. top.Dialog.alert("发布的文件不能修改!");
  483. return;
  484. }
  485. // if(PIGEONHOLE_MAN_ID_231!=tianbaorenID){
  486. // top.Dialog.alert("不能修改别人上传的文件!");
  487. // return;
  488. // }
  489. var fd_id = rows[0].FD_OBJECTID231;
  490. window.location.href="FileEMEdit.jsp?"+fd_id;
  491. };
  492. //查看详情
  493. function onView(){
  494. var rows = g.getSelectedRows();
  495. if (rows.length == 0) {
  496. top.Dialog.alert("请选择一个文件");
  497. return;
  498. }
  499. if (rows.length > 1) {
  500. top.Dialog.alert("只能选择一个文件");
  501. return;
  502. }
  503. var fd_id = rows[0].FD_OBJECTID231;
  504. window.location.href="FileEMInfo.jsp?"+fd_id;
  505. // var fd_id = rows[0].FD_OBJECTID231;
  506. // var url = "FileEMInfo.jsp?"+fd_id;
  507. // window.parent.document.setAttribute("src", "/nwyj/page/business/am/file/"+url);
  508. }
  509. this.openDetail = function(rowindex) {
  510. var row = g.getRow(rowindex);
  511. var fd_id = row.FD_OBJECTID231;
  512. window.location.href="FileEMInfo.jsp?"+fd_id;
  513. };
  514. //上报
  515. function onReport(data){
  516. var row = g.getRow(data);
  517. var fd_id = row.FD_OBJECTID231;
  518. //只能上报自己上传的文件
  519. var userId = row.PIGEONHOLE_MAN_ID_231;
  520. if(getUser_id!=userId){
  521. top.Dialog.alert("只能上报自己上传的文件!");
  522. return;
  523. }
  524. top.Dialog.confirm("确定要上报吗?|上报", function() {
  525. // 上报
  526. $.post($.pathname() +"/ws/EmcPlan/EmgencyPlanService/bgdfileShangbao/", {
  527. //当前单位id
  528. comp_id : dpids,
  529. fd_id : fd_id,
  530. }, function(result) {
  531. if (result.Msg.sucsess == true) {
  532. $.messager.alert("上报成功",null,null,null,-1);
  533. //消息推送
  534. fillShangbao(data);
  535. // 刷新表格数据
  536. g.rend();
  537. } else {
  538. top.Dialog.alert("上报失败!");
  539. }
  540. }, "json");
  541. });
  542. }
  543. //上报前先给上级单位公共消息库里插入一条记录
  544. /**
  545. * 1、取本级单位ID
  546. * 2、上报人ID
  547. * 3、上报消息主键
  548. * 4、服务名称(URL)
  549. **/
  550. function fillShangbao(data){
  551. var row = g.getRow(data);
  552. var fd_id = row.FD_OBJECTID231;
  553. remark=fd_id;
  554. //向后台发送请求调用dwr
  555. var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/sendMsgDwr/';
  556. var msg = "<a href=\"javascript:void(0)\" onclick=\"openY('/nwyj/page/business/am/public/FileEMInfo.jsp?"+fd_id+"')\">"+corp_name+"的保供电制度文件</a>";
  557. //var msg = "<a href=\"javascript:void(0)\" onclick=\"openY('/nwyj/page/business/am/contingencyPlan/PlanAdd.jsp')\">应急预案</a>";
  558. var params = {
  559. parentDeptName:parentId,
  560. msg:msg
  561. };
  562. $.ajax({
  563. url : url,
  564. type : 'post',
  565. data : params,
  566. dataType : 'text',
  567. timeout : 60000,
  568. success : function(data){
  569. },
  570. error : function(){
  571. $.messager.alert('操作失败');
  572. }
  573. });
  574. }
  575. //发布
  576. function onPublish(data){
  577. var row = g.getRow(data);
  578. //只能上报自己上传的文件
  579. var userId = row.PIGEONHOLE_MAN_ID_231;
  580. if(getUser_id!=userId){
  581. top.Dialog.alert("只能发布自己上传的文件!");
  582. return;
  583. }
  584. top.Dialog.confirm("确定要发布吗?|发布", function() {
  585. var fd_id = row.FD_OBJECTID231;
  586. // 发布规范文件
  587. $.post($.pathname() +"/ws/EmcPlan/EmgencyPlanService/bgdfileFabu/", {
  588. comp_id : dpids,
  589. fd_id : fd_id,
  590. }, function(result) {
  591. if (result.Msg.sucsess == true) {
  592. top.Dialog.alert("发布成功");
  593. // 刷新表格数据
  594. g.rend();
  595. } else {
  596. top.Dialog.alert("发布失败!");
  597. }
  598. }, "json");
  599. }
  600. );
  601. }
  602. //撤回
  603. function onCallBack(rowid){
  604. top.Dialog.confirm("确定要撤回吗?|撤回", function() {
  605. if(status=="0"){
  606. top.Dialog.alert("只能撤回已发布或已上报的文件");
  607. return;
  608. }
  609. // 发布规范文件
  610. $.post($.pathname() +"/ws/SystemFile/SystemFileService/callBack", {
  611. "fd_id" : rowid
  612. }, function(result) {
  613. if (result.Msg.sucsess == true) {
  614. top.Dialog.alert("撤回成功",null,null,null,1);
  615. // 刷新表格数据
  616. g.rend();
  617. } else {
  618. top.Dialog.alert("撤回失败!");
  619. }
  620. }, "json");
  621. });
  622. }
  623. //下载
  624. function onDownLoad(){
  625. var rows = g.getSelectedRows();
  626. var rowsLength = rows.length;
  627. if (rowsLength == 0) {
  628. top.Dialog.alert("请选中要下载的文件!");
  629. return;
  630. }
  631. var fd_id = rows[0].FD_OBJECTID231;
  632. showFile(fd_id);
  633. }
  634. function showFile(fd_id){
  635. var diag = new top.Dialog();// 定义一个窗口对象
  636. diag.Title = "下载";// 窗口标题
  637. diag.URL = $.pathname() +"/page/business/am/base/showDownloadFile.html?fd_id="+fd_id;// 窗口对应的页面
  638. diag.Height = 400;
  639. diag.ShowOkButton=false;// 不显示确认按钮
  640. diag.ShowCancelButton=false;// 不显示取消按钮
  641. diag.ButtonAlign="center";// 按钮居中
  642. diag.show();// 显示窗口
  643. }
  644. //共享 单一的
  645. function onShare(data){
  646. var row = g.getRow(data);
  647. var fd_id = row.FD_OBJECTID231+",";
  648. //只能共享以及发布的文件
  649. if(row.FABU_231!="1"){
  650. top.Dialog.alert("只能共享已经发布的文件!");
  651. return;
  652. }
  653. //只能共享自己上传的文件
  654. var REMARK1 = row.PIGEONHOLE_MAN_ID_231;
  655. if(REMARK1!=getUser_id){
  656. top.Dialog.alert("只能共享自己上传的文件!");
  657. return;
  658. }
  659. top.Dialog.confirm("确定要共享吗?|共享", function() {
  660. // 发布规范文件
  661. $.post($.pathname() +"/ws/FILEPOLL/FileAMService/FileEMShare/", {
  662. fd_id : fd_id,
  663. }, function(result) {
  664. if (result.Msg.sucsess == true) {
  665. top.Dialog.alert("共享成功");
  666. // 刷新表格数据
  667. g.rend();
  668. } else {
  669. top.Dialog.alert("共享失败!");
  670. }
  671. }, "json");
  672. });
  673. }
  674. //撤销共享
  675. function noShare(data){
  676. var row = g.getRow(data);
  677. var fd_id = row.FD_OBJECTID231+",";
  678. //只能撤销自己上传的文件
  679. var REMARK1 = row.PIGEONHOLE_MAN_ID_231;
  680. if(REMARK1!=getUser_id){
  681. top.Dialog.alert("只能撤销自己上传的文件!");
  682. return;
  683. }
  684. top.Dialog.confirm("确定要撤销共享吗?|撤销", function() {
  685. // 发布规范文件
  686. $.post($.pathname() +"/ws/FILEPOLL/FileAMService/noFileEMShare/", {
  687. fd_id : fd_id,
  688. }, function(result) {
  689. if (result.Msg.sucsess == true) {
  690. top.Dialog.alert("撤销成功");
  691. // 刷新表格数据
  692. g.rend();
  693. } else {
  694. top.Dialog.alert("撤销失败!");
  695. }
  696. }, "json");
  697. });
  698. }
  699. //导入
  700. function onImport(){
  701. window.location.href="FileEM-import.jsp";
  702. }
  703. //查看历史版本
  704. function onViewHistory(){
  705. var rows = g.getSelectedRows();
  706. if(rows.length==0){
  707. top.Dialog.alert("请选择一条记录");
  708. return;
  709. }
  710. if(rows.length>1){
  711. top.Dialog.alert("只能选择一条记录");
  712. return;
  713. }
  714. //上一个版本的预案ID
  715. var fd_id = rows[0].COLUMN_1_231;
  716. var fd_id1 = rows[0].FD_OBJECTID231;
  717. window.location.href="FileEMVersion.jsp?"+fd_id+"?" + fd_id1;
  718. }
  719. //更多
  720. function more(){
  721. $('#moreDiv').toggle(400,function(){
  722. $("#emptyCondition").click();
  723. $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  724. });
  725. }
  726. //汇总统计
  727. function sumUnit(){
  728. window.location.href="FileEM-poll.jsp";
  729. }
  730. //共享
  731. function publicShare(){
  732. var rows = g.getSelectedRows();
  733. var rowsLength = rows.length;
  734. if (rowsLength == 0) {
  735. top.Dialog.alert("请选中要共享的记录!");
  736. return;
  737. }
  738. var REMARK1 = rows[0].PIGEONHOLE_MAN_ID_231;
  739. if(REMARK1!=getUser_id){
  740. top.Dialog.alert("只能共享自己上传的文件!");
  741. return;
  742. }
  743. var ids = "";
  744. var sturtssb = "";
  745. for ( var i = 0; i < rowsLength; i++) {
  746. ids += rows[i].FD_OBJECTID231 + ",";
  747. sturtssb += rows[i].FABU_231 + ",";
  748. if(rows[i].FABU_231!="1"){
  749. if(rowsLength==1){
  750. top.Dialog.alert("您选中的记录未发布!");
  751. }else{
  752. top.Dialog.alert("您选中的记录有未发布的!");
  753. }
  754. return;
  755. }
  756. if(rows[i].IS_SHARE_231 == "1"){
  757. if(rowsLength==1){
  758. top.Dialog.alert("您选中的记录已共享!");
  759. }else{
  760. top.Dialog.alert("您选中的记录中包含已共享的!");
  761. }
  762. return;
  763. }
  764. }
  765. /* $("#BUSINE_ID_217").val(ids);
  766. var diag = new top.Dialog();
  767. diag.Title = "文件共享";
  768. diag.URL = $.pathname() + '/page/business/am/public/readDept.jsp';
  769. diag.Width = 700;
  770. diag.Height = 500;
  771. diag.Top = "80%";
  772. diag.Left = "50%";
  773. diag.ShowButtonRow=true;
  774. diag.ButtonAlign = 'center';
  775. diag.OkButtonText="确 定";
  776. diag.OKEvent = function(){
  777. Validate(diag);
  778. *//******改变共享字段的值,即改变共享状态***************//*
  779. for(var i=0;i<rowsLength;i++){
  780. var fd_id = rows[i].FD_OBJECTID231;
  781. var is_share=rows[i].IS_SHARE_231;
  782. if(is_share==1){
  783. top.Dialog.alert("包含已共享记录,请重新选择");
  784. return;
  785. }
  786. var params = {
  787. classid : "231",
  788. FD_OBJECTID231 : fd_id,
  789. IS_SHARE_231 : '1'
  790. };
  791. //top.Dialog.confirm("确定要共享吗?|共享", function() {
  792. $.ajax({
  793. url : $.pathname() + '/ws/crud/CRUDService/updateWarning/',
  794. type : 'post',
  795. timeout : 15000,
  796. data : params,
  797. dataType : 'json',
  798. success : function(data) {
  799. top.Dialog.alert('成功共享!', null, null, null, -1);
  800. g.rend();
  801. },
  802. error : function(e) {
  803. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  804. }
  805. });
  806. //});
  807. }
  808. *//******改变改变共享字段的值,即改变共享状体***************//*
  809. };
  810. diag.show(); */
  811. top.Dialog.confirm("确定要共享吗?|共享", function() {
  812. $.post($.pathname() +"/ws/FILEPOLL/FileAMService/FileEMShare/", {
  813. fd_id : ids,
  814. }, function(result) {
  815. if (result.Msg.sucsess == true) {
  816. $.messager.alert("共享成功");
  817. // 刷新表格数据
  818. g.rend();
  819. } else {
  820. top.Dialog.alert("共享失败!");
  821. }
  822. }, "json");
  823. });
  824. }
  825. /* 废弃 */
  826. function Validate(diag){
  827. var zhh="";//总指挥
  828. var fzhh="";//副总指挥
  829. var yjbzr="";//应急办主任
  830. var yjbfzr="";//应急办副主任
  831. var yjbcy="";//应急办副成员
  832. var zyglry="";//专业部门管理人员
  833. var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+""; //登录人ID
  834. //分享单位的ID deptId
  835. var time1=diag.innerFrame.contentWindow.$("#time1").val();
  836. var time2=diag.innerFrame.contentWindow.$("#time2").val();
  837. //获取应急角色被勾选的值
  838. if(diag.innerFrame.contentWindow.document.getElementById("football-1").checked){
  839. //选中取值(可以取到这个值)
  840. zhh = "R002105430201";
  841. }else{
  842. zhh = "";
  843. }
  844. if(diag.innerFrame.contentWindow.document.getElementById("football-2").checked){
  845. //选中取值(可以取到这个值)
  846. fzhh = "R002105430202";
  847. }else{
  848. zyglry = "";
  849. }
  850. if(diag.innerFrame.contentWindow.document.getElementById("football-3").checked){
  851. //选中取值(可以取到这个值)
  852. yjbzr = "R002105430203";
  853. }else{
  854. yjbzr = "";
  855. }
  856. if(diag.innerFrame.contentWindow.document.getElementById("football-4").checked){
  857. //选中取值(可以取到这个值)
  858. yjbfzr = "R002105430204";
  859. }else{
  860. yjbfzr = "";
  861. }
  862. if(diag.innerFrame.contentWindow.document.getElementById("football-5").checked){
  863. //选中取值(可以取到这个值)
  864. yjbcy = "R002105430205";
  865. }else{
  866. yjbcy = "";
  867. }
  868. if(diag.innerFrame.contentWindow.document.getElementById("football-6").checked){
  869. //选中取值(可以取到这个值)
  870. zyglry = "R002105430206||R002105430207||R002105430208||R002105430209||R002105430210||R002105430211||R002105430212||R002105430213||R002105430214";
  871. }else{
  872. zyglry = "";
  873. }
  874. //被分享查看的人
  875. var RECEIVE_MAN = zhh + "||" + fzhh + "||" + yjbzr + "||" + yjbfzr + "||" + yjbcy + "||" + zyglry;
  876. //分享的单位 deptId
  877. //获取zTree对象
  878. var zTree = diag.innerFrame.contentWindow.$.fn.zTree.getZTreeObj("tree-1");
  879. //得到选中的数据集
  880. var checkedNodes = zTree.getCheckedNodes(true);
  881. if(time1==""||time2==""){
  882. $.messager.alert('请选择分享的起始时间!');
  883. return;
  884. }
  885. if(time1>time2){
  886. $.messager.alert('请选择正确的分享起始时间!');
  887. return;
  888. }
  889. if(checkedNodes==""){
  890. $.messager.alert('请选择要申请查看的单位!');
  891. return;
  892. }
  893. var compValue="";
  894. //var compValue2="";
  895. for(var i = 0; i < checkedNodes.length; i++){
  896. //机构名称
  897. compValue += checkedNodes[i].id + ",";
  898. //compValue2 += checkedNodes[i].name+",";
  899. }
  900. var compid = compValue.substring(0,compValue.length-1);
  901. //var compname = compValue2.substring(0,compValue2.length-1);
  902. //给第二个form的字段设置值
  903. $("#SHARE_MAN_217").val(getUser_id); //SHARE_MAN_217 分享人
  904. $("#SHARE_UNITS_217").val(deptId); //SHARE_UNITS_217分享单位
  905. $("#RECEIVE_UNITS_217").val(compid); //RECEIVE_UNITS_217 被分享单位
  906. //SHARE_TYPE_217分享的业务类型 写死3
  907. $("#SHARE_START_TIME_217").val(time1); //SHARE_START_TIME_217开始时间
  908. $("#SHARE_END_TIME_217").val(time2); //SHARE_END_TIME_217结束时间
  909. //BUSINE_ID_217业务ID 点击分享的时候已经赋值给页面了
  910. $("#RECEIVE_MAN_217").val(RECEIVE_MAN); //RECEIVE_MAN_217接收的人
  911. var $form = $('#fillForm1');
  912. var url = $.pathname() + '/ws/crud/CRUDService/create';
  913. $.ajax({
  914. url : url,
  915. type : 'post',
  916. data : $form.serialize(),
  917. dataType : 'text',
  918. timeout : 60000,
  919. success : function(data){
  920. $.messager.alert("共享成功",null,null,null,-1);
  921. },
  922. error : function(){
  923. $.messager.alert('操作失败');
  924. }
  925. });
  926. top.Dialog.close();//关闭新增窗口
  927. }
  928. //撤销
  929. function noPublish(){
  930. var rows = g.getSelectedRows();
  931. var rowsLength = rows.length;
  932. if (rowsLength == 0) {
  933. top.Dialog.alert("请选中要撤销的记录!");
  934. return;
  935. } else if (rowsLength > 1) {
  936. top.Dialog.alert("请选中一条要撤销的记录!");
  937. return;
  938. }
  939. var ids = "";
  940. for ( var i = 0; i < rowsLength; i++) {
  941. ids += rows[i].FD_OBJECTID231 + ",";
  942. var Bcompid = rows[i].PUBLISH_COMP_ID_231;
  943. if(deptId!=Bcompid){
  944. top.Dialog.alert("只能撤销本单位的文件!");
  945. return;
  946. }
  947. if(rows[i].FABU_231!="1"){
  948. top.Dialog.alert("您选中的记录还没有发布!");
  949. return;
  950. }
  951. }
  952. top.Dialog.confirm("确定要撤销发布吗?|撤销", function() {
  953. $.post($.pathname() +"/ws/FILEPOLL/FileAMService/noPublish/", {
  954. fd_id : ids,
  955. }, function(result) {
  956. if (result.Msg.sucsess == true) {
  957. $.messager.alert("撤销成功",null,null,null,-1);
  958. // 刷新表格数据
  959. g.rend();
  960. } else {
  961. top.Dialog.alert("撤销失败!");
  962. }
  963. }, "json");
  964. });
  965. }
  966. $.messager=top.Dialog;
  967. function showPrimaryKey(obj,index){
  968. var fd_id = obj.FD_OBJECTID231;
  969. $('#frmright', window.parent.document).attr('src',$.pathname()+'/page/business/am/PPSFile/FileEMInfo.jsp?'+fd_id);
  970. }