From 5a678cce1b157411f20fbddfaed49c7bc8d9fba7 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期四, 07 十一月 2024 17:03:13 +0800 Subject: [PATCH] 修改为生产模式 --- 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