From fd413ff97abe21ade2c6b2bcc2920c6c16e4d106 Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Wed, 06 Jul 2022 20:59:40 +0800
Subject: [PATCH] 大屏接口对接

---
 src/views/home/index.vue      |   62 +++++++++++++++++-------------
 src/views/manage/index.vue    |   26 +++++++++++--
 src/api/farm/farmingrecord.js |   27 +++++++++++++
 3 files changed, 84 insertions(+), 31 deletions(-)

diff --git a/src/api/farm/farmingrecord.js b/src/api/farm/farmingrecord.js
index b9122db..bb69b14 100644
--- a/src/api/farm/farmingrecord.js
+++ b/src/api/farm/farmingrecord.js
@@ -135,3 +135,30 @@
         }
     })
 }
+export const selctSaletCount = (params) => {
+    return request({
+        url: '/sale/sale/selctSaletCount',
+        method: 'get',
+        params: {
+            ...params
+        }
+    })
+}
+export const selctSaletZ = (params) => {
+    return request({
+        url: '/sale/sale/selctSaletZ',
+        method: 'get',
+        params: {
+            ...params
+        }
+    })
+}
+export const selectMarketCirculate = (params) => {
+    return request({
+        url: '/sale/sale/selectMarketCirculate',
+        method: 'get',
+        params: {
+            ...params
+        }
+    })
+}
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index 24e2511..294719d 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -176,27 +176,9 @@
                             <div class="b-l"></div>
                             <div class="b-r"></div>
                             <div class="title">全年销售总额(元)</div>
-                            <div class="price">
-                                <div>
-                                    <span>1</span>
-                                </div>
-                                <div>
-                                    <span>6</span>
-                                </div>
-                                <div>
-                                    <span>7</span>
-                                </div>
-                                <div>
-                                    <span>8</span>
-                                </div>
-                                <div>
-                                    <span>5</span>
-                                </div>
-                                <div>
-                                    <span>2</span>
-                                </div>
-                                <div>
-                                    <span>0</span>
+                            <div class="price" >
+                                <div v-for="(item,index) in salaNum" :key="index">
+                                    <span>{{item}}</span>
                                 </div>
                             </div>
                         </div>
@@ -272,7 +254,7 @@
 
 <script>
 // eslint-disable-next-line no-unused-vars
-import { getFarmingCount, getFarmingStatis, pagePalnt, SelectCount } from '@/api/farm/farmingrecord'
+import { getFarmingCount, getFarmingStatis, pagePalnt, SelectCount, selctSaletCount, selctSaletZ } from '@/api/farm/farmingrecord'
 // eslint-disable-next-line no-unused-vars
 import { selectXCount } from '@/api/land/land'
 
@@ -288,7 +270,11 @@
             landwnum: 0,
             ncnum: 0,
             rynum: 0,
-            cityShow: false
+            cityShow: false,
+            // 销售总额
+            salaNum: [],
+            // 每月销售统计
+            salaNumY: []
         }
     },
     created () {
@@ -298,12 +284,13 @@
         this.pagePalnt()
         this.selectXCount()
         this.SelectCount()
+        this.selctSaletCount()
+        this.selctSaletZ()
     },
     mounted () {
         this.initPie('BeingEcharts', 100)
         this.initPie('LeisureEcharts', 0)
         this.initRightPie('EquipmentEcharts')
-        this.initLine('TrendEcharts')
     },
     methods: {
         initPie (dom, val) {
@@ -528,6 +515,13 @@
             const chartDom = document.getElementById(dom)
             const myChart = this.$echarts.init(chartDom)
 
+            var x = []
+            var y = []
+            for (let i = 1; i <= 12; i++) {
+                x.push(i)
+                y.push(that.salaNumY[i])
+            }
+
             const option = {
                 tooltip: {},
                 grid: {
@@ -556,7 +550,7 @@
                             }
                         },
                         axisTick: { show: false },
-                        data: ['01', '02', '03', '04', '05', '06', '07']
+                        data: x
                     }
                 ],
                 yAxis: [
@@ -567,7 +561,6 @@
                         },
                         type: 'value',
                         min: 0,
