reportProduceYb.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  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. <script src="../../js/echarts.min.js"></script>
  9. <link rel="stylesheet" href="../../plugins/layui/lay/modules/steps/style.css"></link>
  10. <style>
  11. .layui-input {
  12. width : 200px;
  13. }
  14. .layui-upload-drag .layui-icon {
  15. font-size: 18px;
  16. color: #fff;
  17. }
  18. .layui-btn-sm {
  19. height: 22px;
  20. line-height: 22px;
  21. padding: 0 10px;
  22. font-size: 12px;
  23. }
  24. </style>
  25. </head>
  26. <body class="content">
  27. <div id="step_demo" class="step-body" style = "margin-top : 20px; margin-left: 10%;">
  28. <div class="step-header" style="width:80%;overflow: hidden;">
  29. <ul>
  30. <li>
  31. <span class="step-name">选择报告/报表</span>
  32. </li>
  33. <li>
  34. <span class="step-name">选择文件</span>
  35. </li>
  36. <li>
  37. <span class="step-name">数据预览</span>
  38. </li>
  39. <li>
  40. <span class="step-name">生成报告/报表</span>
  41. </li>
  42. </ul>
  43. </div>
  44. </div>
  45. <div class="order-body" style = "width: 80%; margin-left : 10%;height : 450px" name = "step">
  46. <form class="layui-form" style = "text-align : center;">
  47. <div class="order-select" id="content" style = "background: #FFFFFF;border-radius: 8px;padding: 16px 1.4rem;">
  48. <div class="layui-inline" style="margin-top: 150px;">
  49. <label class="f12-gray4">请选择文件类型:</label>
  50. <div id = "reportTypeDiv" class="layui-inline">
  51. </div>
  52. </div>
  53. <div style="margin-top : 200px;">
  54. <button type="button" class="layui-btn" style = "width : 214px" onclick = "goStep(2)">下一步</button>
  55. </div>
  56. </div>
  57. </form>
  58. </div>
  59. <div name = "step" style = "width: 80%; margin-left : 10%;height : 300px; display : none; text-align : center;">
  60. <div style = "width: 80%; margin-left : 0px; height : 200px" class = "layui-upload-drag" >
  61. <input id = "chooseFenxiReport" type="text" style = "display : inline-block" class="layui-input" 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. </div>
  67. <div name = "step" style = "height : 300px; display : none; text-align : center;">
  68. <div style = "width: 100%; margin-left : 0px;" class = "layui-upload-drag" >
  69. <p id = "fileName" contenteditable="true">国网泰安供电公司2020年8月份配网运行分析月报</p>
  70. <div id = "reportDiv" style = "text-align:left;"></div>
  71. </div>
  72. <div style="margin-top : 50px;">
  73. <button type="button" class="layui-btn" style = "width : 214px" onclick = "goStep(4)">下一步</button>
  74. </div>
  75. </div>
  76. <div name = "step" style = "width: 80%; margin-left : 10%;height : 300px; display : none; text-align : center; margin-top : 50px;">
  77. <i class="layui-icon layui-icon-ok-circle" style="font-size: 100px; color: #009688;"></i>
  78. <p style = "font-weight: 700;font-size: 25px;">报表生成成功!</p>
  79. <p style = " color: #b2bbc2;">可在数据仓库-报表管理进行查看</p>
  80. <div style="margin-top : 100px;">
  81. <button type="button" class="layui-btn" style = "width : 214px" onclick = "finish()">完成</button>
  82. </div>
  83. </div>
  84. <script>
  85. var pageId = getQueryString("pageId");
  86. var reportType = getQueryString("reportType");// 00日报01周报02月报
  87. var $step;
  88. layui.config({
  89. base: '../../plugins/layui/lay/modules/steps/'
  90. }).use(['steps','jquery'],function(){
  91. var $ = layui.$;
  92. $step = $("#step_demo").step();
  93. })
  94. $("#chooseFenxiReport").click(function(){
  95. var openPageId = pageId + "-01";
  96. openMainTabPage(openPageId, "报表生成", "common/chooseDdyFxb.html?pageId="+openPageId, '', pageId, chooseBack);
  97. })
  98. // 选择分析表返回
  99. var fxbReport;
  100. function chooseBack() {
  101. fxbReport = getTempVal("fxbReport");
  102. $("#chooseFenxiReport").val(fxbReport.fileName);
  103. }
  104. // 范围类型
  105. layui.use('form', function(){
  106. var form = layui.form;
  107. $.request({
  108. action : 'BranchReportTypeAction/branchReportTypeQuery',
  109. data : {
  110. reportType : reportType
  111. },
  112. success : function(data) {
  113. var html = '<select id = "reportType" lay-filter="reportTypeFilter"><option value = "">请选择</option>';
  114. var fileTypeList = data.data;
  115. for (var i = 0; i < fileTypeList.length; i ++) {
  116. var fileTypeInf = fileTypeList[i];
  117. html += '<option value = "' + fileTypeInf.id + '_' + fileTypeInf.type + '_' + fileTypeInf.timeType + '">' + fileTypeInf.name + '</option>';
  118. }
  119. html += '</select>';
  120. $("#reportTypeDiv").html(html);
  121. form.render();
  122. },
  123. error : function(data2) {
  124. $.ErrorAlert(data2.MINErrorMessage);
  125. }
  126. });
  127. form.on('select(reportTypeFilter)', function(data){
  128. var value = data.value;
  129. if (!isEmpty(value)) {
  130. var reportTypeId = value.split("_")[0];
  131. $("#fileName").html(data.elem.selectedOptions[0].text);
  132. if (!isEmpty(reportTypeId)) {
  133. $.request({
  134. action : 'BranchReportTypeAction/fileTypeOfReportType',
  135. data : {
  136. reportTypeId : reportTypeId
  137. },
  138. success : function(data) {
  139. fileType = data.data;
  140. setTempVal("fileType", fileType);
  141. var utilDataInf = data.utilDataInf;
  142. if (!isEmpty(utilDataInf)) {
  143. $("#utilName").html(utilDataInf.fileName);
  144. $("#utilName").attr("fileName", utilDataInf.fileName);
  145. setTempVal("utilExcelDataDetail", utilDataInf.excelData);
  146. var algorithmInf = data.algorithmInf;
  147. if (!isEmpty(algorithmInf)) {
  148. $("#algorithmName").html(utilDataInf.fileName+"算法");
  149. $("#algorithmName").attr("reportTypeId", reportTypeId);
  150. }
  151. }
  152. },
  153. error : function(data2) {
  154. $.ErrorAlert(data2.MINErrorMessage);
  155. }
  156. });
  157. }
  158. }
  159. });
  160. })
  161. function goStep (step) {
  162. var reportInf = $("#reportTypeDiv").find("select option:selected").val();
  163. if (step == 2) {
  164. if (isEmpty(reportInf)) {
  165. $.ErrorAlert("请选择上传文件类型!");
  166. return;
  167. }
  168. }
  169. if (step == 4) {
  170. var fileName = $("#fileName").html();
  171. $.request({
  172. action : 'ReportManageAction/fileInfReportSubmit',
  173. data : {
  174. reportData : JSON.stringify(reportData),
  175. reportInf : reportInf,
  176. fileName : fileName,
  177. ddyFxbId : fxbReport.id
  178. },
  179. success : function(data) {
  180. if (data.code == 0) {
  181. $step.goStep(step);
  182. var stepDiv = $("div[name = 'step']");
  183. for (var i = 0; i < stepDiv.length; i ++) {
  184. if (step == (i + 1)) {
  185. $(stepDiv[i]).show();
  186. } else {
  187. $(stepDiv[i]).hide();
  188. }
  189. }
  190. } else {
  191. $.ErrorAlert(res.MINErrorMessage);
  192. }
  193. },
  194. error : function(data2) {
  195. $.ErrorAlert(data2.MINErrorMessage);
  196. }
  197. });
  198. return;
  199. }
  200. $step.goStep(step);
  201. var stepDiv = $("div[name = 'step']");
  202. for (var i = 0; i < stepDiv.length; i ++) {
  203. if (step == (i + 1)) {
  204. $(stepDiv[i]).show();
  205. } else {
  206. $(stepDiv[i]).hide();
  207. }
  208. }
  209. }
  210. function finish() {
  211. deleteTabPageParent(pageId);
  212. }
  213. // 报表excel
  214. var reportData = null;
  215. // 预览
  216. function tableYulan() {
  217. var reportInf = $("#reportTypeDiv").find("select option:selected").val();
  218. if (isEmpty(fxbReport)) {
  219. $.ErrorAlert("请选择分析表!");
  220. return;
  221. }
  222. // 查询符合条件的明细数据,生成预览数据
  223. $.request({
  224. action : 'ReportManageAction/reportNeedDataDetail',
  225. data : {
  226. reportInf : reportInf,
  227. ddyFxbId : fxbReport.id
  228. },
  229. success : function(data) {
  230. if (data.code == 0) {
  231. var resData = data.data;
  232. var desc1 = resData.desc1;
  233. var tableArray1 = resData.tableArray1;
  234. var tubiaoData1 = resData.tubiaoData1;
  235. var areaList = resData.areaList;
  236. var desc2 = resData.desc2;
  237. var tableArray2 = resData.tableArray2;
  238. var desc3 = resData.desc3;
  239. var tableArray3 = resData.tableArray3;
  240. var desc4 = resData.desc4;
  241. var tableArray4 = resData.tableArray4;
  242. var tubiaoData2 = resData.tubiaoData2;
  243. var dataMap = resData.dataMap;
  244. reportData = resData;
  245. for(var key in dataMap){
  246. var replaceStr = "${" + key + "}";
  247. if (key == "month") {
  248. desc1 = desc1.replace(/\${month}/g, dataMap[key]);
  249. desc2 = desc2.replace(/\${month}/g, dataMap[key]);
  250. desc3 = desc3.replace(/\${month}/g, dataMap[key]);
  251. desc4 = desc4.replace(/\${month}/g, dataMap[key]);
  252. } else if (key == "year") {
  253. desc1 = desc1.replace(/\${year}/g, dataMap[key]);
  254. desc2 = desc2.replace(/\${year}/g, dataMap[key]);
  255. desc3 = desc3.replace(/\${year}/g, dataMap[key]);
  256. desc4 = desc4.replace(/\${year}/g, dataMap[key]);
  257. } else {
  258. desc1 = desc1.replace(replaceStr, dataMap[key]);
  259. desc2 = desc2.replace(replaceStr, dataMap[key]);
  260. desc3 = desc3.replace(replaceStr, dataMap[key]);
  261. desc4 = desc4.replace(replaceStr, dataMap[key]);
  262. }
  263. }
  264. $("#reportDiv").append(desc1);
  265. // 压受考核及预警情况统计见表
  266. var tableArray1Html = '<table class="layui-table">';
  267. for (var i = 0; i < tableArray1.length; i ++) {
  268. var child = tableArray1[i];
  269. tableArray1Html += '<tr>';
  270. for (var j = 0; j < child.length; j ++) {
  271. var h = child[j];
  272. tableArray1Html += '<td>' + h + '</td>';
  273. }
  274. tableArray1Html += '</tr>';
  275. }
  276. tableArray1Html += '</table>';
  277. $("#reportDiv").append(tableArray1Html);
  278. $("#reportDiv").append('<div id = "tubiaoData1" style="width: 1200px;height:600px;"></div>');
  279. var ymin1 = '';
  280. var ymax1 = '';
  281. var ymin2 = '';
  282. var ymax2 = '';
  283. var ymin3 = '';
  284. var ymax3 = '';
  285. for (var i = 0; i < tubiaoData1.length; i ++) {
  286. var childMap = tubiaoData1[i];
  287. var childList = childMap.data;
  288. for (var j = 0; j < childList.length; j ++) {
  289. if (i == 0) {
  290. childList[j] = parseInt(childList[j]);
  291. } else {
  292. childList[j] = parseFloat(childList[j].replace("%", ""));
  293. }
  294. // 获取最大最小值
  295. if (i == 0) {
  296. if (isEmpty(ymin1)) {
  297. ymin1 = childList[j];
  298. } else if (ymin1 > childList[j]) {
  299. ymin1 = childList[j];
  300. }
  301. if (isEmpty(ymax1)) {
  302. ymax1 = childList[j];
  303. } else if (ymax1 < childList[j]) {
  304. ymax1 = childList[j];
  305. }
  306. }
  307. if (i == 1) {
  308. if (isEmpty(ymin2)) {
  309. ymin2 = childList[j];
  310. } else if (ymin2 > childList[j]) {
  311. ymin2 = childList[j];
  312. }
  313. if (isEmpty(ymax2)) {
  314. ymax2 = childList[j];
  315. } else if (ymax2 < childList[j]) {
  316. ymax2 = childList[j];
  317. }
  318. }
  319. if (i == 2) {
  320. if (isEmpty(ymin3)) {
  321. ymin3 = childList[j];
  322. } else if (ymin3 > childList[j]) {
  323. ymin3 = childList[j];
  324. }
  325. if (isEmpty(ymax3)) {
  326. ymax3 = childList[j];
  327. } else if (ymax3 < childList[j]) {
  328. ymax3 = childList[j];
  329. }
  330. }
  331. }
  332. }
  333. var tubiaoData1Charts = echarts.init(document.getElementById('tubiaoData1'));
  334. var colors = ['#5793f3', '#d14a61', '#675bba'];
  335. var tubiaoData1Option = {
  336. color: colors,
  337. tooltip: {
  338. trigger: 'axis',
  339. axisPointer: {
  340. type: 'cross'
  341. }
  342. },
  343. toolbox: {
  344. feature: {
  345. dataView: {show: true, readOnly: false},
  346. magicType: {show: true, type: ['line', 'bar']},
  347. restore: {show: true},
  348. saveAsImage: {show: true}
  349. }
  350. },
  351. legend: {
  352. data: ['治理完成户数', '治理完成率', '考核低压占比']
  353. },
  354. xAxis: [
  355. {
  356. type: 'category',
  357. data: areaList,
  358. axisPointer: {
  359. type: 'shadow'
  360. }
  361. }
  362. ],
  363. yAxis: [
  364. {
  365. type: 'value',
  366. name: '治理完成户数',
  367. min: ymin1,
  368. max: ymax1,
  369. position: 'left',
  370. axisLine: {
  371. lineStyle: {
  372. color: colors[0]
  373. }
  374. }
  375. },
  376. {
  377. type: 'value',
  378. name: '治理完成率',
  379. min: ymin2,
  380. max: ymax2,
  381. position: 'right',
  382. axisLabel: {
  383. formatter: '{value} %'
  384. },
  385. axisLine: {
  386. lineStyle: {
  387. color: colors[1]
  388. }
  389. }
  390. },{
  391. type: 'value',
  392. name: '考核低压占比',
  393. min: ymin3,
  394. max: ymax3,
  395. offset: 80,
  396. position: 'right',
  397. axisLabel: {
  398. formatter: '{value} %'
  399. },
  400. axisLine: {
  401. lineStyle: {
  402. color: colors[2]
  403. }
  404. }
  405. }
  406. ],
  407. series: tubiaoData1
  408. };
  409. tubiaoData1Charts.setOption(tubiaoData1Option);
  410. $("#reportDiv").append(desc2);
  411. var tableArray2Html = '<table class="layui-table">';
  412. for (var i = 0; i < tableArray2.length; i ++) {
  413. var child = tableArray2[i];
  414. tableArray2Html += '<tr>';
  415. for (var j = 0; j < child.length; j ++) {
  416. var h = child[j];
  417. tableArray2Html += '<td>' + h + '</td>';
  418. }
  419. tableArray2Html += '</tr>';
  420. }
  421. tableArray2Html += '</table>';
  422. $("#reportDiv").append(tableArray2Html);
  423. $("#reportDiv").append(desc3);
  424. var tableArray3Html = '<table class="layui-table">';
  425. for (var i = 0; i < tableArray3.length; i ++) {
  426. var child = tableArray3[i];
  427. tableArray3Html += '<tr>';
  428. for (var j = 0; j < child.length; j ++) {
  429. var h = child[j];
  430. tableArray3Html += '<td>' + h + '</td>';
  431. }
  432. tableArray3Html += '</tr>';
  433. }
  434. tableArray3Html += '</table>';
  435. $("#reportDiv").append(tableArray3Html);
  436. $("#reportDiv").append(desc4);
  437. var tableArray4Html = '<table class="layui-table">';
  438. for (var i = 0; i < tableArray4.length; i ++) {
  439. var child = tableArray4[i];
  440. tableArray4Html += '<tr>';
  441. for (var j = 0; j < child.length; j ++) {
  442. var h = child[j];
  443. tableArray4Html += '<td>' + h + '</td>';
  444. }
  445. tableArray4Html += '</tr>';
  446. }
  447. tableArray4Html += '</table>';
  448. $("#reportDiv").append(tableArray4Html);
  449. $("#reportDiv").append('<div id = "tubiaoData2" style="width: 1200px;height:600px;"></div>');
  450. var tubiaoData2Charts = echarts.init(document.getElementById('tubiaoData2'));
  451. var tubiaoData2LegendData = new Array();
  452. for (var i = 0; i < tubiaoData2[0].data.length; i ++) {
  453. tubiaoData2LegendData.push(tubiaoData2[0].data[i].name);
  454. }
  455. var tubiaoData2Option = {
  456. title: {
  457. text: '受考核低电压用户原因',
  458. subtext: '分类情况统计',
  459. left: 'center'
  460. },
  461. tooltip: {
  462. trigger: 'item',
  463. formatter: '{a} <br/>{b} : {c} ({d}%)'
  464. },
  465. toolbox: {
  466. show: true,
  467. feature: {
  468. mark: {show: true},
  469. dataView: {show: true, readOnly: false},
  470. magicType: {
  471. show: true,
  472. type: ['pie', 'funnel']
  473. },
  474. restore: {show: true},
  475. saveAsImage: {show: true}
  476. }
  477. },
  478. legend: {
  479. orient: 'vertical',
  480. left: 'left',
  481. data: tubiaoData2LegendData
  482. },
  483. series: tubiaoData2
  484. };
  485. tubiaoData2Charts.setOption(tubiaoData2Option);
  486. goStep(3);
  487. } else {
  488. $.ErrorAlert(res.MINErrorMessage);
  489. }
  490. },
  491. error : function(data2) {
  492. $.ErrorAlert(data2.MINErrorMessage);
  493. }
  494. });
  495. }
  496. </script>
  497. </body>
  498. </html>