reportProduce95598.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>导入</title>
  6. <script src="../../js/min-loader-next.js"></script>
  7. <script src="../../js/report.js"></script>
  8. <link rel="stylesheet" href="../../plugins/layui/lay/modules/steps/style.css"></link>
  9. <style>
  10. .layui-input {
  11. width : 200px;
  12. }
  13. .layui-upload-drag .layui-icon {
  14. font-size: 18px;
  15. color: #fff;
  16. }
  17. .layui-btn-sm {
  18. height: 22px;
  19. line-height: 22px;
  20. padding: 0 10px;
  21. font-size: 12px;
  22. }
  23. </style>
  24. </head>
  25. <body class="content">
  26. <div id="step_demo" class="step-body" style = "margin-top : 20px; margin-left: 10%;">
  27. <div class="step-header" style="width:80%;overflow: hidden;">
  28. <ul>
  29. <li>
  30. <span class="step-name">选择报告/报表</span>
  31. </li>
  32. <li>
  33. <span class="step-name">选择文件</span>
  34. </li>
  35. <li>
  36. <span class="step-name">数据预览</span>
  37. </li>
  38. <li>
  39. <span class="step-name">生成报告/报表</span>
  40. </li>
  41. </ul>
  42. </div>
  43. </div>
  44. <div class="order-body" style = "width: 80%; margin-left : 10%;height : 450px" name = "step">
  45. <form class="layui-form" style = "text-align : center;">
  46. <div class="order-select" id="content" style = "background: #FFFFFF;border-radius: 8px;padding: 16px 1.4rem;">
  47. <div class="layui-inline" style="margin-top: 150px;">
  48. <label class="f12-gray4">请选择文件类型:</label>
  49. <div id = "reportTypeDiv" class="layui-inline">
  50. </div>
  51. </div>
  52. <div style="margin-top : 200px;">
  53. <button type="button" class="layui-btn" style = "width : 214px" onclick = "goStep(2)">下一步</button>
  54. </div>
  55. </div>
  56. </form>
  57. </div>
  58. <div name = "step" style = "width: 80%; margin-left : 10%;height : 300px; display : none; text-align : center;">
  59. <form class="layui-form" style = "text-align : center;">
  60. <div style = "width: 80%; margin-left : 0px; height : 200px" class = "layui-upload-drag" >
  61. <input type="text" style = "display : inline-block" class="layui-input" id="dateRange" placeholder="请选择报表日期范围">
  62. </div>
  63. <div style="margin-top : 50px;">
  64. <button type="button" class="layui-btn" style = "width : 214px" onclick = "tableYulan()">下一步</button>
  65. </div>
  66. </form>
  67. </div>
  68. <div name = "step" style = "width: 90%; margin-left : 5%; height : 300px; display : none; text-align : center;">
  69. <div style = "margin-left : 0px;width: 100%;" class = "layui-upload-drag" >
  70. <p id = "fileName" contenteditable="true">国网泰安供电公司2020年8月份配网运行分析月报</p>
  71. <table id = "reportTable" class="layui-table">
  72. </table>
  73. <div id = "detailTable">
  74. </div>
  75. <!-- <p>报表关联的工具表为《<a id = "utilName" onclick = "goUtilDetail(this)">2020年6月底低电压月报工具表</a>》 关联的报表算法为《<a id = "algorithmName" onclick = "goAlgorithmDetail(this)">国网泰安供电公司2020年8月份配网运行分析月报</a>》 的算法</p> -->
  76. </div>
  77. <div style="margin-top : 50px;">
  78. <button type="button" class="layui-btn" style = "width : 214px" onclick = "goStep(4)">下一步</button>
  79. </div>
  80. </div>
  81. <div name = "step" style = "width: 80%; margin-left : 10%;height : 300px; display : none; text-align : center; margin-top : 50px;">
  82. <i class="layui-icon layui-icon-ok-circle" style="font-size: 100px; color: #009688;"></i>
  83. <p style = "font-weight: 700;font-size: 25px;">报表生成成功!</p>
  84. <p style = " color: #b2bbc2;">可在数据仓库-报表管理进行查看</p>
  85. <div style="margin-top : 100px;">
  86. <button type="button" class="layui-btn" style = "width : 214px" onclick = "finish()">完成</button>
  87. </div>
  88. </div>
  89. <script>
  90. var pageId = getQueryString("pageId");
  91. var reportType = getQueryString("reportType"); //报告类型
  92. var $step;
  93. layui.config({
  94. base: '../../plugins/layui/lay/modules/steps/'
  95. }).use(['steps','jquery'],function(){
  96. var $ = layui.$;
  97. $step = $("#step_demo").step();
  98. })
  99. layui.use('laydate', function(){
  100. var laydate = layui.laydate;
  101. // 报告日期范围选择
  102. laydate.render({
  103. elem : '#dateRange'
  104. ,format : 'yyyyMMdd'
  105. ,range : true
  106. ,done: function(value, date, endDate){
  107. console.log(value); //得到日期生成的值,如:2017-08-18
  108. var fileName = $("#fileName").html();
  109. if (fileName.indexOf("-") != -1) {
  110. $("#fileName").html(fileName.split("-")[0]+value);
  111. } else {
  112. $("#fileName").html(fileName+"-" + value);
  113. }
  114. }
  115. });
  116. })
  117. // 范围类型
  118. layui.use('form', function(){
  119. var form = layui.form;
  120. initSelect("FADateRange", "FADateRange", "FADateRange", "", false);
  121. $.request({
  122. action : 'BranchReportTypeAction/branchReportTypeQuery',
  123. data : {
  124. reportType : reportType
  125. },
  126. success : function(data) {
  127. var html = '<select id = "reportType" lay-filter="reportTypeFilter"><option value = "">请选择</option>';
  128. var fileTypeList = data.data;
  129. for (var i = 0; i < fileTypeList.length; i ++) {
  130. var fileTypeInf = fileTypeList[i];
  131. html += '<option value = "' + fileTypeInf.id + '_' + fileTypeInf.type + '_' + fileTypeInf.timeType + '">' + fileTypeInf.name + '</option>';
  132. }
  133. html += '</select>';
  134. $("#reportTypeDiv").html(html);
  135. form.render();
  136. },
  137. error : function(data2) {
  138. $.ErrorAlert(data2.MINErrorMessage);
  139. }
  140. });
  141. form.on('select(reportTypeFilter)', function(data){
  142. var value = data.value;
  143. if (!isEmpty(value)) {
  144. var reportTypeId = value.split("_")[0];
  145. $("#fileName").html(data.elem.selectedOptions[0].text);
  146. if (!isEmpty(reportTypeId)) {
  147. $.request({
  148. action : 'BranchReportTypeAction/fileTypeOfReportType',
  149. data : {
  150. reportTypeId : reportTypeId
  151. },
  152. success : function(data) {
  153. fileType = data.data;
  154. setTempVal("fileType", fileType);
  155. var utilDataInf = data.utilDataInf;
  156. if (!isEmpty(utilDataInf)) {
  157. $("#utilName").html(utilDataInf.fileName);
  158. $("#utilName").attr("fileName", utilDataInf.fileName);
  159. setTempVal("utilExcelDataDetail", utilDataInf.excelData);
  160. var algorithmInf = data.algorithmInf;
  161. if (!isEmpty(algorithmInf)) {
  162. $("#algorithmName").html(utilDataInf.fileName+"算法");
  163. $("#algorithmName").attr("reportTypeId", reportTypeId);
  164. }
  165. }
  166. },
  167. error : function(data2) {
  168. $.ErrorAlert(data2.MINErrorMessage);
  169. }
  170. });
  171. }
  172. }
  173. });
  174. })
  175. function goStep (step) {
  176. var reportInf = $("#reportTypeDiv").find("select option:selected").val();
  177. if (step == 2) {
  178. if (isEmpty(reportInf)) {
  179. $.ErrorAlert("请选择上传文件类型!");
  180. return;
  181. }
  182. var reportType = reportInf.split("_")[0];
  183. // 台区停电日报
  184. if ("TQTDRB" == reportType) {
  185. $("body").find("[name='TQTDRB']").show();
  186. }
  187. }
  188. if (step == 4) {
  189. var fileName = $("#fileName").html();
  190. var range = $("#dateRange").val();
  191. if (isEmpty(range)) {
  192. $.ErrorAlert("请选择日期范围!");
  193. return;
  194. }
  195. $.request({
  196. action : 'ReportManageAction/fileInfReportSubmit',
  197. data : {
  198. reportData : JSON.stringify(reportData),
  199. reportInf : reportInf,
  200. fileName : fileName,
  201. range : range
  202. },
  203. success : function(data) {
  204. if (data.code == 0) {
  205. $step.goStep(step);
  206. var stepDiv = $("div[name = 'step']");
  207. for (var i = 0; i < stepDiv.length; i ++) {
  208. if (step == (i + 1)) {
  209. $(stepDiv[i]).show();
  210. } else {
  211. $(stepDiv[i]).hide();
  212. }
  213. }
  214. } else {
  215. $.ErrorAlert(res.MINErrorMessage);
  216. }
  217. },
  218. error : function(data2) {
  219. $.ErrorAlert(data2.MINErrorMessage);
  220. }
  221. });
  222. return;
  223. }
  224. $step.goStep(step);
  225. var stepDiv = $("div[name = 'step']");
  226. for (var i = 0; i < stepDiv.length; i ++) {
  227. if (step == (i + 1)) {
  228. $(stepDiv[i]).show();
  229. } else {
  230. $(stepDiv[i]).hide();
  231. }
  232. }
  233. }
  234. function finish() {
  235. deleteTabPageParent(pageId);
  236. }
  237. // 查看工具表详情
  238. function goUtilDetail(t) {
  239. var fileName = $(t).attr("fileName");
  240. var openPageId = pageId + "-01";
  241. openMainTabPage(openPageId, "详情查看", "reprotManage/utilExcelDetail.html?pageId="+openPageId+"&fileName="+chineseUrlEncode(fileName), '', pageId, null);
  242. }
  243. // 查看算法详情
  244. function goAlgorithmDetail(t) {
  245. var reportTypeId = $(t).attr("reportTypeId");
  246. var openPageId = pageId + "-02";
  247. openMainTabPage(openPageId, "详情查看", "reprotManage/reportAlgorithm.html?pageId="+openPageId+"&reportTypeId="+reportTypeId, '', pageId, null);
  248. }
  249. // 报表excel
  250. var reportData = null;
  251. // 预览
  252. function tableYulan() {
  253. var reportInf = $("#reportTypeDiv").find("select option:selected").val();
  254. var range = $("#dateRange").val();
  255. if (isEmpty(range)) {
  256. $.ErrorAlert("请选择日期范围!");
  257. return;
  258. }
  259. // 查询符合条件的明细数据,生成预览数据
  260. $.request({
  261. action : 'ReportManageAction/reportNeedDataDetail',
  262. data : {
  263. reportInf : reportInf,
  264. range : range
  265. },
  266. success : function(data) {
  267. if (data.code == 0) {
  268. reportData = data.data;
  269. // 总览
  270. initExcelData(reportData.tongjiList, "reportTable", false);
  271. var detailHtml = "";
  272. // 详情
  273. var areaDetailList = reportData.areaDetailList;
  274. for (var i = 0; i < areaDetailList.length; i ++) {
  275. var excelList = areaDetailList[i];
  276. detailHtml += '<table class="layui-table">';
  277. for (var j = 0; j < excelList.length; j ++) {
  278. detailHtml += '<tr>';
  279. var childList = excelList[j];
  280. for (var k = 0; k < childList.length; k ++) {
  281. var tdHtml = isEmpty(childList[k])?'':childList[k];
  282. detailHtml += '<td>'+ tdHtml +'</td>';
  283. }
  284. detailHtml += '</tr>';
  285. }
  286. detailHtml += '</table>';
  287. }
  288. $("#detailTable").html(detailHtml);
  289. goStep(3);
  290. } else {
  291. $.ErrorAlert(res.MINErrorMessage);
  292. }
  293. },
  294. error : function(data2) {
  295. $.ErrorAlert(data2.MINErrorMessage);
  296. }
  297. });
  298. }
  299. </script>
  300. </body>
  301. </html>