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-items.js |  176 +++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 131 insertions(+), 45 deletions(-)

diff --git a/pages/inspection/scene/info/device-info-items.js b/pages/inspection/scene/info/device-info-items.js
index e34449c..6867536 100644
--- a/pages/inspection/scene/info/device-info-items.js
+++ b/pages/inspection/scene/info/device-info-items.js
@@ -1,3 +1,8 @@
+import {
+  baseInputItem,
+  hideInputItem,
+  setDefaultValue,
+} from '../../../../components/form/form-util.js';
 import { monitorDevices } from '../../../../common/dataMonitorDeviceType';
 import { treatmentDevices } from '../../../../common/dataTreatmentDeviceType';
 import { productionDevices } from '../../../../common/dataProductionDeviceType';
@@ -6,36 +11,30 @@
 import { ownership } from '../../../../common/dataOwnership';
 
 /**
- * 鐢熸垚涓�鏉¤〃鍗曟潯鐩�
- * @param {String} _label 鏍囩鍚嶇О
- * @param {String} _name 瀛楁鍚嶇О
- * @param {String} _type 杈撳叆绫诲瀷 锛坱ext: 杈撳叆妗�; switch: 鍒囨崲鎸夐挳; picker: 涓嬫媺妗嗛�夐」锛�
- * @param {Boolean} _required 鏄惁涓哄繀濉」
- * @param {Array} _options 褰撹緭鍏ョ被鍨嬩负picker鏃讹紝鎻愪緵鍙�夐」
- */
-function baseInputItem(_label, _name, _required, _type = 'text', _options = []) {
-  return {
-    required: _required,
-    label: _label,
-    placeholder: '璇疯緭鍏�' + _label,
-    name: _name,
-    value: _type == 'switch' ? false : null,
-    status: 'success',
-    tips: _label + '涓嶈兘涓虹┖',
-    inputType: _type,
-    options: _options,
-  };
-}
-
-/**
  * 鐩戞祴璁惧琛ㄥ崟
+ * @param {Number} sceneType 鍦烘櫙绫诲瀷锛堥缇界洃绠$郴缁燂級
+ * @param {Object} defaultValue 琛ㄥ崟榛樿鍊�
  */
