From 87958d6d33603fa673cb7c8f5caf2394689959bf Mon Sep 17 00:00:00 2001
From: hcong <1050828145@qq.com>
Date: 星期四, 21 十一月 2024 11:00:43 +0800
Subject: [PATCH] 1. 图片选择组件移动到全局组件文件夹 2. 涉及到使用图片选择组件添加图片区域loading 3. 无用页面删除

---
 src/views/fysp/support/components/DeviceMatch.vue |   39 ++++++++++++++++++++++++++++++++++++---
 1 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/src/views/fysp/support/components/DeviceMatch.vue b/src/views/fysp/support/components/DeviceMatch.vue
index e9b046f..1cb78e1 100644
--- a/src/views/fysp/support/components/DeviceMatch.vue
+++ b/src/views/fysp/support/components/DeviceMatch.vue
@@ -15,11 +15,13 @@
             >褰曞叆璁惧淇℃伅</el-button
           >
         </div>
-        <el-button type="danger" :disabled="!enabled">涓婁紶鍖归厤淇℃伅</el-button>
+        <el-button type="danger" :disabled="!enabled" @click="uploadMatchScene"
+          >涓婁紶鍖归厤淇℃伅</el-button
+        >
       </el-row>
       <div v-if="newDevice">
         <el-text>鏂板璁惧</el-text>
-        <FormDevice :form-info="newDevice" :is-edit="true" ></FormDevice>
+        <FormDevice :form-info="newDevice" :is-edit="true"></FormDevice>
       </div>
       <div v-if="deviceList.length > 0">
         <el-text>宸叉湁璁惧</el-text>
@@ -31,6 +33,9 @@
 <script setup>
 import { ref, computed, watch } from 'vue';
 import deviceApi from '@/api/fysp/deviceApi';
+import constructionApi from '@/api/additional-jingan/constructionApi';
+import { useFetchData } from '@/composables/fetchData';
+import { ElMessage } from 'element-plus';
 
 import FormDevice from './FormDevice.vue';
 
@@ -38,6 +43,8 @@
   device: Object,
   scene: Object
 });
+
+const emit = defineEmits(['success']);
 
 // 鏂板璁惧淇℃伅
 const newDevice = ref();
@@ -52,7 +59,7 @@
   () => props.scene,
   (nV, oV) => {
     if (nV != oV) {
-      fetchDeviceInfo();
+      // fetchDeviceInfo();
     }
   }
 );
@@ -74,4 +81,30 @@
     diRemoved: false
   };
 }
+
+const { loading, fetchData } = useFetchData();
+/**
+ * 涓婁紶璁惧鍏宠仈宸ュ湴
+ */
+function uploadMatchScene() {
+  const param = {
+    name: props.scene.name,
+    address: props.scene.location,
+    street: props.scene.townname,
+    lon: props.device.lon,
+    lat: props.device.lat,
+    sbCode: props.device.code,
+    sbName: props.device.name
+  };
+  
+  fetchData(() => {
+    return constructionApi.uploadConstructionDevice(param).then((res) => {
+      ElMessage({
+        message: res.message,
+        type: 'success'
+      });
+      emit('success');
+    });
+  });
+}
 </script>

--
Gitblit v1.9.3