-                        max: 40,
                         splitLine: {
                             show: false
                         },
@@ -612,7 +605,7 @@
                                 shadowBlur: 20 // shadowBlur设图形阴影的模糊大小。配合shadowColor,shadowOffsetX/Y, 设置图形的阴影效果。
                             }
                         },
-                        data: [0, 25, 24, 35, 16, 30, 15]
+                        data: y
                     }
                 ]
             }
@@ -627,6 +620,21 @@
                 that.rynum = res.data.data.rynum
             })
         },
+        // 大屏销售统计
+        selctSaletCount () {
+            var that = this
+            selctSaletCount().then((res) => {
+                that.salaNumY = res.data.data
+                this.initLine('TrendEcharts')
+            })
+        },
+        // 统计今年和去年的销售总额
+        selctSaletZ () {
+            var that = this
+            selctSaletZ().then((res) => {
+                that.salaNum = res.data.data[0].num.toString().split("")
+            })
+        },
         getFarmingCount () {
             var that = this
             var deptId = '1123598813738675201'
diff --git a/src/views/manage/index.vue b/src/views/manage/index.vue
index 55593e9..953155e 100644
--- a/src/views/manage/index.vue
+++ b/src/views/manage/index.vue
@@ -59,14 +59,14 @@
                 ></statistics-num>
                 <statistics-num
                         :className="'lt'"
-                        :totalRegion="2678"
+                        :totalRegion="salaNumBN"
                         :imgUrl="'/img/icon/lt.png'"
                         :unit="'公斤'"
                         :title="'市场流通量'"
                         :subOneTitle="'去年流通量'"
-                        :subOneNum="5280"
+                        :subOneNum="salaNumQN"
                         :subTwoTitle="'本月流通量'"
-                        :subTwoNum="0"
+                        :subTwoNum="salaNumBY"
                 ></statistics-num>
             </div>
             <div class="c">
@@ -265,7 +265,7 @@
 <script>
     import { selectXCount } from '@/api/land/land'
     // eslint-disable-next-line no-unused-vars
-    import { page, getStockCount, pagePalnt, statisticsStockAndYield, pageCount,pageCountNz } from '@/api/farm/farmingrecord'
+    import { page, getStockCount, pagePalnt, statisticsStockAndYield, pageCount, pageCountNz, selectMarketCirculate} from '@/api/farm/farmingrecord'
 
     export default {
         data () {
@@ -292,6 +292,10 @@
                 // 农产品投入
                 ncptr: [],
                 nztr: [],
+                // 统计市场流通/去年流通量/本月流通量
+                salaNumBN: [],
+                salaNumBY: [],
+                salaNumQN: [],
                 nzOrNcp: 'ncp',
                 trpOrNcp: 'trp'
             }
@@ -306,6 +310,8 @@
             this.pageCount()
             // 农资投入
             this.pageCountNz()
+            // 统计市场流通/去年流通量/本月流通量
+            this.selectMarketCirculate()
         },
         mounted () {
             this.initBar('TaskNumEcharts')
@@ -835,6 +841,18 @@
                     // 投入品监管图表
                     this.initTrpBar('TrpEcharts')
                 })
+            },
+            // 统计市场流通/去年流通量/本月流通量
+            selectMarketCirculate () {
+                var params = {}
+                params.codes = '000000'
+                params.deptId = '1123598813738675201'
+                params.year = '2022'
+                selectMarketCirculate(Object.assign(params)).then((res) => {
+                    this.salaNumBN = res.data.data[0].num
+                    this.salaNumQN = res.data.data[1].num
+                    this.salaNumBY = res.data.data[2].num
+                })
             }
         }
     }

--
Gitblit v1.9.3