Browse Source

更改了部分问题

duanxiaoduan 1 year ago
parent
commit
4098fd8a78
3 changed files with 112 additions and 51 deletions
  1. 4 1
      .env.development
  2. 99 48
      src/views/dashboard/index.vue
  3. 9 2
      src/views/statisticalAnalysis/errorAnalysis/see.vue

+ 4 - 1
.env.development

@@ -3,7 +3,10 @@ ENV = 'development'
 
 # base api
 # 测试线
-VUE_APP_BASE_API = 'http://192.168.1.70:8081/'
+#VUE_APP_BASE_API = 'http://192.168.1.70:8081/'
+# 正式线
+VUE_APP_BASE_API = 'http://122.114.177.195:8082/'
+
 
 #许义平本地
 # VUE_APP_BASE_API = 'http://192.168.1.96:8090/'

+ 99 - 48
src/views/dashboard/index.vue

@@ -211,7 +211,7 @@
           </div>
           <el-table :key="accuracy.seeRanking.tableKey" v-loading="accuracy.seeRanking.listLoading"
             element-loading-text="给我一点时间" :data="accuracy.seeRanking.list" border fit highlight-current-row
-            style="width: 100%;" :row-style="rowStyle" :cell-style="cellStyle" class="elTable">
+            style="width: 100%;margin-bottom: 50px;" :row-style="rowStyle" :cell-style="cellStyle" class="elTable" height="500">
             <el-table-column type="selection" align="center" width="50" />
             <el-table-column label="排名" min-width="130px" align="center"  type="index"/>
             <el-table-column label="牧场名称" min-width="130px" align="center" prop="pasture_name" />
@@ -231,16 +231,9 @@
   </div>
 </template>
 <script>
-  import {
-    postJson,
-    getJson
-  } from '@/api/common'
-  import {
-    mapGetters
-  } from 'vuex'
-  import {
-    parseTime
-  } from '@/utils/index.js'
+  import { postJson, getJson } from '@/api/common'
+  import { mapGetters } from 'vuex'
+  import { parseTime,json2excel } from '@/utils/index.js'
   // import echarts from 'echarts'
   import * as echarts from 'echarts';
   require('echarts/theme/macarons')
@@ -504,7 +497,64 @@
           });
         }
       },
-      handleExport() {},
+      handleExport(item) {
+        if(item == 'accuracy'){
+          var list1 = this.accuracy.chart1.allTable1Data.mixed_fodder_accurate_ratio
+          var list2 = this.accuracy.chart1.allTable1Data.mixed_fodder_correct_ratio
+          var list3 = this.accuracy.chart1.allTable1Data.sprinkle_fodder_accurate_ratio
+          var list4 = this.accuracy.chart1.allTable1Data.sprinkle_fodder_correct_ratio
+          var titles = []
+          var values = []
+          for(let i =0;i<this.accuracy.chart1.tableTitleList1.length;i++){
+            titles.push(this.accuracy.chart1.tableTitleList1[i].value)
+            values.push(this.accuracy.chart1.tableTitleList1[i].name)
+          }
+          var excelDatasTabChart1 = [
+            {
+              tHeader: titles,
+              filterVal: values,
+              tableDatas: list1,
+              sheetName: '混料准确率'
+            },{
+              tHeader: titles,
+              filterVal: values,
+              tableDatas: list2,
+              sheetName: '混料正确率'
+            },{
+              tHeader: titles,
+              filterVal: values,
+              tableDatas: list3,
+              sheetName: '撒料准确率'
+            },{
+              tHeader: titles,
+              filterVal: values,
+              tableDatas: list4,
+              sheetName: '撒料正确率'
+            }
+          ]
+          json2excel(excelDatasTabChart1, '准确性分析', true, 'xlsx')
+        }else if(item == 'time'){
+          var excelDatasTabChart2 = [
+            {
+              tHeader: titles,
+              filterVal: values,
+              tableDatas: list1,
+              sheetName: '混料准确率'
+            }
+          ]
+          json2excel(excelDatasTabChart1, '准确性分析', true, 'xlsx')
+        }else if(item == 'abnormal'){
+          var excelDatasTabChart3 = [
+            {
+              tHeader: ['牧场','栏舍','班次','实际撒料时间'],
+              filterVal: ['pasture_name','barn_name','class_number','reality_sprinkle_feed_time'],
+              tableDatas: this.abnormal.chart1.tableDataList1,
+              sheetName: ' 撒料时间统计分析'
+            }
+          ]
+          json2excel(excelDatasTabChart3, ' 撒料时间统计分析', true, 'xlsx')
+        }
+      },
       handleSeeRanking() {
         this.accuracy.dialogStatus = 'seeRanking'
         this.accuracy.dialogFormVisible = true
@@ -709,7 +759,8 @@
           }
         })
       },
