Browse Source

修改日期格式

lry 11 months ago
parent
commit
60218f7ccd

+ 4 - 1
industry-system/industry-da/src/main/java/com/example/opc_da/service/impl/ReportTableServiceImpl.java

@@ -178,7 +178,10 @@ public class ReportTableServiceImpl implements ReportTableService {
         }
         // 添加报表、策略、点位关系
         addReportTableIdAndPolicyIdAndItemId(resultList);
-        return Result.ok("修改报表模板成功");
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("msg", "修改报表模板成功");
+        jsonObject.put("version", tableTemplate.getVersion());
+        return Result.ok(jsonObject);
     }
 
     @Override

+ 26 - 2
industry-system/industry-da/src/main/java/com/example/opc_da/validate/reportTable/AutomaticReportTableValidate.java

@@ -29,7 +29,11 @@ import java.util.stream.Stream;
 @Slf4j
 public abstract class AutomaticReportTableValidate implements ReportTableValidate {
 
-    private static final String timePattern = "yyyy-MM-dd HH:mm:ss.SSS";
+    private static final String timePattern = "yyyy-MM-dd HH:mm:ss.SSS";//秒
+    private static final String timePattern_hour = "yyyy-MM-dd HH:00";//小时
+    private static final String timePattern_min = "yyyy-MM-dd HH:mm";//分
+    private static final String timePattern_day = "yyyy-MM-dd";//日
+    String timePattern_str;
 
     InFluxDBService inFluxDBService = SpringContextUtils.getBean(InFluxDBService.class);
     String bucket = SpringContextUtils.getYamlProperty("influxdb.bucket");
@@ -561,9 +565,29 @@ public abstract class AutomaticReportTableValidate implements ReportTableValidat
                     }
                 }
                 //求出每段应该返回的值
+
+                switch (bucketType){
+                    case 0:
+                        timePattern_str = timePattern;
+                        break;
+                    case 1:
+                        timePattern_str = timePattern_day;
+                        break;
+                    case 2:
+                        timePattern_str = timePattern_hour;
+                        break;
+                    case 3:
+                        timePattern_str = timePattern_min;
+                        break;
+                    case 4:
+                        timePattern_str = timePattern;
+                        break;
+                }
+
                 newItemList.add(new Item()
                         .value(CalculateDataFactory.getCalculateData(valueTakingMode).calculateData(valueList))
-                        .time(sDateTime.format(DateTimeFormatter.ofPattern(timePattern))));
+                        .time(sDateTime.format(DateTimeFormatter.ofPattern(timePattern_str))));
+
                 sDateTime = eDateTime;
 
             }

File diff suppressed because it is too large
+ 0 - 0
industry-system/industry-da/src/main/resources/static/reportSheet/js/Luckysheet-2.1.13/luckysheet.esm.js


File diff suppressed because it is too large
+ 0 - 0
industry-system/industry-da/src/main/resources/static/reportSheet/js/Luckysheet-2.1.13/luckysheet.esm.js.map


+ 1 - 1
industry-system/industry-da/src/main/resources/static/reportSheet/js/Luckysheet-2.1.13/luckysheet.umd.js

@@ -22033,7 +22033,7 @@
 				Engineering: "工程计算",
 				Filter: "过滤器",
 				Financial: "财务",
-				luckysheet: "Luckysheet内置",
+				luckysheet: "系统内置",
 				other: "其它",
 				Logical: "逻辑",
 				Lookup: "查找",

File diff suppressed because it is too large
+ 0 - 0
industry-system/industry-da/src/main/resources/static/reportSheet/js/Luckysheet-2.1.13/luckysheet.umd.js.map


+ 19 - 3
industry-system/industry-da/src/main/resources/static/reportSheet/js/report-history.js

@@ -98,8 +98,6 @@ window.onload = function() {
 				}
 			})
 		} else if(json.cmd=='download'){
-			//console.log('down');
-			console.log(json.data.dtype);
 			const range = luckysheet.getRange()
 			if (range.length > 1) {
 				layer.msg('请选择单个打印区域!', {icon: 2})
@@ -130,7 +128,25 @@ window.onload = function() {
 				data,
 				success: (json) => {
 					let fileName = localStorage.getItem('url') + '/' + json.data;
-					console.log(fileName);
+					console.log(json.data);
+					let url = fileName;
+					let name=json.data.split('/').pop();
+					let xhr = new XMLHttpRequest();
+					xhr.open('get',url,true);
+					xhr.responseType = 'blob';
+					xhr.onreadystatechange = function (){
+						if(xhr.readyState===4 && xhr.status===200){
+							window.URL = window.URL || window.webkitURL;
+							let a = document.createElement('a');
+							let blob = new Blob([xhr.response]);
+							let url = window.URL.createObjectURL(blob);
+							a.href = url;
+							a.download = name;
+							a.click();
+							window.URL.revokeObjectURL(url);
+						}
+					}
+					xhr.send();
 				}
 			})
 		}

