From 51b461fa17fb064b309c677019914d0cb89e1c54 Mon Sep 17 00:00:00 2001
From: xiebin <123456>
Date: Tue, 02 Aug 2022 10:53:09 +0800
Subject: [PATCH] 地块编辑优化

---
 src/views/land/landUpdate.vue |   52 +++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/src/views/land/landUpdate.vue b/src/views/land/landUpdate.vue
index 5ca6701..b42f077 100644
--- a/src/views/land/landUpdate.vue
+++ b/src/views/land/landUpdate.vue
@@ -33,10 +33,12 @@
         return {
             title: "编辑地块",
             form: {},
+            isFarmNameCk:false,
             option: {
                 emptyBtn: false,
                 submitText: "保存",
                 gutter: 30,
+                farmName:'',
                 column: [
                     {
                         label: "地块名称",
@@ -57,6 +59,9 @@
                             value: "id"
                         },
                         slot: true,
+                        click:function (value){
+                            this.isFarmNameCk = true
+                        },
                         rules: [{
                             required: true,
                             message: "请选择所属农场",
@@ -113,11 +118,6 @@
     },
     methods: {
         initData (tenantId) {
-            // getDeptTree(tenantId).then(res => {        console.log(res)
-
-            //   const column = this.findObject(this.option.column, "deptId");
-            //   column.dicData = res.data.data;
-            // });
             const data = {
                 deptId: this.userInfo.dept_id
             }
@@ -132,19 +132,19 @@
             this.$store.commit('clear_polygon')
             //计算当前时间
             this.visible = true
-            console.log('land1111111111111:',this.$route.query)
             this.form.landName = this.$route.query.landName
             this.form.id = this.$route.query.id
             this.form.landArea = this.$route.query.landArea
             this.form.farmId = this.$route.query.farmId
+            this.form.$farmId = this.$route.query.deptname
             this.form.landUnit = this.$route.query.landUnit
             this.form.landType = this.$route.query.landType
             this.form.landRange = this.$route.query.landRange
 
 
-          this.form.landRange = this.form.landRange.replace(/POLYGON\(\(/g, '')
-          this.form.landRange = this.form.landRange.replace(/\)\)/g, '')
-          this.form.landRange = this.form.landRange.split(',')
+            this.form.landRange = this.form.landRange.replace(/POLYGON\(\(/g, '')
+            this.form.landRange = this.form.landRange.replace(/\)\)/g, '')
+            this.form.landRange = this.form.landRange.split(',')
 
         },
         // 表单提交
@@ -173,14 +173,32 @@
             }
 
             update(row).then(() => {
-                  that.$emit("refreshOnLoad")
-                  that.$refs.form.resetFields()
-                  that.visible = false
-                  this.$message({
-                      type: "success",
-                      message: "操作成功!"
-                  })
-                  done()
+                that.$emit("refreshOnLoad")
+                that.$refs.form.validate((vaild,done)=>{
+                    if (vaild) {
+                        that.visible = false
+                        this.$message({
+                          type: "success",
+                          message: "操作成功!"
+                        })
+                      done()
+                      this.form.landRange = this.$route.query.landRange
+                      this.form.dica = row.$landUnit
+                      this.form.dic = row.$landType
+                      this.form.deptname = row.$farmId
+
+                      var arr = [];
+                      this.$store.state.tags.tagList.forEach((item) => {
+                        if (item.label != "地块详情") {
+                          arr.push(item);
+                        }
+                      });
+                      this.$store.state.tags.tagList = arr;
+                      this.$router.replace({  path: `/LandDetail`, query: this.form  });
+                    }
+
+                })
+
               }, error => {
                   loading()
                   window.console.log(error)

--
Gitblit v1.9.3