East 3 vuotta sitten
vanhempi
commit
982d6babe3

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 16089 - 21
package-lock.json


+ 55 - 48
src/components/erp/ProductionDonut.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-10-11 14:54:18
- * @LastEditTime: 2021-10-14 17:00:45
+ * @LastEditTime: 2021-11-26 17:40:54
  * @LastEditors: Please set LastEditors
  * @Description: 生产情况的环形图
  * @FilePath: \hyyfClient\src\components\erp\ProductionDonut.vue
@@ -15,41 +15,41 @@
 export default {
   props: {
     id: {
-      type: String,
-      required: true
+      type: Number,
+      required: true,
     },
-    title: {
+    stockName: {
       type: String,
-      required: true
+      required: true,
     },
-    number: {
-      type: Number,
-      required: true
+    stockQuantity: {
+      type: String,
+      required: true,
     },
     color: {
       type: String,
-      required: true
-    }
+      required: true,
+    },
   },
   data() {
     return {
       myChart: null,
-      rest: 0
-    }
+      rest: 0,
+    };
   },
   methods: {
     init() {
-      this.rest = 100 - this.number
-      const useColor = this.color
+      this.rest = 1 - parseFloat(this.stockQuantity);
+      const useColor = this.color;
       let options = {
         title: {
-          text: this.title,
+          text: this.stockName,
           x: 47,
-          y: 175
+          y: 175,
         },
         grid: {
           x: 100,
-          y: 200
+          y: 200,
         },
         // tooltip: {
         //   trigger: 'item',
@@ -71,65 +71,72 @@ export default {
         // },
         graphic: [
           {
-            type: 'text',
-            left: '18%',
-            top: '38%',
+            type: "text",
+            left: "12%",
+            top: "38%",
             style: {
-              text: this.number + '%',
-              fontSize: 40,
-              fill: useColor
-            }
-          }
+              text: (parseFloat(this.stockQuantity) * 100).toFixed(2) + "%",
+              fontSize: 35,
+              fill: useColor,
+            },
+          },
         ],
         series: [
           {
-            name: 'Access From',
-            type: 'pie',
-            radius: ['65%', '80%'], // 半径
-            center: ['30%', '45%'],
+            name: "Access From",
+            type: "pie",
+            radius: ["65%", "80%"], // 半径
+            center: ["30%", "45%"],
             avoidLabelOverlap: false,
             label: {
-              show: false
+              show: false,
             },
             emphasis: {
               label: {
                 show: false,
-                fontSize: '40',
-                fontWeight: 'bold'
-              }
+                fontSize: "40",
+                fontWeight: "bold",
+              },
             },
             labelLine: {
-              show: false
+              show: false,
             },
             itemStyle: {
               normal: {
-                color: function (colors) { // 颜色设置
-                  var colorList = [useColor, '#000000']
-                  return colorList[colors.dataIndex]
+                color: function(colors) {
+                  // 颜色设置
+                  var colorList = [useColor, "#000000"];
+                  return colorList[colors.dataIndex];
                 },
                 // borderWidth: 5, // 设置各项空隙
                 // borderColor: '#fff'
-              }
+              },
             },
             data: [
-              { value: this.number },
-              { value: this.rest }
+              { value: parseFloat(this.stockQuantity) },
+              { value: this.rest },
               // { value: 2032, name: '哺乳仔猪存栏' },
               // { value: 1644, name: '保育猪存栏' },
               // { value: 1546, name: '育肥猪存栏' }
-            ]
-          }
-        ]
+            ],
+          },
+        ],
       };
 
