East il y a 3 ans
Parent
commit
644a512698

+ 131 - 5
src/views/Production/Production.vue

@@ -1,21 +1,147 @@
 <!--
  * @Author: your name
  * @Date: 2021-10-21 17:51:22
- * @LastEditTime: 2021-10-22 09:11:45
- * @LastEditors: your name
+ * @LastEditTime: 2021-10-26 09:42:11
+ * @LastEditors: Please set LastEditors
  * @Description: 生产经营页面
  * @FilePath: \hyyfScreen\src\views\Production\Production.vue
 -->
 <template>
-  <div>生产经营</div>
+  <div class="production">
+    <div class="production-row">
+      <div class="production-row-side">
+        <pro-board :title="'存栏结构'">
+          <chart-amount-pie :data="AmountPieData"></chart-amount-pie>
+        </pro-board>
+      </div>
+      <div class="production-row-middle">
+        <pro-board :title="'重要指标'"></pro-board>
+      </div>
+      <div class="production-row-side">
+        <pro-board :title="'工作看板'"></pro-board>
+      </div>
+    </div>
+    <div class="production-row">
+      <div>中左</div>
+      <div>中中</div>
+      <div>中右</div>
+    </div>
+    <div class="production-row">
+      <div>下左</div>
+      <div>下中</div>
+      <div>下右</div>
+    </div>
+  </div>
 </template>
 
 <script>
+import ProBoard from './board/ProBoard.vue'
+import ChartAmountPie from './board/ChartAmountPie.vue'
+
 export default {
-  name: "Production"
+  name: "Production",
+  data() {
+    return {
+      AmountPieData: [
+        {
+          farmId: 1,
+          id: 1,
+          month: 10,
+          rate: 1,
+          stockName: "总存栏",
+          stockQuantity: 1000,
+          stockType: "total_stock",
+          subareaId: 9,
+          year: 2021,
+        },
+        {
+          farmId: 1,
+          id: 2,
+          month: 10,
+          rate: 0.01,
+          stockName: "母猪存栏",
+          stockQuantity: 10,
+          stockType: "sow_stock",
+          subareaId: 9,
+          year: 2021,
+        },
+        {
+          farmId: 1,
+          id: 3,
+          month: 10,
+          rate: 0.09,
+          stockName: "公猪存栏",
+          stockQuantity: 90,
+          stockType: "boar_stock",
+          subareaId: 9,
+          year: 2021,
+        },
+        {
+          farmId: 1,
+          id: 4,
+          month: 10,
+          rate: 0.1,
+          stockName: "哺乳仔猪存栏",
+          stockQuantity: 100,
+          stockType: "grice_stock",
+          subareaId: 9,
+          year: 2021,
+        },
+        {
+          farmId: 1,
+          id: 5,
+          month: 10,
+          rate: 0.1,
+          stockName: "保育猪存栏",
+          stockQuantity: 100,
+          stockType: "piglet_stock",
+          subareaId: 9,
+          year: 2021,
+        },
+        {
+          farmId: 1,
+          id: 6,
+          month: 10,
+          rate: 0.1,
+          stockName: "育肥猪存栏",
+          stockQuantity: 100,
+          stockType: "fatpig_stock",
+          subareaId: 9,
+          year: 2021
+        }
+      ]
+    }
+  },
+  components: {
+    ProBoard,
+    ChartAmountPie
+  }
 }
 </script>
 
 <style scoped>
-
+.production {
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  justify-content: space-around;
+}
+/* 每一行 */
+.production-row {
+  background-color: #fff;
+  height: 30%;
+  /* 行内布局 */
+  width: 100%;
+  display: flex;
+  justify-content: space-between;
+}
+/* 行 —— 两边 */
+.production-row-side {
+  width: 25%;
+}
+/* 行 —— 中间 */
+.production-row-middle {
+  background-color: rgb(218, 116, 116);
+  width: 45%;
+}
 </style>

+ 164 - 0
src/views/Production/board/ChartAmountPie.vue

