2feeeac1bd2945b953e67149c0ea9ac7f3050d88.svn-base 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889
  1. /**
  2. * 功能:应急xiangying报告添加及修改
  3. *
  4. *
  5. * @author HXB
  6. * @date 2015/09/22
  7. */
  8. WarningAddEditAdjust = function() {
  9. /**定义变量**/
  10. var _this = this;
  11. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
  12. var is_skip = 0;//判断是否跳转发送(1)或发布(2)页面
  13. var nowTime = "";
  14. var radioValue1 = "";//选择纸质签发
  15. var radioValue2 = "";//选择口头授权
  16. _this.DateTime = function(){
  17. $.ajax({//后台获取系统当前时间
  18. url:$.pathname()+ '/ws/response/responseService/getNowTime',
  19. // data : {},
  20. type : 'post',
  21. dataType : 'text',
  22. async : false,
  23. timeout : 6000,
  24. success : function(result){
  25. nowTime=result;
  26. },error : function(e){
  27. top.Dialog.alert("获取后台时间失败!");
  28. return;
  29. }
  30. });
  31. };
  32. /***新增信息***/
  33. _this.save = function(){
  34. _this.DateTime();
  35. $form = $('#editForm');
  36. var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
  37. if(is_adjst == 1){//调整
  38. var is_Plan = 0; //是否触发计划填报
  39. //$("#RELEASE_UNIT_365").val('');
  40. $("#IS_SEND_365").val(0); //未发送状态
  41. //数据ID情况
  42. $("#FD_OBJECTID365").val('');
  43. $("#classid").val(365);
  44. //$("#WRITER_365").val($("#CHECKCK").val()); //填报人
  45. //$("#WRITE_DEPT_365").val($("#unitId").attr("relValue"));
  46. $("#EARLY_WARNING_PROPERTY_365").val(50); //响应性质
  47. $("#WETHER_EW_ADJUST_365").val(1);
  48. $("#WRITE_TIME_365").val(nowTime); //填报时间
  49. $("#CHECK_STATUS_365").val(42); //调整发布
  50. $("#IS_LAST_ID_365").val(fd_id); //上次响应编号
  51. $("#PREV_ER_LEVEL_365").val($("#PREV_ER_LEVEL").attr("relValue"));
  52. if(!(fd_id.length>0 && is_adjst == 1)){
  53. $("#EARLY_WARNING_AREA_ID_365").val($("#EARLY_WARNING_AREA_NAME_365").val());//预警范围ID
  54. }
  55. $("#EARLY_WARNING_AREA_NAME_365").val($("#EARLY_WARNING_AREA_NAME_365_show").val());//预警范围NAME
  56. //$("#RELEASE_UNIT_365").val($("#unitId").attr("relValue"));//发布单位
  57. is_skip = 0;
  58. fileToSave($form,null,null,url);
  59. }else{
  60. top.Dialog.alert(CHECKREDBOX);
  61. };
  62. };
  63. function fileToSave($form,listGrid,msg,url){
  64. // var flag = 1;//是否发布接口的开关
  65. var earlyWarningAreaId = $("#EARLY_WARNING_AREA_ID_365").val();
  66. var lastLevel = $("#PREV_ER_LEVEL_365").val();
  67. var currentLevel = $("#CURRENT_ER_LEVEL_365").val();
  68. $("body").eq(0).showLoading();
  69. //表单异步提交处理
  70. var formValue = $form.serialize();
  71. if(is_skip==1){//发送
  72. send(url,formValue);
  73. }else{
  74. $.request.add(url,formValue,function(data){
  75. $("body").eq(0).hideLoading();
  76. if(is_skip == 2){//发布
  77. //top.Dialog.alert('发布成功!');//弹出提示
  78. $.ajax({//发布通知单时,右下角弹框提示发布单位的下级和本级的应急办成员
  79. url : $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/tzdIssueDwr/',
  80. data : { fd_id : data.Msg.objectID },//参数为发布的通知单的ID
  81. type : 'post',
  82. timeout : 15000,
  83. dataType : 'text',
  84. async : false,
  85. success : function(data) {
  86. },error : function(e) {
  87. top.Dialog.alert("系统错误!");
  88. }
  89. });
  90. $.ajax({//发布以后,用推送的方式,调用首页的方法,更新首页导航下方滚动的预警通知单信息(不需要传参数)
  91. url : $.pathname() + '/ws/alertToImpl/AlertToImplService/updadeWarningMsgOfMainPage/',
  92. type : 'post',
  93. timeout : 15000,
  94. //data : params,
  95. dataType : 'text',
  96. success : function(data) {
  97. },error : function(e) {
  98. //$.messager.alert('系统提示信息', '访问服务失败!', 'error');
  99. }
  100. });
  101. // if(flag == 1){ //暂时接口走不通20160705,所以暂时关掉
  102. var params = {
  103. classid : "365",
  104. FD_OBJECTID365 :data.Msg.objectID,
  105. RELIEVE_DATE_365:getDateTime(),
  106. IS_SEND_365 : "6",
  107. PLAN_NAME : "",
  108. EARLY_WARNING_AREA_ID : earlyWarningAreaId,
  109. LAST_LEVEL : lastLevel,
  110. CURRENT_LEVEL : currentLevel
  111. };
  112. $.ajax({//接口
  113. url : $.pathname() + '/ws/alertToImpl/AlertToImplService/responseSend/',
  114. type : 'post',
  115. timeout : 15000,
  116. data : params,
  117. dataType : 'json',
  118. success : function(result) {
  119. // saveAddNum(data.Msg.objectID);
  120. },error : function(e) {
  121. // $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  122. }
  123. });
  124. saveAddNum1(data.Msg.objectID);
  125. // }else{
  126. // saveAddNum(data.Msg.objectID);
  127. // };
  128. }else{
  129. top.Dialog.alert('保存成功!');//弹出提示
  130. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp");
  131. }
  132. });
  133. }
  134. }
  135. function send(url,formValue){
  136. var diag = new top.Dialog();
  137. diag.Title = '组织人员';
  138. //diag.URL = $.pathname() + '/page/business/em/alert/warning/WarningaddUnitSend.jsp?fd_id='+fd_id; //修改对应的路径的编辑界面
  139. diag.URL = $.pathname() + '/page/business/em/alert/warning/WarningaddUnitTest.jsp?fd_id=' + fd_id + '&isSend=1';
  140. diag.OkButtonText = '发送';
  141. diag.OKEvent = function(){
  142. $.request.add(url,formValue,function(data){
  143. $("body").eq(0).hideLoading();
  144. var fd_id = data.Msg.objectID;
  145. _this.sendSave(diag,fd_id);
  146. });
  147. };
  148. diag.CancelEvent = function(){
  149. $("body").eq(0).hideLoading();
  150. diag.close();
  151. };
  152. diag.Width = 500; //宽度
  153. // diag.Height = 150; //高度
  154. diag.ButtonAlign = 'center';//发送和取消按钮的位置
  155. diag.show();
  156. }
  157. /**新增方法**/
  158. _this.sendSave = function(diag,fd_id){
  159. $("body").eq(0).showLoading();//遮罩
  160. _this.DateTime();
  161. var a = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").val();//弹框页面的下一节点人的id
  162. var c = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").next().html();//弹框页面的下一节点人的NAME
  163. var d = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").next().next().val();//弹框页面的下一节点人的电话
  164. var e = diag.innerFrame.contentWindow.$("#msgRemind").attr("checked");//短信是否被勾选
  165. var f = diag.innerFrame.contentWindow.$("#appRemind").attr("checked");//app是否被勾选
  166. var g = '您有新的通知单任务,请及时处理!';//短信内容
  167. var h = nowTime;//系统时间
  168. if(a==undefined || a=='' || a==null){
  169. top.Dialog.alert("请选择人员!");
  170. return;
  171. }
  172. if(e=='checked'){//短信被勾选
  173. //alert("短信提醒");
  174. if(a == undefined){
  175. top.Dialog.alert("请选择短信接收人!");
  176. return;
  177. }
  178. var url0 = $.pathname() + '/ws/sendsms/SendSmsService/saveMessage';
  179. var params = {
  180. realName : realName,//发送人真实姓名
  181. smsRecTel : d,//接收电话
  182. smsTime : h,//系统时间
  183. smsContent : g,//短信内容
  184. smsSendId : realName_ID,//发送人Id
  185. smsPeople : a,//接收人员id
  186. type:"短信发送"
  187. };
  188. //alert("realName="+realName+"电话:"+d+"系统时间:"+h+"短信内容:"+g+"发送人ID:"+realName_ID+"接收人ID:"+a);
  189. //return;
  190. $.ajax({
  191. type : 'post',
  192. url : url0,
  193. data : params,
  194. async:false,
  195. dataType : 'json',
  196. success : function (data){
  197. //alert(JSON.stringify(data));
  198. },
  199. error : function(e){
  200. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  201. }
  202. });
  203. }
  204. if(f=='checked'){
  205. top.Dialog.alert('应急app提醒!');
  206. }
  207. $.ajax({////修改通知单表的IS_SEEN字段为【下一处理人ID,0 ,处理人ID】
  208. url : $.pathname() + '/ws/sendsms/SendSmsService/updateIs_Seen',
  209. data : { tableName : "ECM_EM_PUBLISH_ALERT_NOTICE" , //表名
  210. fdId : fd_id , //id
  211. nextPeopId : a , //下一处理人ID
  212. userId : realName_ID//处理人ID
  213. },
  214. type : 'post',
  215. dataType : 'json',
  216. async:false,
  217. success : function (data){
  218. },error : function(e){
  219. top.Dialog.alert("系统提示信息!");
  220. }
  221. });
  222. var params = {classid :"365",FD_OBJECTID365:fd_id,IS_SEND_365 :"1"};
  223. var params1 = {
  224. classid:"378",
  225. PERSON_ID_378:a,
  226. PERSON_NAME_378:c,
  227. BUSINESS_ID_378:fd_id,
  228. STATUES_378:"1",
  229. DISPOSE_378:"0"
  230. };
  231. $.ajax({
  232. url : $.pathname() + '/ws/crud/CRUDService/updateWarning/',
  233. type : 'post',
  234. timeout : 15000,
  235. data : params,
  236. dataType : 'json',
  237. success : function(data) {
  238. var url = $.pathname() + '/ws/crud/CRUDService/create/';
  239. $.request.add(url,params1,function(data){
  240. diag.innerFrame.contentWindow.top.Dialog.close();//关闭弹框
  241. top.Dialog.alert('发送成功!');
  242. /** 代办右上角红色圈里面数字的改变 **/
  243. var url = $.pathname() + '/ws/xianlutingyun/XianlutingyunService/WarningTask';
  244. // var compId = top.com.sinosoft.lz.system.user.LoginInfo.getCompany_id();
  245. var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  246. // var roleid = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
  247. var paramsWaitdo = {
  248. // userId : user_id,//
  249. netx_id : a//,//
  250. // isRole : ,//
  251. // company_id : compId,//
  252. // role_id : roleid//
  253. };
  254. $.ajax({//代办处理
  255. url : url,
  256. data : paramsWaitdo,
  257. type : 'post',
  258. dataType : 'text',
  259. timeout : 15000,
  260. // async : false,
  261. success : function(data){
  262. // top.Dialog.alert('发送成功!', null, null, null, -1);
  263. // top.Dialog.alert('成功!');
  264. },error : function (e){
  265. // top.Dialog.alert('系统错误!');
  266. }
  267. });
  268. // 跳转到列表页
  269. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp");
  270. });
  271. },
  272. error : function(e) {
  273. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  274. }
  275. });
  276. };
  277. //页面发送按钮gel
  278. _this.is_Send = function(){
  279. _this.DateTime();
  280. if($("#WETHER_EW_ADJUST").attr("checked")=="checked"){//勾选调整
  281. $("#EARLY_WARNING_PROPERTY_365").val(50);
  282. $("#CHECK_STATUS_365").val(42);
  283. $("#WETHER_EW_ADJUST_365").val(1);
  284. }else if($("#WARNING_PROPERTY").attr("checked")=="checked"){//勾选初次
  285. $("#EARLY_WARNING_PROPERTY_365").val(49);
  286. $("#CHECK_STATUS_365").val(41);
  287. $("#WETHER_EW_ADJUST_365").val(0);
  288. };
  289. $("#classid").val("365");
  290. //$("#RELEASE_UNIT_365").val($("#unitId").attr("relValue"));//发布单位
  291. if(!(fd_id.length>0 && is_adjst == 1)){
  292. $("#EARLY_WARNING_AREA_ID_365").val($("#EARLY_WARNING_AREA_NAME_365").val());//预警范围ID
  293. }
  294. $("#EARLY_WARNING_AREA_NAME_365").val($("#EARLY_WARNING_AREA_NAME_365_show").val());//预警范围NAME
  295. //$("#RELEASE_UNIT_365").val($("#WRITE_DEPT_365").attr("relValue"));//发布单位
  296. is_skip = 1;
  297. $form = $('#editForm');
  298. //附件
  299. //var file = $("#uploaderFileName").val();
  300. var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
  301. $("#WRITE_TIME_365").val(nowTime); //填报时间
  302. fileToSave($form,null,null,url);
  303. };
  304. //页面发布按钮
  305. _this.is_Issue = function(){
  306. _this.DateTime();
  307. if($("#WETHER_EW_ADJUST").attr("checked")=="checked"){//勾选调整
  308. $("#EARLY_WARNING_PROPERTY_365").val(50);
  309. $("#CHECK_STATUS_365").val(42);
  310. $("#WETHER_EW_ADJUST_365").val(1);
  311. }else if($("#WARNING_PROPERTY").attr("checked")=="checked"){//勾选初次
  312. $("#EARLY_WARNING_PROPERTY_365").val(49);
  313. $("#CHECK_STATUS_365").val(41);
  314. $("#WETHER_EW_ADJUST_365").val(0);
  315. };
  316. $("#classid").val("365");
  317. if(!(fd_id.length>0 && is_adjst == 1)){
  318. $("#EARLY_WARNING_AREA_ID_365").val($("#EARLY_WARNING_AREA_NAME_365").val());//预警范围ID
  319. }
  320. $("#EARLY_WARNING_AREA_NAME_365").val($("#EARLY_WARNING_AREA_NAME_365_show").val());//预警范围NAME
  321. //$("#RELEASE_UNIT_365").val($("#unitId").attr("relValue"));//发布单位
  322. is_skip = 2;
  323. $form = $('#editForm');
  324. //附件
  325. //var file = $("#uploaderFileName").val();
  326. var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
  327. $("#WRITE_TIME_365").val(nowTime); //填报时间
  328. var fbTime = $("#RELEASE_RELIEVE_DATE_365").val();//发布时间
  329. if(fbTime == null || fbTime == ""){
  330. top.Dialog.alert("发布时间不能为空!请填写完整!");
  331. return;
  332. };
  333. //if(!hasFile()){//附件不能为空!请选择并上传附件
  334. if(false){
  335. top.Dialog.alert("附件不能为空!请选择并上传附件");
  336. return;
  337. }else{
  338. //top.Dialog.confirm("是否要创建新的填报计划?|报表",function(){
  339. $("body").eq(0).showLoading();//遮罩
  340. var lastID = $("#IS_LAST_ID_365").val();
  341. if(lastID != null && lastID != ""){
  342. var params = {
  343. classid : "365",
  344. FD_OBJECTID365 :lastID,
  345. RELIEVE_DATE_365:getDateTime(),
  346. IS_SEND_365 : "6"
  347. };
  348. $.ajax({
  349. url : $.pathname() + '/ws/crud/CRUDService/updateWarning/',
  350. type : 'post',
  351. timeout : 15000,
  352. data : params,
  353. dataType : 'json',
  354. success : function(data) {
  355. //alert(data.EARLY_WARNING_AREA_NAME);
  356. },error : function(e) {
  357. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  358. }
  359. });
  360. }
  361. $("#IS_SEND_365").val(5);
  362. //top.Dialog.confirm("是否要创建新的填报计划?|报表",function(){
  363. var prepareId = $("#yjbh").attr("relValue"); //突发事件类型id
  364. var alertNum = $("#EARLY_WARNING_ID_365").val(); //响应编号
  365. var alertNum1 = $("#PREV_EW_ID_365").val(); //上次响应编号
  366. var relieveDate = $("#RELEASE_RELIEVE_DATE_365").val(); //发布时间
  367. var alertLevel = $("#CURRENT_ER_LEVEL_365").attr("relValue"); //发布时间
  368. //createPlan(prepareId,alertNum,relieveDate,alertLevel);
  369. finishPlan(alertNum1,CorpArea);
  370. createPlan(prepareId,alertNum,relieveDate,alertLevel);
  371. fileToSave($form,null,null,url);
  372. /*},function(){
  373. fileToSave($form,null,null,url);
  374. });*/
  375. }
  376. //fileToSave($form,null,null,url);
  377. };
  378. function chooseLeader(){//选择口头授权的领导人(默认为本级(本单位)应急总指挥/副总指挥/主任/副主任)
  379. var diag = new top.Dialog();
  380. diag.Title = '口头授权领导';
  381. diag.id = "ok111";
  382. //diag.URL = $.pathname() + '/page/business/em/alert/warning/WarningaddUnitTest.jsp';
  383. diag.URL = $.pathname() + '/page/business/em/alert/warning/WarningAgreeIssueLeader.jsp';
  384. diag.OkButtonText = '确定';
  385. diag.OKEvent = function(){
  386. var a = diag.innerFrame.contentWindow.$("input[name='PERSON_ID_378']:checked").val();//选择的同意发布的领导的ID
  387. var b = diag.innerFrame.contentWindow.$("input[name='PERSON_ID_378']:checked").next().text();//选择的同意发布的领导的NAME
  388. var c = diag.innerFrame.contentWindow.$("input[id='radio_1']:checked").attr("checked");//选择纸质签发
  389. var d = diag.innerFrame.contentWindow.$("input[id='radio_2']:checked").attr("checked");//选择口头授权
  390. radioValue1 = c;//纸质签发是否被选
  391. radioValue2 = d;//口头授权是否被选
  392. $("#AGREE_ISSUE_LEADER_ID_365").val(a);
  393. $("#AGREE_ISSUE_LEADER_NAME_365").val(b);
  394. if(radioValue1 == "checked"){//选择纸质签发
  395. if(!hasFile()){//无附件
  396. top.Dialog.confirm("纸质签发必须上传附件!</br>请上传附件|响应",function(){//点击确定--回到通知单填报页面
  397. diag.close();
  398. },function(){//点击取消--回到弹框选择口头授权的页面
  399. });
  400. }else if(a==undefined){//有附件但是没有选择口头授权人
  401. top.Dialog.confirm("请选择签发人!|响应",function(){//点击确定--回到通知单填报页面
  402. },function(){//点击取消--回到弹框选择口头授权的页面
  403. diag.close();
  404. });
  405. }else{
  406. _this.is_Issue();
  407. diag.close();
  408. }
  409. }else if(radioValue2 == "checked"){//选择口头授权
  410. if(a==undefined){//没有选择签发人
  411. top.Dialog.confirm("请选择签发人!|响应",function(){//点击确定--回到弹框选择口头授权的页面
  412. return;
  413. },function(){//点击取消--回到通知单填报页面
  414. diag.close();
  415. return;
  416. });
  417. }else{
  418. _this.is_Issue();
  419. diag.close();
  420. }
  421. }
  422. //_this.is_Issue();
  423. //diag.close();
  424. };
  425. /*diag.CancelEvent = function(){
  426. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/warning/Warning.jsp");
  427. diag.close();
  428. };*/
  429. diag.Width = 500; //宽度
  430. //diag.Height = 150; //高度
  431. diag.ButtonAlign = 'center';//发送和取消按钮的位置
  432. diag.show();
  433. }
  434. function saveAddNum1(fd_id){
  435. var $form1 = $('#alertResponseNumForm');
  436. var formValue = $form1.serialize();
  437. var url = $.pathname() + '/ws/crud/CRUDService/create/';
  438. $.ajax({
  439. url : url,
  440. type : 'post',
  441. timeout : 15000,
  442. data : formValue,
  443. async: false,
  444. dataType : 'json',
  445. success : function(data) {
  446. top.Dialog.alert('发布成功!');//弹出提示
  447. top.createActiveTab("任务清单",$.pathname()+ "/page/business/em/response/emergencyResponse/WarningReleaseMatter.jsp?fd_id="+ fd_id+"&isActivePage=true");
  448. }
  449. });
  450. };
  451. function saveAddNum(fd_id){
  452. var CorpArea = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  453. /*top.Dialog.confirm("是否要创建新的填报计划?|响应",function(){
  454. var prepareId = $("#MEET_EMERGENCIES_PLAN_365").attr("relValue"); //预案ID
  455. var alertNum = $("#EARLY_WARNING_ID_365").val(); //预警编号
  456. var relieveDate = $("#RELEASE_RELIEVE_DATE_365").val(); //发布时间
  457. var alertLevel = $("#CURRENT_ER_LEVEL_365").attr("relValue"); //预警级别
  458. var typhoonDate = $("#TYPHOON_DATE_365").val();
  459. createPlan(prepareId,alertNum,relieveDate,alertLevel,typhoonDate);
  460. var preAlertNum = $("#PREV_EW_ID_365").val(); //上次预警编号
  461. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids(); //部门ID
  462. finishPlan(preAlertNum,CorpArea);
  463. // top.Dialog.alert('保存成功!');//弹出提示
  464. var $form1 = $('#alertResponseNumForm');
  465. var formValue = $form1.serialize();
  466. var url = $.pathname() + '/ws/crud/CRUDService/create/';
  467. $.request.add(url,formValue,function(data){
  468. top.Dialog.alert('发布成功!');//弹出提示
  469. $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/em/response/emergencyResponse/WarningReleaseMatter.jsp?fd_id="+ fd_id);
  470. });
  471. },function(){*/
  472. var alertNum = $("#EARLY_WARNING_ID_365").val(); //预警编号
  473. var preAlertNum = $("#PREV_EW_ID_365").val(); //上次预警编号
  474. top.Dialog.alert('发布成功!');//弹出提示
  475. var $form1 = $('#alertResponseNumForm');
  476. var alertLevel = $("#CURRENT_ER_LEVEL_365").attr("relvalue");
  477. var alertName = $("#EARLY_WARNING_NAME_365").val();//预警名称
  478. var areaId = $("#EARLY_WARNING_AREA_ID_365").val();//预警范围部门id
  479. var areaName = $("#EARLY_WARNING_AREA_NAME_365").val();//预警范围部门id
  480. var formValue = $form1.serialize();
  481. var url = $.pathname() + '/ws/crud/CRUDService/create/';
  482. $.request.add(url,formValue,function(data){
  483. updatePlan(preAlertNum,alertNum,CorpArea,meet_plan_id,taifengTime,alertLevel,fd_id,alertName,areaId,areaName);
  484. });
  485. // });
  486. // var $form1 = $('#alertResponseNumForm');
  487. // var formValue = $form1.serialize();
  488. // var url = $.pathname() + '/ws/crud/CRUDService/create/';
  489. // $.request.add(url,formValue,function(data){
  490. // $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/em/response/emergencyResponse/WarningReleaseMatter.jsp?fd_id="+ fd_id);
  491. // });
  492. };
  493. /**
  494. * 结束报表填报计划
  495. */
  496. function finishPlan(alertNum,companyId){
  497. var params = {WARNING_NUMBER:alertNum,COMP_ID:companyId,IS_ALERT:"1"};
  498. $.ajax({
  499. url : $.pathname() + '/ws/getPlanRequires/getPlanRequireService/releasePlan',
  500. type : 'post',
  501. timeout : 15000,
  502. async : false,
  503. data : params,
  504. dataType : 'text',
  505. success : function(data) {
  506. }
  507. });
  508. }
  509. /**
  510. * 替换计划
  511. */
  512. function updatePlan(oldAlert,newAlert,companyId,meet_plan_id,typhoon,alertLevel,fd_id,alertName,areaId,areaName){
  513. //alert(oldAlert+"--"+newAlert+"--"+companyId)
  514. if(meet_plan_id == "" || (meet_plan_id.split(",").length==2 && meet_plan_id.split(",")[0].substring(0,4)=="plan")){
  515. //$('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/em/response/emergencyResponse/WarningReleaseMatter.jsp?fd_id="+ fd_id);
  516. $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/em/response/emergencyResponse/Warning.jsp?fd_id="+ fd_id);//任务清单页面
  517. return;
  518. }
  519. var planTime = getPlanTime(meet_plan_id,typhoon,alertLevel);
  520. console.log(alertLevel+"-----"+planTime);
  521. var circleTime = planTime.split("_______")[0];
  522. var temporaryTime = planTime.split("_______")[1];
  523. var params = {OLD_WARN:oldAlert,NEW_WARN:newAlert,COMP_ID:companyId,'isAlert':'1',"temporaryTime":temporaryTime,"circleTime":circleTime,alertName:alertName,areaId:areaId,areaName:areaName,alertLevel:alertLevel};
  524. $.ajax({
  525. url : $.pathname() + '/ws/getPlanRequires/getPlanRequireService/updatePlan',
  526. type : 'post',
  527. timeout : 15000,
  528. data : params,
  529. async: false,
  530. dataType : 'text',
  531. success : function(data) {
  532. //$('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/em/response/emergencyResponse/WarningReleaseMatter.jsp?fd_id="+ fd_id);
  533. $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/em/response/emergencyResponse/Warning.jsp?fd_id="+ fd_id);//任务清单页面
  534. }
  535. });
  536. }
  537. /**
  538. * 通过预案数据获取周期性和临时性时间
  539. * @param meet_plan_id
  540. * @param typhoon
  541. * @returns {String}
  542. */
  543. function getPlanTime(meet_plan_id,typhoon,alertLevel){
  544. var alertDate = ""; //周期时间
  545. var temporaryTime = ""; //临时时间
  546. $.ajax({
  547. url : $.pathname() + '/ws/sendmenu/SendMsgService/PlanInfoEM',
  548. type : 'post',
  549. timeout : 15000,
  550. data : {file_id:meet_plan_id,grade_type:'%6_2'},
  551. dataType : 'json',
  552. async: false,
  553. success : function(data) {
  554. var status = data[0].PLAN_REFINE_CATEGORY;
  555. //如果状态等于14代表突发性群体事件 ,16涉外突发事件,17网络与信息安全无报表填报要求
  556. if(status == 14 || status == 16 || status == 17){
  557. return;
  558. }
  559. if(data != null && data != ""){
  560. var tempRow = data;
  561. if(alertLevel == 29){
  562. alertDate = tempRow[0].FRIST_GRADE;
  563. }else if(alertLevel == 30){
  564. alertDate = tempRow[0].SECOND_GRADE;
  565. }else if(alertLevel == 31){
  566. alertDate = tempRow[0].THRID_GRADE;
  567. }else if(alertLevel == 32){
  568. alertDate = tempRow[0].FOURTH_GRADE;
  569. }
  570. if(alertDate.indexOf("||")>-1){
  571. alertDate = alertDate.split('||');
  572. temporary = alertDate[0];
  573. alertDate = alertDate[1];
  574. }
  575. if(typhoon != null && typhoon != ''){
  576. temporaryTime = getFormatString(typhoon,temporary);
  577. }
  578. //5为大面积停电事件每隔1、2、3小时填写一次
  579. if(status ==5){
  580. var mTime = getSysTimeM();
  581. var num = parseInt(alertDate);
  582. alertDate = "";
  583. for (var i = 0; i < 24;) {
  584. var nu = (i<10 ? "0"+ i : i);
  585. alertDate += "#"+nu+":"+mTime;
  586. i += num;
  587. }
  588. }
  589. if(alertDate.indexOf("#")==0){
  590. //if(alertDate.startsWith("#")){
  591. alertDate = alertDate.substring(1);
  592. }
  593. }
  594. }
  595. });
  596. return alertDate+"_______"+temporaryTime;
  597. }
  598. /**
  599. * 创建报表填报计划
  600. */
  601. function createPlan(prepareId,alertNum,relieveDate,alertLevel){
  602. var CorpArea = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  603. $.ajax({
  604. url : $.pathname() + '/ws/sendmenu/SendMsgService/getReportAndPlanTime',
  605. type : 'post',
  606. data : {"event_type_id":prepareId,"event_level":alertLevel,"comp_id":CorpArea},
  607. dataType : 'text',
  608. async:false,
  609. success : function(data) {
  610. if(data != null && data != ""){
  611. var istemporary = "周期性";
  612. var alertDate = data; //周期时间
  613. var temporaryTime = ""; //临时时间
  614. var CorpArea = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  615. var Corp_names = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
  616. var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();//用户id
  617. var role_ids = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();//角色id
  618. var real_name = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name;//用户名?还是角色名?这里需要用户名
  619. var alertName = $("#EARLY_WARNING_NAME_365").val();//预警名称
  620. var areaId = $("#EARLY_WARNING_AREA_ID_365").val();//预警范围部门id
  621. var areaName = $("#EARLY_WARNING_AREA_NAME_365").val();//预警范围部门名称
  622. var EVENT_ID_365 = $("#EVENT_ID_365").val();//事件id
  623. var MEET_EMERGENCIES_PLAN_365 = $("#MEET_EMERGENCIES_PLAN_365").val();//事件类型id
  624. var isAlert = $("#IS_ALERT_365").val();//预警还是响应
  625. var parmas = {
  626. WARNING_NUMBER : alertNum,
  627. START_TIME : nowTime.substring(0, nowTime
  628. .lastIndexOf(":")),
  629. FILL_IN_SCHEDULE : istemporary,
  630. REPORT_DEPT : "",
  631. DEPT_ID : CorpArea,
  632. ROUND_TIME : alertDate,
  633. TEMPORARY_TIME : temporaryTime,
  634. USER_ID : userId,
  635. ROLE_ID : role_ids,
  636. deptName : Corp_names,
  637. real_name : real_name,
  638. alertName : alertName,
  639. areaId : areaId,
  640. areaName : areaName,
  641. isAlert : isAlert,
  642. alertLevel : alertLevel,
  643. eventType:MEET_EMERGENCIES_PLAN_365,
  644. eventId:EVENT_ID_365
  645. };
  646. //$.request.add("nwyj/ws/getPlanRequires/getPlanRequireService/createPlanByAlert",parmas,function(data){});
  647. $.ajax({
  648. url : $.pathname() + '/ws/getPlanRequires/getPlanRequireService/createPlanByAlert',
  649. type : 'post',
  650. timeout : 15000,
  651. data : parmas,
  652. async : false,
  653. dataType : 'json',
  654. success : function(data) {
  655. //top.Dialog.alert('创建报表计划成功!');
  656. //$('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/warning/Warning.jsp");
  657. }
  658. });
  659. }else{
  660. top.Dialog.alert('预案没有绑定需填报的报表或时间,无法生成报告和报表!');
  661. }
  662. },
  663. error : function(e) {
  664. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  665. }
  666. });
  667. }
  668. // 传递过来的参数( 日期类型 date , 字符串 str 格式 "-20:00#-20:30#+21:00#+21:30#+22:00#" )
  669. function getFormatString(timed,str){
  670. var s='';
  671. timed=timed.replace(/-/g,"/"); // 如果传递过来的是日期字符串timed,可以在这里转成日期类型
  672. var date=new Date(timed);
  673. str = str.replace(/##/g,"#");
  674. if(str.indexOf("#")==0){
  675. str = str.substring(1,str.length);
  676. }
  677. if(str.lastIndexOf("#")==str.length-1){
  678. str = str.substring(0,str.length-1);
  679. }
  680. var array=str.split(/[:#]/);
  681. //var array=str.split("#");
  682. var hourArray=new Array([array.length/2]);
  683. var operArray=new Array([array.length/2]);
  684. var j=0;
  685. // for(var i=0 ;i<array.length/2;i++){
  686. // operArray[i]=array[j].slice(0,1);
  687. // hourArray[i]=array[j].slice(1);
  688. // j+=2;
  689. // }
  690. for(var i=0 ;i<array.length/2;i++){
  691. operArray[i]=array[i*2+1];
  692. hourArray[i]=array[i*2];
  693. //j+=2;
  694. }
  695. var ms=date.getTime();
  696. //j=1;
  697. for(var i=0 ;i<array.length/2;i++){
  698. var ms1=ms+(hourArray[i]*60*60*1000+operArray[i]*60*1000);
  699. s+=getDateString(ms1)+'#';
  700. //j+=2;
  701. }
  702. s = timeStrSort(s,"esc","#","yyyy-MM-dd HH:mm");
  703. console.log(s);
  704. return s;
  705. }
  706. function getDateString(ms){
  707. var s="";
  708. var d=allGetServerTime();
  709. d.setTime(ms);
  710. var vYear = d.getFullYear();
  711. var vMon = d.getMonth() + 1;
  712. var vDay = d.getDate();
  713. var h = d.getHours();
  714. var m = d.getMinutes();
  715. var se = d.getSeconds();
  716. s=vYear+"-"+(vMon<10 ? "0" + vMon : vMon)+"-"+(vDay<10 ? "0"+ vDay : vDay)+" "+(h<10 ? "0"+ h : h)+":"+(m<10 ? "0" + m : m)+":"+(se<10 ? "0" + se : se);
  717. return s;
  718. }
  719. return {
  720. init : function() {
  721. $('#save').bind('click',function(){
  722. var benci = $("#CURRENT_ER_LEVEL_365").val();//本次预警级别
  723. var shangci = $("#PREV_ER_LEVEL").val();//上次预警级别
  724. if(benci == shangci){
  725. top.Dialog.alert("尚未调整响应级别!");
  726. return;
  727. }
  728. $form = $('#editForm');
  729. var valid = $form.validationEngine({returnIsValid: true});//表单验证
  730. if($("#EARLY_WARNING_AREA_NAME_365").val()==""){
  731. top.Dialog.alert("请选择预警范围(响应范围)!");
  732. return ;
  733. }
  734. if(!valid){
  735. top.Dialog.alert("请检查标红输入框!");
  736. return ;
  737. }
  738. fabuTime_new = $("#RELEASE_RELIEVE_DATE_365").val();
  739. if(fabuTime_old > fabuTime_new){//guoenle--161012
  740. top.Dialog.alert("调整后的发布时间不能早于调整前");
  741. return;
  742. }
  743. top.Dialog.confirm("是否要保存?|响应",function(){//点击确定
  744. _this.save();
  745. },function(){//点击取消
  746. //alert("bbbbbb");
  747. });
  748. });
  749. $('#back').bind('click',function(){
  750. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp");
  751. });
  752. $("#is_Send").bind('click',function(){
  753. var benci = $("#CURRENT_ER_LEVEL_365").val();//本次预警级别
  754. var shangci = $("#PREV_ER_LEVEL").val();//上次预警级别
  755. if(benci == shangci){
  756. top.Dialog.alert("尚未调整响应级别!");
  757. return;
  758. }
  759. $form = $('#editForm');
  760. var valid = $form.validationEngine({returnIsValid: true});//表单验证
  761. if($("#EARLY_WARNING_AREA_NAME_365").val()==""){
  762. top.Dialog.alert("请选择预警范围(响应范围)!");
  763. return ;
  764. }
  765. if(!valid){
  766. top.Dialog.alert("请检查标红输入框!");
  767. return ;
  768. }
  769. fabuTime_new = $("#RELEASE_RELIEVE_DATE_365").val();
  770. if(fabuTime_old > fabuTime_new){//guoenle--161012
  771. top.Dialog.alert("调整后的发布时间不能早于调整前");
  772. return;
  773. }
  774. top.Dialog.confirm("是否要发送?|响应",function(){//点击确定
  775. _this.is_Send();
  776. },function(){//点击取消
  777. //alert("bbbbbb");
  778. });
  779. });
  780. $("#is_Issue").bind('click',function(){
  781. var benci = $("#CURRENT_ER_LEVEL_365").val();//本次预警级别
  782. var shangci = $("#PREV_ER_LEVEL").val();//上次预警级别
  783. if(benci == shangci){
  784. top.Dialog.alert("尚未调整响应级别!");
  785. return;
  786. }
  787. $form = $('#editForm');
  788. var valid = $form.validationEngine({returnIsValid: true});//表单验证
  789. if($("#EARLY_WARNING_AREA_NAME_365").val()==""){
  790. top.Dialog.alert("请选择预警范围(响应范围)!");
  791. return ;
  792. }
  793. if(!valid){
  794. top.Dialog.alert("请检查标红输入框!");
  795. return ;
  796. }
  797. fabuTime_new = $("#RELEASE_RELIEVE_DATE_365").val();
  798. if(fabuTime_old > fabuTime_new){//guoenle--161012
  799. top.Dialog.alert("调整后的发布时间不能早于调整前");
  800. return;
  801. }
  802. //top.Dialog.confirm("是否要发布?|响应",function(){//点击确定
  803. chooseLeader();
  804. //_this.is_Issue();
  805. /*},function(){//点击取消
  806. //alert("bbbbbb");
  807. });*/
  808. });
  809. }
  810. };
  811. }();
  812. $(function() {
  813. WarningAddEditAdjust.init();
  814. });
  815. //获得当前系统时间:分
  816. function getSysTimeM(){
  817. var s="";
  818. var d = allGetServerTime();
  819. var vYear = d.getFullYear();
  820. var vMon = d.getMonth() + 1;
  821. var vDay = d.getDate();
  822. var h = d.getHours();
  823. var m = d.getMinutes();
  824. var se = d.getSeconds();
  825. //s=vYear+"-"+(vMon<10 ? "0" + vMon : vMon)+"-"+(vDay<10 ? "0"+ vDay : vDay)+" "+(h<10 ? "0"+ h : h)+":"+(m<10 ? "0" + m : m)+":"+(se<10 ? "0" +se : se);
  826. s= (m<10 ? "0" + m : m);
  827. return s;
  828. }