From 798dcfbbc3ab2a81d1e873b25e00bf5e4ed03aa7 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期一, 02 十二月 2024 18:11:54 +0800
Subject: [PATCH] ll

---
 admin/src/views/Inspection/components/OperaYwPatrolPointWindow.vue |   61 +++++++++++++++++++++---------
 1 files changed, 42 insertions(+), 19 deletions(-)

diff --git a/admin/src/views/Inspection/components/OperaYwPatrolPointWindow.vue b/admin/src/views/Inspection/components/OperaYwPatrolPointWindow.vue
index ca12d05..aa26f0f 100644
--- a/admin/src/views/Inspection/components/OperaYwPatrolPointWindow.vue
+++ b/admin/src/views/Inspection/components/OperaYwPatrolPointWindow.vue
@@ -30,7 +30,7 @@
         <el-input type="textarea" :rows="4" v-model="form.content" placeholder="璇疯緭鍏�" />
       </el-form-item>
       <el-form-item label="涓婁紶鍥剧墖" prop="imgurl">
-        <UploadAvatarImage :file="{ 'imgurlfull': form.fileFullUrl, 'imgurl': form.fileurl }"
+        <UploadAvatarImage :file="{ 'imgurlfull': form.fileFullUrl, 'imgurl': form.fileUrl }"
           :uploadData="{ folder: 'ywPatrol/' }" @uploadSuccess="uploadAvatarSuccess" @uploadEnd="isUploading = false"
           @uploadBegin="isUploading = true" />
       </el-form-item>
@@ -83,6 +83,30 @@
       this.title = title
       this.visible = true
       this.initData()
+      if (row == null) {
+        this.$nextTick(() => {
+          this.form = {
+            name: '',
+            code: '',
+            content: '',
+            imgurl: '',
+            areaId: 0,
+            areaIds: [],
+            addr: ''
+          }
+          this.$refs.form.resetFields()
+
+          this.form[this.configData['field.id']] = null
+        })
+        fetchList({
+          model: { type: 4 },
+          capacity: 1000,
+          page: 1,
+        }).then(res => {
+          this.cateList = res.records || []
+        })
+        return
+      }
       if (row && row.id) {
         this.getDetail(row)
       }
@@ -90,34 +114,33 @@
     getDetail(row) {
       detail(row.id).then(res => {
         this.form = { ...res }
-        // this.$set(this.form, 'areaId', res.areaId)
-        // console.log('res', res)
-        // console.log('res', this.form)
-
-      })
-    },
-    initData() {
-      fetchList({
-        model: { type: 4 },
-        capacity: 1000,
-        page: 1,
-      }).then(res => {
-        this.cateList = res.records || []
-        setTimeout(() => {
-          const areaId = this.form.areaId
+        if (res.longitude && res.latitude) {
+          this.$set(this.form, 'lnglat', res.longitude + ',' + res.latitude)
+        }
+        fetchList({
+          model: { type: 4 },
+          capacity: 1000,
+          page: 1,
+        }).then(ress => {
+          this.cateList = ress.records || []
+          const areaId = res.areaId
           if (areaId) {
             this.cateList.forEach(item => {
               if (item.childCategoryList) {
                 item.childCategoryList.forEach(item2 => {
                   if (item2.id == areaId) {
                     this.$set(this.form, 'areaIds', [item.id, item2.id])
+
                   }
                 })
               }
             })
           }
-        }, 1300)
+        })
+
       })
+    },
+    initData() {
       getDeiceList({
         model: {},
         capacity: 1000,
@@ -146,8 +169,8 @@
       }
     },
     uploadAvatarSuccess(file) {
-      this.form.fileurl = file.imgurl
-      this.form.fileFullUrl = file.imgurlfull
+      this.$set(this.form, 'fileUrl', file.imgurl)
+      this.$set(this.form, 'fileFullUrl', file.imgurlfull)
     },
   }
 }

--
Gitblit v1.9.3