123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>导入</title>
- <script src="../../js/min-loader-next.js"></script>
- <script src="../../js/report.js"></script>
- <link rel="stylesheet" href="../../plugins/layui/lay/modules/steps/style.css"></link>
- <style>
- .layui-input {
- width : 200px;
- }
- .layui-upload-drag .layui-icon {
- font-size: 18px;
- color: #fff;
- }
- .layui-btn-sm {
- height: 22px;
- line-height: 22px;
- padding: 0 10px;
- font-size: 12px;
- }
- </style>
- </head>
- <body class="content">
- <div id="step_demo" class="step-body" style = "margin-top : 20px; margin-left: 10%;">
- <div class="step-header" style="width:80%;overflow: hidden;">
- <ul>
- <li>
- <span class="step-name">选择报告/报表</span>
- </li>
- <li>
- <span class="step-name">选择文件</span>
- </li>
- <li>
- <span class="step-name">数据预览</span>
- </li>
- <li>
- <span class="step-name">生成报告/报表</span>
- </li>
- </ul>
- </div>
- </div>
- <div class="order-body" style = "width: 80%; margin-left : 10%;height : 450px" name = "step">
- <form class="layui-form" style = "text-align : center;">
- <div class="order-select" id="content" style = "background: #FFFFFF;border-radius: 8px;padding: 16px 1.4rem;">
- <div class="layui-inline" style="margin-top: 150px;">
- <label class="f12-gray4">请选择文件类型:</label>
- <div id = "reportTypeDiv" class="layui-inline">
- </div>
- </div>
- <div style="margin-top : 200px;">
- <button type="button" class="layui-btn" style = "width : 214px" onclick = "goStep(2)">下一步</button>
- </div>
- </div>
- </form>
- </div>
- <div name = "step" style = "width: 80%; margin-left : 10%;height : 300px; display : none; text-align : center;">
- <div style = "width: 80%; margin-left : 0px; height : 200px" class = "layui-upload-drag" >
- <input type="text" style = "display : inline-block" class="layui-input" id="dayRange" placeholder="请选择报表日期">
- <input type="text" style = "display : inline-block" class="layui-input" id="dateRange" placeholder="请选择报表日期范围">
- <input type="text" style = "display : inline-block" class="layui-input" id="timeRange" placeholder="请选择报表时间段">
- <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>
- </div>
- <div style="margin-top : 50px;">
- <button type="button" class="layui-btn" style = "width : 214px" onclick = "tableYulan()">下一步</button>
- </div>
- </div>
- <div name = "step" style = "width: auto; height : 300px; display : none; text-align : center;">
- <div style = "width: auto; margin-left : 0px;" class = "layui-upload-drag" >
- <p id = "fileName" contenteditable="true">国网泰安供电公司2020年8月份配网运行分析月报</p>
- <table id = "reportTable" class="layui-table" style = "display : none">
- </table>
- <p id = "gongjubiao">报表关联的工具表为《<a id = "utilName" onclick = "goUtilDetail(this)">2020年6月底低电压月报工具表</a>》 关联的报表算法为《<a id = "algorithmName" onclick = "goAlgorithmDetail(this)">国网泰安供电公司2020年8月份配网运行分析月报</a>》 的算法</p>
- <div id = "reportDiv" style = "display : none;text-align : left;"></div>
- </div>
- <div style="margin-top : 50px;">
- <button type="button" class="layui-btn" style = "width : 214px" onclick = "goStep(4)">下一步</button>
- </div>
- </div>
- <div name = "step" style = "width: 80%; margin-left : 10%;height : 300px; display : none; text-align : center; margin-top : 50px;">
- <i class="layui-icon layui-icon-ok-circle" style="font-size: 100px; color: #009688;"></i>
- <p style = "font-weight: 700;font-size: 25px;">报表生成成功!</p>
- <p style = " color: #b2bbc2;">可在数据仓库-报表管理进行查看</p>
- <div style="margin-top : 100px;">
- <button type="button" class="layui-btn" style = "width : 214px" onclick = "finish()">完成</button>
- </div>
- </div>
-
- <script>
- var pageId = getQueryString("pageId");
- var timeType = getQueryString("timeType");// 00日报01周报02月报
- var reportType = getQueryString("reportType");// 00日报01周报02月报
- // 日报
- if (timeType == '00') {
- $("#dayRange").show();
- $("#dateRange").hide();
- // 周报和月报
- } else {
- $("#dayRange").hide();
- $("#dateRange").show();
- }
-
- var $step;
- layui.config({
- base: '../../plugins/layui/lay/modules/steps/'
- }).use(['steps','jquery'],function(){
- var $ = layui.$;
- $step = $("#step_demo").step();
- })
-
- layui.use('laydate', function(){
- var laydate = layui.laydate;
- // 报告日报日期选择
- laydate.render({
- elem : '#dayRange'
- ,format : 'yyyyMMdd'
- ,done: function(value, date, endDate){
- console.log(value); //得到日期生成的值,如:2017-08-18
- var fileName = $("#fileName").html();
- if (fileName.indexOf("-") != -1) {
- $("#fileName").html(fileName.split("-")[0]+value);
- } else {
- $("#fileName").html(fileName+"-" + value);
- }
- }
- });
- // 报告日期范围选择
- laydate.render({
- elem : '#dateRange'
- ,format : 'yyyyMMdd'
- ,range : true
- ,done: function(value, date, endDate){
- console.log(value); //得到日期生成的值,如:2017-08-18
- var fileName = $("#fileName").html();
- if (fileName.indexOf("-") != -1) {
- $("#fileName").html(fileName.split("-")[0]+value);
- } else {
- $("#fileName").html(fileName+"-" + value);
- }
- }
- });
- //时间范围
- laydate.render({
- elem : '#timeRange'
- ,type : 'time'
- ,format : 'HHmmss'
- ,value : '000000 - 235959'
- ,range : true
- });
- });
-
- // 范围类型
- layui.use('form', function(){
- var form = layui.form;
- $.request({
- action : 'BranchReportTypeAction/branchReportTypeQuery',
- data : {
- reportType : reportType
- },
- success : function(data) {
- var html = '<select id = "reportType" lay-filter="reportTypeFilter"><option value = "">请选择</option>';
- var fileTypeList = data.data;
- for (var i = 0; i < fileTypeList.length; i ++) {
- var fileTypeInf = fileTypeList[i];
- html += '<option value = "' + fileTypeInf.id + '_' + fileTypeInf.type + '_' + fileTypeInf.timeType + '">' + fileTypeInf.name + '</option>';
- }
- html += '</select>';
- $("#reportTypeDiv").html(html);
- form.render();
- },
- error : function(data2) {
- $.ErrorAlert(data2.MINErrorMessage);
- }
- });
-
- form.on('select(reportTypeFilter)', function(data){
- var value = data.value;
- if (!isEmpty(value)) {
- var reportTypeId = value.split("_")[0];
-
- $("#fileName").html(data.elem.selectedOptions[0].text);
-
- if (!isEmpty(reportTypeId)) {
- $.request({
- action : 'BranchReportTypeAction/fileTypeOfReportType',
- data : {
- reportTypeId : reportTypeId
- },
- success : function(data) {
- fileType = data.data;
- setTempVal("fileType", fileType);
-
- var utilDataInf = data.utilDataInf;
- if (!isEmpty(utilDataInf)) {
- $("#utilName").html(utilDataInf.fileName);
- $("#utilName").attr("fileName", utilDataInf.fileName);
- setTempVal("utilExcelDataDetail", utilDataInf.excelData);
- var algorithmInf = data.algorithmInf;
- if (!isEmpty(algorithmInf)) {
- $("#algorithmName").html(utilDataInf.fileName+"算法");
- $("#algorithmName").attr("reportTypeId", reportTypeId);
- }
- }
-
- },
- error : function(data2) {
- $.ErrorAlert(data2.MINErrorMessage);
- }
- });
- }
- }
- });
- })
-
- function goStep (step) {
- var reportInf = $("#reportTypeDiv").find("select option:selected").val();
-
- var dayRange = $("#dayRange").val();
- var dateRange = $("#dateRange").val();
- var timeRange = $("#timeRange").val();
- if (step == 2) {
- if (isEmpty(reportInf)) {
- $.ErrorAlert("请选择上传文件类型!");
- return;
- }
- var reportType = reportInf.split("_")[0];
- // 台区停电日报
- if ("TQTDRB" == reportType) {
- $("body").find("[name='TQTDRB']").show();
- }
- }
-
- if (step == 4) {
- var fileName = $("#fileName").html();
- var range = null;
- if (timeType == '00') {
- range = dayRange + "-" + dayRange;
- } else {
- range = dateRange;
- }
- var monthNum = $("#monthNum").html();
- var countNum = $("#countNum").html();
- $.request({
- action : 'ReportManageAction/fileInfReportSubmit',
- data : {
- reportData : JSON.stringify(resJsonStr),
- reportInf : reportInf,
- fileName : fileName,
- range : range,
- timeRange : timeRange,
- monthNum : monthNum,
- countNum : countNum
- },
- success : function(data) {
- if (data.code == 0) {
- $step.goStep(step);
- var stepDiv = $("div[name = 'step']");
- for (var i = 0; i < stepDiv.length; i ++) {
- if (step == (i + 1)) {
- $(stepDiv[i]).show();
- } else {
- $(stepDiv[i]).hide();
- }
- }
- } else {
- $.ErrorAlert(res.MINErrorMessage);
- }
- },
- error : function(data2) {
- $.ErrorAlert(data2.MINErrorMessage);
- }
- });
- return;
- }
-
- $step.goStep(step);
- var stepDiv = $("div[name = 'step']");
- for (var i = 0; i < stepDiv.length; i ++) {
- if (step == (i + 1)) {
- $(stepDiv[i]).show();
- } else {
- $(stepDiv[i]).hide();
- }
- }
- }
-
- function finish() {
- deleteTabPageParent(pageId);
- }
-
- // 查看工具表详情
- function goUtilDetail(t) {
- var fileName = $(t).attr("fileName");
- var openPageId = pageId + "-01";
- openMainTabPage(openPageId, "详情查看", "reprotManage/utilExcelDetail.html?pageId="+openPageId+"&fileName="+chineseUrlEncode(fileName), '', pageId, null);
- }
- // 查看算法详情
- function goAlgorithmDetail(t) {
- var reportTypeId = $(t).attr("reportTypeId");
- var openPageId = pageId + "-02";
- openMainTabPage(openPageId, "详情查看", "reprotManage/reportAlgorithm.html?pageId="+openPageId+"&reportTypeId="+reportTypeId, '', pageId, null);
- }
-
- // 报表返回数据
- var resJsonStr = null;
- // 预览
- function tableYulan() {
- var reportInf = $("#reportTypeDiv").find("select option:selected").val();
- var dayRange = $("#dayRange").val();
- var dateRange = $("#dateRange").val();
- var timeRange = $("#timeRange").val();
-
- // 日报
- if (timeType == '00') {
- if (isEmpty(dayRange)) {
- $.ErrorAlert("请选择报表日期!");
- return;
- }
- } else {
- if (isEmpty(dateRange)) {
- $.ErrorAlert("请选择报表日期范围!");
- return;
- }
- }
-
- // 日报
- var range = null;
- if (timeType == '00') {
- range = dayRange + "-" + dayRange;
- } else {
- range = dateRange;
- }
- var monthNum = $("#monthNum").html();
- var countNum = $("#countNum").html();
- // 查询符合条件的明细数据,生成预览数据
- $.request({
- action : 'ReportManageAction/reportNeedDataDetail',
- data : {
- range : range,
- timeRange : timeRange,
- reportInf : reportInf,
- monthNum : monthNum,
- countNum : countNum
- },
- success : function(data) {
- if (data.code == 0) {
- // 日报
- if (timeType == '00') {
- resJsonStr = data.data.resList;
- $("#reportDiv").hide();
- $("#reportTable").show();
- $("#gongjubiao").show();
- initExcelData(resJsonStr, "reportTable", false);
- goStep(3);
- // 月报 或 周报
- } else if (timeType == '02' || timeType == '01') {
- $("#reportTable").hide();
- $("#gongjubiao").hide();
- $("#reportDiv").show();
- resJsonStr = data.data;
- var dataMap = data.data.dataMap;
- var descStr = data.data.descStr;
- console.log(dataMap);
- console.log(descStr);
- for(var key in dataMap){
- var replaceStr = "${" + key + "}";
- if (key == "totalCountTwice") {
- descStr = descStr.replace(/\${totalCountTwice}/g, dataMap[key]);
- } else {
- descStr = descStr.replace(replaceStr, dataMap[key]);
- }
-
- }
-
- $("#reportDiv").html(descStr);
-
- var tableHtml = '<table class="layui-table">';
- // 周报
- if (timeType == '01') {
- var excelList = data.data.excelList;
- for (var i = 0; i < excelList.length; i ++) {
- tableHtml += '<tr>';
- var childList = excelList[i];
- for (var j = 0; j < childList.length; j ++) {
- tableHtml += '<td>' + childList[j] + '</td>';
- }
- tableHtml += '</tr>';
- }
- }
- tableHtml += '</table>';
- $("#reportDiv").append(tableHtml);
- goStep(3);
- }
-
- } else {
- $.ErrorAlert(res.MINErrorMessage);
- }
- },
- error : function(data2) {
- $.ErrorAlert(data2.MINErrorMessage);
- }
- });
- }
-
- function changeHtml(t) {
- var initValue = $(t).html();
- layer.prompt({
- formType: 2,
- value: initValue,
- title: '请输入',
- area: ['200px', '33px'] //自定义文本域宽高
- },
- function(value, index, elem){
- $(t).html(value);
- layer.close(index);
- }
- );
- }
- </script>
- </body>
- </html>
|