From 7ae4b4b6679ba419cfd92d2a60ed603c2c8a446d Mon Sep 17 00:00:00 2001
From: xiebin <123456>
Date: Thu, 11 Aug 2022 16:59:00 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/views/land/cs.vue |   96 +++++++++++++++++++++++++++++++++--------------
 1 files changed, 67 insertions(+), 29 deletions(-)

diff --git a/src/views/land/cs.vue b/src/views/land/cs.vue
index 715c834..1ce9628 100644
--- a/src/views/land/cs.vue
+++ b/src/views/land/cs.vue
@@ -15,7 +15,7 @@
                         <el-option label="果园" value="2"></el-option>
                         <el-option label="鱼塘" value="3"></el-option>
                         <el-option label="山地" value="4"></el-option>
-                        <el-option label="养殖区" value="4"></el-option>
+                        <el-option label="养殖区" value="5"></el-option>
                     </el-select>
                 </div>
                 <!--        <div style="float: left; margin-left: 15px">-->
@@ -40,18 +40,31 @@
                     ></el-input>
                 </div>
             </div>
-            <div>
+            <div class="edit">
                 <el-button size="small">
-                    <span style="color: #5abf78" @click="goToMapModel(row)">进入地图模式</span>
+                  <span style="color: #5abf78" @click="goToMapModel(row)">进入地图模式</span>
                 </el-button>
                 <el-button
-                    type="success"
-                    size="small"
-                    @click="land"
-                    style="margin-right: 50px;width: 80px;"
+                  type="success"
+                  size="small"
+                  @click="land"
+                  style="margin-right: 50px;width: 80px;"
                 >圈地</el-button>
             </div>
         </div>
+        <div class="el-page" style="text-align: center;">
+            <el-pagination
+              @size-change="handleSizeChange"
+              @current-change="handleCurrentChange"
+              :current-page="page.currentPage"
+              :hide-on-single-page="value"
+              :page-size="page.pageSize"
+              background
+              layout="total, prev, pager, next"
+              :total="page.total"
+            ></el-pagination>
+        </div>
+
         <div class="landhome">
             <div
                 class="land"
@@ -60,7 +73,8 @@
                 @click="landInfo(item)"
             >
                 <div class="land-img">
-                    <img :src="item.url" class="landimg" />
+                    <img v-if="item.url" :src="item.url" class="landimg" />
+                    <img v-else src="../../../public/img/bg/noimage.jpg" class="landimg" />
                 </div>
                 <div class="text">
                     <div class="land-name">{{ item.landName }}</div>
@@ -69,18 +83,6 @@
                     </div>
                 </div>
             </div>
-        </div>
-        <div class="el-page">
-            <el-pagination
-                @size-change="handleSizeChange"
-                @current-change="handleCurrentChange"
-                :current-page="page.currentPage"
-                :hide-on-single-page="value"
-                :page-size="page.pageSize"
-                background
-                layout="total, prev, pager, next"
-                :total="page.total"
-            ></el-pagination>
         </div>
         <landAdd v-if="landVisible" ref="land" @refreshOnLoad="onLoad"></landAdd>
     </div>
@@ -103,12 +105,13 @@
                 keyword: "",
             },
             query: {},
-            value: false,
+            farm:{},
+            value: true,
             farmingCount: 0,
             landVisible: false,
             farmPlanList: [],
             page: {
-                pageSize: 4,
+                pageSize: 12,
                 currentPage: 1,
                 total: 0,
             },
@@ -126,10 +129,20 @@
         }
     },
     computed: {
-        ...mapGetters(["userInfo"]),
+        ...mapGetters(["userInfo","$farmId"]),
     },
-    created () {
+    watch: {
+    '$farmId':{
+      handler (newName, oldName) {
+        this.farm.id = newName
+        //地块页面
         this.onLoad()
+      }
+    }
+  },
+    created () {
+        this.farm.id = this.$farmId
+        this.onLoad(this.page)
     },
     methods: {
         //圈地
@@ -143,6 +156,7 @@
         stypeChange (value) {
             this.query["landType"] = value
             this.onLoad(this.page, this.query)
+            this.page.currentPage = 1
         },
         //库存 select 改变事件
         stateChange (value) {
@@ -165,14 +179,26 @@
             this.onLoad(this.page)
         },
         landInfo (item) {
+          var arr = [];
+          this.$store.state.tags.tagList.forEach((item) => {
+            if (item.label != "地块详情") {
+              arr.push(item);
+            }
+          });
+          this.$store.state.tags.tagList = arr;
             this.$router.push({
                 path: `/LandDetail`,
                 query: item,
             })
         },
         onLoad (page, params = {}) {
-            getList(1, 10, Object.assign(params, this.query)).then(res => {
+            if(typeof(page) == "undefined" ){
+                page = this.page
+            }
+            Object.assign(params,{farmId:this.farm.id})
+            getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
                 const data = res.data.data
+                this.page.total = data.total
                 this.farmPlanList = data.records
             })
         },
@@ -198,6 +224,13 @@
     display: flex;
     flex-flow: row nowrap;
     justify-content: space-between;
+
+    // .el-page{
+    //     text-align: right;
+    // }
+    // .el-pagination{
+    //     text-align: right;
+    // }
 }
 
 .wraaper-box {
@@ -211,8 +244,8 @@
 
 .landhome {
     padding: 10px;
-    wdith: 100%;
-    height: 100%;
+    width: 100%;
+    height: 88%;
     display: flex;
     box-sizing: border-box;
     flex-wrap: wrap;
@@ -227,13 +260,15 @@
 
         .land-img {
             width: 100%;
-            height: 280px;
+            // height: 280px;
+            height: 240px;
             margin: 0 auto;
             text-align: center;
 
             .landimg {
                 width: 100%;
-                height: 280px;
+                // height: 280px;
+                height: 240px;
                 //border-radius: 100px;
                 //margin-top: 25px;
                 //margin-left: -25px;
@@ -289,4 +324,7 @@
         text-align: center;
     }
 }
+.edit {
+    padding-left: 13px;
+}
 </style>

--
Gitblit v1.9.3