+ 4 - 2
industry-system/industry-da/src/main/resources/static/reportSheet/js/src/model/right-menu.js

@@ -29,15 +29,17 @@ layui.define(['layer', 'util', 'jquery', 'form', 'sheetTypew', 'chartRightw', 'i
 					chart: layui.excelUtil.getChartData()
 				}),
 			}
-			console.log(params)
+			//console.log(params)
 			if (layui.sheetTypew.templateReportId > 0) {
 				params.id = layui.sheetTypew.templateReportId
 				params.version = layui.sheetTypew.templateReportVersion
+				console.log(params)
 				layui.api.updateTableTemplate(params).then(json => {
 					if (json.code == 200) {
+						layui.sheetTypew.templateReportVersion = json.data.version;
 						layer.msg('保存报表成功!', {icon: 1})
 					} else {
-						layer.msg(json.msg, {icon: 2})
+						layer.msg(json.data.msg, {icon: 2})
 					}
 				})
 			} else {

+ 33 - 32
industry-system/industry-da/src/main/resources/static/reportSheet/js/src/model/sheet-util.js

@@ -71,6 +71,7 @@ layui.define(function(exports) {
 			if (sheetConfig && sheetConfig.data) {
 				option.data = sheetConfig.data
 			}
+
 			option.hook = {
 				cellEditBefore: function(range) {
 					const cell = luckysheet.getCellValue((range[0].row)[0], (range[0].column)[0], {type: 'v'})
@@ -106,38 +107,38 @@ layui.define(function(exports) {
 					return true
 				},
 				rangeCopyAfter:function(range,data){
-					// copyRange = range;
-					// let scol = copyRange[0].column[0];
-					// let ecol = copyRange[0].column[1];
-					// let srow = copyRange[0].row[0];
-					// let erow = copyRange[0].row[1];
-					// console.log(scol);
-					// console.log(srow);
-					// console.log(luckysheet.getCellValue(3, 6));
-					// for(let i=srow;i<=erow;i++){
-					// 	for(let j=scol;j<=ecol;j++){
-					// 		const cell = luckysheet.getCellValue(i, j);
-					// 		console.log(cell)
-					// 	}
-					// }
+					copyRange = range;
+					let scol = copyRange[0].column[0];
+					let ecol = copyRange[0].column[1];
+					let srow = copyRange[0].row[0];
+					let erow = copyRange[0].row[1];
+					console.log(scol);
+					console.log(srow);
+					console.log(luckysheet.getCellValue(3, 6));
+					for(let i=srow;i<=erow;i++){
+						for(let j=scol;j<=ecol;j++){
+							const cell = luckysheet.getCellValue(i, j);
+							console.log(cell)
+						}
+					}
 				},
 				rangePasteBefore:function(range,data){
-					// console.log('rangePasteBefore')
-					// console.log(range);
-					// console.log(data);
-					// let scol = range[0].column[0];
-					// let ecol = range[0].column[1];
-					// let srow = range[0].row[0];
-					// let erow = range[0].row[1];
-					// console.log(scol);
-					// console.log(srow);
-					// console.log(luckysheet.getCellValue(3, 6));
-					// for(let i=srow;i<=erow;i++){
-					// 	for(let j=scol;j<=ecol;j++){
-					// 		const cell = luckysheet.getCellValue(i, j);
-					// 		console.log(cell)
-					// 	}
-					// }
+					console.log('rangePasteBefore')
+					console.log(range);
+					console.log(data);
+					let scol = range[0].column[0];
+					let ecol = range[0].column[1];
+					let srow = range[0].row[0];
+					let erow = range[0].row[1];
+					console.log(scol);
+					console.log(srow);
+					console.log(luckysheet.getCellValue(3, 6));
+					for(let i=srow;i<=erow;i++){
+						for(let j=scol;j<=ecol;j++){
+							const cell = luckysheet.getCellValue(i, j);
+							console.log(cell)
+						}
+					}
 				},
 				cellMousedown:function(cell,position,sheet,ctx){
 					//console.log('r='+position.r+','+'c='+position.c);
@@ -145,8 +146,8 @@ layui.define(function(exports) {
 					//console.log(cell);
 				},
 				rangePasteAfter:function(range,data){
-					//console.log('rangePasteAfter')
-					//console.log(data);
+					console.log('rangePasteAfter')
+					console.log(data);
 				},
 				sheetMousemove: function(cell, position, sheet, moveState) {
 					if (moveState.cellSelectedMove && !moveJson.move) {

Some files were not shown because too many files changed in this diff