East 3 роки тому
батько
коміт
fd5cadcd50

+ 2 - 2
src/utils/api.js

@@ -458,7 +458,7 @@ export function getYingFu(data) {
 /** 人员管理 - 人脸门禁 - Token */
 export function getFaceToken(data) {
   return axios({
-    url: 'http://192.168.1.171:9987/token/getToken',
+    url: 'http://47.98.40.154:10253/token/getToken',
     method: 'get',
     params: data
   })
@@ -466,7 +466,7 @@ export function getFaceToken(data) {
 /** 人员管理 - 人脸门禁 - 查询 */
 export function getFaceGuard(data) {
   return axios({
-    url: 'http://192.168.1.171:9987/person/get_person_record',
+    url: 'http://47.98.40.154:10253/person/get_person_record',
     method: 'post',
     data: data
   })

+ 5 - 5
src/utils/chenApi.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-11-18 13:40:39
- * @LastEditTime: 2021-11-26 17:35:19
+ * @LastEditTime: 2021-11-27 11:47:06
  * @LastEditors: Please set LastEditors
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: \hyyfClient\src\utils\chenApi.js
@@ -12,7 +12,7 @@ import axios from './http';
 /* 获取门禁所有 */
 export function getFaceGuardTotal(data) {
   return axios({
-    url: '/produce/person/get_person_record_totalpage',
+    url: 'http://47.98.40.154:10253/produce/person/get_person_record_totalpage',
     method: 'post',
     data: data
   })
@@ -21,7 +21,7 @@ export function getFaceGuardTotal(data) {
 /* 车辆管理 - 车辆通行 */
 export function getCarPassage(data) {
   return axios({
-    url: '/produce/car/get_car_record',
+    url: 'http://47.98.40.154:10253/produce/car/get_car_record',
     method: 'get',
     params: data
   })
@@ -30,7 +30,7 @@ export function getCarPassage(data) {
 /* 车辆管理 - 车辆洗消 */
 export function getCarWash(params) {
   return axios({
-    url: '/produce/accident/accident_record_xixiao',
+    url: 'http://47.98.40.154:10253/produce/accident/accident_record_xixiao',
     method: 'post',
     data: params
   })
@@ -39,7 +39,7 @@ export function getCarWash(params) {
 /* 车辆管理 - 车辆洗消 - 总数 */
 export function getCarWashTotal(params) {
   return axios({
-    url: '/produce/accident/accident_record_xixiao_totalpage',
+    url: 'http://47.98.40.154:10253/produce/accident/accident_record_xixiao_totalpage',
     method: 'post',
     data: params
   })

+ 80 - 67
src/views/BioSafety/PersonAdmin.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-09-16 11:27:35
- * @LastEditTime: 2021-11-19 14:45:43
+ * @LastEditTime: 2021-11-27 11:29:43
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: \hyyfClient\src\views\BioSafety\PersonAdmin.vue
@@ -9,17 +9,28 @@
 <template>
   <div class="person-admin">
     <!-- 顶部的按钮选择 -->
-    <head-btns 
-      :btnNames="btnNames" 
+    <head-btns
+      :btnNames="btnNames"
       :btnSelected="btnSelected"
-      @btnSelected="getBtnSelected">
+      @btnSelected="getBtnSelected"
+    >
     </head-btns>
 
     <!-- 筛选条件 -->
-    <query-conditions :formItems="formItems" :propFormData="propFormData" @getQueryParams="handleQuery"></query-conditions>
+    <query-conditions
+      :formItems="formItems"
+      :propFormData="propFormData"
+      @getQueryParams="handleQuery"
+    ></query-conditions>
 
     <!-- 表格 -->
-    <new-table :title="title" :listData="listData" :tableItems="tableItems" :shows="tableShows" :height="475">
+    <new-table
+      :title="title"
+      :listData="listData"
+      :tableItems="tableItems"
+      :shows="tableShows"
+      :height="475"
+    >
       <template v-slot:right>
         <template v-if="btnSelected === 1">
           <div>
@@ -39,28 +50,29 @@
         </template>
       </template>
       <template v-slot:recordImage="slotProps">
-        <img :src="slotProps.row.recordImage"  alt="人员门禁" width="100"/>
+        <img :src="slotProps.row.recordImage" alt="人员门禁" width="100" />
       </template>
     </new-table>
     <table-footer
       :totals="total"
       :size="size"
       @sizeChange="sizeChange"
-      @pageChange="pageChange">
+      @pageChange="pageChange"
+    >
     </table-footer>
   </div>
 </template>
 
 <script>
-import HeadBtns from 'components/bioSafety/Btns'
-import QueryConditions from 'components/bioSafety/QueryConditions'
-import NewTable from 'components/newTable/NewTable'
-import TableFooter from "../../components/TableFooter"
+import HeadBtns from "components/bioSafety/Btns";
+import QueryConditions from "components/bioSafety/QueryConditions";
+import NewTable from "components/newTable/NewTable";
+import TableFooter from "../../components/TableFooter";
 
-import { formItems, propFormData } from './personAdmin/queryCondition.config'
-import { titles, tableItems, tableShows } from './personAdmin/table.config'
-import { getFaceToken, getFaceGuard } from '../../utils/api'
-import { getFaceGuardTotal } from '../../utils/chenApi'
+import { formItems, propFormData } from "./personAdmin/queryCondition.config";
+import { titles, tableItems, tableShows } from "./personAdmin/table.config";
+import { getFaceToken, getFaceGuard } from "../../utils/api";
+import { getFaceGuardTotal } from "../../utils/chenApi";
 
 export default {
   name: "PersonAdmin",
@@ -68,19 +80,20 @@ export default {
     HeadBtns,
     QueryConditions,
     NewTable,
-    TableFooter
+    TableFooter,
   },
   data() {
     return {
-      btnNames: [ // 按钮情况
-        { id: 1, name: '档案管理' },
-        { id: 2, name: '人脸门禁' },
+      btnNames: [
+        // 按钮情况
+        { id: 1, name: "档案管理" },
+        { id: 2, name: "人脸门禁" },
         // { id: 3, name: '赶猪监管' }
       ],
       btnSelected: 2, // 选中的按钮
       formItems: [], // 传给 QueryCondition 组件的 formItems
       propFormData: {}, // 传给 QueryCondition 组件的 propFormData
-      title: '', // 传给 BioTable 组件的 title
+      title: "", // 传给 BioTable 组件的 title
       listData: [], // 传给 BioTable 组件的表格展示的值 listData
       tableItems: [], // 传给 BioTable 组件的表格的列表 tableItems
       tableShows: {},
@@ -88,55 +101,55 @@ export default {
       total: 0,
       size: 20,
       pageNum: 1,
-      selectId: '',
-      params: {}
-    }
+      selectId: "",
+      params: {},
+    };
   },
   mounted() {
-    this.formItems = formItems[this.btnSelected - 1]
-    this.propFormData = propFormData[this.btnSelected - 1]
-    this.title = titles[this.btnSelected - 1]
-    this.tableItems = tableItems[this.btnSelected - 1]
-    this.tableShows = tableShows
+    this.formItems = formItems[this.btnSelected - 1];
+    this.propFormData = propFormData[this.btnSelected - 1];
+    this.title = titles[this.btnSelected - 1];
+    this.tableItems = tableItems[this.btnSelected - 1];
+    this.tableShows = tableShows;
   },
   methods: {
     // 获取选中的按钮情况
     getBtnSelected(id) {
-      this.btnSelected = id
-      this.formItems = formItems[id - 1]
-      this.propFormData = propFormData[id - 1]
-      this.title = titles[id - 1]
-      this.tableItems = tableItems[id - 1]
+      this.btnSelected = id;
+      this.formItems = formItems[id - 1];
+      this.propFormData = propFormData[id - 1];
+      this.title = titles[id - 1];
+      this.tableItems = tableItems[id - 1];
     },
     // 获取查询条件
     handleQuery(params) {
-      this.params = params
+      this.params = params;
       if (this.btnSelected === 2) {
-        this.faceGuard()
-        this.faceGuardTotal()
+        this.faceGuard();
+        this.faceGuardTotal();
       }
     },
     // 修改size
     sizeChange(val) {
       this.size = val;
       if (this.btnSelected === 2) {
-        this.faceGuard()
+        this.faceGuard();
       }
     },
     // 修改页数
     pageChange(val) {
-      this.pageNum= val;
+      this.pageNum = val;
       if (this.btnSelected === 2) {
-        this.faceGuard()
+        this.faceGuard();
       }
     },
     init() {
       let params = {
         pageNum: this.pageNum,
         pageSize: this.size,
-        searchStr: this.keyword
-      }
-      console.log(params)
+        searchStr: this.keyword,
+      };
+      console.log(params);
       // 获取后端数据
     },
     // 人脸门禁的查询
@@ -145,37 +158,37 @@ export default {
         pageNum: this.pageNum,
         pageSize: this.size,
         personName: this.params.name || undefined,
-        startSwingTime: this.params.time[0] + ' 00:00:00',
-        endSwingTime: this.params.time[1] + ' 23:59:59',
-        openType: 61 // 进门,刷脸
-      }
+        startSwingTime: this.params.time[0] + " 00:00:00",
+        endSwingTime: this.params.time[1] + " 23:59:59",
+        openType: 61, // 进门,刷脸
+      };
       getFaceGuard(queryParams).then(async (res) => {
-        console.log('res:', res)
-        console.log(JSON.parse(res.result))
+        console.log("res:", res);
+        console.log(JSON.parse(res.result));
         // 结果是 JSON 格式
-        this.listData = JSON.parse(res.result).data.pageData
-        const { token } = await getFaceToken()
-        this.listData.forEach(item => {
-          item.channelName = item.channelName.split('人脸门禁')[0]
-          item.recordImage = `https://36.26.62.70:447/evo-pic/${item.recordImage}?token=${token}&oss_addr=172.16.3.223:8925`
-        })
-        console.log('token:', token)
-      })
+        this.listData = JSON.parse(res.result).data.pageData;
+        const { token } = await getFaceToken();
+        this.listData.forEach((item) => {
+          item.channelName = item.channelName.split("人脸门禁")[0];
+          item.recordImage = `https://36.26.62.70:447/evo-pic/${item.recordImage}?token=${token}&oss_addr=172.16.3.223:8925`;
+        });
+        console.log("token:", token);
+      });
     },
     faceGuardTotal() {
       let queryParams = {
         personName: this.params.name || undefined,
-        startSwingTime: this.params.time[0] + ' 00:00:00',
-        endSwingTime: this.params.time[1] + ' 23:59:59',
-        openType: 61 // 进门,刷脸
-      }
-      getFaceGuardTotal(queryParams).then(res => {
-        console.log('total:', JSON.parse(res.result))
-        this.total = JSON.parse(res.result).data
-      })
-    }
+        startSwingTime: this.params.time[0] + " 00:00:00",
+        endSwingTime: this.params.time[1] + " 23:59:59",
+        openType: 61, // 进门,刷脸
+      };
+      getFaceGuardTotal(queryParams).then((res) => {
+        console.log("total:", JSON.parse(res.result));
+        this.total = JSON.parse(res.result).data;
+      });
+    },
   },
-}
+};
 </script>
 
 <style scoped>

+ 23 - 3
src/views/PdcData/Analysis.vue

@@ -102,7 +102,10 @@
           </el-date-picker>
         </div>
         <div class="important-chart">
-          <important-line></important-line>
+          <important-line
+            :listData="importantData"
+            v-bind="importantTitle"
+          ></important-line>
         </div>
       </div>
 
@@ -356,9 +359,10 @@ export default {
           label: "成活率指标",
         },
       ],
-      importantValue: "",
+      importantValue: 1,
       importantDates: [],
       importantData: [], // 重要指标折线图数据
+      importantTitle: {}, // 重要指标的名称
       // 销售额
       // salesFormItems: [],
       salesDay: 2, //默认选择本周
@@ -434,6 +438,7 @@ export default {
     this.initWorkBoard(); // 工作看板
     this.initSafeInventory(); // 安全库存报警
     this.initProductionCondition(); // 生产情况
+    this.initImportantData(); // 重要指标
   },
   methods: {
     handleWorkInfoClick(item) {
@@ -646,7 +651,22 @@ export default {
         endDate: this.importantDates[1],
         type: this.importantValue,
       }).then((res) => {
-        console.log("重要指标数据----------------", res);
+        const types = [
+          ["break_rate"],
+          ["avg_farrow_1", "avg_farrow_2", "avg_farrow_3"],
+          ["avg_weight", "break_grice"],
+          ["fatpig_rate", "grice_rate", "piglet_rate"],
+        ];
+        this.importantData = [];
+        types[this.importantValue - 1].forEach((type) => {
+          this.importantData.push(res.data[type]);
+        });
+        this.importantTitle = {
+          isPercentage: res.data["isPercentage"],
+          isWeight: res.data["isWeight"],
+          isHead: res.data["isHead"],
+        };
+        console.log("重要指标数据----------------", this.importantTitle);
       });
     },
     // 重要指标的 type 改变

+ 149 - 82
src/views/PdcData/analysis/ImportantLine.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-10-12 10:31:13
- * @LastEditTime: 2021-10-12 10:42:49
+ * @LastEditTime: 2021-11-27 16:27:13
  * @LastEditors: Please set LastEditors
  * @Description: 重要指标
  * @FilePath: \hyyfClient\src\views\PdcData\analysis\ImportantLine.vue
@@ -14,116 +14,183 @@
 
 <script>
 export default {
+  props: {
+    listData: {
+      type: Array,
+      default: () => [],
+    },
+    isPercentage: {
+      type: Number,
+      default: 0,
+    },
+    isWeight: {
+      type: Number,
+      default: 0,
+    },
+    isHead: {
+      type: Number,
+      default: 0,
+    },
+  },
   data() {
     return {
-      myChart: null
-    }
+      myChart: null,
+    };
   },
   methods: {
     init() {
+      let seriesData = [];
+      // [
+      //     {
+      //       name: "头",
+      //       type: "line",
+      //       smooth: false,
+      //       data: [
+      //         1500,
+      //       ],
+      //       itemStyle: {
+      //         normal: {
+      //           color: "rgb(251,222,107)",
+      //           lineStyle: {
+      //             color: "rgb(251,222,107)",
+      //             width: 3,
+      //           },
+      //         },
+      //       },
+      //     },
+      //   ],
+      this.listData.forEach((item) => {
+        let yName = ["头", "百分比", "千克"];
+        seriesData.push({
+          name: yName[item.isPercentage],
+          type: "line",
+          smooth: false,
+          data: item.value,
+        });
+      });
+      let yAxisData = [];
+      if (this.isWeight) {
+        yAxisData.push({
+          type: "value",
+          name: "千克",
+          axisLabel: {
+            show: true,
+            formatter: "{value}",
+          },
+          axisLine: {
+            show: true,
+            lineStyle: {
+              color: "#6e7079",
+            },
+          },
+          axisTick: {
+            show: false,
+          },
+          splitLine: {
+            show: false,
+          },
+        });
+      }
+      if (this.isPercentage) {
+        yAxisData.push({
+          type: "value",
+          name: "百分比",
+          axisLabel: {
+            show: true,
+            formatter: "{value} %",
+          },
+          axisLine: {
+            show: true,
+            lineStyle: {
+              color: "#6e7079",
+            },
+          },
+          axisTick: {
+            show: false,
+          },
+          splitLine: {
+            show: false,
+          },
+        });
+      }
+      if (this.isHead) {
+        yAxisData.push({
+          type: "value",
+          name: "头",
+          axisLabel: {
+            show: true,
+            formatter: "{value}",
+          },
+          axisLine: {
+            show: true,
+            lineStyle: {
+              color: "#6e7079",
+            },
+          },
+          axisTick: {
+            show: false,
+          },
+          splitLine: {
+            show: false,
+          },
+        });
+      }
+      console.log("纵轴坐标", yAxisData);
       let options = {
         title: {
-          text: '重要指标',
+          text: "重要指标",
           x: 10,
-          y: 0
+          y: 0,
         },
         tooltip: {
-          trigger: 'axis',
+          trigger: "axis",
         },
         // legend: {
         //   data: ['头']
         // },
-        color: ['#3aa0ff', '#4dcb73', '#fad337', '#f2637b', '#975fe4'],
+        color: ["#3aa0ff", "#4dcb73", "#fad337", "#f2637b", "#975fe4"],
         grid: {
-          top: '20%',
-          left: '10%',
-          bottom: '10%',
-          right: '10%'
+          top: "20%",
+          left: "10%",
+          bottom: "10%",
+          right: "10%",
         },
         xAxis: [
           {
-            type: 'category',
-            data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
+            type: "category",
+            data: this.listData[0].time,
             axisPointer: {
-              type: 'none'
+              type: "none",
             },
             axisLine: {
               show: true,
               lineStyle: {
-                color: '#6e7079',
-              }
-            },
-            axisTick:{
-              show: true
+                color: "#6e7079",
+              },
             },
-          }
-        ],
-        yAxis: //[
-          {
-            type: 'value',
-            // name: '头',
-            // axisLabel: {
-            //   formatter: '{value} °C'
-            // },
-            axisLine: {
+            axisTick: {
               show: true,
-              lineStyle: {
-                color: '#6e7079',
-              }
             },
-            axisTick:{
-              show:false
-            },
-            splitLine:{
-              show:false
-            }
           },
-          // {
-          //   type: 'value',
-          //   name: '湿度',
-          //   axisLabel: {
-          //     formatter: '{value} RH'
-          //   },
-          //   axisLine: {
-          //     show: false,
-          //     lineStyle: {
-          //       color: '#6e7079',
-          //     }
-          //   },
-          //   axisTick:{
-          //     show:false
-          //   },
-          //   // splitLine:{
-          //   //   show:false
-          //   // }
-          // }
-        //],
-        series: [
-          {
-            name: '头',
-            type: 'line',
-            smooth: false,
-            data: [300, 1000, 1600, 1300, 2300, 2450, 2400, 2000, 2200, 1700, 1800, 1500],
-            itemStyle: {
-              normal: {
-                color: 'rgb(251,222,107)',
-                lineStyle: {
-                  color: 'rgb(251,222,107)',
-                  width: 3
-                }
-              }
-            }
-          }
-        ]
-      }
-      this.myChart.setOption(options);
-    }
+        ],
+        //[
+        yAxis: yAxisData,
+        series: seriesData,
+      };
+      this.myChart.setOption(options, true);
+    },
   },
   mounted() {
-    this.myChart = this.$echarts.init(document.getElementById('importantLine'));
-    this.init();
-  }
-}
+    this.myChart = this.$echarts.init(document.getElementById("importantLine"));
+    // this.init();
+  },
+  watch: {
+    listData(newValue) {
+      console.log("重要指标的图", newValue);
+      this.init();
+    },
+  },
+};
 </script>
 
 <style scoped>