-      roadChartLine1(chartLine_data) {
+      roadChartLine1(chartLine_data) {
+        console.log(chartLine_data,'chartLine_data')
         if (this.accuracy.chart1.chartLine != null) {
           this.accuracy.chart1.chartLine.dispose()
         }
@@ -731,20 +782,13 @@
             containLabel: true
           },
           xAxis: [{
-            data: chartLine_data.date_day,
+            data: chartLine_data.title,
             type: 'category',
-            // boundaryGap: false,
-            // axisLabel: {
-            //   showMinLabel: true,
-            // },
-            // axisLine: {
-            //   lineStyle: {
-            //     color: '#666'
-            //   }
-            // },
           }],
           yAxis: [{
             type: 'value',
+            min:0,
+            interval:25,
             name: '(%)',
             axisLine: {
               lineStyle: {
@@ -752,30 +796,29 @@
               }
             },
           }],
-          color: ['#4b07fa', '#0f96fc', '#ff42a9', '#ff724c', '#05fbf0', '#ffae00', '#b705fa', '#9a60b4', '#3cff00'],
-          series: function(e) {
-            var serie = [];
-            for (var i = 0; i < chartLine_data.pasture_name.length; i++) {
-              var item = {
-                name: chartLine_data.pasture_name[i],
-                data: chartLine_data.data_list[i],
-                type: 'bar',
-                barMaxWidth: 20, // 每一个都要设置
-                barMinWidth: 5,
-                // smooth: true,
-                // itemStyle: {
-                //   borderColor: '#fff',
-                //   borderWidth: 2
-                // },
-                // label: {
-                //   // normal: {  show: true },
-                // },
-              }
-              serie.push(item);
-            }
-            console.log(serie)
-            return serie;
-          }()
+          color: ['#4b07fa', '#0f96fc', '#ff42a9', '#ff724c', '#05fbf0', '#ffae00', '#b705fa', '#9a60b4', '#3cff00'],
+          series: [{
+              name: '撒料正确率',
+              type: 'bar',
+              barWidth:10,
+              data: chartLine_data.ratio
+            }
+          ]
+          // series: function(e) {
+          //   var serie = [];
+          //   for (var i = 0; i < chartLine_data.pasture_name.length; i++) {
+          //     var item = {
+          //       name: chartLine_data.pasture_name[i],
+          //       data: chartLine_data.data_list[i],
+          //       type: 'bar',
+          //       barMaxWidth: 20, // 每一个都要设置
+          //       barMinWidth: 5
+          //     }
+          //     serie.push(item);
+          //   }
+          //   console.log(serie)
+          //   return serie;
+          // }()
         };
         this.accuracy.chart1.chartLine.setOption(option)
         if (this.accuracy.chart1.chartLine !== null) {
@@ -865,8 +908,10 @@
         }
       },
       formatter(param) {
+        // console.log(param,'param')
         return [
-            // '类别名称: ' + param.name,
+            '执行时间/分钟<br/>'+
+             '牧场: '+ param.name,
             '最大值: ' + param.data[1],
             '上四分位数: ' + param.data[2],
             '中位数: ' + param.data[3],
@@ -893,6 +938,12 @@
                 if(data[0].data !== 0 && data[1].data !== 0){
                   rate1 = (a/b * 100).toFixed(2)
                   rate2 = 100 - (parseFloat(rate1))
+                }else if(data[0].data == 100){
+                  rate1 = 100
+                  rate2 = 0
+                }else if(data[1].data == 100){
+                  rate1 = 0
+                  rate2 = 100
                 }else{
                   rate1 = 0
                   rate2 = 0

+ 9 - 2
src/views/statisticalAnalysis/errorAnalysis/see.vue

@@ -320,6 +320,8 @@ export default {
       this.table2.getdataListParm.parammaps.error = this.error
       let url = 'api/v1/ops/accuracy/data_by_name'
       let data = {}
+      data.offset = this.table2.getdataListParm.offset
+      data.page = this.table2.getdataListParm.page
       data.api_name = this.table2.getdataListParm.name
       data.error = this.table2.getdataListParm.parammaps.error
       data.pasture_id = this.methodpastureid
@@ -362,6 +364,8 @@ export default {
       console.log(this.table3.getdataListParm,'table2')
       let url = 'api/v1/ops/accuracy/data_by_name'
       let data = {}
+      data.offset = this.table3.getdataListParm.offset
+      data.page = this.table3.getdataListParm.page
       data.api_name = this.table3.getdataListParm.name
       data.error = this.table3.getdataListParm.parammaps.error
       data.pasture_id = this.methodpastureid
@@ -403,12 +407,15 @@ export default {
       this.chart1.getdataListParm.parammaps.error = this.error
       let page = 0
       let page_size = 0
+      // let url = 'api/v1/ops/accuracy/data_by_name'
       let url = '/api/v1/ops/process/analysis/mixed_sprinkle_detail' + '?page=' + page + '&page_size=' + page_size
       let data = {
         'pasture_id':this.methodpastureid,
         'api_name':this.chart1.getdataListParm.name,
-        'start_time':this.chart1.getdataListParm.parammaps.startTime,
-        'end_time':this.chart1.getdataListParm.parammaps.stopTime
+         'start_time': parseTime(new Date(), '{y}-{m}-{d}'),
+         'end_time': parseTime(new Date(), '{y}-{m}-{d}')
+        // 'start_time':this.chart1.getdataListParm.parammaps.startTime,
+        // 'end_time':this.chart1.getdataListParm.parammaps.stopTime
       }
       if(this.chart1.getdataListParm.parammaps.pid){
         data.pid = this.chart1.getdataListParm.parammaps.pid