reportProduce.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  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. <div style = "width: 80%; margin-left : 0px; height : 200px" class = "layui-upload-drag" >
  60. <input type="text" style = "display : inline-block" class="layui-input" id="dayRange" placeholder="请选择报表日期">
  61. <input type="text" style = "display : inline-block" class="layui-input" id="dateRange" placeholder="请选择报表日期范围">
  62. <input type="text" style = "display : inline-block" class="layui-input" id="timeRange" placeholder="请选择报表时间段">
  63. <p name = "TQTDRB" style = "display : none;"><a id = "monthNum" style = "font-size: 18px; color: red;" onclick = "changeHtml(this)">2</a>个月内停电<a id = "countNum" style = "font-size: 18px; color: red;" onclick = "changeHtml(this)">3</a>次以上的台区数量</p>
  64. </div>
  65. <div style="margin-top : 50px;">
  66. <button type="button" class="layui-btn" style = "width : 214px" onclick = "tableYulan()">下一步</button>
  67. </div>
  68. </div>
  69. <div name = "step" style = "width: 80%; margin-left : 10%; height : 300px; display : none; text-align : center;">
  70. <div style = "width: 80%; margin-left : 0px;" class = "layui-upload-drag" >
  71. <p id = "fileName" contenteditable="true">国网泰安供电公司2020年8月份配网运行分析月报</p>
  72. <table id = "reportTable" class="layui-table">
  73. </table>
  74. <p id = "content"></p>
  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 timeType = getQueryString("timeType");// 00日报01周报02月报
  92. // 日报
  93. if (timeType == '00') {
  94. $("#dayRange").show();
  95. $("#dateRange").hide();
  96. // 周报和月报
  97. } else {
  98. $("#dayRange").hide();
  99. $("#dateRange").show();
  100. }
  101. var $step;
  102. layui.config({
  103. base: '../../plugins/layui/lay/modules/steps/'
  104. }).use(['steps','jquery'],function(){
  105. var $ = layui.$;
  106. $step = $("#step_demo").step();
  107. })
  108. layui.use('laydate', function(){
  109. var laydate = layui.laydate;
  110. // 报告日报日期选择
  111. laydate.render({
  112. elem : '#dayRange'
  113. ,format : 'yyyyMMdd'
  114. });
  115. // 报告日期范围选择
  116. laydate.render({
  117. elem : '#dateRange'
  118. ,format : 'yyyyMMdd'
  119. ,range : true
  120. });
  121. //时间范围
  122. laydate.render({
  123. elem : '#timeRange'
  124. ,type : 'time'
  125. ,format : 'HHmmss'
  126. ,value : '000000 - 235959'
  127. ,range : true
  128. });
  129. });
  130. // 范围类型
  131. layui.use('form', function(){
  132. var form = layui.form;
  133. $.request({
  134. action : 'BranchReportTypeAction/branchReportTypeQuery',
  135. data : {
  136. timeType : timeType
  137. },
  138. success : function(data) {
  139. var html = '<select id = "reportType" lay-filter="reportTypeFilter"><option value = "">请选择</option>';
  140. var fileTypeList = data.data;
  141. for (var i = 0; i < fileTypeList.length; i ++) {
  142. var fileTypeInf = fileTypeList[i];
  143. html += '<option value = "' + fileTypeInf.id + '_' + fileTypeInf.type + '_' + fileTypeInf.timeType + '">' + fileTypeInf.name + '</option>';
  144. }
  145. html += '</select>';
  146. $("#reportTypeDiv").html(html);
  147. form.render();
  148. },
  149. error : function(data2) {
  150. $.ErrorAlert(data2.MINErrorMessage);
  151. }
  152. });
  153. form.on('select(reportTypeFilter)', function(data){
  154. var value = data.value;
  155. if (!isEmpty(value)) {
  156. var reportTypeId = value.split("_")[0];
  157. $("#fileName").html(data.elem.selectedOptions[0].text);
  158. if (!isEmpty(reportTypeId)) {
  159. $.request({
  160. action : 'BranchReportTypeAction/fileTypeOfReportType',
  161. data : {
  162. reportTypeId : reportTypeId
  163. },
  164. success : function(data) {
  165. fileType = data.data;
  166. setTempVal("fileType", fileType);
  167. var utilDataInf = data.utilDataInf;
  168. if (!isEmpty(utilDataInf)) {
  169. $("#utilName").html(utilDataInf.fileName);
  170. $("#utilName").attr("fileName", utilDataInf.fileName);
  171. setTempVal("utilExcelDataDetail", utilDataInf.excelData);
  172. var algorithmInf = data.algorithmInf;
  173. if (!isEmpty(algorithmInf)) {
  174. $("#algorithmName").html(utilDataInf.fileName+"算法");
  175. $("#algorithmName").attr("reportTypeId", reportTypeId);
  176. }
  177. }
  178. },
  179. error : function(data2) {
  180. $.ErrorAlert(data2.MINErrorMessage);
  181. }
  182. });
  183. }
  184. }
  185. });
  186. })
  187. function goStep (step) {
  188. var reportInf = $("#reportTypeDiv").find("select option:selected").val();
  189. var dayRange = $("#dayRange").val();
  190. var dateRange = $("#dateRange").val();
  191. var timeRange = $("#timeRange").val();
  192. if (step == 2) {
  193. if (isEmpty(reportInf)) {
  194. $.ErrorAlert("请选择上传文件类型!");
  195. return;
  196. }
  197. var reportType = reportInf.split("_")[0];
  198. // 台区停电日报
  199. if ("TQTDRB" == reportType) {
  200. $("body").find("[name='TQTDRB']").show();
  201. }
  202. }
  203. if (step == 4) {
  204. var reportData = getTempVal("reportData");
  205. var fileName = $("#fileName").html();
  206. var range = null;
  207. if (timeType == '00') {
  208. range = dayRange + "-" + dayRange;
  209. } else {
  210. range = dateRange;
  211. }
  212. $.request({
  213. action : 'ReportManageAction/fileInfReportSubmit',
  214. data : {
  215. reportData : JSON.stringify(excelList),
  216. reportInf : reportInf,
  217. fileName : fileName,
  218. range : range,
  219. timeRange : timeRange
  220. },
  221. success : function(data) {
  222. if (data.code == 0) {
  223. $step.goStep(step);
  224. var stepDiv = $("div[name = 'step']");
  225. for (var i = 0; i < stepDiv.length; i ++) {
  226. if (step == (i + 1)) {
  227. $(stepDiv[i]).show();
  228. } else {
  229. $(stepDiv[i]).hide();
  230. }
  231. }
  232. } else {
  233. $.ErrorAlert(res.MINErrorMessage);
  234. }
  235. },
  236. error : function(data2) {
  237. $.ErrorAlert(data2.MINErrorMessage);
  238. }
  239. });
  240. return;
  241. }
  242. $step.goStep(step);
  243. var stepDiv = $("div[name = 'step']");
  244. for (var i = 0; i < stepDiv.length; i ++) {
  245. if (step == (i + 1)) {
  246. $(stepDiv[i]).show();
  247. } else {
  248. $(stepDiv[i]).hide();
  249. }
  250. }
  251. }
  252. function finish() {
  253. deleteTabPageParent(pageId);
  254. }
  255. // 报表查询的明细数据
  256. var chooseFileData;
  257. function deleteChooseFile(index) {
  258. chooseFileData.splice(index, 1);
  259. tableInit();
  260. }
  261. // 查看工具表详情
  262. function goUtilDetail(t) {
  263. var fileName = $(t).attr("fileName");
  264. var openPageId = pageId + "-01";
  265. openMainTabPage(openPageId, "详情查看", "reprotManage/utilExcelDetail.html?pageId="+openPageId+"&fileName="+chineseUrlEncode(fileName), '', pageId, null);
  266. }
  267. // 查看算法详情
  268. function goAlgorithmDetail(t) {
  269. var reportTypeId = $(t).attr("reportTypeId");
  270. var openPageId = pageId + "-02";
  271. openMainTabPage(openPageId, "详情查看", "reprotManage/reportAlgorithm.html?pageId="+openPageId+"&reportTypeId="+reportTypeId, '', pageId, null);
  272. }
  273. // 报表excel
  274. var excelList = null;
  275. // 预览
  276. function tableYulan() {
  277. var reportInf = $("#reportTypeDiv").find("select option:selected").val();
  278. var dayRange = $("#dayRange").val();
  279. var dateRange = $("#dateRange").val();
  280. var timeRange = $("#timeRange").val();
  281. // 日报
  282. if (timeType == '00') {
  283. if (isEmpty(dayRange)) {
  284. $.ErrorAlert("请选择报表日期!");
  285. return;
  286. }
  287. } else {
  288. if (isEmpty(dateRange)) {
  289. $.ErrorAlert("请选择报表日期范围!");
  290. return;
  291. }
  292. }
  293. // 日报
  294. var range = null;
  295. if (timeType == '00') {
  296. range = dayRange + "-" + dayRange;
  297. } else {
  298. range = dateRange;
  299. }
  300. var monthNum = $("#monthNum").html();
  301. var countNum = $("#countNum").html();
  302. // 查询符合条件的明细数据,生成预览数据
  303. $.request({
  304. action : 'ReportManageAction/reportNeedDataDetail',
  305. data : {
  306. range : range,
  307. timeRange : timeRange,
  308. reportInf : reportInf,
  309. monthNum : monthNum,
  310. countNum : countNum
  311. },
  312. success : function(data) {
  313. if (data.code == 0) {
  314. excelList = data.data.resList;
  315. initExcelData(excelList, "reportTable", false);
  316. goStep(3);
  317. } else {
  318. $.ErrorAlert(res.MINErrorMessage);
  319. }
  320. },
  321. error : function(data2) {
  322. $.ErrorAlert(data2.MINErrorMessage);
  323. }
  324. });
  325. }
  326. function changeHtml(t) {
  327. var initValue = $(t).html();
  328. layer.prompt({
  329. formType: 2,
  330. value: initValue,
  331. title: '请输入',
  332. area: ['200px', '33px'] //自定义文本域宽高
  333. },
  334. function(value, index, elem){
  335. $(t).html(value);
  336. layer.close(index);
  337. }
  338. );
  339. }
  340. </script>
  341. </body>
  342. </html>