From 67ec5a8f6ebd1589f6f13e35e3283cd789735cd0 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 14 Jul 2022 11:28:21 +0800
Subject: [PATCH] 农事操作表格

---
 src/styles/publicBox/farm-oper-table.scss |   33 +++++++++++++++-
 src/views/home/index.vue                  |   75 +++++++++++++++++++++++++++----------
 src/router/axios.js                       |    4 +-
 3 files changed, 86 insertions(+), 26 deletions(-)

diff --git a/src/router/axios.js b/src/router/axios.js
index af498d0..3908494 100644
--- a/src/router/axios.js
+++ b/src/router/axios.js
@@ -12,8 +12,8 @@
 //   console.log(window.location);
 //   console.log(url);
 // }, 3000);
-// window.$apiUrls = 'http://182.106.212.58:8013/api'
-window.$apiUrls = 'http://192.168.0.114:89'
+window.$apiUrls = 'http://182.106.212.58:8013/api'
+// window.$apiUrls = 'http://192.168.0.114:89'
 const service = axios.create({
     //   baseURL: 'http://192.168.0.107:83',
 
diff --git a/src/styles/publicBox/farm-oper-table.scss b/src/styles/publicBox/farm-oper-table.scss
index 129d472..117d48f 100644
--- a/src/styles/publicBox/farm-oper-table.scss
+++ b/src/styles/publicBox/farm-oper-table.scss
@@ -1,3 +1,11 @@
+.el-scrollbar {
+    position: relative;
+
+    .el-scrollbar__wrap {
+        overflow-x: hidden; // 隐藏横向滚动栏
+    }
+}
+
 .public-farm-oper-table {
     position: fixed;
     top: 50%;
@@ -81,6 +89,25 @@
                         border-color: #21BAC4;
                     }
                 }
+
+                .select-type {
+
+                    input {
+                        color: #fff;
+                        background: rgba(33, 186, 196, 0.2);
+                        border-color: #21BAC4;
+                    }
+                }
+
+                .select-plot {
+                    margin-left: 30px;
+
+                    input {
+                        color: #fff;
+                        background: rgba(33, 186, 196, 0.2);
+                        border-color: #21BAC4;
+                    }
+                }
             }
 
             .btn-grounp {
@@ -101,7 +128,7 @@
         }
 
         .table-list {
-            flex: 1;
+            height: calc(100% - 74px);
             display: flex;
             flex-direction: column;
 
@@ -117,7 +144,7 @@
             }
 
             .t-body {
-                flex: 1;
+                height: calc(100% - 56px);
                 overflow-y: auto;
             }
 
@@ -167,7 +194,7 @@
 
             .t-header>div:nth-child(7),
             .table-list>div:nth-child(7) {
-                width: 150px;
+                flex: 1;
             }
 
             .t-header>div:nth-child(8),
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index 03fe613..94d473e 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -2,7 +2,7 @@
 * @Author: Morpheus
 * @Date: 2022-05-11 15:00:23
  * @Last Modified by: Morpheus
- * @Last Modified time: 2022-07-13 17:58:03
+ * @Last Modified time: 2022-07-14 11:28:08
 * 驾驶舱
 */
 <template>
@@ -132,6 +132,11 @@
                     </div>
                 </div>
                 <div class="c">
+                    <div class="farm-more-btn" @click="farmOperClick({type: '', landId: ''})">
+                        更多
+                        <i class="el-icon-d-arrow-right"></i>
+                    </div>
+
                     <div class="title-box">
                         <div class="icon"></div>
                         <div class="text">
@@ -147,12 +152,7 @@
                     </div>
 
                     <div class="content-box" :v-if="isFarmingDetail">
-                        <div
-                            @click="farmOperClick(item)"
-                            class="detail"
-                            v-for="(item, index) in farmingList"
-                            :key="index"
-                        >
+                        <div class="detail" v-for="(item, index) in farmingList" :key="index">
                             <div class="title">{{ item.name }}</div>
                             <div class="num-unit">
                                 <div class="num">{{ item.value }}</div>
