reportProduceYb.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  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 desc2 = resData.desc2;
  236. var tableArray2 = resData.tableArray2;
  237. var desc3 = resData.desc3;
  238. var tableArray3 = resData.tableArray3;
  239. var desc4 = resData.desc4;
  240. var tableArray4 = resData.tableArray4;
  241. var tubiaoData2 = resData.tubiaoData2;
  242. var dataMap = resData.dataMap;
  243. reportData = resData;
  244. for(var key in dataMap){
  245. var replaceStr = "${" + key + "}";
  246. if (key == "month") {
  247. desc1 = desc1.replace(/\${month}/g, dataMap[key]);
  248. desc2 = desc2.replace(/\${month}/g, dataMap[key]);
  249. desc3 = desc3.replace(/\${month}/g, dataMap[key]);
  250. desc4 = desc4.replace(/\${month}/g, dataMap[key]);
  251. } else if (key == "year") {
  252. desc1 = desc1.replace(/\${year}/g, dataMap[key]);
  253. desc2 = desc2.replace(/\${year}/g, dataMap[key]);
  254. desc3 = desc3.replace(/\${year}/g, dataMap[key]);
  255. desc4 = desc4.replace(/\${year}/g, dataMap[key]);
  256. } else {
  257. desc1 = desc1.replace(replaceStr, dataMap[key]);
  258. desc2 = desc2.replace(replaceStr, dataMap[key]);
  259. desc3 = desc3.replace(replaceStr, dataMap[key]);
  260. desc4 = desc4.replace(replaceStr, dataMap[key]);
  261. }
  262. }
  263. $("#reportDiv").append(desc1);
  264. // 压受考核及预警情况统计见表
  265. var tableArray1Html = '<table class="layui-table">';
  266. for (var i = 0; i < tableArray1.length; i ++) {
  267. var child = tableArray1[i];
  268. tableArray1Html += '<tr>';
  269. for (var j = 0; j < child.length; j ++) {
  270. var h = child[j];
  271. tableArray1Html += '<td>' + h + '</td>';
  272. }
  273. tableArray1Html += '</tr>';
  274. }
  275. tableArray1Html += '</table>';
  276. $("#reportDiv").append(tableArray1Html);
  277. $("#reportDiv").append('<div id = "tubiaoData1" style="width: 1200px;height:600px;"></div>');
  278. var ymin1 = '';
  279. var ymax1 = '';
  280. var ymin2 = '';
  281. var ymax2 = '';
  282. var ymin3 = '';
  283. var ymax3 = '';
  284. for (var i = 0; i < tubiaoData1.length; i ++) {
  285. var childMap = tubiaoData1[i];
  286. var childList = childMap.data;
  287. for (var j = 0; j < childList.length; j ++) {
  288. if (i == 0) {
  289. childList[j] = parseInt(childList[j]);
  290. } else {
  291. childList[j] = parseFloat(childList[j].replace("%", ""));
  292. }
  293. // 获取最大最小值
  294. if (i == 0) {
  295. if (isEmpty(ymin1)) {
  296. ymin1 = childList[j];
  297. } else if (ymin1 > childList[j]) {
  298. ymin1 = childList[j];
  299. }
  300. if (isEmpty(ymax1)) {
  301. ymax1 = childList[j];
  302. } else if (ymax1 < childList[j]) {
  303. ymax1 = childList[j];
  304. }
  305. }
  306. if (i == 1) {
  307. if (isEmpty(ymin2)) {
  308. ymin2 = childList[j];
  309. } else if (ymin2 > childList[j]) {
  310. ymin2 = childList[j];
  311. }
  312. if (isEmpty(ymax2)) {
  313. ymax2 = childList[j];
  314. } else if (ymax2 < childList[j]) {
  315. ymax2 = childList[j];
  316. }
  317. }
  318. if (i == 2) {
  319. if (isEmpty(ymin3)) {
  320. ymin3 = childList[j];
  321. } else if (ymin3 > childList[j]) {
  322. ymin3 = childList[j];
  323. }
  324. if (isEmpty(ymax3)) {
  325. ymax3 = childList[j];
  326. } else if (ymax3 < childList[j]) {
  327. ymax3 = childList[j];
  328. }
  329. }
  330. }
  331. }
  332. var tubiaoData1Charts = echarts.init(document.getElementById('tubiaoData1'));
  333. var colors = ['#5793f3', '#d14a61', '#675bba'];
  334. var tubiaoData1Option = {
  335. color: colors,
  336. tooltip: {
  337. trigger: 'axis',
  338. axisPointer: {
  339. type: 'cross'
  340. }
  341. },
  342. toolbox: {
  343. feature: {
  344. dataView: {show: true, readOnly: false},
  345. magicType: {show: true, type: ['line', 'bar']},
  346. restore: {show: true},
  347. saveAsImage: {show: true}
  348. }
  349. },
  350. legend: {
  351. data: ['治理完成户数', '治理完成率', '考核低压占比']
  352. },
  353. xAxis: [
  354. {
  355. type: 'category',
  356. data: ['岱岳', '东平', '高新', '新泰', '宁阳', '肥城', '泰山', '景区'],
  357. axisPointer: {
  358. type: 'shadow'
  359. }
  360. }
  361. ],
  362. yAxis: [
  363. {
  364. type: 'value',
  365. name: '治理完成户数',
  366. min: ymin1,
  367. max: ymax1,
  368. position: 'left',
  369. axisLine: {
  370. lineStyle: {
  371. color: colors[0]
  372. }
  373. }
  374. },
  375. {
  376. type: 'value',
  377. name: '治理完成率',
  378. min: ymin2,
  379. max: ymax2,
  380. position: 'right',
  381. axisLabel: {
  382. formatter: '{value} %'
  383. },
  384. axisLine: {
  385. lineStyle: {
  386. color: colors[1]
  387. }
  388. }
  389. },{
  390. type: 'value',
  391. name: '考核低压占比',
  392. min: ymin3,
  393. max: ymax3,
  394. offset: 80,
  395. position: 'right',
  396. axisLabel: {
  397. formatter: '{value} %'
  398. },
  399. axisLine: {
  400. lineStyle: {
  401. color: colors[2]
  402. }
  403. }
  404. }
  405. ],
  406. series: tubiaoData1
  407. };
  408. tubiaoData1Charts.setOption(tubiaoData1Option);
  409. $("#reportDiv").append(desc2);
  410. var tableArray2Html = '<table class="layui-table">';
  411. for (var i = 0; i < tableArray2.length; i ++) {
  412. var child = tableArray2[i];
  413. tableArray2Html += '<tr>';
  414. for (var j = 0; j < child.length; j ++) {
  415. var h = child[j];
  416. tableArray2Html += '<td>' + h + '</td>';
  417. }
  418. tableArray2Html += '</tr>';
  419. }
  420. tableArray2Html += '</table>';
  421. $("#reportDiv").append(tableArray2Html);
  422. $("#reportDiv").append(desc3);
  423. var tableArray3Html = '<table class="layui-table">';
  424. for (var i = 0; i < tableArray3.length; i ++) {
  425. var child = tableArray3[i];
  426. tableArray3Html += '<tr>';
  427. for (var j = 0; j < child.length; j ++) {
  428. var h = child[j];
  429. tableArray3Html += '<td>' + h + '</td>';
  430. }
  431. tableArray3Html += '</tr>';
  432. }
  433. tableArray3Html += '</table>';
  434. $("#reportDiv").append(tableArray3Html);
  435. $("#reportDiv").append(desc4);
  436. var tableArray4Html = '<table class="layui-table">';
  437. for (var i = 0; i < tableArray4.length; i ++) {
  438. var child = tableArray4[i];
  439. tableArray4Html += '<tr>';
  440. for (var j = 0; j < child.length; j ++) {
  441. var h = child[j];
  442. tableArray4Html += '<td>' + h + '</td>';
  443. }
  444. tableArray4Html += '</tr>';
  445. }
  446. tableArray4Html += '</table>';
  447. $("#reportDiv").append(tableArray4Html);
  448. $("#reportDiv").append('<div id = "tubiaoData2" style="width: 1200px;height:600px;"></div>');
  449. var tubiaoData2Charts = echarts.init(document.getElementById('tubiaoData2'));
  450. var tubiaoData2LegendData = new Array();
  451. for (var i = 0; i < tubiaoData2[0].data.length; i ++) {
  452. tubiaoData2LegendData.push(tubiaoData2[0].data[i].name);
  453. }
  454. var tubiaoData2Option = {
  455. title: {
  456. text: '受考核低电压用户原因',
  457. subtext: '分类情况统计',
  458. left: 'center'
  459. },
  460. tooltip: {
  461. trigger: 'item',
  462. formatter: '{a} <br/>{b} : {c} ({d}%)'
  463. },
  464. toolbox: {
  465. show: true,
  466. feature: {
  467. mark: {show: true},
  468. dataView: {show: true, readOnly: false},
  469. magicType: {
  470. show: true,
  471. type: ['pie', 'funnel']
  472. },
  473. restore: {show: true},
  474. saveAsImage: {show: true}
  475. }
  476. },
  477. legend: {
  478. orient: 'vertical',
  479. left: 'left',
  480. data: tubiaoData2LegendData
  481. },
  482. series: tubiaoData2
  483. };
  484. tubiaoData2Charts.setOption(tubiaoData2Option);
  485. goStep(3);
  486. } else {
  487. $.ErrorAlert(res.MINErrorMessage);
  488. }
  489. },
  490. error : function(data2) {
  491. $.ErrorAlert(data2.MINErrorMessage);
  492. }
  493. });
  494. }
  495. </script>
  496. </body>
  497. </html>