-      this.myChart.setOption(options)
-    }
+      this.myChart.setOption(options);
+    },
   },
   mounted() {
     this.myChart = this.$echarts.init(document.getElementById(this.id));
-    this.init()
-  }
-}
+    this.init();
+  },
+  watch: {
+    stockName(newValue) {
+      console.log(newValue);
+      this.init();
+    },
+  },
+};
 </script>
 <style scoped>
 .production-donut {

+ 1 - 1
src/utils/api.js

@@ -449,7 +449,7 @@ export function getYingShou(data) {
 /** 应付 */
 export function getYingFu(data) {
   return axios({
-    url: '/produce/prodPayable/listPayable',
+    url: '/produce/prodPayableRank/listPayable',
     method: 'get',
     params: data
   })

+ 46 - 1
src/utils/chenApi.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-11-18 13:40:39
- * @LastEditTime: 2021-11-19 14:43:06
+ * @LastEditTime: 2021-11-26 17:35:19
  * @LastEditors: Please set LastEditors
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: \hyyfClient\src\utils\chenApi.js
@@ -44,3 +44,48 @@ export function getCarWashTotal(params) {
     data: params
   })
 }
+
+/** 生产数据 - ERP 数据分析 - 工作看板 */
+// 汇总信息
+export function getWorkTotal(params) {
+  return axios({
+    url: '/produce/prodWorkPlan/listWorkPlan',
+    method: 'get',
+    params: params
+  })
+}
+// 报警信息
+export function getWorkInfos(params) {
+  return axios({
+    url: '/produce/prodWarningMsg/listWarningMsg',
+    method: 'post',
+    data: params
+  })
+}
+
+/**  生产数据 - ERP 数据分析 - 安全库存报警 */
+export function getSafeInventory(params) {
+  return axios({
+    url: '/produce/prodGoodsWarning/listGoodsWarning',
+    method: 'get',
+    params: params
+  })
+}
+
+/** 生产数据 - ERP - 生产情况 */
+export function getProductionCondition(params) {
+  return axios({
+    url: '/produce/prodProduce/listProducee',
+    method: 'get',
+    params: params
+  })
+}
+
+/** 生产数据 - ERP - 重要指标折线图 */
+export function getImportantData(params) {
+  return axios({
+    url: '/produce/prodProduce/listImportance',
+    method: 'post',
+    data: params
+  })
+}

+ 370 - 196
src/views/PdcData/Analysis.vue

@@ -3,13 +3,18 @@
     <!-- 工作看板 -->
     <board :title="title[0]">
       <div>
-        <work-infos :dataList="workInfos" @workInfoClick="handleWorkInfoClick"></work-infos>
+        <work-infos :dataList="workInfos" @workInfoClick="handleWorkInfoClick">
+        </work-infos>
         <div class="table-content">
-          <table-content 
-            :tableItems="tableItems" 
-            :height="height" 
+          <table-content
+            :tableItems="tableItems"
+            :height="height"
             :shows="tableShows"
-            :listData="tableData">
+            :listData="tableData"
+          >
+            <template v-slot:handleState="slotProps">
+              {{ slotProps.row.handleState ? "已处理" : "未处理" }}
+            </template>
           </table-content>
         </div>
       </div>
@@ -22,7 +27,9 @@
           <!-- 存栏结构 -->
           <chart-inventory-pie :data="inventoryPieData"></chart-inventory-pie>
           <!-- 存栏变动 -->
-          <chart-inventory-lines :data="inventoryLinesData"></chart-inventory-lines>
+          <chart-inventory-lines
+            :data="inventoryLinesData"
+          ></chart-inventory-lines>
         </div>
         <div>
           <!-- 存栏计数 -->
@@ -49,7 +56,8 @@
               v-for="item in costOptions"
               :key="item.value"
               :label="item.label"
-              :value="item.value">
+              :value="item.value"
+            >
             </el-option>
           </el-select>
         </div>
@@ -67,15 +75,18 @@
       <!-- 重要指标 -->
       <div class="important">
         <div class="condition">
-          <el-select 
-            size="small" 
+          <el-select
+            size="small"
             v-model="importantValue"
-            style="margin-right: 20px">
+            style="margin-right: 20px"
+            @change="changeImportantValue"
+          >
             <el-option
               v-for="item in importantOptions"
-              :key="item.value"
+              :key="item.type"
               :label="item.label"
-              :value="item.value">
+              :value="item.type"
+            >
             </el-option>
           </el-select>
           <el-date-picker
@@ -84,7 +95,10 @@
             type="daterange"
             range-separator="至"
             start-placeholder="开始日期"
-            end-placeholder="结束日期">
+            end-placeholder="结束日期"
+            value-format="yyyy-MM-dd"
+            @change="changeImportantDates"
+          >
           </el-date-picker>
         </div>
         <div class="important-chart">
@@ -95,7 +109,6 @@
       <!-- 销售情况 -->
       <div class="sales">
         <div class="sales-condition">
-          <!-- <x-form :formItems="salesFormItems" :day="salesDay" @setDay="salesSetDay" @onClickType="salesOnClickType"></x-form> -->
           <el-date-picker
             v-model="getSalesDates"
             type="datetimerange"
@@ -104,7 +117,8 @@
             start-placeholder="开始日期"
             end-placeholder="结束日期"
             align="right"
-            size="small">
+            size="small"
+          >
           </el-date-picker>
         </div>
         <div class="sales-content">
@@ -114,10 +128,17 @@
               <span>{{ weekSales }}元</span>
               <div class="sales-change">
                 <div>
-                  <div class="triangle-change" :class="weekSalesChange>0? 'triangle-up': 'triangle-down'"></div>
-                  <span :class="weekSalesChange>0? 'color-up': 'color-down'">{{ weekSalesChange }}%</span>
+                  <div
+                    class="triangle-change"
+                    :class="
+                      weekSalesChange > 0 ? 'triangle-up' : 'triangle-down'
+                    "
+                  ></div>
+                  <span :class="weekSalesChange > 0 ? 'color-up' : 'color-down'"
+                    >{{ weekSalesChange }}%</span
+                  >
                   &nbsp;&nbsp;&nbsp;同比上周
-                  </div>
+                </div>
               </div>
             </div>
             <div class="down">
@@ -125,8 +146,21 @@
               <span>{{ weekSalesVolume }}元</span>
               <div class="sales-change">
                 <div>
-                  <div class="triangle-change" :class="weekSalesVolumeChange>0? 'triangle-up': 'triangle-down'"></div>
-                  <span :class="weekSalesVolumeChange>0? 'color-up': 'color-down'">{{ weekSalesVolumeChange }}%</span>
+                  <div
+                    class="triangle-change"
+                    :class="
+                      weekSalesVolumeChange > 0
+                        ? 'triangle-up'
+                        : 'triangle-down'
+                    "
+                  ></div>
+                  <span
+                    :class="
+                      weekSalesVolumeChange > 0 ? 'color-up' : 'color-down'
+                    "
+                  >
+                    {{ weekSalesVolumeChange }}%
+                  </span>
                   &nbsp;&nbsp;&nbsp;同比上周
                 </div>
               </div>
@@ -140,65 +174,89 @@
     </board>
 
     <!-- 应收排名 -->
-    <board :title="title[4]">
-      <table-content 
-        :tableItems="yingshouTableItems" 
-        :height="height" 
+    <!-- <board :title="title[4]">
+      <table-content
+        :tableItems="yingshouTableItems"
+        :height="height"
         :shows="yingshouTableShows"
-        :listData="yingshouTableData">
+        :listData="yingshouTableData"
+      >
       </table-content>
-    </board>
+    </board> -->
 
     <!-- 应付排名 -->
     <board :title="title[5]">
-      <table-content 
-        :tableItems="yingshouTableItems" 
-        :height="height" 
+      <table-content
+        :tableItems="yingshouTableItems"
+        :height="height"
         :shows="yingshouTableShows"
-        :listData="yingfuTableData">
+        :listData="yingfuTableData"
+      >
       </table-content>
     </board>
 
     <!-- 安全库存报警 -->
     <board :title="title[6]">
-      <table-content 
-        :tableItems="safetyTableItems" 
-        :height="height" 
+      <table-content
+        :tableItems="safetyTableItems"
+        :height="height"
         :shows="safetyTableShows"
-        :listData="safetyTableData">
+        :listData="safetyTableData"
+      >
       </table-content>
       <table-footer
         :totals="total"
         :size="size"
         @sizeChange="sizeChange"
-        @pageChange="pageChange">
+        @pageChange="pageChange"
+      >
       </table-footer>
     </board>
   </div>
 </template>
 
 <script>
-import Board from 'components/board/index.vue'
-import WorkInfos from './analysis/WorkInfos.vue'
-import TableContent from 'components/newTable/TableContent.vue'
-import ChartInventoryPie from './analysis/ChartInventoryPie.vue'
-import ChartInventoryLines from './analysis/ChartInventoryLines.vue'
-import InventoryItems from './analysis/InventoryItems.vue'
-import ProductionDonuts from './analysis/ProductionDonuts.vue'
-import ProductionItems from './analysis/ProductionItems.vue'
-import CostPie from './analysis/CostPie.vue'
-import CostHistogram from './analysis/CostHistogram.vue'
-import ImportantLine from './analysis/ImportantLine.vue'
-// import XForm from "components/XForm";
-import SalesChart from './analysis/SalesChart.vue'
-import TableFooter from "../../components/TableFooter"
+import Board from "components/board/index.vue";
+import WorkInfos from "./analysis/WorkInfos.vue";
+import TableContent from "components/newTable/TableContent.vue";
+import ChartInventoryPie from "./analysis/ChartInventoryPie.vue";
+import ChartInventoryLines from "./analysis/ChartInventoryLines.vue";
+import InventoryItems from "./analysis/InventoryItems.vue";
+import ProductionDonuts from "./analysis/ProductionDonuts.vue";
+import ProductionItems from "./analysis/ProductionItems.vue";
+import CostPie from "./analysis/CostPie.vue";
+import CostHistogram from "./analysis/CostHistogram.vue";
+import ImportantLine from "./analysis/ImportantLine.vue";
+import SalesChart from "./analysis/SalesChart.vue";
+import TableFooter from "../../components/TableFooter";
 
-import { tableItems, tableShows } from './analysis/table.config'
-import { yingshouTableItems, yingshouTableShows } from './analysis/yingshouTable.config'
-import { safetyTableItems, safetyTableShows } from './analysis/safetyTable.config'
+import { tableItems, tableShows } from "./analysis/table.config";
+import {
+  yingshouTableItems,
+  yingshouTableShows,
+} from "./analysis/yingshouTable.config";
+import {
+  safetyTableItems,
+  safetyTableShows,
+} from "./analysis/safetyTable.config";
 // import { formItems } from './analysis/salesXForm.config'
 
-import { getInventoryLines, getInventoryAndProduct, getSalesChange, getSalesChart, getCosts, getYingShou, getYingFu } from 'utils/api'
+import {
+  getInventoryLines,
+  getInventoryAndProduct,
+  getSalesChange,
+  getSalesChart,
+  getCosts,
+  // getYingShou,
+  getYingFu,
+} from "utils/api";
+import {
+  getWorkTotal,
+  getWorkInfos,
+  getSafeInventory,
+  getProductionCondition,
+  getImportantData,
+} from "utils/chenApi";
 
 export default {
   name: "Analysis",
@@ -216,46 +274,54 @@ export default {
     ImportantLine,
     // XForm,
     SalesChart,
-    TableFooter
+    TableFooter,
   },
   data() {
     return {
-      title: ['工作看板', '存栏情况', '生产情况', '经营分析', '应收排名', '应付排名', '安全库存报警'],
+      title: [
+        "工作看板",
+        "存栏情况",
+        "生产情况",
+        "经营分析",
+        "应收排名",
+        "应付排名",
+        "安全库存报警",
+      ],
       workInfos: [
         {
-          label: '预警信息',
-          number: 10
+          label: "预警信息",
+          number: 10,
         },
         {
-          label: '断奶数量',
-          number: 1150
+          label: "断奶数量",
+          number: 1150,
         },
         {
-          label: '配种数量',
-          number: 1540
+          label: "配种数量",
+          number: 1540,
         },
         {
-          label: '转舍计划',
-          number: 108
+          label: "转舍计划",
+          number: 108,
         },
         {
-          label: '分娩数量',
-          number: 180
+          label: "分娩数量",
+          number: 180,
         },
         {
-          label: '日常计划',
-          number: 10
+          label: "日常计划",
+          number: 10,
         },
         {
-          label: '天才计划',
-          number: 10
+          label: "天才计划",
+          number: 10,
         },
         {
-          label: '保健计划',
-          number: 10
-        }
+          label: "保健计划",
+          number: 10,
+        },
       ],
-      tableItems: [], 
+      tableItems: [],
       tableShows: {},
       height: 300,
       tableData: [],
@@ -268,13 +334,31 @@ export default {
       productionItems: [], // 下面块图的数据
       // 经营分析
       costOptions: [],
-      costValue: '',
+      costValue: "",
       costPieData: [], // 经营分析 - 成本分析环形图
       costHisData: [], // 经营分析 - 柱状图
       // 重要指标
-      importantOptions: [],
-      importantValue: '',
+      importantOptions: [
+        {
+          type: 1,
+          label: "配种指标",
+        },
+        {
+          type: 2,
+          label: "分娩指标",
+        },
+        {
+          type: 3,
+          label: "断奶指标",
+        },
+        {
+          type: 4,
+          label: "成活率指标",
+        },
+      ],
+      importantValue: "",
       importantDates: [],
+      importantData: [], // 重要指标折线图数据
       // 销售额
       // salesFormItems: [],
       salesDay: 2, //默认选择本周
@@ -283,32 +367,37 @@ export default {
       weekSalesVolume: 1000,
       weekSalesVolumeChange: -10,
       getSalesDates: [], // 销售图的时间选择
-      pickerOptions: { // 快捷选项
-        shortcuts: [{
-          text: '最近一周',
-          onClick(picker) {
-            const end = new Date();
-            const start = new Date();
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
-            picker.$emit('pick', [start, end]);
-          }
-        }, {
-          text: '最近一个月',
-          onClick(picker) {
-            const end = new Date();
-            const start = new Date();
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
-            picker.$emit('pick', [start, end]);
-          }
-        }, {
-          text: '最近三个月',
-          onClick(picker) {
-            const end = new Date();
-            const start = new Date();
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
-            picker.$emit('pick', [start, end]);
-          }
-        }]
+      pickerOptions: {
+        // 快捷选项
+        shortcuts: [
+          {
+            text: "最近一周",
+            onClick(picker) {
+              const end = new Date();
+              const start = new Date();
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
+              picker.$emit("pick", [start, end]);
+            },
+          },
+          {
+            text: "最近一个月",
+            onClick(picker) {
+              const end = new Date();
+              const start = new Date();
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+              picker.$emit("pick", [start, end]);
+            },
+          },
+          {
+            text: "最近三个月",
+            onClick(picker) {
+              const end = new Date();
+              const start = new Date();
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
+              picker.$emit("pick", [start, end]);
+            },
+          },
+        ],
       },
       salesChartData: {}, // 销售图的数据
       // 应收排名
@@ -324,28 +413,31 @@ export default {
       total: 0,
       size: 20,
       pageNum: 1,
-    }
+    };
   },
   mounted() {
     // this.salesFormItems = formItems
-    this.tableItems = tableItems
-    this.tableShows = tableShows
-    this.yingshouTableItems = yingshouTableItems
-    this.yingshouTableShows = yingshouTableShows
-    this.safetyTableItems = safetyTableItems
-    this.safetyTableShows = safetyTableShows
+    this.tableItems = tableItems;
+    this.tableShows = tableShows;
+    this.yingshouTableItems = yingshouTableItems;
+    this.yingshouTableShows = yingshouTableShows;
+    this.safetyTableItems = safetyTableItems;
+    this.safetyTableShows = safetyTableShows;
     /** 获取网络请求数据 */
-    this.initInventoryLines()
-    this.initInventoryAndProduct()
-    this.initSalesChange()
-    this.initSalesChart()
-    this.initCosts()
-    this.initYingShou()
-    this.initYingFu()
+    this.initInventoryLines();
+    this.initInventoryAndProduct();
+    this.initSalesChange();
+    this.initSalesChart();
+    this.initCosts();
+    // this.initYingShou();
+    this.initYingFu();
+    this.initWorkBoard(); // 工作看板
+    this.initSafeInventory(); // 安全库存报警
+    this.initProductionCondition(); // 生产情况
   },
   methods: {
     handleWorkInfoClick(item) {
-      console.log(item)
+      console.log(item);
     },
     // 修改size
     sizeChange(val) {
@@ -354,33 +446,40 @@ export default {
     },
     // 修改页数
     pageChange(val) {
-      this.pageNum= val;
+      this.pageNum = val;
       this.init();
     },
     init() {
       let params = {
         pageNum: this.pageNum,
         pageSize: this.size,
-        searchStr: this.keyword
-      }
-      console.log(params)
+        searchStr: this.keyword,
+      };
+      console.log(params);
       // 获取后端数据
     },
     // 销售额选中日期
     salesSetDay(data) {
       this.salesDay = data;
-      console.log(this.salesDay)
+      console.log(this.salesDay);
     },
     // 销售额选中日周月
     salesOnClickType(data) {
-      console.log(data)
+      console.log(data);
+    },
+    // 工作看板
+    initWorkBoard() {
+      getWorkTotal({}).then(async (res) => {
+        this.workInfos = res.data;
+        const result = await getWorkInfos({});
+        this.tableData = result.data;
+      });
     },
     // 存栏情况 - 存栏变动折线图数据请求
     initInventoryLines() {
-      getInventoryLines({}).then(res => {
+      getInventoryLines({}).then((res) => {
         if (res.code === 10000) {
-          this.inventoryLinesData = res.data
-          console.log(this.inventoryLinesData)
+          this.inventoryLinesData = res.data;
         } else {
           this.inventoryLinesData = {
             boarStock: [],
@@ -388,23 +487,42 @@ export default {
             griceStock: [],
             month: [],
             pigletStock: [],
-            sowStock: []
-          }
+            sowStock: [],
+          };
         }
-      })
+      });
     },
     // 存栏情况 + 生产情况
     initInventoryAndProduct() {
-      getInventoryAndProduct({}).then(res => {
+      getInventoryAndProduct({}).then((res) => {
         if (res.code === 10000) {
           // this.inventoryLinesData = res.data
-          console.log(res.data)
-          this.inventoryPieData = res.data.slice(0, 6)
-          console.log('-----------存栏结构数据')
-          console.log(this.inventoryPieData)
-          this.inventoryItemsData = [res.data[1].stockQuantity, res.data[6].stockQuantity, res.data[7].stockQuantity, res.data[8].stockQuantity, res.data[2].stockQuantity, res.data[9].stockQuantity]
-          this.productionPercents = [res.data[12].rate*100, res.data[13].rate*100, res.data[14].rate*100, res.data[15].rate*100, res.data[16].rate*100]
-          this.productionItems = [res.data[17].stockQuantity, res.data[18].stockQuantity, res.data[19].stockQuantity, res.data[20].stockQuantity, res.data[21].stockQuantity, res.data[22].stockQuantity, res.data[23].stockQuantity, res.data[24].stockQuantity]
+          console.log(res.data);
+          // this.inventoryPieData = res.data.slice(0, 6)
+          this.inventoryPieData = [
+            res.data["sow_stock"],
+            res.data["boar_stock"],
+            res.data["grice_stock"],
+            res.data["piglet_stock"],
+            res.data["fatpig_stock"],
+          ];
+          this.inventoryItemsData = [
+            res.data["sow_stock"].stockQuantity,
+            res.data["sow_stock_1"].stockQuantity,
+            res.data["sow_stock_2"].stockQuantity,
+            res.data["sow_stock_3"].stockQuantity,
+            res.data["boar_stock"].stockQuantity,
+            res.data["business_stock"].stockQuantity,
+          ];
+          // this.productionPercents = [
+          //   res.data[12].rate * 100,
+          //   res.data[13].rate * 100,
+          //   res.data[14].rate * 100,
+          //   res.data[15].rate * 100,
+          //   res.data[16].rate * 100,
+          // ];
+          // this.productionPercents = [res.data[12].rate*100, res.data[13].rate*100, res.data[14].rate*100, res.data[15].rate*100, res.data[16].rate*100]
+          // this.productionItems = [res.data[17].stockQuantity, res.data[18].stockQuantity, res.data[19].stockQuantity, res.data[20].stockQuantity, res.data[21].stockQuantity, res.data[22].stockQuantity, res.data[23].stockQuantity, res.data[24].stockQuantity]
         } else {
           // this.inventoryLinesData = {
           //   boarStock: [],
@@ -415,82 +533,138 @@ export default {
           //   sowStock: []
           // }
         }
-      })
+      });
     },
     // 经营分析 - 销售改变
     initSalesChange() {
-      getSalesChange({}).then(res => {
+      getSalesChange({}).then((res) => {
         if (res.code === 10000) {
-          this.weekSales = res.data.quantityAll
-          this.weekSalesChange = res.data.quantityType? res.data.quantityPercentage: -res.data.quantityPercentage
-          this.weekSalesVolume = res.data.saleAll
-          this.weekSalesVolumeChange = res.data.saleType? res.data.salePercentage: -res.data.salePercentage
+          this.weekSales = res.data.quantityAll;
+          this.weekSalesChange = res.data.quantityType
+            ? res.data.quantityPercentage
+            : -res.data.quantityPercentage;
+          this.weekSalesVolume = res.data.saleAll;
+          this.weekSalesVolumeChange = res.data.saleType
+            ? res.data.salePercentage
+            : -res.data.salePercentage;
         } else {
-          this.weekSales = 0
-          this.weekSalesChange = 0
-          this.weekSalesVolume = 0
-          this.weekSalesVolumeChange = 0
+          this.weekSales = 0;
+          this.weekSalesChange = 0;
+          this.weekSalesVolume = 0;
+          this.weekSalesVolumeChange = 0;
         }
-      })
+      });
     },
     // 经营分析 - 销售情况图
     initSalesChart() {
       const params = {
-        beginDate: this.getSalesDates[0] || '',
-        endDate: this.getSalesDates[1] || ''
-      }
-      console.log('我要放参数了', params)
-      getSalesChart(params).then(res => {
+        beginDate: this.getSalesDates[0] || "",
+        endDate: this.getSalesDates[1] || "",
+      };
+      console.log("我要放参数了", params);
+      getSalesChart(params).then((res) => {
         if (res.code === 10000) {
-          this.salesChartData = res.data
-          console.log(this.salesChartData)
+          this.salesChartData = res.data;
+          console.log(this.salesChartData);
         }
-      })
+      });
     },
     // 经营分析 - 成本分析
     initCosts() {
-      getCosts({}).then(res => {
+      getCosts({}).then((res) => {
         if (res.code === 10000) {
-          this.costPieData = []
-          res.data.forEach(item => {
+          this.costPieData = [];
+          res.data.forEach((item) => {
             this.costPieData.push({
               name: item.costName,
-              value: item.costRate
-            })
-          })
-          this.costHisData = []
-          res.data.forEach(item => {
-            this.costHisData.push(item.costVal)
-          })
+              value: item.costRate,
+            });
+          });
+          this.costHisData = [];
+          res.data.forEach((item) => {
+            this.costHisData.push(item.costVal);
+          });
         }
-      })
+      });
     },
-    // 应收排名
-    initYingShou() {
-      getYingShou({}).then(res => {
-        console.log('应收', res)
+    // // 应收排名
+    // initYingShou() {
+    //   getYingShou({}).then((res) => {
+    //     console.log("应收", res);
+    //     if (res.code === 10000) {
+    //       this.yingshouTableData = res.data;
+    //     }
+    //   });
+    // },
+    // 应付排名
+    initYingFu() {
+      getYingFu({}).then((res) => {
+        console.log("应付", res);
         if (res.code === 10000) {
-          this.yingshouTableData = res.data
+          this.yingfuTableData = res.data;
         }
-      })
+      });
     },
-    // 应付排名
-    initYingFu() {
-      getYingFu({}).then(res => {
-        console.log('应付', res)
+    // 安全库存报警
+    initSafeInventory() {
+      getSafeInventory({
+        current: this.size,
+        size: this.pageNum,
+      }).then((res) => {
+        console.log(res);
+      });
+    },
+    // 生产情况
+    initProductionCondition() {
+      getProductionCondition({}).then((res) => {
+        console.log(res.data);
         if (res.code === 10000) {
-          this.yingfuTableData = res.data
+          this.productionPercents = [
+            { ...res.data["grice_rate"], color: "rgb(112,249,250)" },
+            { ...res.data["piglet_rate"], color: "rgb(51, 211, 137)" },
+            { ...res.data["fatpig_rate"], color: "rgb(255, 125, 0)" },
+            { ...res.data["break_rate"], color: "rgb(2, 167, 240)" },
+            // FIXME: 配种分娩率没有,也不能随便放 color: "rgb(112, 0, 217)"
+          ];
+          this.productionItems = [
+            res.data["avg_farrow_1"].stockQuantity,
+            res.data["avg_farrow_2"].stockQuantity,
+            res.data["avg_farrow_3"].stockQuantity,
+            res.data["break_grice"].stockQuantity,
+            res.data["avg_weight"].stockQuantity,
+            res.data["avg_weight"].stockQuantity, // FIXME: 没有数据,随便放一个先
+            res.data["nest_times"].stockQuantity,
+            res.data["psy"].stockQuantity,
+          ];
         }
-      })
-    }
+      });
+    },
+    // 重要指标折线图
+    initImportantData() {
+      getImportantData({
+        startDate: this.importantDates[0],
+        endDate: this.importantDates[1],
+        type: this.importantValue,
+      }).then((res) => {
+        console.log("重要指标数据----------------", res);
+      });
+    },
+    // 重要指标的 type 改变
+    changeImportantValue() {
+      this.initImportantData();
+    },
+    // 重要指标的时间改变
+    changeImportantDates() {
+      this.initImportantData();
+    },
   },
   watch: {
     getSalesDates(newValue) {
-      this.getSalesDates = newValue
-      this.initSalesChart()
-    }
-  }
-}
+      this.getSalesDates = newValue;
+      this.initSalesChart();
+    },
+  },
+};
 </script>
 
 <style scoped>
