shi'sen'yuan 3 år sedan
förälder
incheckning
90d030aa5f

+ 11 - 0
master/src/main/java/com/ruoyi/project/aspen/controller/TDashboarddayController.java

@@ -45,6 +45,17 @@ public class TDashboarddayController extends BaseController
         return getDataTable(list);
     }
 
+    /**
+     * 查询最近31条DASHBOARD每日抓取数据列表
+     */
+    @PreAuthorize("@ss.hasPermi('aspen:dashboardday:list')")
+    @GetMapping("/month")
+    public AjaxResult selectLast(TDashboardday tDashboardday)
+    {
+        List<TDashboardday> list = tDashboarddayService.selectLast(tDashboardday);
+        return AjaxResult.success(list);
+    }
+
     /**
      * 导出DASHBOARD每日抓取数据列表
      */

+ 8 - 0
master/src/main/java/com/ruoyi/project/aspen/mapper/TDashboarddayMapper.java

@@ -20,6 +20,14 @@ public interface TDashboarddayMapper
      */
     public TDashboardday selectTDashboarddayById(Long id);
 
+    /**
+     * 查询最近31条dashboard抓取数据
+     *
+     * @param tDashboardday dashboard抓取数据
+     * @return DASHBOARD每日抓取数据集合
+     */
+    public List<TDashboardday> selectLast(TDashboardday tDashboardday);
+
     /**
      * 查询DASHBOARD每日抓取数据列表
      * 

+ 9 - 0
master/src/main/java/com/ruoyi/project/aspen/service/ITDashboarddayService.java

@@ -1,6 +1,7 @@
 package com.ruoyi.project.aspen.service;
 
 import java.util.List;
+
 import com.ruoyi.project.aspen.domain.TDashboardday;
 
 /**
@@ -19,6 +20,14 @@ public interface ITDashboarddayService
      */
     public TDashboardday selectTDashboarddayById(Long id);
 
+    /**
+     * 查询最近31条dashboard抓取数据
+     *
+     * @param tDashboardday dashboard抓取数据
+     * @return DASHBOARD每日抓取数据集合
+     */
+    public List<TDashboardday> selectLast(TDashboardday tDashboardday);
+
     /**
      * 查询DASHBOARD每日抓取数据列表
      * 

+ 12 - 1
master/src/main/java/com/ruoyi/project/aspen/service/impl/TDashboarddayServiceImpl.java

@@ -7,6 +7,8 @@ import com.ruoyi.project.aspen.mapper.TDashboarddayMapper;
 import com.ruoyi.project.aspen.domain.TDashboardday;
 import com.ruoyi.project.aspen.service.ITDashboarddayService;
 
+import javax.annotation.Resource;
+
 /**
  * DASHBOARD每日抓取数据Service业务层处理
  *
@@ -16,7 +18,7 @@ import com.ruoyi.project.aspen.service.ITDashboarddayService;
 @Service
 public class TDashboarddayServiceImpl implements ITDashboarddayService
 {
-    @Autowired
+    @Resource
     private TDashboarddayMapper tDashboarddayMapper;
 
     /**
@@ -31,6 +33,15 @@ public class TDashboarddayServiceImpl implements ITDashboarddayService
         return tDashboarddayMapper.selectTDashboarddayById(id);
     }
 
+    /**
+     * 查询最近31条dashboard抓取数据
+     *
+     * @param tDashboardday dashboard抓取数据
+     * @return DASHBOARD每日抓取数据集合
+     */
+    @Override
+    public List<TDashboardday> selectLast(TDashboardday tDashboardday) { return tDashboarddayMapper.selectLast(tDashboardday); }
+
     /**
      * 查询DASHBOARD每日抓取数据列表
      *

+ 6 - 3
master/src/main/resources/mybatis/aspen/TDashboarddayMapper.xml

@@ -21,8 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectTDashboarddayVo">
-        select d.id, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.daily_yixi, d.daily_bingxi, d.loss_rate, d.energy_consumption, d.product_putput, d.data_date ,s.dept_name from t_dashboardday d
-      left join sys_dept s on s.dept_id = d.dept_id
+        select id, del_flag, creater_code, createdate, updater_code, updatedate, daily_yixi, daily_bingxi, loss_rate, energy_consumption, product_putput, data_date from t_dashboardday
     </sql>
 
     <select id="selectTDashboarddayList" parameterType="TDashboardday" resultMap="TDashboarddayResult">
@@ -38,11 +37,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="energyConsumption != null  and energyConsumption != ''"> and energy_consumption = #{energyConsumption}</if>
             <if test="productPutput != null  and productPutput != ''"> and product_putput = #{productPutput}</if>
             <if test="dataDate != null "> and data_date = #{dataDate}</if>
-            and d.del_flag = 0
+            and del_flag = 0
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
     </select>
+
+    <select id="selectLast" parameterType="TDashboardday" resultMap="TDashboarddayResult">
+        select * from ( select * from t_dashboardday where del_flag = 0 order by id desc ) WHERE 32 > ROWNUM
+    </select>
     
     <select id="selectTDashboarddayById" parameterType="Long" resultMap="TDashboarddayResult">
         <include refid="selectTDashboarddayVo"/>

+ 5 - 5
ui/src/views/dashboard/LossrateChart.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container-Lossrate">
-    <div id="LossrateChart" :style="{height:height,width:width}"></div>
+    <!--<div id="LossrateChart" :style="{height:height,width:width}"></div>-->
   </div>
 </template>
 
@@ -50,7 +50,7 @@
       });
     },
     initChart() {
-      // 基于准备好的dom,初始化echarts实例
+      /*// 基于准备好的dom,初始化echarts实例
       this.chart = this.echarts.init(document.getElementById('LossrateChart'))
 
       this.chart.setOption({
@@ -64,14 +64,14 @@
             }
           }
         },
