Jelajahi Sumber

报表修改

tudc 4 tahun lalu
induk
melakukan
3e74b48dd3

+ 13 - 5
src/main/webapp/admin/reprotManage/reportAlgorithm.html

@@ -20,9 +20,9 @@
 	</div>
     <script>
     	// 报告生成事查看算法
-    	var algorithmId = getQueryString("algorithmId");
-    	if (!isEmpty(algorithmId)) {
-    		contentQuery(algorithmId);
+    	var reportTypeId = getQueryString("reportTypeId");
+    	if (!isEmpty(reportTypeId)) {
+    		contentQuery(reportTypeId);
     	}
     	
     	layui.use(['tree', 'util'], function(){
@@ -59,8 +59,16 @@
 					reportTypeId : reportTypeId
 				},
 				success : function(data) {
-					$("#utilName").html(data.utilName);
-					$("#content").html(data.content);
+					if (isEmpty(data.utilName)) {
+						$("#utilName").html("");
+					} else {
+						$("#utilName").html(data.utilName);
+					}
+					if (isEmpty(data.content)) {
+						$("#content").html("");
+					} else {
+						$("#content").html(data.content);
+					}
 				},
 				error : function(data2) {
 					$.ErrorAlert(data2.MINErrorMessage);

+ 3 - 19
src/main/webapp/admin/reprotManage/reportManage.html

@@ -15,7 +15,7 @@
 			<div class="tiaojian-part2 fr  demoTable">
 				<button class="order-bnt1 layui-btn" onclick="reloadSearch()" >查询</button>
 				<button class="layui-btn order-bnt2" onclick="reset()">重置</button>
-				<button class="order-bnt2 layui-btn" onclick="uploadExcel()">报表导入</button>
+				<button class="order-bnt2 layui-btn" onclick="uploadExcel()">报表生成</button>
 				<a href="#" id="toggle" class="top">收起</a>
 			</div>
 		</div>
@@ -162,24 +162,8 @@
     	  openMainTabPage(openPageId, "编辑", "reprotManage/reportManageUpdate.html?pageId="+openPageId+"&reportId="+data.id+"&type="+data.type+"&typeId="+data.typeId+"&fileName="+chineseUrlEncode(data.fileName), '', pageId, reloadSearch);
       }
       function algorithmDetail(data){
-		$.request({
-			action : 'ReportManageAction/reportAlgorithmId',
-			data : {
-				reportTypeId : data.typeId
-			},
-			success : function(resData) {
-				var algorithmId = resData.algorithmId;
-				if (isEmpty(algorithmId)) {
-					$.ErrorAlert("未查询到关联算法!");
-					return;
-				}
-				var openPageId = pageId + "-04";
-				openMainTabPage(openPageId, "编辑", "reprotManage/reportAlgorithm.html?pageId="+openPageId+"&algorithmId="+algorithmId, '', pageId, null);
-			},
-			error : function(data2) {
-				$.ErrorAlert(data2.MINErrorMessage);
-			}
-		});
+   	  	var openPageId = pageId + "-04";
+		openMainTabPage(openPageId, "编辑", "reprotManage/reportAlgorithm.html?pageId="+openPageId+"&reportTypeId="+data.typeId, '', pageId, null);
       }
       
    	function changeSelectCon(index, t, type, dateValue){

+ 163 - 91
src/main/webapp/admin/reprotManage/reportProduce.html

@@ -57,22 +57,20 @@
 		</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;" class = "layui-upload-drag" >
-		  <button type="button" class="layui-btn" style = "width : 214px" onclick = "chooseFile()"> <i class="layui-icon">&#xe608;</i> 选择文件</button>
-		  <table id = "chooseFileDataTable" class="layui-table">
-		  	<tr><td>序号</td><td>时间</td><td>文件名称</td><td>导入人员</td><td>数据条数</td><td>操作</td></tr>
-		  	<tr><td colspan = "6">无数据</td></tr>
-		  </table>
+		<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><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 = "goStep(3)">下一步</button>
+	      <button type="button" class="layui-btn" style = "width : 214px" onclick = "tableYulan()">下一步</button>
 	    </div>
 	</div>
-	<div name = "step" style = "width: 80%; margin-left : 10%;height : 300px; display : none; text-align : center;">
+	<div name = "step" style = "width: 80%; margin-left : 10%; height : 300px; display : none; text-align : center;">
 		<div style = "width: 80%; margin-left : 0px;" class = "layui-upload-drag" >
 		  <p id = "fileName" contenteditable="true">国网泰安供电公司2020年8月份配网运行分析月报</p>
 		  <table id = "reportTable" class="layui-table">
-		  	
 		  </table>
 		  <p>报表关联的工具表为《<a id = "utilName" onclick = "goUtilDetail(this)">2020年6月底低电压月报工具表</a>》  关联的报表算法为《<a id = "algorithmName" onclick = "goAlgorithmDetail(this)">国网泰安供电公司2020年8月份配网运行分析月报</a>》    的算法</p>
 		</div>
@@ -100,6 +98,31 @@
     	    $step = $("#step_demo").step();
 		})
 		
+		layui.use('laydate', function(){
+			var laydate = layui.laydate;
+			// 报告日报日期选择
+			laydate.render({
+				elem : '#dayRange'
+				,format : 'yyyyMMdd'
+			});
+			// 报告日期范围选择
+			laydate.render({
+				elem : '#dateRange'
+				,format : 'yyyyMMdd'
+				,range : true
+			});
+			//时间范围
+			laydate.render({ 
+			  elem : '#timeRange'
+			  ,type : 'time'
+			  ,format : 'HHmmss'
+			  ,value : '000000 - 235959'
+			  ,range : true
+			});
+		});
+		
+		// 范围类型
+		var timeType = null;
 		layui.use('form', function(){
 			var form = layui.form;
 			$.request({
@@ -111,7 +134,7 @@
 					var fileTypeList = data.data;
 					for (var i = 0; i < fileTypeList.length; i ++) {
 						var fileTypeInf = fileTypeList[i];
-						html += '<option value = "' + fileTypeInf.id + '_' + fileTypeInf.type +'">' + fileTypeInf.name + '</option>';
+						html += '<option value = "' + fileTypeInf.id + '_' + fileTypeInf.type + '_' + fileTypeInf.timeType + '">' + fileTypeInf.name + '</option>';
 					}
 					html += '</select>';
 					$("#reportTypeDiv").html(html);
@@ -123,44 +146,58 @@
     	  	});
 			
 			form.on('select(reportTypeFilter)', function(data){
-				  var value = data.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("algorithmId", algorithmInf.id);
+				var value = data.value;
+				if (!isEmpty(value)) {
+					var reportTypeId = value.split("_")[0];
+					timeType = value.split("_")[2];
+					// 日报
+					if (timeType == '00') {
+						$("#dayRange").show();
+						$("#dateRange").hide();
+					} else {
+						$("#dayRange").hide();
+						$("#dateRange").show();
+					}
+					$("#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);
 								}
-								
-							},
-							error : function(data2) {
-								$.ErrorAlert(data2.MINErrorMessage);
-							}
-			    	  });
-				  }
+				    	  });
+					  }
+				}
 			});      
 		})
 		