@@ -509,7 +683,7 @@ export default {
   border-bottom: 1px solid rgba(228, 228, 228, 1);
   position: relative;
 }
-.cost>.select {
+.cost > .select {
   position: absolute;
   right: 0;
   margin: 20px;
@@ -524,7 +698,7 @@ export default {
 .cost-right {
   flex: 1;
 }
-.cost>.label {
+.cost > .label {
   text-align: center;
   font-weight: bold;
   font-size: 18px;
@@ -535,7 +709,7 @@ export default {
   position: relative;
   border-bottom: 1px solid rgba(228, 228, 228, 1);
 }
-.important>.condition {
+.important > .condition {
   position: absolute;
   right: 0;
   margin-right: 20px;
@@ -556,32 +730,32 @@ export default {
   width: 100%;
   display: flex;
   flex-direction: row;
-  justify-content: space-around
+  justify-content: space-around;
 }
 .sales-left {
   width: 15%;
   line-height: 25px;
   padding-top: 30px;
 }
-.sales-left>.up {
+.sales-left > .up {
   margin-bottom: 20px;
 }
-.sales-left>.up>label,
-.sales-left>.down>label {
+.sales-left > .up > label,
+.sales-left > .down > label {
   display: block;
   text-align: center;
   font-size: 13px;
   color: #999;
 }
-.sales-left>.up>span,
-.sales-left>.down>span {
+.sales-left > .up > span,
+.sales-left > .down > span {
   display: block;
   text-align: center;
   font-size: 16px;
   color: #333;
 }
-.sales-left>.up>.sales-change,
-.sales-left>.down>.sales-change {
+.sales-left > .up > .sales-change,
+.sales-left > .down > .sales-change {
   display: flex;
   justify-content: space-around;
   font-size: 13px;

+ 16 - 14
src/views/PdcData/analysis/ChartInventoryPie.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-09-30 15:46:57
- * @LastEditTime: 2021-10-21 18:08:06
+ * @LastEditTime: 2021-11-25 09:56:31
  * @LastEditors: Please set LastEditors
  * @Description: 存栏结构图
  * @FilePath: \hyyfClient\src\views\PdcData\analysis\ChartInventoryPie.vue
@@ -27,7 +27,7 @@ export default {
   methods: {
     init() {
       const _this = this
-      let total = this.data[1].stockQuantity + this.data[2].stockQuantity + this.data[3].stockQuantity + this.data[4].stockQuantity + this.data[5].stockQuantity
+      let total = this.data.reduce((prev, item) => prev + item.stockQuantity, 0)
       let options = {
         title: {
           text: '存栏结构',
@@ -56,13 +56,15 @@ export default {
           },
           formatter: function (name) {
             var legendIndex = 0;
-            var clientLabels = [
-              { name: '母猪存栏', percent: parseFloat(_this.data[1].stockQuantity / total)*100 + '%', number: _this.data[1].stockQuantity },
-              { name: '公猪存栏', percent:  parseFloat(_this.data[2].stockQuantity / total)*100 + '%', number: _this.data[2].stockQuantity },
-              { name: '哺乳仔猪存栏', percent:  parseFloat(_this.data[3].stockQuantity / total)*100 + '%', number: _this.data[3].stockQuantity },
-              { name: '保育猪存栏', percent:  parseFloat(_this.data[4].stockQuantity / total)*100 + '%', number: _this.data[4].stockQuantity },
-              { name: '育肥猪存栏', percent:  parseFloat(_this.data[5].stockQuantity / total)*100 + '%', number: _this.data[5].stockQuantity },
-            ]
+            const clientLabels = []
+            // 将右侧文字备注放上去
+            _this.data.forEach(item => {
+              clientLabels.push({
+                name: item.stockName,
+                percent: (parseFloat(item.stockQuantity / total) * 100).toFixed(2) + '%',
+                number: item.stockQuantity
+              })
+            })
             clientLabels.forEach(function (value, i) {
                 if (value.name == name) {
                     legendIndex = i;
@@ -125,11 +127,11 @@ export default {
               }
             },
             data: [
-              { value: this.data[1].stockQuantity, name: '母猪存栏' },
-              { value: this.data[2].stockQuantity, name: '公猪存栏' },
-              { value: this.data[3].stockQuantity, name: '哺乳仔猪存栏' },
-              { value: this.data[4].stockQuantity, name: '保育猪存栏' },
-              { value: this.data[5].stockQuantity, name: '育肥猪存栏' }
+              { value: this.data[0].stockQuantity, name: '母猪存栏' },
+              { value: this.data[1].stockQuantity, name: '公猪存栏' },
+              { value: this.data[2].stockQuantity, name: '哺乳仔猪存栏' },
+              { value: this.data[3].stockQuantity, name: '保育猪存栏' },
+              { value: this.data[4].stockQuantity, name: '育肥猪存栏' }
             ]
           }
         ]

+ 31 - 21
src/views/PdcData/analysis/InventoryItems.vue

@@ -1,9 +1,9 @@
 <!--
  * @Author: your name
  * @Date: 2021-10-11 10:10:26
- * @LastEditTime: 2021-10-21 16:42:37
+ * @LastEditTime: 2021-11-26 14:04:57
  * @LastEditors: Please set LastEditors
- * @Description: In User Settings Edit
+ * @Description: 存栏情况 - 下面 item 的数字
  * @FilePath: \hyyfClient\src\views\PdcData\analysis\InventoryItems.vue
 -->
 <template>
@@ -63,7 +63,7 @@
       </template>
       <template v-slot:dataNum>
         <div>
-          {{data[3] }}
+          {{ data[3] }}
         </div>
       </template>
     </inventory-item>
@@ -103,25 +103,35 @@
   </div>
 </template>
 <script>
-import InventoryItem from 'components/erp/InventoryItem.vue'
+import InventoryItem from "components/erp/InventoryItem.vue";
 
 export default {
   props: {
     data: {
       type: Array,
-      default: () => ([1, 1, 1, 1, 1, 1])
-    }
+      default: () => [1, 1, 1, 1, 1, 1],
+    },
+  },
+  data() {
+    return {
+      getData: [],
+    };
   },
   components: {
-    InventoryItem
+    InventoryItem,
+  },
+  mounted() {
+    console.log("-----------------------");
+    console.log(this.data);
   },
   watch: {
-    // data(newValue) {
-    //   this.getData = newValue
-    //   console.log('-------------------------', this.getData.length)
-    // }
-  }
-}
+    data(newValue) {
+      this.getData = newValue;
+      console.log(this.getData, "-------------------------");
+      console.log("-------------------------", this.getData.length);
+    },
+  },
+};
 </script>
 <style scoped>
 .inventory-items {
@@ -135,29 +145,29 @@ export default {
 }
 /* 母猪存栏图片 */
 .picture01 {
-  background: url('~assets/images/erpAnalysis/u3827.svg') no-repeat 50%;
+  background: url("~assets/images/erpAnalysis/u3827.svg") no-repeat 50%;
   background-size: 50%;
 }
 /* 妊娠 */
 .picture02 {
-  background: url('~assets/images/erpAnalysis/u3828.svg') no-repeat 50%;
+  background: url("~assets/images/erpAnalysis/u3828.svg") no-repeat 50%;
   background-size: 50%;
 }
 /* 哺乳 */
 .picture03 {
-  background: url('~assets/images/erpAnalysis/u3829.svg') no-repeat 50%;
+  background: url("~assets/images/erpAnalysis/u3829.svg") no-repeat 50%;
   background-size: 50%;
 }
 /* 空怀 */
 .picture04 {
-  background: url('~assets/images/erpAnalysis/u3831.svg') no-repeat 50%;
+  background: url("~assets/images/erpAnalysis/u3831.svg") no-repeat 50%;
   background-size: 50%;
 }
 .parent {
   position: relative;
 }
 .blank {
-  background: url('~assets/images/erpAnalysis/u3832.svg') no-repeat 50%;
+  background: url("~assets/images/erpAnalysis/u3832.svg") no-repeat 50%;
   position: absolute;
   top: 0;
   left: 5px;
@@ -166,16 +176,16 @@ export default {
 }
 /* 公猪 */
 .picture05 {
-  background: url('~assets/images/erpAnalysis/u3686.svg') no-repeat 50%;
+  background: url("~assets/images/erpAnalysis/u3686.svg") no-repeat 50%;
   background-size: 50%;
 }
 /* 商品 */
 .picture06 {
-  background: url('~assets/images/erpAnalysis/u3834.svg') no-repeat 50%;
+  background: url("~assets/images/erpAnalysis/u3834.svg") no-repeat 50%;
   background-size: 50%;
 }
 .sale {
-  background: url('~assets/images/erpAnalysis/u3835.svg') no-repeat 50%;
+  background: url("~assets/images/erpAnalysis/u3835.svg") no-repeat 50%;
   position: absolute;
   top: 30px;
   right: 53px;

+ 14 - 45
src/views/PdcData/analysis/ProductionDonuts.vue

@@ -1,73 +1,42 @@
 <!--
  * @Author: your name
  * @Date: 2021-10-11 14:56:37
- * @LastEditTime: 2021-10-21 17:52:11
+ * @LastEditTime: 2021-11-25 16:23:07
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: \hyyfClient\src\views\PdcData\analysis\ProductionDonuts.vue
 -->
 <template>
   <div class="production-donuts">
-    <template v-for="item in datas">
-      <production-donut :key="item.title" v-bind="item"></production-donut>
-    </template>
+    <production-donut v-for="item in datas" :key="item.id" v-bind="item">
+    </production-donut>
   </div>
 </template>
 <script>
-import ProductionDonut from 'components/erp/ProductionDonut'
+import ProductionDonut from "components/erp/ProductionDonut";
 
 export default {
   props: {
     data: {
       type: Array,
-      required: true
-    }
+      required: true,
+    },
   },
   data() {
     return {
-      datas: []
-    }
+      datas: [],
+    };
   },
   watch: {
     data(newValue) {
-      this.datas = [
-        {
-          id: 'chart01',
-          title: '产房成活率',
-          number: newValue[0],
-          color: 'rgb(112,249,250)'
-        },
-        {
-          id: 'chart02',
-          title: '保育成活率',
-          number: newValue[1],
-          color: 'rgb(51, 211, 137)'
-        },
-        {
-          id: 'chart03',
-          title: '育肥成活率',
-          number: newValue[2],
-          color: 'rgb(255, 125, 0)'
-        },
-        {
-          id: 'chart04',
-          title: '7日内断配率',
-          number: newValue[3],
-          color: 'rgb(2, 167, 240)'
-        },
-        {
-          id: 'chart05',
-          title: '配种分娩率',
-          number: newValue[4],
-          color: 'rgb(112, 0, 217)'
-        }
-      ]
-    }
+      this.datas = newValue;
+      console.log(this.datas, "++++++++++++++++++");
+    },
   },
   components: {
-    ProductionDonut
-  }
-}
+    ProductionDonut,
+  },
+};
 </script>
 <style scoped>
 .production-donuts {

+ 5 - 4
src/views/PdcData/analysis/WorkInfos.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-09-28 11:28:08
- * @LastEditTime: 2021-09-28 13:49:48
+ * @LastEditTime: 2021-11-25 13:43:25
  * @LastEditors: Please set LastEditors
  * @Description: 工作看板的预警信息等统计
  * @FilePath: \hyyfClient\src\views\PdcData\analysis\WorkInfos.vue
@@ -10,10 +10,10 @@
   <div class="work-info">
     <el-row>
       <template v-for="item in dataList">
-        <el-col :span="12" :key="item.label">
+        <el-col :span="12" :key="item.id">
           <div class="item" @click="handleClick(item)">
-            <span class="label">{{ item.label }}</span>
-            <span class="right">(<span class="number">{{ item.number }}</span>)</span>
+            <span class="label">{{ item.planName }}</span>
+            <span class="right">(<span class="number">{{ item.planTimes }}</span>)</span>
           </div>
         </el-col>
       </template>
@@ -45,6 +45,7 @@ export default {
     border-bottom: 1px solid rgba(235, 238, 245, 1);
     font-size: 13px;
     margin: 0px 10px;
+    cursor: pointer;
   }
   .item:hover {
     background-color: #eee;

+ 13 - 12
src/views/PdcData/analysis/safetyTable.config.js

@@ -1,40 +1,41 @@
 /*
  * @Author: your name
  * @Date: 2021-10-11 16:19:57
- * @LastEditTime: 2021-10-12 09:27:29
+ * @LastEditTime: 2021-11-25 14:33:43
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: \hyyfClient\src\views\PdcData\analysis\safetyTable.config.js
  */
 export const safetyTableItems = [
   {
-    prop: 'time',
+    prop: 'warningTime',
     label: '报警时间',
     minWidth: '200',
-    slotName: 'time'
+    slotName: 'warningTime'
   },
   {
-    prop: 'content',
+    prop: 'goods',
     label: '报警物品',
     minWidth: '400',
-    slotName: 'content'
+    slotName: 'goods'
   },
   {
-    prop: 'now',
+    prop: 'quantity',
     label: '目前数量',
     minWidth: '200',
-    slotName: 'now'
+    slotName: 'quantity'
   },
   {
-    prop: 'safe',
+    prop: 'safeLine',
     label: '安全存储数量',
     minWidth: '200',
-    slotName: 'safe'
+    slotName: 'safeLine'
   },
   {
-    label: '操作',
-    minWidth: '150',
-    slotName: 'handler'
+    prop: 'isWarning',
+    label: '是否已报警',
+    minWidth: '200',
+    slotName: 'isWarning'
   }
 ]
 

+ 16 - 9
src/views/PdcData/analysis/table.config.js

@@ -1,28 +1,35 @@
 /*
  * @Author: your name
  * @Date: 2021-09-28 13:54:21
- * @LastEditTime: 2021-09-28 13:54:22
+ * @LastEditTime: 2021-11-25 13:41:02
  * @LastEditors: Please set LastEditors
  * @Description: 生产数据 - ERP数据分析 - 工作看板 的表格
  * @FilePath: \hyyfClient\src\views\PdcData\analysis\table.config.js
  */
 export const tableItems = [
   {
-    prop: 'time',
-    label: '报警时间',
+    prop: 'tipTime',
+    label: '提醒时间',
     minWidth: '200',
-    slotName: 'time'
+    slotName: 'tipTime'
   },
   {
-    prop: 'content',
+    prop: 'warningContent',
     label: '内容',
     minWidth: '400',
-    slotName: 'content'
+    slotName: 'warningContent'
   },
   {
-    label: '操作',
-    minWidth: '150',
-    slotName: 'handler'
+    prop: 'handleState',
+    label: '是否已处理',
+    minWidth: '400',
+    slotName: 'handleState'
+  },
+  {
+    prop: 'handleTime',
+    label: '处理时间',
+    minWidth: '200',
+    slotName: 'handleTime'
   }
 ]
 

+ 7 - 13
src/views/PdcData/analysis/yingshouTable.config.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-10-11 16:12:07
- * @LastEditTime: 2021-10-22 16:45:21
+ * @LastEditTime: 2021-11-25 13:54:45
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: \hyyfClient\src\views\PdcData\analysis\yingshouTable.config.js
@@ -14,10 +14,10 @@ export const yingshouTableItems = [
     slotName: 'rank'
   },
   {
-    prop: 'company',
-    label: '名称',
+    prop: 'farmName',
+    label: '牧场名称',
     minWidth: '300',
-    slotName: 'name'
+    slotName: 'farmName'
   },
   {
     prop: 'money',
@@ -26,16 +26,10 @@ export const yingshouTableItems = [
     slotName: 'number'
   },
   {
-    prop: 'linkman',
-    label: '联系人',
+    prop: 'suppier',
+    label: '供应商',
     minWidth: '200',
-    slotName: 'person'
-  },
-  {
-    prop: 'phone',
-    label: '联系电话',
-    minWidth: '300',
-    slotName: 'phone'
+    slotName: 'suppier'
   }
 ]