ソースを参照

修改图表时间格式

lry 10 ヶ月 前
コミット
d26eeb6f8c

+ 8 - 4
industry-admin/src/views/report/tableTemplate/index.vue

@@ -28,9 +28,9 @@
                                     data.templateName
                                   }}</span>
 								<span v-if="data.id == -1" style="position: absolute; right: 10px;">
-									<el-button type="text" size="mini" title="新建报表" @click="addReportEvent"
+									<el-button type="text" size="mini" title="新建报表" @click="addReportEvent" :disabled="isLoadingStatus"
 										icon="el-icon-document-add" style="font-size: 18px"></el-button>
-									<el-button type="text" size="mini" style="margin-left: 5px;font-size: 18px"
+									<el-button type="text" size="mini" style="margin-left: 5px;font-size: 18px" :disabled="isLoadingStatus"
 										title="导入报表" @click="importReportEvent" icon="el-icon-upload2"></el-button>
 									<input ref="importFileNode" class="import-file-node" type="file" @change="loadExcel"
 										accept=".xlsx" style="display: none;"></input>
@@ -180,7 +180,9 @@
 				if (json.cmd === 'close') {
 					//_this.$router.go(-1)
 				} else if (json.cmd === 'newsave') {
-					_this.getAllTableTemplate()
+          _this.getAllTableTemplate()
+        } else if(json.cmd === 'complete'){
+          _this.isLoadingStatus = false;
 				} else if (json.cmd === 'updated') {
 					//console.log(json)
 					if (json.updatecnt > 0) {
@@ -218,6 +220,7 @@
 					return;
 				}
 				const _this = this
+        _this.isLoadingStatus = true;
 				const files = localStorage.getItem('IMPORT_FILES_JSON')
 				_this.sendMsg({
 					cmd: 'init',
@@ -229,6 +232,7 @@
 						files
 					}
 				})
+        //_this.isLoadingStatus = false;
 				localStorage.setItem('IMPORT_FILES_JSON', '')
 			},
 			addEventListener() {
@@ -577,4 +581,4 @@
 		opacity: unset !important;
 		background: #2c3e50 !important;
 	}
-</style>
+</style>

+ 5 - 0
industry-system/industry-da/src/main/java/com/example/opc_da/util/calculate/AverageCalculate.java

@@ -1,6 +1,7 @@
 package com.example.opc_da.util.calculate;
 
 import com.example.opc_common.util.Blank;
+import lombok.extern.slf4j.Slf4j;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
@@ -9,10 +10,12 @@ import java.util.List;
 import java.util.OptionalDouble;
 
 // 实现 CalculateData 接口的 AverageCalculate 类
+@Slf4j
 public class AverageCalculate implements CalculateData {
     @Override
     public String calculateData(List<String> valueList,Integer scale,Integer defaultScale) {
         if (valueList == null || valueList.isEmpty()) {
+            log.error("valuelist=null");
             return null; // 或者根据实际需求返回特定默认值
         }
 
@@ -37,7 +40,9 @@ public class AverageCalculate implements CalculateData {
                 return null; // 或者返回说明数据无效的默认值
             }
         } catch (NumberFormatException e) {
+            log.error("catch",e);
             return null; // 或者根据实际需求返回特定错误信息
+
         }
     }
 }

+ 5 - 1
industry-system/industry-da/src/main/java/com/example/opc_da/validate/reportTable/ManualReportTableValidate.java

@@ -276,7 +276,11 @@ public class ManualReportTableValidate implements ReportTableValidate {
                 serieJsonObject.put("data", serieDataList.get(i));
             }
             JSONObject xAxis = chartData.getJSONArray("xAxis").getJSONObject(0);
-            JSONObject axisLabel = xAxis.getJSONObject("axisLabel");
+//            JSONObject axisLabel = xAxis.getJSONObject("axisLabel");
+//            String script = "function (value) {return new Date(value).format('yyyy-MM-dd HH:mm')}";
+//            axisLabel.put("formatter",script);
+            //axisLabel.put("formatter","function (value) {return new Date(value).format('yyyy-MM-dd HH:mm')}");
+
             xAxis.put("data", xAxisList);
             //如果为饼图
         } else if (chartType.equals(ConstantStr.PIE_CHART)) {

+ 7 - 2
industry-system/industry-da/src/main/resources/static/reportSheet/js/report-history.js

@@ -300,10 +300,15 @@ const indexFn = {
 												templateData.chart[key].chartData.backgroundColor = colorForm.background
 												$(`#${chartId}_c`).css('background', colorForm.background)
 											}
-											console.log(templateData.chart[key].chartData);
-											chart.setOption(templateData.chart[key].chartData, {
+											const xForm = templateData.chart[key].xForm;
+											let chart_new = templateData.chart[key].chartData;
+											chart_new.xAxis[0].axisLabel.formatter = function (value) {return new Date(value).format(xForm.formatter)};
+											chart.setOption(chart_new, {
 												notMerge: true
 											})
+											// chart.setOption(templateData.chart[key].chartData, {
+											// 	notMerge: true
+											// })
 											if (colorForm.border) {
 												$(`#${chartId}_c`).css('border', '1px solid ' + colorForm.border)
 											}

+ 0 - 1
industry-system/industry-da/src/main/resources/static/reportSheet/js/src/model/chart-right-window.js

@@ -141,7 +141,6 @@ layui.define(['layer', 'form', 'jquery', 'element', 'laydate', 'colorpicker', 's
 						//$('input[lay-filter="chart-hand-data-type"]').parent().addClass('layui-hide')
 						//$('input[lay-filter="chart-hand-data-type"]').parent().prev().addClass('layui-hide')
 						const data = layui.rightMenu.data.chart[fn.data.chartId].dataForm
-						console.log(data)
 						if (data.isChartDataType == 1) {
 							$('.chart-hand-history-view').addClass('layui-hide')
 						} else {

+ 8 - 4
industry-system/industry-da/src/main/resources/static/reportSheet/js/src/model/excel-util.js

@@ -1833,12 +1833,16 @@ layui.define(function(exports) {
 				luckysheet.showChart({
 					chartId: key,
 					option: data[key].position,
-					init: function(chart, chartId) {
-						//console.log("showChart");
-						//console.log(data[key].chartData);
-						chart.setOption(data[key].chartData, {
+					init: function(chart, chartId) {					
+						const xForm = data[key].xForm;
+						let chart_new = data[key].chartData;
+						chart_new.xAxis[0].axisLabel.formatter = function (value) {return new Date(value).format(xForm.formatter)};
+						chart.setOption(chart_new, {
 							notMerge: true
 						})
+						// chart.setOption(data[key].chartData, {
+						// 	notMerge: true
+						// })
 						const colorForm = data[key].colorForm
 						if (colorForm.background) {
 							$(`#${chartId}_c`).css('background', colorForm.background)

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

@@ -315,6 +315,9 @@ layui.define(function(exports) {
 					}
 					
 					window.localStorage.setItem('cnt',-1);
+					window.parent.postMessage({
+						cmd: 'complete',
+					}, '*')
 				}
 			}
 			//console.log(option);