Browse Source

王子文 生产日报 bug fix: 修复了日报选择对比指标,重新选择开始/结束日期后,对比趋势图缺失的问题

wangggziwen 2 years ago
parent
commit
b4dd5053a2

+ 1 - 1
master/src/main/java/com/ruoyi/project/system/controller/SysLoginController.java

@@ -152,7 +152,7 @@ public class SysLoginController {
 
         // 1.1 构建请求头
         HttpHeaders headers = new HttpHeaders();
-        headers.setContentType(MediaType.APPLICATION_JSON);
+        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
         headers.add("Authorization", "Bearer ");
         // 1.2 构建请求参数
         Map<String, String> body = new HashMap<>();

+ 24 - 8
ui/src/views/production/daily/index.vue

@@ -4149,14 +4149,30 @@ export default {
     },
     /** 处理趋势图对话框开始/结束日期change事件 */
     handleAnalysisQuery() {
-      this.disposeChart();
-      this.valueList = [];
-      this.dateList = [];
-      let endDate = new Date(this.analysisQueryParams.endDate);
-      let startDate = new Date(this.analysisQueryParams.startDate);
-      this.analysisQueryParams.endDate = endDate.getFullYear() + "-" + Number(endDate.getMonth() + 1) + "-" + endDate.getDate();
-      this.analysisQueryParams.startDate = startDate.getFullYear() + "-" + Number(startDate.getMonth() + 1) + "-" + startDate.getDate();
-      this.draw();
+      if (this.chemicalChosen != null && this.chemicalChosen != "") {
+        this.analysisQueryParams.fieldName = this.chemicalChosen;
+        for (let i = 0; i < this.chemicalsOptions.length; i++) {
+          if (this.chemicalsOptions[i].dictValue == this.chemicalChosen) {
+            this.fieldNameTitle2 = this.chemicalsOptions[i].dictLabel;
+          }
+        }
+        this.disposeChart();
+        this.valueList2 = [];
+        let endDate = new Date(this.analysisQueryParams.endDate);
+        let startDate = new Date(this.analysisQueryParams.startDate);
+        this.analysisQueryParams.endDate = endDate.getFullYear() + "-" + Number(endDate.getMonth() + 1) + "-" + endDate.getDate();
+        this.analysisQueryParams.startDate = startDate.getFullYear() + "-" + Number(startDate.getMonth() + 1) + "-" + startDate.getDate();
+        this.draw2();
+      } else {
+        this.disposeChart();
+        this.valueList = [];
+        this.dateList = [];
+        let endDate = new Date(this.analysisQueryParams.endDate);
+        let startDate = new Date(this.analysisQueryParams.startDate);
+        this.analysisQueryParams.endDate = endDate.getFullYear() + "-" + Number(endDate.getMonth() + 1) + "-" + endDate.getDate();
+        this.analysisQueryParams.startDate = startDate.getFullYear() + "-" + Number(startDate.getMonth() + 1) + "-" + startDate.getDate();
+        this.draw();
+      }
     },
     /** 绘制趋势图 */
     draw() {