261ff8b8864a027a063f6e5a6d611df4f5237e7d.svn-base 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  2. //登陆用户的单位名称
  3. var corp_name = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
  4. var parent_ids = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
  5. /*******************************修改、删除信息 各级单位的超级管理员可以修改表单信息。湛江局许永山提的建议 2016-05-31** */
  6. //登陆人角色
  7. var Roleid = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids() + ",";
  8. var roleidTemp =Roleid.split(",");
  9. var flag="0";
  10. $(function(){
  11. });
  12. var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+""; //登录人ID
  13. var g;
  14. var dept_id = (window.location.href).split('?')[1];
  15. //dept_id ="8F6F2D6B24494CB6B1F1E0931E7AF87D";
  16. //
  17. condition = "DATEDIFF(MONTH,plan_time ,sysdate) >1 and IMPLEMENT_STAT='0' and is_del= '0' and UNITS ='"+dept_id+"'" ;
  18. //列表加载参数
  19. var loadParams = {
  20. "listId" : '299',
  21. "condition" : condition,
  22. direction:'DESC',
  23. sort: 'UPDATEDATE'
  24. };
  25. function initComplete(){
  26. /**
  27. * 工具条
  28. */
  29. var roleCons = roleButtonArr();
  30. var toolBarOpt1 = {
  31. items:[
  32. {text: '新增', click: "addUnit", iconClass: 'add1_tem',id:"rcxz"},
  33. {text: '删除', click: "deleteUnit", iconClass: 'delete_tem',id:"rcsc"},
  34. {text: '修改', click: "updateUnit", iconClass: 'update_tem',id:"rcxg"},
  35. {text: '查看', click: "onView", iconClass: 'view_tem',id:"10003"},
  36. {text: '统计', click: "sumUnit", iconClass: 'poll_tem',id:"10200"},
  37. {text: '导入', click: "showImportDialog", iconClass: 'import_tem',id:"rcdr"},
  38. {text: '导出', click: "exportTotalData", iconClass: 'export_tem',id:"10006"},
  39. { text: '撤销', click: "noPublish", iconClass: 'release_tem' ,id:"10215"}
  40. ],
  41. roleCons:roleCons
  42. };
  43. /**
  44. * 树形列
  45. */
  46. var grid_option1 = {
  47. columns: [
  48. { display: '演练名称', name: 'DRILL_NAME_299', align: 'center', width: "14%",isPrimaryKey:true,
  49. render : function(rowdata, rowindex, value, column) {
  50. return "<a href='javascript:;' style='width:100%;height:100%;display:block' title='" + value + "' onclick='openDetail(" + rowindex + ")'>" + value + "</a>";
  51. }
  52. },
  53. { display: '填报单位', name: 'UNITS_299_SHOW', align: 'center', width: "13%"},
  54. { display: '主办单位', name: 'SPONSOR_COMP_299_SHOW', align: 'center', width: "13%"},
  55. { display: '演练类别', name: 'DRILL_TYPE_299_SHOW', align: 'center' , width: "10%"},
  56. { display: '演练形式', name: 'DRILL_FORM_299_SHOW', align: 'center', width: "10%"},
  57. { display: '是否计划', name: 'IS_PLAN_299_SHOW', align: 'center', width: "10%"},
  58. { display: '计划时间', name: 'PLAN_TIME_299', align: 'center' , width: "10%"},
  59. { display: '计划填报人', name: 'PLAN_MAKER_299_SHOW', align: 'center', width: "10%" },
  60. { display: '操作', isAllowHide: false, align: 'center', width:"10%",
  61. render: function (rowdata, rowindex, value, column){
  62. //判断是否已经发布。取发布的状态,如果已经上报为“1”;未上报为“0”fashang_09fashang_plan
  63. var shangbao='';
  64. if(rowdata.IS_SHANGBAO_299=="1"){
  65. shangbao = '<span class="sendup_templan hand" title="上报" onclick="shangbao(' + rowindex + ')"></span>';
  66. }else{
  67. shangbao = '<span class="fashang_plan hand" title="上报" onclick="shangbao(' + rowindex + ')"></span>';
  68. }
  69. return shangbao;
  70. }
  71. }
  72. ],
  73. rownumbers : true,
  74. checkbox : true,
  75. sortName : 'UPDATEDATE_299',
  76. pageSize : 10,
  77. percentWidthMode : true
  78. };
  79. var options1={
  80. url :'/nwyj/ws/crud/CRUDService/queryQui',
  81. params:loadParams,
  82. gridOptions:grid_option1,
  83. singleRecodeOptions:{a:"aa"},
  84. paperOpration:{showInput:"true"},
  85. toolBarOptions:toolBarOpt1
  86. };
  87. g=gridAndSingleRecode=$("#maingrid").quickgridAndSingleRecode(options1);
  88. }
  89. function onDownload(){
  90. var rows = g.getSelectedRows();
  91. if (rows.length == 0) {
  92. top.Dialog.alert("请选择一条记录");
  93. return;
  94. }
  95. if (rows.length > 1) {
  96. top.Dialog.alert("只能选择一条记录");
  97. return;
  98. }
  99. var fd_id = rows[0].FD_OBJECTID299;
  100. showFile(fd_id);
  101. }
  102. function showFile(fd_id){
  103. var diag = new top.Dialog();// 定义一个窗口对象
  104. diag.Title = "下载";// 窗口标题
  105. diag.URL = $.pathname() +"/page/business/am/base/showDownloadFile.html?fd_id="+fd_id;// 窗口对应的页面
  106. diag.Height = 400;
  107. diag.ShowOkButton=false;// 不显示确认按钮
  108. diag.ShowCancelButton=false;// 不显示取消按钮
  109. diag.ButtonAlign="center";// 按钮居中
  110. diag.show();// 显示窗口
  111. }
  112. function searchHandler(){
  113. $queryForm = $("#queryForm");
  114. if($("#DRILL_NAME_299").val()=="请输入演练的名称"){
  115. $("#DRILL_NAME_299").val("");
  116. }
  117. $queryForm.serialize();
  118. var $comp_id = $("#selectConditions").find(".UNITS");
  119. var loadParams11;
  120. //判断是否有用单位做查询条件
  121. if(!!$comp_id.prop("outerHTML")){
  122. loadParams11 = {
  123. "listId" : '299',
  124. "condition" : " IS_DEL='0'",
  125. direction:'DESC',
  126. sort: 'UPDATEDATE'
  127. };
  128. }else{
  129. loadParams11 = $.extend({},loadParams,loadParams);
  130. }
  131. //获取选中的值
  132. var searchCondition = getSelectCon(conditionData);
  133. var queryParams = getQueryFormParams($queryForm);
  134. var params=$.extend({},loadParams11,queryParams);
  135. //与之前参数条件拼接
  136. params.condition = searchCondition.condition + params.condition;
  137. g.setOptions({"params":params});
  138. //加载数据
  139. g.rend();
  140. }
  141. //新增
  142. function addUnit(){
  143. window.location.href="emc-drill-add.jsp";
  144. }
  145. //修改
  146. function updateUnit(rowid){
  147. var rows = g.getSelectedRows();
  148. if(rows.length==0){
  149. top.Dialog.alert("请选择一条记录");
  150. return;
  151. }
  152. if(rows.length>1){
  153. top.Dialog.alert("只能选择一条记录");
  154. return;
  155. }
  156. for(var i=0; i< roleidTemp.length; i++){
  157. if(roleidTemp[i]=="R002105430200"){
  158. flag="1";
  159. }
  160. }
  161. var PLAN_MAKER_299 = rows[0].PLAN_MAKER_299;;
  162. var tianbaorenID = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+"";
  163. if(PLAN_MAKER_299!=tianbaorenID&&flag=="0"){
  164. top.Dialog.alert("不能修改别人上传的演练计划!");
  165. return;
  166. }
  167. var fd_id= rows[0].FD_OBJECTID299;
  168. window.location.href="emc-drill-update.jsp?"+fd_id;
  169. }
  170. //删除
  171. function deleteUnit(){
  172. var rows = g.getSelectedRows();
  173. var rowsLength = rows.length;
  174. if (rowsLength == 0) {
  175. top.Dialog.alert("请选中要删除的记录!");
  176. return;
  177. }
  178. for(var i=0; i< roleidTemp.length; i++){
  179. if(roleidTemp[i]=="R002105430200"){
  180. flag="1";
  181. }
  182. }
  183. var ids = "";
  184. var fd_sb ="";
  185. var PLAN_MAKER_299;
  186. var tianbaorenID = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+"";
  187. for ( var i = 0; i < rowsLength; i++) {
  188. ids += rows[i].FD_OBJECTID299 + ",";
  189. fd_sb = rows[i].IS_SHANGBAO_299;
  190. PLAN_MAKER_299 = rows[i].PLAN_MAKER_299;
  191. if(fd_sb=="1"&&flag=="0"){
  192. top.Dialog.alert("上报的应急演练不能删除!");
  193. return;
  194. }
  195. if(PLAN_MAKER_299!=tianbaorenID&&flag=="0"){
  196. top.Dialog.alert("不能删除别人上传的演练计划!");
  197. return;
  198. }
  199. }
  200. top.Dialog.confirm("确定要删除吗?|删除", function() {
  201. // 删除记录
  202. $.post($.pathname() +"/ws/crud/CRUDService/delete/", {
  203. "objectIDs" : ids,
  204. classid : 299
  205. }, function(result) {
  206. if (result.Msg.sucsess == true) {
  207. $.messager.alert("删除成功",null,null,null,1);
  208. // 刷新表格数据
  209. g.rend();
  210. } else {
  211. top.Dialog.alert("删除失败!");
  212. }
  213. }, "json");
  214. });
  215. }
  216. //单个删除
  217. function onDelete(rowid){
  218. var row = g.getRow(rowid);
  219. var fd_shangbao = row.IS_SHANGBAO_299;
  220. if(fd_shangbao=="1"){
  221. top.Dialog.alert("上报的应急演练不能删除!");
  222. return;
  223. }
  224. var fd_id= row.FD_OBJECTID299;
  225. top.Dialog.confirm("确定要删除该记录吗?",function(){
  226. //删除记录
  227. $.post($.pathname() +"/ws/crud/CRUDService/delete/",{
  228. "objectIDs" : fd_id,
  229. classid : 299
  230. },function(result){
  231. if(result.Msg.sucsess == true){
  232. top.Dialog.alert("删除成功!",null,null,null,1);
  233. }else{
  234. top.Dialog.alert("删除失败!");
  235. }
  236. //刷新表格
  237. g.loadData();
  238. },"json");
  239. });
  240. }
  241. //导入
  242. function showImportDialog(){
  243. window.location.href="emc-drill-import.jsp";
  244. }
  245. //导出
  246. function exportTotalData(){
  247. var rows = g.getSelectedRows();
  248. var rowsLength = rows.length;
  249. if (rowsLength == 0) {
  250. top.Dialog.confirm("是否导出所有的应急演练计划?|确定", function() {
  251. excelExport(299,loadParams,"应急演练计划","IS_DEL,UPDATEDATE,FD_OBJECTID,IS_SHANGBAO,DRILL_VIEW_CONTENT,DRILL_SCHEME,APPEAR_COMP,FINAL_REPORT,NOTICE_TIME,PLAN_MAKER,PLAN_STAT");});
  252. return;
  253. }
  254. var ids = "";
  255. for ( var i = 0; i < rowsLength; i++) {
  256. ids += "'"+rows[i].FD_OBJECTID299+"'" + ",";
  257. }
  258. var temp = ids.substring(0,ids.length-1);
  259. var condition = " IS_DEL='0' ";
  260. condition += " AND FD_OBJECTID IN (" + temp + ") " ; //'%" +name+"%';
  261. var sql = {
  262. "listId" :'299' ,
  263. "condition" : condition,
  264. direction:'DESC',
  265. sort: 'UPDATEDATE'
  266. };
  267. excelExport(299,sql,"应急演练计划","IS_DEL,UPDATEDATE,FD_OBJECTID,IS_SHANGBAO,DRILL_VIEW_CONTENT,DRILL_SCHEME,APPEAR_COMP,FINAL_REPORT,NOTICE_TIME,PLAN_MAKER,PLAN_STAT");
  268. }
  269. //点击查看
  270. function jumpPage(id){
  271. window.location.href="emc-drill-info.jsp?"+id;
  272. }
  273. //点击主键跳转详细信息页面
  274. this.openDetail = function(rowindex) {
  275. var row = g.getRow(rowindex);
  276. var fd_id = row.FD_OBJECTID299;
  277. window.location.href="emc-drill-info.jsp?"+fd_id;
  278. };
  279. function showPrimaryKey(obj,index){
  280. var fd_id = obj.FD_OBJECTID299;
  281. window.location.href="emc-drill-info.jsp?"+fd_id;
  282. }
  283. //详情
  284. function onView(rowid){
  285. var rows = g.getSelectedRows();
  286. if(rows.length==0){
  287. top.Dialog.alert("请选择一条记录");
  288. return;
  289. }
  290. if(rows.length>1){
  291. top.Dialog.alert("只能选择一条记录");
  292. return;
  293. }
  294. // var row = g.getRow(rowid);
  295. // var fd_id= row.FD_OBJECTID299;
  296. var fd_id= rows[0].FD_OBJECTID299;
  297. window.location.href="emc-drill-info.jsp?"+fd_id;
  298. }
  299. //上报(修改预案的状态)
  300. function shangbao(data){
  301. var row = g.getRow(data);
  302. var fd_id = row.FD_OBJECTID299;
  303. var shangbao = row.IS_SHANGBAO_299;
  304. if(shangbao=="1"){
  305. top.Dialog.alert("该演练计划已经上报!");
  306. return;
  307. }
  308. top.Dialog.confirm("确定要上报吗?|上报", function() {
  309. // 上报
  310. $.post($.pathname() +"/ws/DrillCount/DrillCountService/appear/", {
  311. //当前单位id
  312. comp_id : 299,
  313. fd_id : fd_id,
  314. }, function(result) {
  315. if (result.Msg.sucsess == true) {
  316. $.messager.alert("上报成功",null,null,null,-1);
  317. //推送
  318. fillShangbao(data);
  319. // 刷新表格数据 上报成功后不能刷新表格
  320. g.rend();
  321. } else {
  322. top.Dialog.alert("上报失败!");
  323. }
  324. }, "json");
  325. });
  326. }
  327. //上报前先给上级单位公共消息库里插入一条记录
  328. /**
  329. * 1、取本级单位ID
  330. * 2、上报人ID
  331. * 3、上报消息主键
  332. * 4、服务名称(URL)
  333. **/
  334. function fillShangbao(data){
  335. var row = g.getRow(data);
  336. var fd_id = row.FD_OBJECTID299;
  337. //向后台发送请求调用dwr
  338. var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/sendMsgDwr/';
  339. var msg = "<a href=\"javascript:void(0)\" onclick=\"openY('/nwyj/page/business/am/public/emc-drill-info.jsp?"+fd_id+"')\">"+corp_name+"的应急演练</a>";
  340. //var msg = "<a href=\"javascript:void(0)\" onclick=\"openY('/nwyj/page/business/am/contingencyPlan/PlanAdd.jsp')\">应急预案</a>";
  341. var params = {
  342. parentDeptName:parent_ids,
  343. msg:msg
  344. };
  345. $.ajax({
  346. url : url,
  347. type : 'post',
  348. data : params,
  349. dataType : 'text',
  350. timeout : 60000,
  351. success : function(data){
  352. },
  353. error : function(){
  354. // $.messager.alert('操作失败');
  355. }
  356. });
  357. }
  358. function onReport(id){
  359. top.Dialog.alert("上报");
  360. }
  361. //统计
  362. function sumUnit(){
  363. window.location.href="emc-drill-poll.jsp";
  364. }
  365. //短信
  366. function sendMsg(){
  367. window.location.href="NoticeTime.jsp";
  368. }
  369. function more() {
  370. $('#moreDiv').toggle(400,function(){
  371. $("#emptyCondition").click();
  372. $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  373. });
  374. }
  375. //撤销
  376. function noPublish(){
  377. var rows = g.getSelectedRows();
  378. var rowsLength = rows.length;
  379. if (rowsLength == 0) {
  380. top.Dialog.alert("请选中要撤销的记录!");
  381. return;
  382. } else if (rowsLength > 1) {
  383. top.Dialog.alert("请选中一条要撤销的记录!");
  384. return;
  385. }
  386. var ids = "";
  387. for ( var i = 0; i < rowsLength; i++) {
  388. ids += rows[i].FD_OBJECTID299 + ",";
  389. //判断是否包含已经上报的记录
  390. if(rows[i].IS_SHANGBAO_299=="0"){
  391. top.Dialog.alert("您选中的记录还未上报!");
  392. return;
  393. }
  394. }
  395. top.Dialog.confirm("确定要撤销上报吗?|撤销", function() {
  396. $.post($.pathname() +"/ws/DrillCount/DrillCountService/noAppear/", {
  397. fd_id : ids,
  398. }, function(result) {
  399. if (result.Msg.sucsess == true) {
  400. $.messager.alert("撤销成功",null,null,null,-1);
  401. g.rend();// 刷新表格数据
  402. } else {
  403. top.Dialog.alert("撤销失败!");
  404. }
  405. }, "json");
  406. });
  407. }
  408. $.messager=top.Dialog;