-		var fileType = null;
-		
 		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("请选择上传文件类型!");
@@ -168,24 +205,23 @@
 				}
 			}
 			
-			if (step == 3) {
-				if (isEmpty(chooseFileData) || chooseFileData.length == 0) {
-					$.ErrorAlert("请选择关联文件!");
-					return;
-				}
-				reportInit(reportInf, chooseFileData);
-			}
-			
 			if (step == 4) {
 				var reportData = getTempVal("reportData");
 				var fileName = $("#fileName").html();
+				var range = null;
+				if (timeType == '00') {
+					range = dayRange + "-" + dayRange;
+				} else {
+					range = dateRange;
+				}
 				$.request({
 					action : 'ReportManageAction/fileInfReportSubmit',
 					data : {
-						reportData : JSON.stringify(reportData),
-						chooseFileData : JSON.stringify(chooseFileData),
+						reportData : JSON.stringify(excelList),
 						reportInf : reportInf,
-						fileName : fileName
+						fileName : fileName,
+						range : range,
+						timeRange : timeRange
 					},
 					success : function(data) {
 						if (data.code == 0) {
@@ -224,44 +260,9 @@
 			deleteTabPageParent(pageId); 
 		}
 		
-		// 选择原始文件
-		function chooseFile() {
-			setTempVal("chooseFileData", chooseFileData);
-			var openPageId = pageId + "01";
-			openMainTabPage(openPageId, "选择文件", "common/chooseDataWare.html?pageId="+openPageId, '', pageId, chooseFileDataBack);
-		}
-		
+		// 报表查询的明细数据
 		var chooseFileData;
-		// 选择原始数据后处理
-		function chooseFileDataBack() {
-			var dataWareData = getTempVal("dataWareData");
-			if (!isEmpty(dataWareData)) {
-				setTempVal("dataWareData", null);
-				if (isEmpty(chooseFileData)) {
-					chooseFileData = dataWareData;
-				} else {
-					for (var i = 0; i < dataWareData.length; i ++) {
-						chooseFileData.push(dataWareData[i]);
-					}
-				}
-				tableInit();
-			}
-		}
-		
-		function tableInit() {
-			var html = '<tr><td>序号</td><td>时间</td><td>文件名称</td><td>导入人员</td><td>数据条数</td><td>操作</td></tr>';
-			
-			if (isEmpty(chooseFileData) || chooseFileData.length == 0) {
-				html += '<tr><td colspan = "6">无数据</td></tr>';
-			} else {
-				for (var i = 0; i < chooseFileData.length; i ++) {
-					var resMap = chooseFileData[i];
-					html += '<tr><td>' + (i + 1) + '</td><td>' + resMap.uploadDate + '</td><td>' + resMap.fileName + '</td><td>' + resMap.userName + '</td><td>' + resMap.dataNum + '</td><td>  <button onclick = "deleteChooseFile('+i+')" type="button" class="layui-btn-danger layui-btn-sm"><i class="layui-icon">&#xe640;</i></button></td></tr>';
-				}
-			}
-			
-			$("#chooseFileDataTable").html(html);
-		}
+
 		
 		function deleteChooseFile(index) {
 			chooseFileData.splice(index, 1);
@@ -276,9 +277,80 @@
 		}
 		// 查看算法详情
 		function goAlgorithmDetail(t) {
-			var algorithmId = $(t).attr("algorithmId");
+			var reportTypeId = $(t).attr("reportTypeId");
 			var openPageId = pageId + "-02";
-			openMainTabPage(openPageId, "详情查看", "reprotManage/reportAlgorithm.html?pageId="+openPageId+"&algorithmId="+algorithmId, '', pageId, null);
+			openMainTabPage(openPageId, "详情查看", "reprotManage/reportAlgorithm.html?pageId="+openPageId+"&reportTypeId="+reportTypeId, '', pageId, null);
+		}
+		
+		// 报表excel
+		var excelList = 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) {
+						excelList = data.data.resList;
+						initExcelData(excelList, "reportTable", false);
+						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>