@@ -381,23 +381,33 @@
             <template slot="public-box-content">
                 <div class="action-bar">
                     <div class="search">
-                        <el-select size="small" v-model="farmOperType" placeholder="选择农事类型">
+                        <el-select
+                            class="select-type"
+                            size="small"
+                            v-model="farmOperType"
+                            placeholder="选择农事类型"
+                        >
                             <el-option
                                 v-for="(item, index) in farmingList"
                                 :key="index"
                                 :label="item.name"
-                                :value="item.name"
+                                :value="item.type"
                             ></el-option>
                         </el-select>
-                        <!--
-                        <el-select size="small" v-model="value" placeholder="选择地块">
+
+                        <el-select
+                            class="select-plot"
+                            size="small"
+                            v-model="farmPlotId"
+                            placeholder="选择地块"
+                        >
                             <el-option
-                                v-for="item in options"
-                                :key="item.value"
-                                :label="item.label"
-                                :value="item.value"
+                                v-for="(item, index) in plotNumArray"
+                                :key="index"
+                                :label="item.landName"
+                                :value="item.id"
                             ></el-option>
-                        </el-select>-->
+                        </el-select>
                     </div>
                     <div class="btn-grounp">
                         <el-button
@@ -405,12 +415,14 @@
                             class="search"
                             type="primary"
                             icon="el-icon-search"
+                            @click="farmSelectList"
                         >查询</el-button>
                         <el-button
                             size="small"
                             class="reset"
                             type="info"
                             icon="el-icon-refresh-right"
+                            @click="farmResetList"
                         >重置</el-button>
                     </div>
                 </div>
@@ -430,7 +442,7 @@
                             <div>{{item.typeName}}</div>
                             <div>{{item.landName}}</div>
                             <div>{{item.remarks == '' ? '--' : item.remarks}}</div>
-                            <div>{{item.content}}</div>
+                            <div>{{item.agriculturalName}}</div>
                             <div>{{item.jobWay == 0 ? '人工' : '机械'}}</div>
                             <div>{{item.time}}</div>
                             <div>{{item.createTime.substr(0,10)}}</div>
@@ -491,7 +503,9 @@
             // 农事操作记录列表
             farmOperList: [],
             // 选择的农事类型
-            farmOperType: ''
+            farmOperType: '',
+            // 农场地块id
+            farmPlotId: ''
         }
     },
     created () {
@@ -512,8 +526,20 @@
         this.initRightPie('EquipmentEcharts')
     },
     methods: {
+        // 农事操作搜索
+        farmSelectList () {
+            this.farmOperClick({ type: this.farmOperType, landId: this.farmPlotId })
+        },
+
+        // 农事操作重置
+        farmResetList () {
+            this.farmOperType = ''
+            this.farmPlotId = ''
+            this.farmOperClick({ type: this.farmOperType, landId: this.farmPlotId })
+        },
+
         farmOperClick (item) {
-            getFarmingRecordList({ type: item.type }).then(res => {
+            getFarmingRecordList({ type: item.type, landId: item.landId }).then(res => {
                 this.farmOperList = res.data.data
                 this.farmOperPopup = true
             })
@@ -549,8 +575,6 @@
 
         getLandList () {
             getLandList().then(res => {
-                console.log(res.data.data, 456)
-
                 res.data.data.forEach(item => {
                     if (item.landRange != '' || item.landRange != null) {
                         item.landRange = item.landRange.replace(/POLYGON\(\(/g, '')
@@ -1984,5 +2008,14 @@
             }
         }
     }
+
+    .farm-more-btn {
+        position: absolute;
+        top: 4px;
+        right: 0;
+        font-size: 14px;
+        color: #a9d1d7;
+        cursor: pointer;
+    }
 }
 </style>

--
Gitblit v1.9.3