-export function monitorDeviceForm(sceneType) {
-  return [
+export function monitorDeviceForm(sceneType, defaultValue) {
+  const items = [
+    hideInputItem('id', 'diId'),
+    hideInputItem('鍒涘缓鏃堕棿', 'diCreateTime'),
+    hideInputItem('鏇存柊鏃堕棿', 'diUpdateTime'),
+    hideInputItem('鍦烘櫙id', 'diSceneGuid'),
+    hideInputItem('鍦烘櫙绫诲瀷', 'diSceneTypeId'),
+
     baseInputItem('绔欑偣鍚嶇О', 'diName', true),
     baseInputItem('璁惧缂栧彿', 'diDeviceCode'),
     // 璁惧绫诲瀷鍜岃澶囧瓙绫诲悎骞剁敤绾ц仈閫夋嫨鍣ㄥ睍绀�
-    baseInputItem('璁惧绫诲瀷', '_type', true, 'cascader', monitorDevices(sceneType)),
+    baseInputItem(
+      '璁惧绫诲瀷',
+      '_type',
+      true,
+      'cascader',
+      monitorDevices(sceneType),
+      ['閫夋嫨璁惧绫诲瀷', '閫夋嫨璁惧瀛愮被'],
+      ['diTypeId', 'diSubtypeId'],
+    ),
     // baseInputItem('璁惧绫诲瀷', 'diTypeId', true, 'picker'),
     // baseInputItem('璁惧瀛愮被', 'diSubtypeId', true, 'picker'),
     baseInputItem('渚涘簲鍟�', 'diSupplier'),
@@ -49,37 +48,124 @@
     baseInputItem('鎵�鏈夋潈', 'diOwnership', true, 'picker', ownership),
 
     // todo 2024/8/12: 鍚庣画瑕佹坊鍔犱簩缁寸爜鐨勪俊鎭壂鎻忓綍鍏�
-    // baseInputItem('鏍囪瘑浜岀淮鐮�', 'DI_QR_Code'),
-    // baseInputItem('鍏朵粬绗笁鏂规垨璁惧鑷甫浜岀淮鐮�', 'DI_Other_QR_Code'),
+    // baseInputItem('鏍囪瘑浜岀淮鐮�', 'diQRCode'),
+    // baseInputItem('鍏朵粬绗笁鏂规垨璁惧鑷甫浜岀淮鐮�', 'diOtherQRCode'),
   ];
+
+  // 濉厖榛樿鏁版嵁
+  setDefaultValue(items, defaultValue);
+
+  return items;
 }
 
 /**
  * 娌荤悊璁惧琛ㄥ崟
  */
-export function treatmentDeviceForm(sceneType) {
-  return [
-    baseInputItem('绔欑偣鍚嶇О', 'diName', true),
-    baseInputItem('璁惧缂栧彿', 'diDeviceCode'),
-    baseInputItem('璁惧绫诲瀷', 'diType', true),
-    baseInputItem('渚涘簲鍟�', 'diSupplier'),
-    baseInputItem('杩愮淮鍟�', 'diMaintainer'),
-    baseInputItem('鏄惁涓婄嚎', 'diRunningStatus', true, 'switch'),
-    baseInputItem('鏄惁鎷嗛櫎', 'diRemoved', true, 'switch'),
+export function treatmentDeviceForm(sceneType, defaultValue) {
+  const items = [
+    hideInputItem('id', 'piId'),
+    hideInputItem('鍒涘缓鏃堕棿', 'piCreateTime'),
+    hideInputItem('鏇存柊鏃堕棿', 'piUpdateTime'),
+    hideInputItem('鍦烘櫙id', 'piSceneGuid'),
+    hideInputItem('鍦烘櫙绫诲瀷', 'piSceneTypeId'),
+
+    baseInputItem('璁惧鍚嶇О', 'piName', true),
+    baseInputItem('璁惧缂栧彿', 'piDeviceCode'),
+    // 璁惧绫诲瀷鍜岃澶囧瓙绫诲悎骞剁敤绾ц仈閫夋嫨鍣ㄥ睍绀�
+    baseInputItem(
+      '璁惧绫诲瀷',
+      '_type',
+      true,
+      'cascader',
+      treatmentDevices(sceneType),
+      ['閫夋嫨璁惧绫诲瀷', '閫夋嫨璁惧瀛愮被'],
+      ['piTypeId', 'piSubtypeId'],
+    ),
+    // baseInputItem('璁惧绫诲瀷', 'piTypeId', true, 'picker'),
+    // baseInputItem('璁惧瀛愮被', 'piSubtypeId', true, 'picker'),
+    baseInputItem('渚涘簲鍟�', 'piSupplier'),
+    baseInputItem('杩愮淮鍟�', 'piMaintainer'),
+    baseInputItem('杩愮淮棰戞', 'piMaintainFrequency', true, 'picker', freq),
+    baseInputItem('杩愮淮浜哄憳', 'piMaintainStaff'),
+    baseInputItem('杩愮淮鐢佃瘽', 'piMaintainTel'),
+    baseInputItem('杩愯鐘舵��', 'piRunningStatus', true, 'picker', status),
+    baseInputItem('鍝佺墝鍨嬪彿', 'piBrandModel'),
+    baseInputItem('璁惧鍙傛暟', 'piDeviceParam'),
+    baseInputItem('鎵�鏈夋潈', 'piOwnership', true, 'picker', ownership),
+
+    // todo 2024/8/12: 鍚庣画瑕佹坊鍔犱簩缁寸爜鐨勪俊鎭壂鎻忓綍鍏�
+    // baseInputItem('鏍囪瘑浜岀淮鐮�', 'piQRCode'),
+    // baseInputItem('鍏朵粬绗笁鏂规垨璁惧鑷甫浜岀淮鐮�', 'piOtherQRCode'),
   ];
+  setDefaultValue(items, defaultValue);
+  return items;
 }
 
 /**
  * 鐢熶骇璁惧琛ㄥ崟
  */
-export function productionDeviceForm(sceneType) {
-  return [
-    baseInputItem('绔欑偣鍚嶇О', 'diName', true),
-    baseInputItem('璁惧缂栧彿', 'diDeviceCode'),
-    baseInputItem('璁惧绫诲瀷', 'diType', true),
-    baseInputItem('渚涘簲鍟�', 'diSupplier'),
-    baseInputItem('杩愮淮鍟�', 'diMaintainer'),
-    baseInputItem('鏄惁涓婄嚎', 'diRunningStatus', true, 'switch'),
-    baseInputItem('鏄惁鎷嗛櫎', 'diRemoved', true, 'switch'),
+export function productionDeviceForm(sceneType, defaultValue) {
+  const items = [
+    hideInputItem('id', 'wiId'),
+    hideInputItem('鍒涘缓鏃堕棿', 'wiCreateTime'),
+    hideInputItem('鏇存柊鏃堕棿', 'wiUpdateTime'),
+    hideInputItem('鍦烘櫙id', 'wiSceneGuid'),
+    hideInputItem('鍦烘櫙绫诲瀷', 'wiSceneTypeId'),
+
+    baseInputItem('璁惧鍚嶇О', 'wiName', true),
+    baseInputItem('璁惧缂栧彿', 'wiDeviceCode'),
+    // 璁惧绫诲瀷鍜岃澶囧瓙绫诲悎骞剁敤绾ц仈閫夋嫨鍣ㄥ睍绀�
+    baseInputItem(
+      '璁惧绫诲瀷',
+      '_type',
+      true,
+      'cascader',
+      productionDevices(sceneType),
+      ['閫夋嫨璁惧绫诲瀷', '閫夋嫨璁惧瀛愮被'],
+      ['wiTypeId', 'wiSubtypeId'],
+    ),
+    // baseInputItem('璁惧绫诲瀷', 'piTypeId', true, 'picker'),
+    // baseInputItem('璁惧瀛愮被', 'piSubtypeId', true, 'picker'),
+    baseInputItem('渚涘簲鍟�', 'wiSupplier'),
+    baseInputItem('鏈嶅姟鍟�', 'wiServicer'),
+    baseInputItem('鏈嶅姟浜哄憳', 'wiMaintainStaff'),
+    baseInputItem('鏈嶅姟鐢佃瘽', 'wiMaintainTel'),
+    baseInputItem('杩愯鐘舵��', 'wiRunningStatus', true, 'picker', status),
+    baseInputItem('鍝佺墝鍨嬪彿', 'wiBrandModel'),
+    baseInputItem('璁惧鍙傛暟', 'wiDeviceParam'),
+    baseInputItem('鎵�鏈夋潈', 'wiOwnership', true, 'picker', ownership),
+
+    // todo 2024/8/12: 鍚庣画瑕佹坊鍔犱簩缁寸爜鐨勪俊鎭壂鎻忓綍鍏�
+    // baseInputItem('鏍囪瘑浜岀淮鐮�', 'wiQRCode'),
+    // baseInputItem('鍏朵粬绗笁鏂规垨璁惧鑷甫浜岀淮鐮�', 'wiOtherQRCode'),
   ];
+  setDefaultValue(items, defaultValue);
+  return items;
+}
+
+/**
+ * 璁惧鐘舵�佽〃鍗�
+ */
+export function deviceStatusForm(defaultValue) {
+  const items = [
+    hideInputItem('id', 'dlId'),
+    hideInputItem('璁惧id', 'dlDeviceId'),
+    hideInputItem('璁惧绫诲瀷', 'dlDeviceType'),
+    hideInputItem('鍦烘櫙id', 'dlSceneGuid'),
+    hideInputItem('鍦烘櫙绫诲瀷', 'dlSceneTypeId'),
+    hideInputItem('鐜板満鍥剧墖', 'dlPicUrl'),
+    hideInputItem('鐜板満瑙嗛', 'dlVideoUrl'),
+    hideInputItem('鍒涘缓鏃堕棿', 'dlCreateTime'),
+    hideInputItem('鏇存柊鏃堕棿', 'dlUpdateTime'),
+    hideInputItem('璁惧浣嶇疆', 'dlLocation', true),
+    hideInputItem('缁忓害', 'dlLongitude'),
+    hideInputItem('缁村害', 'dlLatitude', true),
+
+    baseInputItem('鏄惁瑙勮寖', 'dlStandard', true, 'switch'),
+    baseInputItem('涓嶈鑼冨師鍥�', 'dlUnStandardReason'),
+    baseInputItem('杩愯鐘舵��', 'dlRealTimeStatus', true, 'picker', status),
+  ];
+
+  setDefaultValue(items, defaultValue);
+  return items;
 }

--
Gitblit v1.9.3