b39d334679b2d4c4489593abaaf7f818e86adbc1.svn-base 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. /**
  2. * 功能:应急预警报告添加及修改
  3. *
  4. *
  5. * @author HXB
  6. * @date 2015/09/25
  7. */
  8. WarningAddEditAdjust = function() {
  9. /**定义变量**/
  10. var _this = this;
  11. var nowTime ="";
  12. /**私有方法**/
  13. _this.DateTime = function(){
  14. $.ajax({//后台获取系统当前时间
  15. url:$.pathname()+ '/ws/response/responseService/getNowTime',
  16. // data : {},
  17. type : 'post',
  18. dataType : 'text',
  19. async : false,
  20. timeout : 6000,
  21. success : function(result){
  22. nowTime=result;
  23. },error : function(e){
  24. top.Dialog.alert("获取后台时间失败!");
  25. return;
  26. }
  27. });
  28. };
  29. var isCheckAndIssue = 0;//判断是否是点击审核并签发按钮 0》》不是 1》》是
  30. var isPass = "";
  31. /***新增信息***/
  32. _this.save = function(diag,fd_id,isCheckAndIssue){
  33. _this.DateTime();
  34. var is_audit = $("#is_audit").val();
  35. var nextManId = "";//代办处理会用到这个变量,主要用于保存下一节点处理人ID
  36. if(diag){
  37. isPass = diag.innerFrame.contentWindow.$("input:radio[name='aa']:checked").val();//判断是否同意
  38. }
  39. if(isCheckAndIssue == 0){//不是“审核并签发”
  40. if(is_audit==0){
  41. /********** 弹框start **********/
  42. var valid = diag.innerFrame.contentWindow.$("#ideaForm").validationEngine({returnIsValid: true});//弹框页面的非空验证
  43. if(!valid){
  44. top.Dialog.alert("请检查红色输入框!");
  45. return;
  46. };
  47. var a = diag.innerFrame.contentWindow.$("#EXPLAIN_37800").val();//弹框页面的回退说明的值
  48. $("#EXPLAIN_378").val(a);//给主页面的回退说明标签赋值
  49. var b = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").val();//弹框页面的下一节点人的id
  50. nextManId = b;
  51. $("#PERSON_ID_378").val(b);//给主页面的下一节点人id赋值
  52. var isChecked1 = diag.innerFrame.contentWindow.$("#yAgree").attr("checked");
  53. var isChecked2 = diag.innerFrame.contentWindow.$("#nAgree").attr("checked");
  54. if(isChecked1 == 'checked' && b == undefined){
  55. top.Dialog.alert("请选择下一处理人!");
  56. diag.URL = $.pathname() + '/page/business/em/alert/warning/WarningaddUnitTest.jsp?fd_id='+fd_id+'&isPass=0&pageType=1&level2='+level2;
  57. return;
  58. }
  59. if(isChecked2 == 'checked' && a == ""){
  60. top.Dialog.alert("请填写回退说明!");
  61. return;
  62. }
  63. // if(a=='' && b == undefined){
  64. // top.Dialog.alert("请选择下一处理人!!");
  65. // return;
  66. // }
  67. var c = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").next().html();//弹框页面的下一节点人的NAME
  68. $("#PERSON_NAME_378").val(c);
  69. var d = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").next().next().val();//弹框页面的下一节点人的电话
  70. var e = diag.innerFrame.contentWindow.$("#msgRemind").attr("checked");//短信是否被勾选
  71. var f = diag.innerFrame.contentWindow.$("#appRemind").attr("checked");//app是否被勾选
  72. isPass = diag.innerFrame.contentWindow.$(".aa[checked='checked']").val();//判断是否同意
  73. if(isChecked1 == 'checked'){
  74. isPass = "同意";
  75. }else{
  76. isPass = "回退";
  77. }
  78. var g = '您有新的通知单任务,请及时处理!';//短信内容
  79. //var h = nowTime;//系统时间
  80. var h ="nidaye";
  81. if(e=='checked'){//短信被勾选
  82. //alert("短信提醒");
  83. if(b == undefined){
  84. top.Dialog.alert("请选择短信接收人!");
  85. return;
  86. }
  87. var url0 = $.pathname() + '/ws/sendsms/SendSmsService/saveMessage';
  88. var params = {
  89. realName : realName,//发送人真实姓名
  90. smsRecTel : d,//接收电话
  91. smsTime : h,//系统时间
  92. smsContent : g,//短信内容
  93. smsSendId : realName_ID,//发送人Id
  94. smsPeople : b,//接收人员id?还是name?
  95. type:"短信发送"
  96. };
  97. $.ajax({
  98. type : 'post',
  99. url : url0,
  100. data : params,
  101. async:false,
  102. dataType : 'json',
  103. success : function (data){
  104. //alert(JSON.stringify(data));
  105. },
  106. error : function(e){
  107. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  108. }
  109. });
  110. }
  111. if(f=='checked'){
  112. alert("应急app提醒!");
  113. }
  114. diag.innerFrame.contentWindow.top.Dialog.close();//关闭弹框
  115. $.ajax({////修改通知单表的IS_SEEN字段为【下一处理人ID,0 ,处理人ID】
  116. url : $.pathname() + '/ws/sendsms/SendSmsService/updateIs_Seen',
  117. data : { tableName : "ECM_EM_PUBLISH_ALERT_NOTICE" , //表名
  118. fdId : fd_id , //id
  119. nextPeopId : b , //下一处理人ID
  120. userId : realName_ID//处理人ID
  121. },
  122. type : 'post',
  123. dataType : 'json',
  124. async:false,
  125. success : function (data){
  126. },error : function(e){
  127. top.Dialog.alert("系统提示信息!");
  128. }
  129. });
  130. /********** 弹框end **********/
  131. }else{//签发通过,保存下一节点人信息于378表中
  132. if(isPass == "回退"){
  133. var isChecked2 = diag.innerFrame.contentWindow.$("#nAgree").attr("checked");
  134. var a = diag.innerFrame.contentWindow.$("#EXPLAIN_37800").val();//弹框页面的回退说明的值
  135. if(isChecked2 == 'checked' && a == ""){
  136. top.Dialog.alert("请填写回退说明!");
  137. return;
  138. }
  139. }else{
  140. $("#AGREE_ISSUE_LEADER_ID_365").val(realName_ID);
  141. $("#AGREE_ISSUE_LEADER_NAME_365").val(realName);
  142. }
  143. var url = $.pathname() + '/ws/crud/CRUDService/getDataById/';
  144. var params = {
  145. classid : '365',
  146. objectID : fd_id
  147. };
  148. $.ajax({
  149. url : url,
  150. data : params,
  151. type : 'post',
  152. dataType : 'json',
  153. async : false,
  154. timeout : 1500 ,
  155. success : function(result){
  156. var params1 = {
  157. classid:"378",
  158. PERSON_ID_378: result.WRITER_ID_365,
  159. PERSON_NAME_378: result.WRITER_365,
  160. BUSINESS_ID_378:fd_id,
  161. STATUES_378:"4",
  162. DISPOSE_378:"0"
  163. };
  164. $.ajax({
  165. url : $.pathname() + '/ws/crud/CRUDService/create/',
  166. type : 'post',
  167. timeout : 15000,
  168. data : params1,
  169. dataType : 'json',
  170. async : false,
  171. success : function(data) {
  172. },error:function(e){
  173. top.Dialog.alert("系统错误!1");
  174. }
  175. });
  176. $.ajax({////修改通知单表的IS_SEEN字段为【下一处理人ID,0 ,处理人ID】
  177. url : $.pathname() + '/ws/sendsms/SendSmsService/updateIs_Seen',
  178. data : { tableName : "ECM_EM_PUBLISH_ALERT_NOTICE" , //表名
  179. fdId : fd_id , //id
  180. nextPeopId : result.WRITER_ID_365 , //下一处理人ID
  181. userId : realName_ID//处理人ID
  182. },
  183. type : 'post',
  184. dataType : 'json',
  185. async:false,
  186. success : function (data){
  187. },error : function(e){
  188. top.Dialog.alert("系统提示信息!");
  189. }
  190. });
  191. },error:function(e){
  192. top.Dialog.alert("系统错误!2");
  193. }
  194. });
  195. }
  196. }else{//【审核并签发】
  197. isPass="同意";
  198. $("#AGREE_ISSUE_LEADER_ID_365").val(realName_ID);
  199. $("#AGREE_ISSUE_LEADER_NAME_365").val(realName);
  200. $.ajax({////修改通知单表的IS_SEEN字段为【下一处理人ID,0 ,处理人ID】
  201. url : $.pathname() + '/ws/sendsms/SendSmsService/updateIs_Seen',
  202. data : { tableName : "ECM_EM_PUBLISH_ALERT_NOTICE" , //表名
  203. fdId : fd_id , //id
  204. nextPeopId : $("#WRITER_ID_365").val() , //下一处理人ID
  205. userId : realName_ID//处理人ID
  206. },
  207. type : 'post',
  208. dataType : 'json',
  209. async:false,
  210. success : function (data){
  211. },error : function(e){
  212. top.Dialog.alert("系统提示信息!");
  213. }
  214. });
  215. }
  216. $form1 = $('#editForm1');
  217. $form = $('#editForm');
  218. var is_audit = $("#is_audit").val();
  219. $('#classid').val('365');
  220. if(is_audit == "0"){//is_audit 等于0为审核 等于1为签发
  221. if(isPass == '同意'){//审核通过
  222. if(isCheckAndIssue == 1){//审核并签发
  223. $("#PERSON_ID_378").val(realName_ID);//审核人为系统登录人ID
  224. $("#PERSON_NAME_378").val(realName);//审核人为系统登录人NAME
  225. $("#STATUES_378").val(3);
  226. $("#IS_SEND_365").val(4); //3 设置成待签发
  227. }else{
  228. $("#STATUES_378").val(3);
  229. $("#IS_SEND_365").val(3);
  230. }
  231. var url = $.pathname() + '/ws/human/TreateHumanService/updateTreateHumanDispose';
  232. var params = {
  233. personId_378 : $("#lastWriterID").val(),
  234. businessId_378 : $("#lastBusinessID").val(),
  235. statues_378 : '1'
  236. };
  237. $.request.query(url,params,function(data){
  238. //alert(data);
  239. });
  240. }else{
  241. $("#IS_SEND_365").val(0);//变为未发送状态
  242. $("#STATUES_378").val(2);
  243. var url0 = $.pathname() + '/ws/human/TreateHumanService/updateTreateHumanDisDel';
  244. var params0 = { businessId_378 : $("#lastBusinessID").val() ,STATUES_378 : 2 ,EXPAIN_378 : $("#EXPLAIN_378").val()};
  245. $.request.query(url0,params0,function(data){
  246. });
  247. var url1 = $.pathname() +'/ws/crud/CRUDService/create/';
  248. var $editForm1 = $("#editForm1");
  249. var params1 = $editForm1.serialize();
  250. // alert(JSON.stringify(params1))
  251. $.request.query(url1,params1,function(data){
  252. });
  253. }
  254. }else if(is_audit == "1"){//签发 is_audit 等于0为审核 等于1为签发
  255. if(isPass == "回退"){
  256. $("#IS_SEND_365").val(0);//变为未发送状态
  257. $("#STATUES_378").val(2);
  258. var url0 = $.pathname() + '/ws/human/TreateHumanService/updateTreateHumanDisDel';
  259. var params0 = { businessId_378 : $("#lastBusinessID").val() };
  260. $.request.query(url0,params0,function(data){
  261. //alert(data);
  262. });
  263. diag.innerFrame.contentWindow.top.Dialog.close();//关闭弹框
  264. }else{
  265. $("#STATUES_378").val(4);
  266. $("#IS_SEND_365").val(4); //4 设置成待发布
  267. var url = $.pathname() + '/ws/human/TreateHumanService/updateTreateHumanDispose';
  268. var params = {
  269. personId_378 : $("#lastWriterID").val(),
  270. businessId_378 : $("#lastBusinessID").val(),
  271. statues_378 : '3'
  272. };
  273. $.request.query(url,params,function(data){
  274. //alert(data);
  275. });
  276. //=====================================================================================================
  277. }
  278. }
  279. $("#EARLY_WARNING_AREA_ID_365").val($("#EARLY_WARNING_AREA_NAME_365").val());//预警范围ID
  280. $("#EARLY_WARNING_AREA_NAME_365").val($("#EARLY_WARNING_AREA_NAME_365_show").val());//预警范围NAME
  281. $("#RELEASE_UNIT_365").val($("#WRITE_DEPT_365").val());//发布单位
  282. var valid = $form.validationEngine({returnIsValid: true});
  283. var valid1 = $form1.validationEngine({returnIsValid: true});
  284. $("#DB_TYPE").val("1");
  285. var formValue = $form.serialize();
  286. var formValue1 = $form1.serialize();
  287. if(valid && valid1){
  288. updateAlert(formValue,formValue1,is_audit,isPass,nextManId,fd_id);//is_audit(0代表审核 1代表签发)
  289. }else{
  290. top.Dialog.alert(CHECKREDBOX);
  291. }
  292. };
  293. function updateAlert(formValue,formValue1,is_audit,isPass,nextManId,fd_id){
  294. var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
  295. $.request.add(url,formValue,function(data){
  296. if(is_audit==0 && isPass == '同意'){//审核同意走这里,新增下一节点人信息
  297. url = $.pathname() +'/ws/crud/CRUDService/create/';
  298. if(isCheckAndIssue == 1){
  299. $("#DISPOSE_378").val(1);
  300. formValue1 = $form1.serialize();
  301. }
  302. $.request.add(url,formValue1,function(data){
  303. // if(is_audit==0 && isPass == '同意'){
  304. if(isPass == '同意'){
  305. if(isCheckAndIssue == 1){
  306. var writerId = $("#WRITER_ID_365").val();
  307. var writerName = $("#WRITER_365").val();
  308. $("#PERSON_ID_378").val(writerId);//发布人(这里应该保存该条通知单的填报人id,为了让填报人的代办中有一条待分发的代办)
  309. $("#PERSON_NAME_378").val(writerName);//发布人(这里应该保存该条通知单的填报人NAME)
  310. $("#STATUES_378").val(4);
  311. $("#DISPOSE_378").val(0);
  312. formValue1 = $form1.serialize();
  313. url = $.pathname() +'/ws/crud/CRUDService/create/';
  314. $.request.add(url,formValue1,function(data){
  315. top.Dialog.alert("审核并签发成功!");
  316. if(isWaitDo == 1){
  317. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
  318. }else{
  319. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp");
  320. }
  321. });
  322. }else{
  323. top.Dialog.alert("审核通过!");
  324. if(isWaitDo == 1){
  325. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
  326. }else{
  327. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp");
  328. }
  329. }
  330. }
  331. // $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp");
  332. });
  333. }else{
  334. //回退在前面已经删除过操作节点人了
  335. if(isPass == '回退'){
  336. top.Dialog.alert("回退成功!");
  337. }else{//签发不需要再选择下一节点人
  338. top.Dialog.alert("签发通过!");
  339. }
  340. if(isWaitDo == 1){
  341. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
  342. }else{
  343. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp");
  344. }
  345. }
  346. });
  347. /** 代办右上角红色圈里面数字的改变 **/
  348. var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  349. var params="";
  350. if(is_audit=="0"){//审核
  351. if(isPass == '回退'){//退回
  352. params = {
  353. userId : user_id//,//处理人ID(系统登录人)
  354. //netx_id : nextManId//,//下一节点处理人ID
  355. };
  356. }else{//审核通过
  357. params = {userId : user_id,netx_id : nextManId};
  358. }
  359. }else if(is_audit=="1"){//签发
  360. if(isPass == '回退'){//退回
  361. params = {userId : user_id/*,netx_id : b*/};
  362. }else{//签发通过
  363. $.ajax({
  364. url : $.pathname() + '/ws/response/responseService/getWriterIdByFdid',
  365. data : { FD_OBJECTID : fd_id} ,
  366. type : 'post',
  367. dataType : 'text',
  368. timeout : 15000,
  369. async : false,
  370. success : function(relust){
  371. params = {userId : user_id,netx_id : relust};
  372. },error : function (e){
  373. top.Dialog.alert('系统错误!3');
  374. }
  375. });
  376. }
  377. }
  378. $.ajax({
  379. url : $.pathname() + '/ws/xianlutingyun/XianlutingyunService/WarningTask',
  380. data : params,
  381. type : 'post',
  382. dataType : 'text',
  383. timeout : 15000,
  384. // async : false,
  385. success : function(data){
  386. // top.Dialog.alert('发送成功!', null, null, null, -1);
  387. }/*,error : function (e){
  388. top.Dialog.alert('系统错误!4');
  389. }*/
  390. });
  391. }
  392. return {
  393. init : function() {
  394. /********** 弹框start **********/
  395. $("#pass00").bind("click",function(){
  396. if(is_audit == "1"){//签发
  397. isCheckAndIssue = 0;
  398. $(".person").hide();
  399. $("#PERSON_NAME_378").attr("class","");
  400. _this.save(null,fd_id,isCheckAndIssue);
  401. }else{
  402. var level2 = $("#CURRENT_ER_LEVEL_365").val();//响应级别 29 I级 30 II级 31 III级 32 IV级
  403. var pageType = 1;//pageType的值 0为发送页面 1为审核页面
  404. var isPass=0;//同意
  405. dialogDemo(isPass,level2,pageType,null);
  406. }
  407. });
  408. $("#rock00").bind("click",function(){
  409. var level2 = $("#CURRENT_ER_LEVEL_365").val();//响应级别 29 I级 30 II级 31 III级 32 IV级
  410. var pageType = 1;//pageType的值 0为发送页面 1为审核页面
  411. var isPass=1;//回退
  412. dialogDemo(isPass,level2,pageType,null);
  413. });
  414. function dialogDemo(isPass,level2,pageType,isCheckAndIssue){
  415. //var ifmHeight = $(top.document.body).find("#frmright").height();
  416. var diag = new top.Dialog();
  417. if (is_audit == 0){//审核
  418. diag.Title = '审核意见';
  419. }else if(is_audit == 1){//签发
  420. diag.Title = '签发页面';
  421. }
  422. if(isPass==0){//同意
  423. diag.URL = $.pathname() + '/page/business/em/alert/warning/WarningaddUnitTest.jsp?fd_id='+fd_id+'&isPass=0&pageType=1&level2='+level2; //修改对应的路径的编辑界面
  424. }else if(isPass==1){//退回
  425. if(is_audit == 1){
  426. diag.URL = $.pathname() + '/page/business/em/alert/warning/WarningaddUnitTest.jsp?fd_id='+fd_id+'&isPass=1&pageType=1&isBack=1&level2='+level2; //修改对应的路径的编辑界面
  427. }else{
  428. diag.URL = $.pathname() + '/page/business/em/alert/warning/WarningaddUnitTest.jsp?fd_id='+fd_id+'&isPass=1&pageType=1&level2='+level2; //修改对应的路径的编辑界面
  429. }
  430. }
  431. diag.OkButtonText = '提交';
  432. diag.OKEvent = function(){
  433. isCheckAndIssue = 0;
  434. _this.save(diag,fd_id,isCheckAndIssue);
  435. diag.close();
  436. //_this.saveMenuRole(diag,fd_id);
  437. };
  438. diag.Width = 500; //宽度
  439. // diag.Height = 200; //高度
  440. diag.ButtonAlign = 'center';
  441. diag.show();
  442. };
  443. /********** 弹框end **********/
  444. $('#back').bind('click',function(){
  445. if(isWaitDo == 1){
  446. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
  447. }else{
  448. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp");
  449. }
  450. });
  451. $('#checkAndIssue').bind('click',function(){
  452. isCheckAndIssue = 1;
  453. _this.save(null,fd_id,isCheckAndIssue);
  454. });
  455. }
  456. };
  457. }();
  458. $(function() {
  459. WarningAddEditAdjust.init();
  460. });