-        /* 标识 */
+        /!* 标识 *!/
         legend: {
           data: ['实际', '计划'],
           textStyle:{
             color: '#ffffff'//字体颜色
           }
         },
-        /* 周围边距 */
+        /!* 周围边距 *!/
         grid: {
           left: '3%',
           right: '3%',
@@ -154,7 +154,7 @@
             data: [320, 132, 201, 334, 190, 130, 220, 320, 132, 201, 334, 190, 130, 220, 320, 132, 201, 334, 190, 130, 220, 320, 132, 201, 334, 190, 130, 220]
           },
         ]
-      })
+      })*/
     }
   }
 }

+ 1 - 1
ui/src/views/front/annualOutput.vue

@@ -8,7 +8,7 @@
             <div class="m-7xz2"></div>
             <div class="m-7xz3 xzleft"></div>
             <div class="m-7zt1">{{ $t('年产量') }}</div>
-            <div class="m-7zt2" id="sx1">{{ dashboarddata.outputAnnual }}%</div>
+            <div class="m-7zt2" id="sx1">{{ dashboarddata.outputAnnual }}</div>
           </div>
         </div>
       </div>

+ 97 - 4
ui/src/views/front/energyConsumption.vue

@@ -13,19 +13,112 @@
         </div>
       </div>
       <div>
-        <lossrate-chart />
+        <div id="LossrateChart" style="width:420px; height: 160px;"></div>
       </div>
     </div>
   </div>
 </template>
 
 <script>
-import lossrateChart from "../dashboard/LossrateChart";
+import resize from "../dashboard/mixins/resize";
 
 export default {
-  components: {
-    lossrateChart
+  components: {},
+  mixins: [resize],
+  props: {
+    width: {
+      type: String,
+      default: '100%'
+    },
+    height: {
+      type: String,
+      default: '180px'
+    },
   },
+  data() {
+    return {
+      chart: null
+    }
+  },
+  beforeDestroy() {
+    if (!this.chart) {
+      return
+    }
+    this.chart.dispose()
+    this.chart = null
+  },
+  mounted() {
+    this.initChart();
+  },
+  methods: {
+    initChart() {
+      // 基于准备好的dom,初始化echarts实例
+      this.chart = this.echarts.init(document.getElementById('LossrateChart'))
+
+      this.chart.setOption({
+        color: ['#37A2FF'],
+        tooltip: {
+          trigger: 'axis',
+          axisPointer: {
+            type: 'cross',
+            label: {
+              backgroundColor: '#6a7985'
+            }
+          }
+        },
+        /* 周围边距 */
+        grid: {
+          left: '3%',
+          right: '3%',
+          bottom: '1%',
+          top: '13%',
+          containLabel: true
+        },
+        xAxis: {
+          type: 'category',
+          boundaryGap: false,
+          data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
+        },
+        yAxis: {
+          type: 'value',
+          axisLabel: {
+            formatter: '{value} °C'
+          }
+        },
+        series: [
+          {
+            name: 'Lowest',
+            type: 'line',
+            data: [1, -2, 2, 5, 3, 2, 0],
+            markPoint: {
+              data: [{ name: '周最低', value: -2, xAxis: 1, yAxis: -1.5 }]
+            },
+            markLine: {
+              data: [
+                { type: 'average', name: 'Avg' },
+                [
+                  {
+                    symbol: 'none',
+                    x: '90%',
+                    yAxis: 'max'
+                  },
+                  {
+                    symbol: 'circle',
+                    label: {
+                      position: 'start',
+                      formatter: 'Max'
+                    },
+                    type: 'max',
+                    name: '最高点'
+                  }
+                ]
+              ]
+            }
+          }
+        ]
+      })
+    }
+  }
 }
 </script>