8f4c7f616a1f42f986fd44c31ec03b4b4aad2071.svn-base 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864
  1. //获取用户Id
  2. var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  3. //获取用户部门Id
  4. var corpId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  5. //获取公司Id
  6. //var comp_id = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
  7. var comp_name = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
  8. var _thisUrl = window.location.href;
  9. var role_id = getUrlParams("role_Id",_thisUrl);//top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
  10. var fd_id = getUrlParams("fd_id",_thisUrl);
  11. var dept_name = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
  12. var real_name = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
  13. //获取时间
  14. var relval="";
  15. var sysval; var equipmentval; var markval;var safeyval;var qxval;
  16. var systext;var equipmenttext;var marktext;var safetext;var qxtext;
  17. var message="应急办:" ;
  18. var tableName = "";
  19. var areaId = "";
  20. var areaName = "";
  21. var planType = "";
  22. var deptLevel = getThing($.pathname() +"/ws/xianlutingyun/XianlutingyunService/getDeptLevel",{"comp_id":corpId},"text");
  23. function goback(){
  24. if(_thisUrl.indexOf("fd_id")>-1 && planType == '0'){
  25. window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/business/em/alert/warning/WarningReleaseMatter.jsp?fd_id="+fd_id);
  26. }else if(_thisUrl.indexOf("fd_id")>-1 && planType == '1'){
  27. window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/business/em/response/emergencyResponse/WarningReleaseMatter.jsp?fd_id="+fd_id);
  28. }else{
  29. window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/business/em/report/Report_Require.jsp");
  30. }
  31. }
  32. function initComplete(){
  33. $("#back").hover(function(){
  34. $(this).attr("src","/nwyj/images/temp/back_hover.png");
  35. },function(){
  36. $(this).attr("src","/nwyj/images/temp/back.png");
  37. });
  38. $("#DEPT_337").val(dept_name);
  39. $("#REAL_NAME_337").val(real_name);
  40. $("#ROLE_ID_337").val(role_id);
  41. $("#COMP_ID_337").val(corpId);
  42. $("#USER_ID_337").val(userId);
  43. initTypeSel();
  44. var alerttUrl = $.pathname() + '/ws/xianlutingyun/XianlutingyunService/getReportWarnningNumber/';
  45. $.ajax({
  46. url:alerttUrl,
  47. type:'post',
  48. data:{unitId : dept_name,comp_id :corpId,role_id:role_id,fd_id:fd_id},
  49. dataType:'json',
  50. async:false,
  51. success:function(data){
  52. //alert(JSON.stringify(data));
  53. $("#WARNING_NUMBER_337").data("data",data);
  54. $("#WARNING_NUMBER_337").render();
  55. if(_thisUrl.indexOf("fd_id")>-1){
  56. $("#WARNING_NUMBER_337").setValue(data[0].value);
  57. $("#WARNING_NUMBER_337").render();
  58. getProjectName();
  59. }
  60. },
  61. error:function(){
  62. }
  63. });
  64. change('round');
  65. checkScreenWidth();
  66. $("#WRITE_DEPT_SHOW").on("mouseenter","li",function(){
  67. $(this).addClass("hoverli");
  68. });
  69. $("#WRITE_DEPT_SHOW").on("mouseleave","li",function(){
  70. $(this).removeClass("hoverli");
  71. });
  72. $("#WRITE_DEPT_SHOW").on("click","li",function(){
  73. $("#inverse").removeClass("backcolor");
  74. $("#addAll").removeClass("backcolor");
  75. var _this = $(this);
  76. var id = _this.attr("id");
  77. if(_this.hasClass("selectedli")){
  78. _this.removeClass("selectedli");
  79. $("#WRITE_DEPT li").each(function(){
  80. if($(this).data("id")==id){
  81. $(this).remove();
  82. }
  83. });
  84. }else{
  85. _this.addClass("selectedli");
  86. var $li = $("<li class='selectCondi'>"+_this.text()+"</li>");
  87. $li.data("id",_this.attr("id"));
  88. $("#WRITE_DEPT").append($li);
  89. }
  90. $("#selectNum").text("已选择"+$("#WRITE_DEPT li").length+"个填报单位");
  91. // $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  92. setBbContentHeight();
  93. });
  94. $("#WRITE_DEPT").on("click","li",function(){
  95. $("#inverse").removeClass("backcolor");
  96. $("#addAll").removeClass("backcolor");
  97. var _this = $(this);
  98. var id = _this.data("id");
  99. _this.remove();
  100. $("#WRITE_DEPT_SHOW li").each(function(){
  101. if(id==$(this).attr("id")){
  102. $(this).removeClass("selectedli");
  103. }
  104. });
  105. $("#selectNum").text("已选择"+$("#WRITE_DEPT li").length+"个填报单位");
  106. // $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  107. setBbContentHeight();
  108. });
  109. //全选
  110. $("#addAll").bind("click",function(){
  111. $("#inverse").removeClass("backcolor");
  112. $("#addAll").addClass("backcolor");
  113. $("#WRITE_DEPT").empty();
  114. $("#WRITE_DEPT_SHOW li").each(function(){
  115. var $li = $("<li class='selectCondi'>"+$(this).text()+"</li>");
  116. $li.data("id",$(this).attr("id"));
  117. $("#WRITE_DEPT").append($li);
  118. });
  119. $("#WRITE_DEPT_SHOW li").addClass("selectedli");
  120. $("#selectNum").text("已选择"+$("#WRITE_DEPT li").length+"个填报单位");
  121. // $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  122. setBbContentHeight();
  123. });
  124. //反选
  125. $("#inverse").bind("click",function(){
  126. if($("#WRITE_DEPT li").length<=0){
  127. return;
  128. }
  129. $("#inverse").addClass("backcolor");
  130. $("#addAll").removeClass("backcolor");
  131. $("#WRITE_DEPT").empty();
  132. $("#WRITE_DEPT_SHOW li").each(function(){
  133. var _this = $(this);
  134. if(_this.hasClass("selectedli")){
  135. _this.removeClass("selectedli");
  136. }else{
  137. _this.addClass("selectedli");
  138. var $li = $("<li class='selectCondi'>"+_this.text()+"</li>");
  139. $li.data("id",_this.attr("id"));
  140. $("#WRITE_DEPT").append($li);
  141. }
  142. });
  143. $("#selectNum").text("已选择"+$("#WRITE_DEPT li").length+"个填报单位");
  144. // $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  145. setBbContentHeight();
  146. });
  147. }
  148. function checkScreenWidth(){
  149. var W = window.screen.width;
  150. var H = window.screen.height;
  151. if(W=="1024"&&H=="768"){
  152. $("#buttonDiv").css("left","74.5%");
  153. }
  154. }
  155. function initTypeSel(){
  156. var urls = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getRequireTypeSel";
  157. $.ajax({
  158. url : urls,
  159. type : 'post',
  160. timeout : 15000,
  161. async : false,
  162. data : {
  163. "comp_id" : corpId
  164. },
  165. dataType : 'json',
  166. success : function(data) {
  167. for(var i=0;i<data.length;i++){
  168. var data1 = data[i].value;
  169. data1 = eval('('+data1+')');
  170. if(data[i].key=='R002105430210'){
  171. $("#SYSTEM_DEPT").data("data",data1);
  172. $("#SYSTEM_DEPT").render();
  173. }
  174. if(data[i].key=='R002105430211'){
  175. $("#EQUIPMENT_DEPT").data("data",data1);
  176. $("#EQUIPMENT_DEPT").render();
  177. }
  178. if(data[i].key=='R002105430212'){
  179. $("#MARKETING_DEPT").data("data",data1);
  180. $("#MARKETING_DEPT").render();
  181. }
  182. if(data[i].key=='R002105430213'){
  183. $("#SAFEY_DEPT").data("data",data1);
  184. $("#SAFEY_DEPT").render();
  185. }
  186. if(deptLevel=="2"){
  187. if(data[i].key=='R002105430222'){
  188. $("#QX_DEPT").data("data",data1);
  189. $("#QX_DEPT").render();
  190. }
  191. $("#qx").show();
  192. }
  193. }
  194. setBbContentHeight();
  195. },
  196. error : function(e) {
  197. $.messager.alert('查询报表类型失败', '访问服务失败!', 'error');
  198. }
  199. });
  200. }
  201. /**
  202. * 保存
  203. */
  204. function sure(nextReportTaskFlag){
  205. var pattern = new RegExp("[`~!@#$^&*=|{}':;',\\[\\].<>/?~!@#¥……&*|{}【】‘;:”“'。,、?]");
  206. //var obj = getTimeId();
  207. if(!checkTime()){
  208. return;
  209. }else if(!decideTime()){
  210. return ;
  211. } else if(!checkTimes()){
  212. return;
  213. }/*else if(!checkTimeAdd("addTime",obj,timeindex)){
  214. return;
  215. }*/else if(pattern.test($("#PROJECT_NAME_337").val())){
  216. top.Dialog.alert("计划名称不能包含特殊字符");
  217. return;
  218. }
  219. else{
  220. if($("#SYSTEM_DEPT").attr("relText")!="请选择"){
  221. sysval = splits($("#SYSTEM_DEPT").attr("relValue"));
  222. systext = $("#SYSTEM_DEPT").attr("relText");
  223. var nodes = $("#SYSTEM_DEPT").data("selectedNodes");
  224. for(var i=0;i<nodes.length;i++){
  225. tableName += nodes[i].report_type+","+nodes[i].name+"||";
  226. }
  227. message += sysval+";"+systext +"|";
  228. }
  229. if($("#EQUIPMENT_DEPT").attr("relText")!="请选择"){
  230. equipmentval = splits($("#EQUIPMENT_DEPT").attr("relValue"));
  231. equipmenttext = $("#EQUIPMENT_DEPT").attr("relText");
  232. var nodes = $("#EQUIPMENT_DEPT").data("selectedNodes");
  233. for(var i=0;i<nodes.length;i++){
  234. tableName += nodes[i].report_type+","+nodes[i].name+"||";
  235. }
  236. message += equipmentval+";"+equipmenttext+"|";
  237. }
  238. if($("#MARKETING_DEPT").attr("relText")!="请选择"){
  239. markval = splits($("#MARKETING_DEPT").attr("relValue"));
  240. marktext = $("#MARKETING_DEPT").attr("relText");
  241. var nodes = $("#MARKETING_DEPT").data("selectedNodes");
  242. for(var i=0;i<nodes.length;i++){
  243. tableName += nodes[i].report_type+","+nodes[i].name+"||";
  244. }
  245. message += markval+";"+marktext+"|";
  246. }
  247. if($("#SAFEY_DEPT").attr("relText")!="请选择"){
  248. safeyval = splits($("#SAFEY_DEPT").attr("relValue"));
  249. safetext = $("#SAFEY_DEPT").attr("relText");
  250. var nodes = $("#SAFEY_DEPT").data("selectedNodes");
  251. for(var i=0;i<nodes.length;i++){
  252. tableName += nodes[i].report_type+","+nodes[i].name+"||";
  253. }
  254. message += safeyval+";"+safetext+"|";
  255. }
  256. if(deptLevel=="2"){
  257. if($("#QX_DEPT").attr("relText")!="请选择"){
  258. qxval = splits($("#QX_DEPT").attr("relValue"));
  259. qxtext = $("#QX_DEPT").attr("relText");
  260. var nodes = $("#QX_DEPT").data("selectedNodes");
  261. for(var i=0;i<nodes.length;i++){
  262. tableName += nodes[i].report_type+","+nodes[i].name+"||";
  263. }
  264. message += qxval+";"+qxtext+"|";
  265. }
  266. }
  267. if(message=="应急办:" || tableName==""){
  268. top.Dialog.alert("最少选择一个部门填报报表");
  269. return;
  270. }
  271. $("#REPORT_DEPT_337").val(message);
  272. console.log(tableName);
  273. var json=[{
  274. "WARNING_NUMBER":$("#EARLY_WARNING_ID").val(),
  275. "START_TIME":$("#START_TIME_337").val(),
  276. "FILL_IN_SCHEDULE": getVal(),
  277. "REPORT_DEPT":tableName,
  278. "DEPT_ID":corpId,
  279. "ROUND_TIME":$("#ROUND_TIME_337").val(),
  280. "TEMPORARY_TIME":$("#TEMPORARY_TIME_337").val(),
  281. "USER_ID":userId,
  282. "ROLE_ID":$("#ROLE_ID_337").val(),
  283. "deptName":comp_name,
  284. "real_name":real_name,
  285. "alertName":$("#EARLY_WARNING_NAME").val(),
  286. "areaId":areaId,
  287. "areaName":areaName,
  288. "isAlert":$("#IS_ALERT").val(),
  289. "alertLevel":$("#CURRENT_EW_LEVEL").val()
  290. }];
  291. var jsonData = JSON.stringify(json);
  292. console.log(jsonData);
  293. //$form = $("#requireForm");
  294. //var url = $.pathname() + '/ws/crud/CRUDService/create';
  295. var url = $.pathname()+ "/ws/xianlutingyun/XianlutingyunService/createPlanByAlert";
  296. $.ajax({
  297. url : url,
  298. type : 'post',
  299. //data : $form.serialize(),
  300. data : {json:jsonData,type:"sure",nextFlag:nextReportTaskFlag},
  301. dataType : 'text',
  302. timeout : 60000,
  303. success : function(data){
  304. top.Dialog.alert("保存成功",null,null,null,null);
  305. if(_thisUrl.indexOf("fd_id")>-1 && planType == '0'){
  306. window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/business/em/alert/warning/WarningReleaseMatter.jsp?fd_id="+fd_id);
  307. }else if(_thisUrl.indexOf("fd_id")>-1 && planType == "1"){
  308. window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/business/em/response/emergencyResponse/WarningReleaseMatter.jsp?fd_id="+fd_id);
  309. }else{
  310. goback();
  311. }
  312. },
  313. error : function(){
  314. top.Dialog.alert('操作失败');
  315. }
  316. });
  317. }
  318. }
  319. /**
  320. * 保存并发布
  321. */
  322. function save1(nextReportTaskFlag){
  323. var pattern = new RegExp("[`~!@#$^&*=|{}':;',\\[\\].<>/?~!@#¥……&*|{}【】‘;:”“'。,、?]");
  324. //var obj = getTimeId();
  325. if(!checkTime()){
  326. return;
  327. }else if(!decideTime()){
  328. return ;
  329. } else if(!checkTimes()){
  330. return;
  331. }/*else if(!checkTimeAdd("addTime",obj,timeindex)){
  332. return ;
  333. }*/else if(pattern.test($("#PROJECT_NAME_337").val())){
  334. top.Dialog.alert("计划名称不能包含特殊字符");
  335. return;
  336. }
  337. else{
  338. if($("#SYSTEM_DEPT").attr("relText")!="请选择"){
  339. sysval = splits($("#SYSTEM_DEPT").attr("relValue"));
  340. systext = $("#SYSTEM_DEPT").attr("relText");
  341. var nodes = $("#SYSTEM_DEPT").data("selectedNodes");
  342. for(var i=0;i<nodes.length;i++){
  343. tableName += nodes[i].report_type+","+nodes[i].name+"||";
  344. }
  345. message += sysval+";"+systext +"|";
  346. }
  347. if($("#EQUIPMENT_DEPT").attr("relText")!="请选择"){
  348. equipmentval = splits($("#EQUIPMENT_DEPT").attr("relValue"));
  349. equipmenttext = $("#EQUIPMENT_DEPT").attr("relText");
  350. var nodes = $("#EQUIPMENT_DEPT").data("selectedNodes");
  351. for(var i=0;i<nodes.length;i++){
  352. tableName += nodes[i].report_type+","+nodes[i].name+"||";
  353. }
  354. message += equipmentval+";"+equipmenttext+"|";
  355. }
  356. if($("#MARKETING_DEPT").attr("relText")!="请选择"){
  357. markval = splits($("#MARKETING_DEPT").attr("relValue"));
  358. marktext = $("#MARKETING_DEPT").attr("relText");
  359. var nodes = $("#MARKETING_DEPT").data("selectedNodes");
  360. for(var i=0;i<nodes.length;i++){
  361. tableName += nodes[i].report_type+","+nodes[i].name+"||";
  362. }
  363. message += markval+";"+marktext+"|";
  364. }
  365. if($("#SAFEY_DEPT").attr("relText")!="请选择"){
  366. safeyval = splits($("#SAFEY_DEPT").attr("relValue"));
  367. safetext = $("#SAFEY_DEPT").attr("relText");
  368. var nodes = $("#SAFEY_DEPT").data("selectedNodes");
  369. for(var i=0;i<nodes.length;i++){
  370. tableName += nodes[i].report_type+","+nodes[i].name+"||";
  371. }
  372. message += safeyval+";"+safetext+"|";
  373. }
  374. if(deptLevel=="2"){
  375. if($("#QX_DEPT").attr("relText")!="请选择"){
  376. qxval = splits($("#QX_DEPT").attr("relValue"));
  377. qxtext = $("#QX_DEPT").attr("relText");
  378. var nodes = $("#QX_DEPT").data("selectedNodes");
  379. for(var i=0;i<nodes.length;i++){
  380. tableName += nodes[i].report_type+","+nodes[i].name+"||";
  381. }
  382. message += qxval+";"+qxtext+"|";
  383. }
  384. }
  385. if(message=="应急办:" || tableName==""){
  386. top.Dialog.alert("最少选择一个部门填报报表");
  387. return;
  388. }
  389. $("#REPORT_DEPT_337").val(message);
  390. /*var json=[{
  391. "ROLE_ID":$("#ROLE_ID_337").val(),
  392. "DEPT":$("#DEPT_337").val(),
  393. "REAL_NAME":$("#REAL_NAME_337").val(),
  394. "REPORT_DEPT":$("#REPORT_DEPT_337").val(),
  395. "ROUND_TIME":$("#ROUND_TIME_337").val(),
  396. "TEMPORARY_TIME":$("#TEMPORARY_TIME_337").val(),
  397. "PROJECT":$("#PROJECT_NAME_337").val(),
  398. "START_TIME":$("#START_TIME_337").val(),
  399. "END_TIME":$("#END_TIME_337").val(),
  400. "FILL_IN_SCHEDULE": getVal(),
  401. "WARNING_NUMBER":$("#WARNING_NUMBER_337").val()
  402. }];*/
  403. var json=[{
  404. "WARNING_NUMBER":$("#EARLY_WARNING_ID").val(),
  405. "START_TIME":$("#START_TIME_337").val(),
  406. "FILL_IN_SCHEDULE": getVal(),
  407. "REPORT_DEPT":tableName,
  408. "DEPT_ID":corpId,
  409. "ROUND_TIME":$("#ROUND_TIME_337").val(),
  410. "TEMPORARY_TIME":$("#TEMPORARY_TIME_337").val(),
  411. "USER_ID":userId,
  412. "ROLE_ID":$("#ROLE_ID_337").val(),
  413. "deptName":comp_name,
  414. "real_name":real_name,
  415. "alertName":$("#EARLY_WARNING_NAME").val(),
  416. "areaId":areaId,
  417. "areaName":areaName,
  418. "isAlert":$("#IS_ALERT").val(),
  419. "alertLevel":$("#CURRENT_EW_LEVEL").val()
  420. }];
  421. var jsonData = JSON.stringify(json);
  422. $("body").eq(0).showLoading();
  423. $.ajax({
  424. //url : $.pathname()+ "/ws/xianlutingyun/XianlutingyunService/saveAndSend",
  425. url : $.pathname()+ "/ws/xianlutingyun/XianlutingyunService/createPlanByAlert",
  426. type : 'post',
  427. data : {json:jsonData,type:"save","nextFlag":nextReportTaskFlag},
  428. /*{
  429. json:jsons,
  430. compId:corpId,
  431. userId:userId
  432. }*/
  433. dataType : 'json',
  434. timeout : 60000,
  435. success : function(data){
  436. if(data[0].succ=="true"){
  437. $("body").eq(0).hideLoading();
  438. var name=data[0].name;
  439. var tel=data[0].tel;
  440. top.Dialog.confirm("保存并发布成功,是否发送短信?|发送短信",function(){
  441. addMsg(name,tel,"","1");
  442. },function(){
  443. if(_thisUrl.indexOf("fd_id")>-1 && planType == '0'){
  444. window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/business/em/alert/warning/WarningReleaseMatter.jsp?fd_id="+fd_id);
  445. }else if(_thisUrl.indexOf("fd_id")>-1 && planType == "1"){
  446. window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/business/em/response/emergencyResponse/WarningReleaseMatter.jsp?fd_id="+fd_id);
  447. }else{
  448. goback();
  449. }
  450. });
  451. }else{
  452. top.Dialog.alert("保存并发布失败");
  453. }
  454. },
  455. error : function(){
  456. top.Dialog.alert('操作失败');
  457. }
  458. });
  459. }
  460. }
  461. //是否生成下级任务 有选择填报单位时生成下级任务
  462. var nextReportTaskFlag = true;
  463. function save(num) {
  464. var valid = $("#requireForm").validationEngine({
  465. returnIsValid : true
  466. });
  467. if($("#WRITE_DEPT").text()==""){
  468. nextReportTaskFlag = false;
  469. }
  470. var deptLength = $("#WRITE_DEPT li").length;
  471. for(var i=0;i<deptLength;i++){
  472. areaId += $("#WRITE_DEPT li").eq(i).data("id")+",";
  473. areaName += $("#WRITE_DEPT li").eq(i).text()+",";
  474. }
  475. if(valid==true&&num=="1"){
  476. //保存
  477. sure(nextReportTaskFlag);
  478. }else if(valid==true&&num=="0"){
  479. //保存并发布
  480. save1(nextReportTaskFlag);
  481. }else{
  482. var obj = getTimeId();
  483. if($("#WARNING_NUMBER_337").val().trim()==""){
  484. top.Dialog.alert("请输入预警/响应编号");
  485. }else if($("#PROJECT_NAME_337").val().trim()==""){
  486. top.Dialog.alert("请输入填报要求名称");
  487. }else if($("#START_TIME_337").val().trim()==""){
  488. top.Dialog.alert("请输入起始日期");
  489. }else if(obj=="round" || obj=="temporary"){
  490. var $inputs = $("#addTime").find("input");
  491. for(var i=0;i<$inputs.length;i++){
  492. if($inputs.eq(i).val()==""){
  493. if(obj=="temporary"){
  494. top.Dialog.alert("请输入第"+(i+1)+"个临时性时间");
  495. }else{
  496. top.Dialog.alert("请输入第"+(i+1)+"个周期性时间");
  497. }
  498. break;
  499. }
  500. }
  501. }
  502. }
  503. }
  504. function clear_msg(){
  505. top.Dialog.confirm("确定要重置?将会清空填写的数据,请慎重选择|重置", function() {
  506. $("#WARNING_NUMBER_337").render();
  507. $("#START_TIME_337").val("");
  508. $("#END_TIME_337").val("");
  509. $("#PROJECT_NAME_337").val("");
  510. $(".selectTree").render();
  511. $("#round").attr("checked","checked");
  512. change("round");
  513. });
  514. }
  515. //置换周期性、临时性
  516. function change(obj){
  517. timeindex = 0;
  518. if(obj=="round"){
  519. $("#addTime").html("");
  520. var $td=$('<td class="circle_type" colspan="3" fixedCellHeight="true"></td>');
  521. var $date = $('<input type="text" class="date validate[required] round" id="time0" style="width:32%;" dateFmt="HH:mm" readOnly="readOnly"/>');
  522. var $add = $('<input type="button" id="addBtn" onclick="addTime()" value="增加"/>');
  523. var $delete = $('<input type="button" id="addBtn" onclick="deleteTime()" value="删除"/>');
  524. $td.append($date);
  525. $td.append($add);
  526. $td.append($delete);
  527. $("#addTime").append('<td width="15%" align="right" class="circle_type"><span class="star">*</span>每日:</td>');
  528. $("#addTime").append($td);
  529. $add.render();
  530. $delete.render();
  531. $date.render();
  532. }
  533. if(obj=="temporary"){
  534. $("#addTime").html("");
  535. var $td=$('<td class="temporary_type" colspan="3" fixedCellHeight="true"></td>');
  536. var $date = $('<input type="text" class="date validate[required] temporary" id="time0" style="width:32%;" dateFmt="yyyy-MM-dd HH:mm" readOnly="readOnly"/>');
  537. var $add = $('<input type="button" id="addBtn" onclick="addTime()" value="增加"/>');
  538. var $delete = $('<input type="button" id="addBtn" onclick="deleteTime()" value="删除"/>');
  539. $td.append($date);
  540. $td.append($add);
  541. $td.append($delete);
  542. $("#addTime").append('<td width="15%" align="right" class="temporary_type"><span class="star">*</span>填报时间:</td>');
  543. $("#addTime").append($td);
  544. $add.render();
  545. $delete.render();
  546. $date.render();
  547. }
  548. }
  549. //判定时间
  550. function checkTime(){
  551. var star = $("#START_TIME_337").val();
  552. var end = $("#END_TIME_337").val();
  553. star = star.substring(0,10);
  554. if(star&&end&&(star>end)){
  555. top.Dialog.alert("截止日期不能小于起始日期");
  556. return false;
  557. }else{
  558. return true;
  559. }
  560. }
  561. //获取下填报要求报告的名字
  562. function getProjectName(){
  563. var value = $("#WARNING_NUMBER_337").val();
  564. var selData = $("#WARNING_NUMBER_337").data("data");
  565. if(value){
  566. for(var i=0;i<selData.length;i++){
  567. if(selData[i]["value"]==value){
  568. if(selData[i]["is_alert"]=='0'){
  569. $("#PROJECT_NAME_337").val($("#WARNING_NUMBER_337").attr("relText")+"预警计划");
  570. }else{
  571. $("#PROJECT_NAME_337").val($("#WARNING_NUMBER_337").attr("relText")+"响应计划");
  572. }
  573. planType = selData[i]["is_alert"];
  574. $("#EARLY_WARNING_ID").val(selData[i]["key"]);
  575. $("#EARLY_WARNING_NAME").val(selData[i]["value"]);
  576. $("#IS_ALERT").val(selData[i]["is_alert"]);
  577. $("#EARLY_WARNING_AREA_NAME").val(selData[i]["early_warning_area_name"]);
  578. $("#EARLY_WARNING_AREA_ID").val(selData[i]["early_warning_area_id"]);
  579. $("#CURRENT_EW_LEVEL").val(selData[i]["current_ew_level"]);
  580. childComp(selData[i]["early_warning_area_name"]);
  581. }
  582. }
  583. }else{
  584. $("#PROJECT_NAME_337").val("");
  585. $("#WRITE_DEPT_SHOW").empty();
  586. $("#WRITE_DEPT").empty();
  587. $("#selectNum").text("已选择"+$("#WRITE_DEPT li").length+"个填报单位");
  588. }
  589. setBbContentHeight();
  590. }
  591. function childComp(area){
  592. var url = $.pathname()+ "/ws/xianlutingyun/XianlutingyunService/childComp";
  593. $.post(url,{comp_id:corpId},function(data){
  594. //alert(JSON.stringify(data));
  595. $("#WRITE_DEPT_SHOW").empty();
  596. $("#WRITE_DEPT").empty();
  597. $.each(data,function(n,value){
  598. var $li = null;
  599. if(area.indexOf(value.COMP_NAME)>-1){
  600. $li = ("<li id='"+value.COMP_ID+"' class='selectedli'>"+value.COMP_NAME+"</li>");
  601. var $lis = $("<li class='selectCondi'>"+value.COMP_NAME+"</li>");
  602. $lis.data("id",value.COMP_ID);
  603. $("#WRITE_DEPT").append($lis);
  604. $("#selectNum").text("已选择"+$("#WRITE_DEPT li").length+"个填报单位");
  605. $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  606. }else{
  607. $li = ("<li id='"+value.COMP_ID+"'>"+value.COMP_NAME+"</li>");
  608. }
  609. $("#WRITE_DEPT_SHOW").append($li);
  610. });
  611. },"json");
  612. }
  613. //获取当前时间
  614. function getTime(){
  615. var now=allGetServerTime();
  616. var year = now.getFullYear();
  617. var month=now.getMonth()+1;
  618. if(month>=1&&month<=9){
  619. month = "0"+month;
  620. }
  621. //获取日期
  622. var day=now.getDate();
  623. if(day>=1&&day<=9){
  624. day = "0"+day;
  625. }
  626. var currenttime = year+"-"+month+"-"+day;
  627. return currenttime;
  628. };
  629. //判断起始时间和截止时间不能小于当前时间
  630. function decideTime(){
  631. var star = $("#START_TIME_337").val();
  632. var end = $("#END_TIME_337").val();
  633. if(star&&end&&(getTime()>star||getTime()>end)){
  634. top.Dialog.alert("起始日期或截止日期不能小于当前日期");
  635. return false;
  636. }else if(star&&(getTime()>star)){
  637. top.Dialog.alert("起始日期不能小于当前日期");
  638. return false;
  639. }
  640. else{
  641. return true;
  642. }
  643. }
  644. //将角色Id劈开
  645. function splits(val){
  646. relval = val.split(",")[0];
  647. return relval;
  648. }
  649. var timeindex = 0;
  650. function addTime(){
  651. var obj = getTimeId();
  652. /*if(checkTimeAdd("addTime",obj,timeindex)){*/
  653. var addTime = $("#addTime");
  654. var lastVal = addTime.find("."+obj).last().val();
  655. if(lastVal==""){
  656. top.Dialog.alert("请输入时间再进行添加");
  657. return false;
  658. }
  659. timeindex++;
  660. var $date = "";
  661. if(obj=="round"){
  662. $date = $('<input type="text" id="time'+timeindex+'" class="date validate[required] round" style="width:32%;" dateFmt="HH:mm" readOnly="readOnly"/>');
  663. }else{
  664. $date = $('<input type="text" id="time'+timeindex+'" class="date validate[required] temporary" style="width:32%;" dateFmt="yyyy-MM-dd HH:mm" readOnly="readOnly"/>');
  665. }
  666. $("#addBtn").before($date);
  667. $date.render();
  668. $("#addBtn").render();
  669. addTime.render();
  670. setBbContentHeight();
  671. /*}*/
  672. }
  673. function deleteTime(){
  674. var $date = $("#addTime").find(".date");
  675. if($date.length==1){
  676. return;
  677. }else{
  678. $date.last().remove();
  679. timeindex--;
  680. }
  681. setBbContentHeight();
  682. }
  683. function checkTimes(){
  684. var obj = getTimeId();
  685. var timeStr = "";
  686. var startTime = $("#START_TIME_337").val().substring(0,10);
  687. var endTime = $("#END_TIME_337").val();
  688. var $date = $("#addTime").find(".date");
  689. for(var i=0;i<$date.length;i++){
  690. var time = $date.eq(i).val().trim();
  691. if(obj=="temporary"){
  692. var time1 = time.substring(0,10);
  693. if(startTime&&endTime&&(time1<startTime||time1>endTime)){
  694. top.Dialog.alert("填报时间要在起始日期和截止日期之间");
  695. return false;
  696. }else if(startTime&&(time1<startTime)){
  697. top.Dialog.alert("填报时间不能小于起始日期");
  698. return false;
  699. }
  700. }
  701. timeStr +=time+';';
  702. }
  703. timeStr = timeStr.substring(0, timeStr.lastIndexOf(";"));
  704. if(obj=="temporary"){
  705. $("#TEMPORARY_TIME_337").val(timeStr);
  706. }else{
  707. $("#ROUND_TIME_337").val(timeStr);
  708. }
  709. return true;
  710. }
  711. function getTimes(){
  712. var now=allGetServerTime();
  713. //获取年份
  714. var year=now.getFullYear();
  715. //获取月份
  716. var month=now.getMonth()+1;
  717. if(month>=1&&month<=9){
  718. month = "0"+month;
  719. }
  720. //获取日期
  721. var day=now.getDate();
  722. if(day>=1&&day<=9){
  723. day = "0"+day;
  724. }
  725. //获取小时
  726. var hours=now.getHours();
  727. if(hours>=1&&hours<=9){
  728. hours = "0"+hours;
  729. }
  730. //获取分钟
  731. var minutes=now.getMinutes();
  732. if(minutes>=1&&minutes<=9){
  733. minutes = "0"+minutes;
  734. }
  735. //获取秒
  736. var seconds=now.getSeconds();
  737. if(seconds>=1&&seconds<=9){
  738. seconds = "0"+seconds;
  739. }
  740. var currentTime =year+"-"+month+"-"+day+" "+hours+":"+minutes+":"+seconds;
  741. return currentTime;
  742. }
  743. function getVal(){
  744. $int=$("#int").find("input");
  745. for(var i=0;i<$int.length;i++){
  746. if($int.eq(i).attr("checked")=="checked"){
  747. return $int.eq(i).val();
  748. }
  749. }
  750. }
  751. function getTimeId(){
  752. var $radio = $("#int :radio");
  753. var obj = "";
  754. for(var i=0;i<$radio.length;i++){
  755. if($radio.eq(i).attr("checked")=="checked"){
  756. obj = $radio.eq(i).attr("id");
  757. }
  758. }
  759. return obj;
  760. }
  761. function getUrlParams(msg,url){
  762. if(msg!=""&&url.indexOf(msg)>-1){
  763. return url.split("?")[1].split("=")[1];
  764. }else{
  765. return "";
  766. }
  767. }
  768. function setBbContentHeight(){
  769. var content = $(".box1").height();
  770. $(window.document.body).height(content+30);
  771. $(parent.document.body).find("#frmright").height($(window.document.body).height());
  772. }