From b4033c002e21c1376d68be61622da56182a962e9 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 14 八月 2024 15:19:52 +0800
Subject: [PATCH] 修复设备信息表单生产失败
---
pages/inspection/scene/info/device-status/index.js | 4 ++--
components/form/form-util.js | 20 ++++++++++++++------
model/device.js | 3 +++
pages/inspection/scene/index.js | 2 +-
4 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/components/form/form-util.js b/components/form/form-util.js
index 9286ddf..58ec443 100644
--- a/components/form/form-util.js
+++ b/components/form/form-util.js
@@ -60,13 +60,17 @@
}
// 涓嬫媺妗嗛櫎浜嗚祴鍊硷紝闇�瑕侀澶栬祴鍊煎睘鎬value(鏁扮粍绫诲瀷锛岀粍浠秚-picker鐨勭壒鎬�)
else if (e.inputType == 'picker') {
- if (defaultValue.hasOwnProperty(e.name)) {
+ if (
+ defaultValue.hasOwnProperty(e.name) &&
+ defaultValue[e.name] != null &&
+ defaultValue[e.name] != undefined
+ ) {
e.value = defaultValue[e.name] + '';
e._value = [e.value];
- const op = e.options.find(o=>{
- return o.value == e.value
- })
- e._label = op.label
+ const op = e.options.find(o => {
+ return o.value == e.value;
+ });
+ e._label = op.label;
}
}
// 绾ц仈閫夋嫨鍣紝鏍规嵁灞炴�eferItems鎵惧埌瀵瑰簲鐨勫垵濮嬫暟鎹�
@@ -76,7 +80,11 @@
note,
options = e.options;
e.referItems.forEach(r => {
- if (defaultValue.hasOwnProperty(r)) {
+ if (
+ defaultValue.hasOwnProperty(r) &&
+ defaultValue[r] != null &&
+ defaultValue[r] != undefined
+ ) {
const o = options.find(v => {
return v.value == defaultValue[r];
});
diff --git a/model/device.js b/model/device.js
index 0592124..56888ad 100644
--- a/model/device.js
+++ b/model/device.js
@@ -9,6 +9,7 @@
// 鐩戞祴璁惧
export function getMonitorDevice(data) {
+ data._id = data.diId
data._name = data.diName
data._deviceCode = data.diDeviceCode
data._updateTime = dayjs(data.diUpdateTime).format('YYYY骞碝M鏈圖D鏃�');
@@ -23,6 +24,7 @@
// 娌荤悊璁惧
export function getTreatmentDevice(data) {
+ data._id = data.piId
data._name = data.piName
data._deviceCode = data.piDeviceCode
data._updateTime = dayjs(data.piUpdateTime).format('YYYY骞碝M鏈圖D鏃�');
@@ -37,6 +39,7 @@
// 鐢熶骇璁惧
export function getProductionDevice(data) {
+ data._id = data.wiId
data._name = data.wiName
data._deviceCode = data.wiDeviceCode
data._updateTime = dayjs(data.wiUpdateTime).format('YYYY骞碝M鏈圖D鏃�');
diff --git a/pages/inspection/scene/index.js b/pages/inspection/scene/index.js
index 2f823e9..322defa 100644
--- a/pages/inspection/scene/index.js
+++ b/pages/inspection/scene/index.js
@@ -13,7 +13,7 @@
onLoad(options) {},
onShow() {
- this.getTabBar().init();
+ // this.getTabBar().init();
},
onReachBottom() {
diff --git a/pages/inspection/scene/info/device-status/index.js b/pages/inspection/scene/info/device-status/index.js
index b5d9304..60bf3ce 100644
--- a/pages/inspection/scene/info/device-status/index.js
+++ b/pages/inspection/scene/info/device-status/index.js
@@ -40,7 +40,7 @@
if (data) {
const { scene, type, deviceInfo } = data;
defaultForm = deviceStatusForm({
- dlDeviceId: deviceInfo.diId,
+ dlDeviceId: deviceInfo._id,
dlDeviceType: type,
dlSceneGuid: scene.guid,
dlSceneTypeId: scene.typeid,
@@ -58,7 +58,7 @@
fetchDeviceStatus() {
const { scene, type, deviceInfo } = this.data;
- fetchDeviceStatus(scene.guid, deviceInfo.diId, type).then(res => {
+ fetchDeviceStatus(scene.guid, deviceInfo._id, type).then(res => {
this.setData({
deviceStatusList: res.data,
});
--
Gitblit v1.9.3