bd667fd0578b9af8172d8e4d907a155d560b2f28.svn-base 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. var corpId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  2. var deptLevel = getThing($.pathname() +"/ws/xianlutingyun/XianlutingyunService/getDeptLevel",{"comp_id":corpId},"text");
  3. function intClick(){
  4. var report_type = $(this).parent().siblings().find("span").eq(0).data("report_type");
  5. if("2"==report_type){
  6. if("2"==deptLevel || "1"==deptLevel){
  7. report_type = "101";
  8. }
  9. }
  10. var dbtype = $(this).data("data-dbtype");
  11. var report_time = $(this).data("data-time");
  12. var affair = $(this).data("data-affair");
  13. var goTime=null;
  14. var min = null;
  15. if(report_time.indexOf(" ")==-1){
  16. if(report_time.indexOf(":")>-1){
  17. var check = report_time.substring(0, report_time.indexOf(":"));
  18. goTime = check;
  19. /*if(0===parseInt(check,10)){
  20. check = "24";
  21. }*/
  22. min = report_time.substring(report_time.indexOf(":")+1);
  23. report_time = check+":"+min;
  24. }else{
  25. goTime = report_time;
  26. }
  27. }else{
  28. goTime = report_time;
  29. }
  30. var nowDateTime = getServerTime().replace(/-/g,"/");
  31. var nowTime = parseInt(new Date(nowDateTime).getTime());
  32. var year = nowDateTime.substring(0, 10);
  33. if(report_time.indexOf(" ")==-1){
  34. report_time = year+" "+report_time;
  35. }
  36. if(report_time.indexOf("-")>-1){
  37. report_time = report_time.replace(new RegExp("-","gm"),"/");
  38. }
  39. report_time = parseInt(new Date(report_time).getTime());
  40. if((nowTime-60*60*1000<=report_time)&&(nowTime+60*60*1000>=report_time)){
  41. var reports = $(this).parent().parent().parent().parent().find("tbody").find(".input1[type='"+report_type+"']");//当前角色激活状态的报表
  42. var reportNum = "";
  43. for(var i=0;i<reports.length;i++){
  44. if(reportNum.indexOf(reports.eq(i))==-1){
  45. reportNum += reports.eq(i).data("data-fdId")+",";
  46. }
  47. }
  48. console.log("报表填报任务id=========="+reportNum);
  49. var scheduleName = $(this).parent().parent().parent().parent().find("thead").find("tr").first().find("td").eq(0).find("span").data("data-schedule");
  50. window.parent.parent.document.getElementById("frmright").setAttribute("src", $.pathname()+"/page/business/em/report/Report_Add.html?"+report_type+"?"+reportNum+"?"+dbtype+"?"+affair+"?"+scheduleName);
  51. }else{
  52. var starTime = "";
  53. var endTime ="";
  54. if(goTime.indexOf(" ")==-1){
  55. if(0<parseInt(goTime,10)&&parseInt(goTime,10)<23){
  56. starTime = parseInt(goTime,10)-1;
  57. endTime = parseInt(goTime,10)+1;
  58. }else if(0===parseInt(goTime,10)){
  59. starTime = 23;
  60. endTime = 1;
  61. }else if(23===parseInt(goTime)){
  62. starTime = 22;
  63. endTime =0;
  64. }
  65. if(min!=null){
  66. starTime = starTime+":"+min;
  67. endTime = endTime+":"+min;
  68. }
  69. }else{
  70. goTime = goTime.replace(new RegExp("-","gm"),"/");
  71. var seconds = (new Date(goTime)).getTime();
  72. var hS = 60*60*1000;
  73. starTime = getNowDateTime((parseInt(seconds,10)-parseInt(hS,10)));//new Date((parseInt(seconds,10)-parseInt(hS,10)));
  74. endTime= getNowDateTime((parseInt(seconds,10)+parseInt(hS,10)));
  75. starTime = starTime.replace(new RegExp("/","gm"),"-");
  76. endTime = endTime.replace(new RegExp("/","gm"),"-");
  77. }
  78. top.Dialog.alert("该报表请在"+starTime+"~"+endTime+"时填报");
  79. }
  80. }
  81. function init(params,roleId){
  82. $("#requireForm").empty();
  83. getRequire(params,roleId);
  84. }
  85. function getNowDateTime(time){
  86. var now=null;
  87. if(time){
  88. now = new Date(time);
  89. }else{
  90. now=allGetServerTime();
  91. }
  92. //获取年份
  93. var year=now.getFullYear();
  94. //获取月份
  95. var month=now.getMonth()+1;
  96. if(month>=1&&month<=9){
  97. month = "0"+month;
  98. }
  99. //获取日期
  100. var day=now.getDate();
  101. if(day>=1&&day<=9){
  102. day = "0"+day;
  103. }
  104. //获取小时
  105. var hours=now.getHours();
  106. if(hours>=1&&hours<=9){
  107. hours = "0"+hours;
  108. }
  109. //获取分钟
  110. var minutes=now.getMinutes();
  111. if(minutes>=1&&minutes<=9){
  112. minutes = "0"+minutes;
  113. }
  114. var seconds = now.getSeconds();
  115. if(seconds>=1&&seconds<=9){
  116. seconds = "0"+seconds;
  117. }
  118. var currentTime =year+"/"+month+"/"+day+" "+hours+":"+minutes+":"+seconds;
  119. return currentTime;
  120. }
  121. function getRequire(params,roleId){
  122. $("body").eq(0).showLoading();
  123. $.ajax({
  124. url : $.pathname()+ "/ws/xianlutingyun/XianlutingyunService/getReportTask",
  125. type : 'post',
  126. // timeout : 15000,
  127. async : false,
  128. data : params,
  129. dataType : 'json',
  130. success : function(data) {
  131. if(data==null || data.length==0){
  132. $("#requireForm").append("<span class='spantip'>没有要填写的报表数据</span>");
  133. $("body").eq(0).hideLoading();
  134. return;
  135. }
  136. for(var m in data){
  137. var role = data[m]["roleId"];
  138. var roleName = data[m]["roleName"];
  139. var totalNum = data[m]["totalNum"];
  140. var writeNum = data[m]["writeNum"];
  141. var roleTable = $("<div style='width : 99.2%'><div class='bgd_title bgd_hide' id='"+role+"'>"+roleName+"---"+writeNum+"/"+totalNum+"</div><hr/></div>");
  142. var contentTable = $("<div id='content_"+role+"' style='Width:100%;display:none'></div>");
  143. var tableData = data[m]["data"];
  144. if(tableData.length==0){
  145. contentTable.append("<span class='spantip'>没有要填写的报表数据</span>");
  146. roleTable.append(contentTable);
  147. $("#requireForm").append(roleTable);
  148. continue;
  149. }
  150. for (var i = 0; i < tableData.length; i++) {
  151. var table = $("<table class='table'></table>");
  152. var th = $("<thead></thead>");
  153. var tbody = $("<tbody></tbody>");
  154. var schedule = tableData[i].schedule;
  155. var cfData = tableData[i].cfRole;
  156. var db_type = tableData[i].report_type;
  157. var reportContent = tableData[i].reportContent;
  158. var scheduleName = schedule.split("|");
  159. var scheduleNum = tableData[i].fdIds;
  160. var affair = tableData[i].affair;
  161. var tr_h = $("<tr><td class='cententCenter'></td></tr>");
  162. var sch_span = $("<span></span>");
  163. for(var n=0;n<scheduleName.length;n++){
  164. var sch_div = $("<div class='TitleHeads'>"+scheduleName[n]+"</div>");
  165. sch_span.append(sch_div);
  166. }
  167. sch_span.data("data-num",scheduleNum);
  168. sch_span.data("data-schedule",scheduleName);
  169. tr_h.find("td").eq(0).append(sch_span);
  170. if(deptLevel!="true" && cfData!="no"){
  171. tr_h.find("td").eq(0).attr("colspan","2");
  172. var td = $("<td class='cententCenter'></td>");
  173. //cfRole只要不为no都可以拆分
  174. var cf_input = $("<span class='cfSpan'>拆分计划</span>");
  175. cf_input.data("data-role",role);
  176. cf_input.on("click",cfClick);
  177. td.append(cf_input);
  178. tr_h.append(td);
  179. }else{
  180. tr_h.find("td").eq(0).attr("colspan","3");
  181. }
  182. th.append(tr_h);
  183. var tr_h1 = $("<tr><td class='cententCenter td_head'>填报时间段</td><td class='cententCenter td_head'>需要填报的报表</td><td class='cententCenter td_head'>操作</td></tr>");
  184. th.append(tr_h1);
  185. table.append(th);
  186. for (var j = 0; j < reportContent.length; j++) {
  187. var time = reportContent[j].time;
  188. var reports = reportContent[j].report;
  189. var flag = reportContent[j].flag;//任务状态
  190. var fdId = reportContent[j].fdId;//任务id
  191. var report = reports.split(",");
  192. var len = report.length;
  193. var $td1 = $("<td rowspan=" + len
  194. + " class='cententCenter_t td_border2'>"+time+"</td>");
  195. for (var k = 0; k < len; k++) {
  196. var reportName = report[k].split("_")[0];
  197. var reportType = report[k].split("_")[1];
  198. var tr1 = $("<tr></tr>");
  199. var span = $("<span></span>");
  200. var tb_input = "";
  201. var $td2 = $("<td class='cententCenter td_border1' ></td>");
  202. var $td_btn = $("<td class='cententCenter_btn td_border1'> </td>");
  203. if(flag=="true"){
  204. span.addClass("yes_write");
  205. tb_input = $("<span class='input1' type='"+reportType+"'>填报</span>");
  206. tb_input.data("data-time",time);
  207. tb_input.data("data-dbtype",db_type);
  208. tb_input.data("data-affair",affair);
  209. tb_input.data("data-fdId",fdId.split("_")[k]);
  210. tb_input.on("click",intClick);
  211. }else{
  212. if(flag=="cg"){
  213. tb_input = $("<span>未按时填报</span>");
  214. }else{
  215. tb_input = $("<span>未到填报时间</span>");
  216. }
  217. }
  218. span.data("report_type",reportType);
  219. span.text(reportName);
  220. $td2.append(span);
  221. $td_btn.append(tb_input);
  222. if(len==1){
  223. tr1.addClass("td_border2");
  224. }else{
  225. if(k==len-1){
  226. tr1.addClass("tr_border2");
  227. }
  228. }
  229. if (k == 0) {
  230. tr1.append($td1).append($td2).append($td_btn);
  231. } else {
  232. tr1.append($td2).append($td_btn);
  233. }
  234. tbody.append(tr1);
  235. table.append(tbody);
  236. }
  237. }
  238. contentTable.append(table);
  239. roleTable.append(contentTable);
  240. }
  241. $("#requireForm").append(roleTable);
  242. }
  243. $("body").eq(0).hideLoading();
  244. },
  245. error : function(e) {
  246. $.messager.alert('查询行失败!', '访问服务失败!', 'error');
  247. }
  248. });
  249. }
  250. function getRoleSel(userId,zyRoleId){
  251. $.ajax({
  252. url : $.pathname() +"/ws/getUserRole/GetRoleService/getUserRole",
  253. type : 'post',
  254. timeout : 15000,
  255. async : false,
  256. data : {
  257. userId:userId,
  258. roleId:zyRoleId
  259. },
  260. dataType : 'json',
  261. success : function(data) {
  262. $("#roleSel").data("data",data);
  263. $("#roleSel").render();
  264. },
  265. error : function(e) {
  266. $.messager.alert('查询报表类型失败', '访问服务失败!', 'error');
  267. }
  268. });
  269. }
  270. /*
  271. function hideLoad(){
  272. $(".idxModule-loading-bg").hide();
  273. $(".idxModule-loading-box").hide();
  274. }
  275. function showLoad(){
  276. $(".idxModule-loading-bg").show();
  277. $(".idxModule-loading-box").show();
  278. }*/
  279. /**
  280. * 拆分计划
  281. */
  282. function cfClick(){
  283. var roleId = $(this).data("data-role");
  284. var fd_ids = $(this).parents().find("thead").find("tr").first().find("td").eq(0).find("span").data("data-num");
  285. // var cfRole = $(this).parents().find("thead").find("tr").first().find("td").eq(0).find("span").data("data-cfRole");
  286. var fd_id = "";
  287. if(fd_ids.length==1){
  288. fd_id = fd_ids[0];
  289. }else{
  290. fd_id = fd_ids.join(",");
  291. }
  292. window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/business/em/report/reportDept/addReportRequire.html?fd_id="+fd_id+"&role_Id="+roleId+"&db=db");
  293. }