From 5036880fc037e5d112206b93a729f60be12bf8ab Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 07 十一月 2024 17:03:13 +0800
Subject: [PATCH] 2024.11.07 bug修复

---
 pages/inspection/scene/info/device-info/index.js |   72 ++++++++++++++++++++++++++++--------
 1 files changed, 56 insertions(+), 16 deletions(-)

diff --git a/pages/inspection/scene/info/device-info/index.js b/pages/inspection/scene/info/device-info/index.js
index dcb8b4d..52565b2 100644
--- a/pages/inspection/scene/info/device-info/index.js
+++ b/pages/inspection/scene/info/device-info/index.js
@@ -18,31 +18,41 @@
     this.getOpenerEventChannel().on('acceptDeviceData', data => {
       if (data) {
         const { scene, type, mode, deviceInfo } = data;
-        let barTitle = mode == 'add' ? '鏂板':'淇敼', _formArr;
+        let barTitle = mode == 'add' ? '鏂板' : '淇敼',
+          _formArr;
         switch (type) {
           case 1:
             barTitle += '娌荤悊璁惧';
-            let defaultValue1 = mode == 'update' ? deviceInfo : {
-              piSceneGuid: scene.guid,
-              piSceneTypeId: scene.typeid,
-            }
+            let defaultValue1 =
+              mode == 'update'
+                ? deviceInfo
+                : {
+                    piSceneGuid: scene.guid,
+                    piSceneTypeId: scene.typeid,
+                  };
             _formArr = treatmentDeviceForm(scene.typeid, defaultValue1);
             break;
           case 2:
             barTitle += '鐢熶骇璁惧';
-            let defaultValue2 = mode == 'update' ? deviceInfo : {
-              wiSceneGuid: scene.guid,
-              wiSceneTypeId: scene.typeid,
-            }
+            let defaultValue2 =
+              mode == 'update'
+                ? deviceInfo
+                : {
+                    wiSceneGuid: scene.guid,
+                    wiSceneTypeId: scene.typeid,
+                  };
             _formArr = productionDeviceForm(scene.typeid, defaultValue2);
             break;
           case 0:
           default:
             barTitle += '鐩戞祴璁惧';
-            let defaultValue0 = mode == 'update' ? deviceInfo : {
-              diSceneGuid: scene.guid,
-              diSceneTypeId: scene.typeid,
-            }
+            let defaultValue0 =
+              mode == 'update'
+                ? deviceInfo
+                : {
+                    diSceneGuid: scene.guid,
+                    diSceneTypeId: scene.typeid,
+                  };
             _formArr = monitorDeviceForm(scene.typeid, defaultValue0);
             break;
         }
@@ -75,14 +85,32 @@
 
   // 鍙栨秷琛ㄥ崟
   cancel() {
-    console.log('cancel');
+    // console.log('cancel');
+    wx.navigateBack({
+      delta: 1,
+      success: res => {},
+      fail: res => {},
+      complete: res => {},
+    });
   },
 
   // 鏂板璁惧淇℃伅
   addDevice(formObj) {
     const { deviceType } = this.data;
     uploadDevice(formObj, deviceType).then(res => {
-      console.log(res);
+      // console.log(res);
+      this.getOpenerEventChannel().emit('updateDeviceInfoOver');
+      wx.navigateBack({
+        delta: 1,
+        success: () => {
+          wx.showToast({
+            title: '璁惧鏂板鎴愬姛',
+            duration: 2000,
+            icon: 'success',
+            mask: true,
+          });
+        },
+      });
     });
   },
 
@@ -90,7 +118,19 @@
   updateDevice(formObj) {
     const { deviceType } = this.data;
     updateDevice(formObj, deviceType).then(res => {
-      console.log(res);
+      // console.log(res);
+      this.getOpenerEventChannel().emit('updateDeviceInfoOver');
+      wx.navigateBack({
+        delta: 1,
+        success: () => {
+          wx.showToast({
+            title: '璁惧淇敼鎴愬姛',
+            duration: 2000,
+            icon: 'success',
+            mask: true,
+          });
+        },
+      });
     });
   },
 });

--
Gitblit v1.9.3