b792dfa797810a56ab8073c9609c514935990980.svn-base 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. var corpId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  2. var jb_role = getRoleNameById();//获取专业管理部门角色id,name
  3. jb_role[0].R002105430205 = "应急办";
  4. function createBaoGaoTable(corpId,role_id){
  5. $("#baoGaoCon").empty();
  6. $(".dateSel").hide();
  7. $("body").eq(0).showLoading();
  8. $.ajax({
  9. url : $.pathname()+ "/ws/xianlutingyun/XianlutingyunService/getBaoGaoDaiBan",
  10. type : 'post',
  11. timeout : 15000,
  12. async : false,
  13. data : {"company_id":corpId,"role_id":role_id},
  14. dataType : 'json',
  15. success : function(data){
  16. var sj_add = false;
  17. var bj_add = false;
  18. if(data==null ){
  19. $("#baoGaoCon").append("<span class='spantip'>没有要填写的报告数据</span>");
  20. $("body").eq(0).hideLoading();
  21. return;
  22. }
  23. var sj_div = $("<div style='width : 99.2%'><div class='bgd_title bgd_show' id='baoGao_sj'>上级</div><hr/></div>");
  24. var bj_div = $("<div style='width : 99.2%'><div class='bgd_title bgd_show' id='baoGao_bj'>本级</div><hr/></div>");
  25. $("#baoGaoCon").append(sj_div);
  26. $("#baoGaoCon").append(bj_div);
  27. var $sj = $("<div id='content_baoGao_sj'></div>");//上级报告填报要求
  28. var $bj = $("<div id='content_baoGao_bj'></div>");//本级报告填报要求
  29. sj_div.after($sj);
  30. bj_div.after($bj);
  31. // $sj.append($("<div style='width : 99.2%'><div class='bgd_title bgd_hide' id='baoGao_sj'>上级</div><hr/></div>"));
  32. // $bj.append($("<div style='width : 99.2%'><div class='bgd_title bgd_hide' id-'baoGao_bj'>本级</div><hr/></div>"));
  33. for (var i = 0; i < data.length; i++) {
  34. var table = $("<table class='table'></table>");
  35. var th = $("<thead></thead>");
  36. var tbody = $("<tbody></tbody>");
  37. var is_up = data[i].is_up;
  38. if(is_up==0){
  39. $sj.append(table);
  40. sj_add = true;
  41. }else{
  42. $bj.append(table);
  43. bj_add = true;
  44. }
  45. table.append(th).append(tbody);
  46. //表头
  47. th.append($("<tr><td class='cententCenter' colspan='4'><div class='TitleHeads blue_color'>"+data[i].PROGRAMME_NAME+"</div></td></tr>"));
  48. th.append($("<tr><td class='cententCenter td_head'>报告类型</td><td class='cententCenter td_head'>要求填报时间</td><td class='cententCenter td_head'>填报角色</td><td class='cententCenter td_head'>操作</td></tr>"));
  49. //填报时间#填报角色
  50. var input_time = data[i].input_time;
  51. //获取第一列(报告类型)的跨行数
  52. var rowspan1 = getCharNumFromString(input_time,"#");
  53. var tr = $("<tr></tr>");
  54. //报告类型
  55. var report_type = data[i].REPORT_TYPE;
  56. var report_type_name = "";
  57. if(report_type==1){
  58. report_type_name = "预警行动信息报告";
  59. }else if(report_type==2){
  60. report_type_name = "预警总结报告";
  61. }else if(report_type==3){
  62. report_type_name = "应急工作专报";
  63. }else if(report_type==4){
  64. report_type_name = "应急工作动态";
  65. }
  66. var td1 = $("<td rowspan='"+rowspan1+"' class='cententCenter td_border1' >"+report_type_name+"</td>");
  67. var timeArr = input_time.split(";");
  68. for (var j = 0; j < timeArr.length; j++) {
  69. var inputRoleArr = timeArr[j].split("#");//第一个元素为时间,后面的元素才是填报角色id
  70. var td2 = $("<td rowspan='"+(inputRoleArr.length-1)+"' class='cententCenter td_border1' >"+inputRoleArr[0]+"</td>");
  71. var tr1 = $("<tr></tr>");
  72. if(j==0){
  73. tr.append(td1).append(td2);
  74. tbody.append(tr);
  75. }else{
  76. tr1.append(td2);
  77. }
  78. //循环填报角色id
  79. for (var k = 1; k < inputRoleArr.length; k++) {
  80. var td3 = $("<td class='cententCenter td_border1' >"+jb_role[0][inputRoleArr[k]]+"</td>");
  81. var tb_input = $("<span class='input1'>填报</span>");
  82. tb_input.data("plan_time",inputRoleArr[0]);//要求填报时间
  83. tb_input.data("input_role",inputRoleArr[k]);//填报角色id
  84. tb_input.data("report_type",report_type);//报告类型
  85. tb_input.data("plan_id",data[i].FD_OBJECTID);//填报要求id
  86. tb_input.on("click",report_click);
  87. var td4 = $("<td class='cententCenter td_border1' ></td>");
  88. td4.append(tb_input);
  89. var tr2 = $("<tr></tr>");
  90. if(j==0 && k==1){
  91. tr.append(td3).append(td4);
  92. }else if(j!=0 && k==1){
  93. tr1.append(td3).append(td4);
  94. tbody.append(tr1);
  95. }else{
  96. tr2.append(td3).append(td4);
  97. tbody.append(tr2);
  98. }
  99. }
  100. }
  101. }
  102. if(!sj_add){
  103. $sj.append("<span class='spantip'>没有上级发布的报告要求</span>");
  104. }
  105. if(!bj_add){
  106. $bj.append("<span class='spantip'>没有本级发布的报告要求</span>");
  107. }
  108. setHt();
  109. $("body").eq(0).hideLoading();
  110. },
  111. error : function(e) {
  112. $.messager.alert('查询行失败!', '访问服务失败!', 'error');
  113. }
  114. });
  115. }
  116. /***
  117. * 获取某字符串中某字符的个数
  118. * @param str 字符串
  119. * @param char 字符
  120. * @returns str中char的个数
  121. */
  122. function getCharNumFromString(str,char){
  123. var num = 0;
  124. if(!str || !char || str=="" || char=="" ){
  125. num = 0;
  126. }else{
  127. var str1 = str.replace(new RegExp(char,'g'),"");
  128. num = str.length - str1.length;
  129. }
  130. return num;
  131. };
  132. /**
  133. * 点击报告的填报事件
  134. */
  135. function report_click(){
  136. var $self = $(this);
  137. var plan_time = $self.data("plan_time");//要求填报时间
  138. var input_role = $self.data("input_role");//填报角色id
  139. var report_type = $self.data("report_type");//报告类型
  140. var plan_id = $self.data("plan_id");//填报要求id
  141. if(report_type=="1"){
  142. top.document.getElementById("frmright").setAttribute("src", $.pathname()+ "/page/business/em/alert/report/reportInput/ReportInputAddEdit.jsp?pagetype=daiban&plan_id="+plan_id+"&plan_time="+plan_time+"&input_role="+input_role);
  143. }else if(report_type=="2"){
  144. //var url = $.pathname()+ "/page/business/em/alert/report/reportInput1/ReportInputAddEdit.jsp?plan_id="+plan_id;
  145. //alert(url+'======url');
  146. top.document.getElementById("frmright").setAttribute("src", $.pathname()+ "/page/business/em/alert/report/reportInput1/ReportInputAddEdit.jsp?pagetype=daiban&plan_id="+plan_id+"&plan_time="+plan_time+"&input_role="+input_role);
  147. }
  148. if(report_type=="3"){
  149. top.document.getElementById("frmright").setAttribute("src", $.pathname()+ "/page/business/em/response/report/reportInput/ReportInputAddEdit.jsp?pagetype=daiban&plan_id="+plan_id+"&plan_time="+plan_time+"&input_role="+input_role);
  150. }else if(report_type=="4"){
  151. top.document.getElementById("frmright").setAttribute("src", $.pathname()+ "/page/business/em/response/report/reportInput1/ReportInputAddEdit.jsp?pagetype=daiban&plan_id="+plan_id+"&plan_time="+plan_time+"&input_role="+input_role);
  152. }
  153. }
  154. /**
  155. 获取简报角色
  156. **/
  157. function getRoleNameById(){
  158. var roles = "";
  159. $.ajax({
  160. url : $.pathname() + '/ws/qrps/QueryReportProgrammeService/loadJBRole1',
  161. type : 'post',
  162. timeout : 15000,
  163. dataType : 'json',
  164. async:false,
  165. success : function(data) {
  166. roles = data;
  167. },
  168. error : function(e) {
  169. $.messager.alert('报送失败');
  170. }
  171. });
  172. return roles;
  173. }
  174. /**
  175. * 加载处置值班待办
  176. * @param corpId
  177. * @param role_id
  178. */
  179. function createWarningDutyTable(corpId,role_id){
  180. $("#baoGaoCon").empty();
  181. $(".dateSel").hide();
  182. $("body").eq(0).showLoading();
  183. $.ajax({
  184. url : $.pathname()+ "/ws/xianlutingyun/XianlutingyunService/getDBmsg1",
  185. type : 'post',
  186. timeout : 15000,
  187. async : false,
  188. data : {
  189. role_id:role_id,
  190. company_id:corpId,
  191. type:"8"//1通知单 2处置报表 3报告 4队伍调拨 5装备调拨 6限申请 7预案修编 8日常报表
  192. },
  193. dataType : 'json',
  194. success : function(data){
  195. data = data.rows.rows;
  196. if(!data || data.length==0 ){
  197. $("#baoGaoCon").append("<span class='spantip'>没有要安排的值班任务</span>");
  198. $("body").eq(0).hideLoading();
  199. return;
  200. }
  201. var table = $("<table class='table'></table>");
  202. var th = $("<thead></thead>");
  203. var tbody = $("<tbody></tbody>");
  204. $("#baoGaoCon").append(table);
  205. table.append(th).append(tbody);
  206. //表头
  207. th.append($("<tr><td class='cententCenter td_head'>任务名称</td><td class='cententCenter td_head'>开始日期</td><td class='cententCenter td_head'>截止日期</td><td class='cententCenter td_head'>班次</td><td class='cententCenter td_head'>开始时间</td><td class='cententCenter td_head'>部门</td><td class='cententCenter td_head'>操作</td></tr>"));
  208. for (var i = 0; i < data.length; i++) {
  209. //填报角色
  210. var roleStr = data[i].roleStr;
  211. roleStr = roleStr.split(";");
  212. //获取跨行数
  213. var rowspan1 = roleStr.length;
  214. var tr = $("<tr></tr>");
  215. var planId = data[i].planId;
  216. var PLAN_NAME = data[i].PLAN_NAME;
  217. var START_DATE = data[i].START_DATE;
  218. var END_DATE = data[i].END_DATE;
  219. var DUTY_NUM = data[i].DUTY_NUM;
  220. var START_TIME = data[i].START_TIME;
  221. var td1 = $("<td rowspan='"+rowspan1+"' class='cententCenter td_border1' >"+PLAN_NAME+"</td>");
  222. var td2 = $("<td rowspan='"+rowspan1+"' class='cententCenter td_border1' >"+START_DATE+"</td>");
  223. var td3 = $("<td rowspan='"+rowspan1+"' class='cententCenter td_border1' >"+END_DATE+"</td>");
  224. var td4 = $("<td rowspan='"+rowspan1+"' class='cententCenter td_border1' >"+DUTY_NUM+"</td>");
  225. var td5 = $("<td rowspan='"+rowspan1+"' class='cententCenter td_border1' >"+START_TIME+"</td>");
  226. for (var j = 0; j < roleStr.length; j++) {
  227. var inputRoleArr = roleStr[j].split(",");//填报角色id、name
  228. var roleId = inputRoleArr[0];
  229. var roleName = inputRoleArr[1];
  230. var td6 = $("<td class='cententCenter td_border1' >"+roleName+"</td>");
  231. var tb_input = $("<span class='input1'>填报</span>");
  232. var td7 = $("<td class='cententCenter td_border1' ></td>");
  233. tb_input.data("data_plan_id",planId);
  234. tb_input.data("data_role_id",roleId);
  235. tb_input.data("roleName",roleName);
  236. tb_input.on("click",duty_click);
  237. td7.append(tb_input);
  238. if(j==0){
  239. tr.append(td1).append(td2).append(td3).append(td4).append(td5).append(td6).append(td7);
  240. tbody.append(tr);
  241. }else{
  242. var tr1 = $("<tr></tr>");
  243. tr1.append(td6).append(td7);
  244. tbody.append(tr1);
  245. }
  246. }
  247. }
  248. setHt();
  249. $("body").eq(0).hideLoading();
  250. },
  251. error : function(e) {
  252. $.messager.alert('查询行失败!', '访问服务失败!', 'error');
  253. }
  254. });
  255. }
  256. /**
  257. * 处置值班点击事件
  258. */
  259. function duty_click(){
  260. var $self = $(this);
  261. var plan_id = $self.data("data_plan_id");//任务id
  262. var roleName = $self.data("roleName");//填报角色name
  263. roleName = encodeURI(encodeURI(roleName));
  264. var input_role = $self.data("data_role_id");//填报角色id
  265. top.document.getElementById("frmright").setAttribute("src", $.pathname()+ "/page/business/em/warningDuty/DutyRecordsAddEdit.jsp?pagetype=daiban&planId="+plan_id+"&input_role="+input_role+"&roleName="+roleName);
  266. }