78460c2cb8d1377b22385717f7f42ac791938534.svn-base 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. //2015-09-29 可以取到父页面的预案ID
  2. var sub_fd_id ="";
  3. sub_fd_id = parent.fd_id;
  4. //取预案PLAN_BIAOZHI字段,如果该字段等于0,说明该预案没有修订版本。没有绑定过任何条件。如果不等于0,则该预案有过修订版本。可能存在绑定过的条件。
  5. var PLAN_BIAOZHI="";
  6. PLAN_BIAOZHI = parent.PLAN_BIAOZHI;
  7. //取父页面传过来的预案细化类型
  8. var SUB_BM_YAXHLB = "";
  9. SUB_BM_YAXHLB = parent.BM_YAXHLB;
  10. //给页面赋值细化类型
  11. var tempValue = "";
  12. //判断细化类型
  13. /**
  14. * 细化类型
  15. * 4、人身事故
  16. * 5、大面积停电事件
  17. * 6、设备事故
  18. * 7、电厂大坝厂房事故
  19. * 8、环境污染
  20. * 9、防风防汛
  21. * 10、地震灾害
  22. * 11、低温雨雪冰冻灾害
  23. * 12、电力供应及客户服务
  24. * 13、生产场所防恐怖袭击
  25. * 14、突发性群体事件
  26. * 15、突发新闻事件
  27. * 16、涉外突发事件
  28. * 17、网络与信息安全
  29. * 18、突发公共卫生
  30. * **/
  31. if(SUB_BM_YAXHLB=="4"){
  32. tempValue="4_1";
  33. }else if(SUB_BM_YAXHLB=="5"){
  34. tempValue="5_1";
  35. }else if(SUB_BM_YAXHLB=="6"){
  36. tempValue="6_1";
  37. }else if(SUB_BM_YAXHLB=="7"){
  38. tempValue="7_1";
  39. }else if(SUB_BM_YAXHLB=="8"){
  40. tempValue="8_1";
  41. }else if(SUB_BM_YAXHLB=="9"){
  42. tempValue="9_1";
  43. }else if(SUB_BM_YAXHLB=="10"){
  44. tempValue="10_1";
  45. }else if(SUB_BM_YAXHLB=="11"){
  46. tempValue="11_1";
  47. }else if(SUB_BM_YAXHLB=="12"){
  48. tempValue="12_1";
  49. }else if(SUB_BM_YAXHLB=="13"){
  50. tempValue="13_1";
  51. }else if(SUB_BM_YAXHLB=="14"){
  52. tempValue="14_1";
  53. }else if(SUB_BM_YAXHLB=="15"){
  54. tempValue="15_1";
  55. }else if(SUB_BM_YAXHLB=="16"){
  56. tempValue="16_1";
  57. }else if(SUB_BM_YAXHLB=="17"){
  58. tempValue="17_1";
  59. }else if(SUB_BM_YAXHLB=="18"){
  60. tempValue="18_1";
  61. }else if(SUB_BM_YAXHLB=="21"){
  62. tempValue="21_1";
  63. }else if(SUB_BM_YAXHLB=="22"){
  64. tempValue="22_1";
  65. }else if(SUB_BM_YAXHLB=="23"){
  66. tempValue="23_1";
  67. }else if(SUB_BM_YAXHLB=="24"){
  68. tempValue="24_1";
  69. }
  70. var temp1="";
  71. if(PLAN_BIAOZHI=="0"){
  72. temp1 = sub_fd_id;
  73. }else{
  74. temp1 =PLAN_BIAOZHI;
  75. }
  76. //如果突发事件四个等级都为空,则证明该条件没有被绑定,走新增的方法
  77. var FRIST_GRAD="";
  78. var SECOND_GRADE="";
  79. var THRID_GRADE="";
  80. var FOURTH_GRADE="";
  81. var total = "";
  82. var fd_id215 = "";
  83. var FILLER1_215 = "";
  84. //如果突发事件四个等级不为空,走修改的方法。
  85. //记录当前页面的值
  86. var InitformValue="";
  87. $(function(){
  88. setTimeout(function(){
  89. $("#titlename").html(parent.titlename);
  90. },100);
  91. var url = $.pathname()
  92. + "/ws/sendmenu/SendMsgService/PlanInfo";
  93. var params = {
  94. file_id : sub_fd_id,
  95. grade_type:tempValue,
  96. };
  97. $.ajax({
  98. url : url,
  99. type : 'post',
  100. timeout : 12000,
  101. data : params,
  102. dataType : 'json',
  103. success : function(data) {
  104. if(data.rows.length!=0){
  105. window.setTimeout("setHeightThis()", 200);
  106. FRIST_GRADE = data.rows[0].FRIST_GRADE;//FRIST_GRADE
  107. SECOND_GRADE = data.rows[0].SECOND_GRADE;
  108. THRID_GRADE = data.rows[0].THRID_GRADE;
  109. FOURTH_GRADE = data.rows[0].FOURTH_GRADE;
  110. fd_id215 = data.rows[0].FD_OBJECTID;
  111. FILLER1_215 = data.rows[0].FILLER1;
  112. total = FRIST_GRADE+SECOND_GRADE+THRID_GRADE+FOURTH_GRADE;
  113. $("#FRIST_GRADE_215").html(FRIST_GRADE);
  114. $("#SECOND_GRADE_215").html(SECOND_GRADE);
  115. $("#THRID_GRADE_215").html(THRID_GRADE);
  116. $("#FOURTH_GRADE_215").html(FOURTH_GRADE);
  117. $("#fd_id215").val(fd_id215);
  118. $("#FILLER1_215").val(FILLER1_215);
  119. for ( var i in data) {
  120. $('#' + i).html(data[i]);
  121. }
  122. }
  123. //记录当前页面的值
  124. InitformValue = $('#fillForm').serialize();
  125. $("#infotab").init();
  126. },
  127. error : function(e) {
  128. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  129. }
  130. });
  131. });
  132. function setHeightThis(){
  133. $(parent.document.body).find("iframe").height($(window.document.body).height()+30);
  134. $(parent.parent.document.body).find("iframe").height($(parent.document.body).height()+280);
  135. }
  136. //判断是走新增还是走修改的方法
  137. function isAdd(containerId){
  138. //fd_id215
  139. if(fd_id215!=""){
  140. //修改方法
  141. edit(containerId);
  142. }else{
  143. //新增绑定条件
  144. addTransferDaily(containerId);
  145. }
  146. }
  147. //保存跳转下一步
  148. function isAdd1(){
  149. if(fd_id215!=""){
  150. //修改方法
  151. edit1();
  152. }else{
  153. //新增绑定条件
  154. addTransferDaily1();
  155. }
  156. }
  157. //新增保存并跳转下一步
  158. function addTransferDaily1(){
  159. var FRIST_GRADE = $("#FRIST_GRADE_215").val();
  160. var SECOND_GRADE = $("#SECOND_GRADE_215").val();
  161. var THRID_GRADE = $("#THRID_GRADE_215").val();
  162. var FOURTH_GRADE = $("#FOURTH_GRADE_215").val();
  163. var total = FRIST_GRADE + SECOND_GRADE + THRID_GRADE + FOURTH_GRADE;
  164. if(total==""){
  165. top.Dialog.alert('还没绑定任何条件!');
  166. return;
  167. }else{
  168. //取父页面的变量
  169. var sub_fd_id = parent.fd_id;
  170. $("#FILLER1_215").val(sub_fd_id);
  171. //写入预案分级的等级
  172. $("#GRADE_TYPE_215").val(tempValue);
  173. $form = $('#fillForm');
  174. var url = $.pathname() + '/ws/crud/CRUDService/create';
  175. $.ajax({
  176. url : url,
  177. type : 'post',
  178. data : $form.serialize(),
  179. dataType : 'text',
  180. timeout : 60000,
  181. success : function(data){
  182. $.messager.alert("保存成功",null,null,null,-1);
  183. Next();
  184. },
  185. error : function(){
  186. $.messager.alert('操作失败');
  187. }
  188. });
  189. }
  190. }
  191. //修改保存并跳转下一步
  192. function edit1(){
  193. $("#GRADE_TYPE_215").val(tempValue);
  194. var formValue = $('#fillForm').serialize();
  195. var url = $.pathname() + '/ws/crud/CRUDService/update';
  196. $.ajax({
  197. url : url,
  198. type : 'post',
  199. data : formValue,
  200. dataType : 'text',
  201. timeout : 60000,
  202. success : function(data){
  203. $.messager.alert('修改成功');
  204. Next();
  205. },
  206. error : function(){
  207. $.messager.alert('操作失败');
  208. }
  209. });
  210. }
  211. //修改
  212. function edit(containerId){
  213. var FRIST_GRADE = $("#FRIST_GRADE_215").val();
  214. var SECOND_GRADE = $("#SECOND_GRADE_215").val();
  215. var THRID_GRADE = $("#THRID_GRADE_215").val();
  216. var FOURTH_GRADE = $("#FOURTH_GRADE_215").val();
  217. var valid = $(containerId).validationEngine({returnIsValid: true});
  218. if(valid == true){
  219. $("#GRADE_TYPE_215").val(tempValue);
  220. var formValue = $('#fillForm').serialize();
  221. var url = $.pathname() + '/ws/crud/CRUDService/update';
  222. $.ajax({
  223. url : url,
  224. type : 'post',
  225. data : formValue,
  226. dataType : 'text',
  227. timeout : 60000,
  228. success : function(data){
  229. $.messager.alert('修改成功');
  230. //刷新页面
  231. location.reload();
  232. },
  233. error : function(){
  234. $.messager.alert('操作失败');
  235. }
  236. });
  237. }else{
  238. if(FRIST_GRADE==""){
  239. top.Dialog.alert("特别重大事件不能为空!");
  240. return;
  241. }
  242. if(SECOND_GRADE==""){
  243. top.Dialog.alert("重大事件不能为空!");
  244. return;
  245. }
  246. if(THRID_GRADE==""){
  247. top.Dialog.alert("比较重大事件不能为空!");
  248. return;
  249. }
  250. if(FOURTH_GRADE==""){
  251. top.Dialog.alert("一般事件不能为空!");
  252. return;
  253. }
  254. }
  255. }
  256. //重置
  257. function resetSearch(){
  258. document.location.reload();
  259. }
  260. //新增绑定条件的方法
  261. function addTransferDaily(containerId){
  262. var FRIST_GRADE = $("#FRIST_GRADE_215").val();
  263. var SECOND_GRADE = $("#SECOND_GRADE_215").val();
  264. var THRID_GRADE = $("#THRID_GRADE_215").val();
  265. var FOURTH_GRADE = $("#FOURTH_GRADE_215").val();
  266. // var total = FRIST_GRADE + SECOND_GRADE + THRID_GRADE + FOURTH_GRADE;
  267. var valid = $(containerId).validationEngine({returnIsValid: true});
  268. if(valid == true){
  269. $("#FILLER1_215").val(sub_fd_id);
  270. //写入预案分级的等级
  271. $("#GRADE_TYPE_215").val(tempValue);
  272. $form = $('#fillForm');
  273. var url = $.pathname() + '/ws/crud/CRUDService/create';
  274. $.ajax({
  275. url : url,
  276. type : 'post',
  277. data : $form.serialize(),
  278. dataType : 'text',
  279. timeout : 60000,
  280. success : function(data){
  281. $.messager.alert("保存成功",null,null,null,-1);
  282. //刷新页面
  283. location.reload();
  284. },
  285. error : function(){
  286. $.messager.alert('操作失败');
  287. }
  288. });
  289. }else{
  290. if(FRIST_GRADE==""){
  291. top.Dialog.alert("特别重大事件不能为空!");
  292. return;
  293. }
  294. if(SECOND_GRADE==""){
  295. top.Dialog.alert("重大事件不能为空!");
  296. return;
  297. }
  298. if(THRID_GRADE==""){
  299. top.Dialog.alert("比较重大事件不能为空!");
  300. return;
  301. }
  302. if(FOURTH_GRADE==""){
  303. top.Dialog.alert("一般事件不能为空!");
  304. return;
  305. }
  306. }
  307. // if(total==""){
  308. // top.Dialog.alert('还没绑定任何条件!');
  309. // return;
  310. // }else{}
  311. }
  312. //保存并跳转到下一步
  313. function Next() {
  314. var url = "/nwyj/page/business/am/contingencyPlan/"+"PlanGradeYJ.jsp";
  315. parent.document.getElementById("text1").setAttribute("class", "");
  316. parent.document.getElementById("text2").setAttribute("class", "current");
  317. parent.document.getElementById("frmrightChild").setAttribute("src", ""+encodeURI(url));
  318. }
  319. //返回事件
  320. function goBack() {
  321. if(parent.backId=="ZX"){
  322. var url = "/nwyj/page/business/am/contingencyPlan/"+"ContingencyPlanZX.jsp";
  323. top.parent.document.getElementById("frmright").setAttribute("src", ""+encodeURI(url));
  324. }else{
  325. var url = "/nwyj/page/business/am/contingencyPlan/"+"ContingencyPlan.jsp";
  326. top.parent.document.getElementById("frmright").setAttribute("src", ""+encodeURI(url));
  327. }
  328. /* var formValue = $('#fillForm').serialize();
  329. if(formValue!=InitformValue){
  330. top.Dialog.confirm("您已修改了表单,是否需要离开?|离开", function() {
  331. var url = "/nwyj/page/business/am/contingencyPlan/"+"ContingencyPlan.jsp";
  332. top.parent.document.getElementById("frmright").setAttribute("src", ""+encodeURI(url));
  333. });
  334. }else{
  335. }
  336. */
  337. }
  338. $.messager=top.Dialog;