@@ -0,0 +1,164 @@
+<!--
+ * @Author: your name
+ * @Date: 2021-10-26 09:15:22
+ * @LastEditTime: 2021-10-26 09:42:54
+ * @LastEditors: Please set LastEditors
+ * @Description: 存栏结构图
+ * @FilePath: \hyyfScreen\src\views\Production\board\ChartAmountPie.vue
+-->
+<template>
+  <div class="chart-inventory-pie">
+    <div id="chartAmountPie"></div>
+  </div>
+</template>
+<script>
+export default {
+  data() {
+    return {
+      myChart: null
+    }
+  },
+  props: {
+    data: {
+      type: Array,
+      required: true
+    }
+  },
+  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 options = {
+        title: {
+          text: '存栏结构',
+          x: 20,
+          y: 20
+        },
+        grid: {
+          x: 100
+        },
+        tooltip: {
+          trigger: 'item',
+          formatter: function ({name, value, percent}) {
+            return name + ':' + value + '头&nbsp;&nbsp;&nbsp;&nbsp;' + percent + '%'
+          }
+        },
+        legend: {
+          top: '25%',
+          left: '55%',
+          orient: 'vertical',
+          icon: "circle",
+          selectedMode: false, // 取消右侧项选中
+          itemGap: 20, // 各项间隔
+          textStyle: {
+            fontSize: 15,
+            color: '#666'
+          },
+          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 },
+            ]
+            clientLabels.forEach(function (value, i) {
+                if (value.name == name) {
+                    legendIndex = i;
+                }
+            });
+            return name + " (" + clientLabels[legendIndex].percent + ', ' + clientLabels[legendIndex].number + '头' + ") ";
+          }
+        },
+        graphic: [
+          {
+            type: 'text',
+            left: '27%',
+            top: '43%',
+            style: {
+              text: '总存栏',
+              fontSize: 15,
+              fill: 'rgb(192, 188, 189)'
+            }
+          },
+          {
+            type: 'text',
+            left: '25%',
+            top: '53%',
+            style: {
+              text: total + '头',
+              fontSize: 22,
+              fontWeight: 700
+            }
+          }
+        ],
+        series: [
+          {
+            name: 'Access From',
+            type: 'pie',
+            radius: ['60%', '80%'], // 半径
+            center: ['30%', '55%'],
+            avoidLabelOverlap: false,
+            label: {
+              show: false,
+              // position: 'center'
+            },
+            emphasis: {
+              label: {
+                show: false,
+                fontSize: '40',
+                fontWeight: 'bold'
+              }
+            },
+            labelLine: {
+              show: false
+            },
+            itemStyle: {
+              normal: {
+                color: function (colors) { // 颜色设置
+                  var colorList = ['#3aa0ff', '#4dcb73', '#fad337', '#f2637b', '#975fe4']
+                  return colorList[colors.dataIndex]
+                },
+                borderWidth: 5, // 设置各项空隙
+                borderColor: '#fff'
+              }
+            },
+            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: '育肥猪存栏' }
+            ]
+          }
+        ]
+      };
+
+      this.myChart.setOption(options)
+    }
+  },
+  mounted() {
+    this.myChart = this.$echarts.init(document.getElementById('chartAmountPie'));
+    this.init()
+    console.log(this.data)
+  },
+  watch: {
+    data(newValue) {
+      console.log(newValue)
+      this.init()
+    }
+  }
+}
+</script>
+<style scoped>
+.chart-inventory-pie {
+  display: inline-block;
+  width: 45%;
+  height: 300px;
+}
+#chartAmountPie {
+  width: 100%;
+  height: 100%;
+}
+</style>

+ 84 - 0
src/views/Production/board/ProBoard.vue

@@ -0,0 +1,84 @@
+<!--
+ * @Author: your name
+ * @Date: 2021-10-26 09:03:16
+ * @LastEditTime: 2021-10-26 09:43:39
+ * @LastEditors: Please set LastEditors
+ * @Description: 生产经营 - 面板
+ * @FilePath: \hyyfScreen\src\views\Production\board\ProBoard.vue
+-->
+<template>
+  <div class="pro-board">
+    <div class="title">
+      <div class="title-left"></div>
+      <div class="title-center">{{ title }}</div>
+      <div class="title-right"></div>
+    </div>
+    <div class="content">
+      <slot></slot>
+    </div>
+  </div>
+</template>
+<script>
+export default {
+  props: {
+    title: {
+      type: String,
+      required: true
+    }
+  }
+}
+</script>
+<style scoped>
+.pro-board {
+  width: 100%;
+  height: 100%;
+  background-color: rgb(8, 204, 8);
+}
+
+/* 标题 */
+.title {
+  width: 100%;
+  height: 26px;
+  display: flex;
+}
+.title-left {
+  width: 325px;
+  height: 26px;
+  background: url("../../../assets/BioSafety/u1717.svg") no-repeat;
+  background-size: 100% 100%;
+  position: relative;
+}
+.title-left::before {
+  content: '';
+  height: 85%;
+  border: 2px solid #66FFFF;
+  position: absolute;
+  top: 0;
+  left: 0;
+}
+.title-center {
+  padding: 0 15px;
+  width: 130px;
+  height: 26px;
+  background: url("../../../assets/BioSafety/u1719.svg") no-repeat;
+  background-size: 100% 100%;
+  line-height: 26px;
+  color: white;
+  font-size: 16px;
+}
+.title-right {
+  width: 325px;
+  height: 26px;
+  background: url("../../../assets/BioSafety/u1718.svg") no-repeat;
+  background-size: 100% 100%;
+  position: relative;
+}
+.title-right::after{
+  content: '';
+  height: 85%;
+  border: 2px solid #66FFFF;
+  position: absolute;
+  top: 0;
+  right: 0;
+}
+</style>

+ 1 - 1
src/views/Zoology/Zoology.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-10-21 17:51:22
- * @LastEditTime: 2021-10-25 17:22:24
+ * @LastEditTime: 2021-10-26 09:10:09
  * @LastEditors: Please set LastEditors
  * @Description: 生态监测页面
  * @FilePath: \hyyfScreen\src\views\Zoology\Zoology.vue