From 65124213af664a68ad88ce7f6dcb133116d7702f Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期一, 12 八月 2024 17:27:08 +0800
Subject: [PATCH] 监管场景设备信息管理模块

---
 pages/inspection/scene/info/device-info-items.js |  118 ++++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 84 insertions(+), 34 deletions(-)

diff --git a/pages/inspection/scene/info/device-info-items.js b/pages/inspection/scene/info/device-info-items.js
index 92f4ff4..e34449c 100644
--- a/pages/inspection/scene/info/device-info-items.js
+++ b/pages/inspection/scene/info/device-info-items.js
@@ -1,35 +1,85 @@
-export const menuData = [
-  {
-    label: '绔欑偣鍚嶇О',
-    placeholder: '璇疯緭鍏ョ珯鐐瑰悕绉�',
-    name: 'diName',
-    value: '',
+import { monitorDevices } from '../../../../common/dataMonitorDeviceType';
+import { treatmentDevices } from '../../../../common/dataTreatmentDeviceType';
+import { productionDevices } from '../../../../common/dataProductionDeviceType';
+import { freq } from '../../../../common/dataMaintainFrequency';
+import { status } from '../../../../common/dataRunningStatus';
+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: '绔欑偣鍚嶇О涓嶈兘涓虹┖',
-    onChange:(v)=>{
-      this.value = v
-    }
-  },
-  {
-    label: 'MN缂栧彿',
-    placeholder: '璇疯緭鍏N缂栧彿',
-    name: 'diMnCode',
-    value: '',
-    status: 'success',
-    tips: 'MN缂栧彿涓嶈兘涓虹┖',
-    onChange:(v)=>{
-      this.value = v
-    }
-  },
-  {
-    label: '璁惧绫诲瀷',
-    placeholder: '璇疯緭鍏ヨ澶囩被鍨�',
-    name: 'diType',
-    value: '',
-    status: 'success',
-    tips: '璁惧绫诲瀷涓嶈兘涓虹┖',
-    onChange:(v)=>{
-      this.value = v
-    }
-  },
-];
+    tips: _label + '涓嶈兘涓虹┖',
+    inputType: _type,
+    options: _options,
+  };
+}
+
+/**
+ * 鐩戞祴璁惧琛ㄥ崟
+ */
+export function monitorDeviceForm(sceneType) {
+  return [
+    baseInputItem('绔欑偣鍚嶇О', 'diName', true),
+    baseInputItem('璁惧缂栧彿', 'diDeviceCode'),
+    // 璁惧绫诲瀷鍜岃澶囧瓙绫诲悎骞剁敤绾ц仈閫夋嫨鍣ㄥ睍绀�
+    baseInputItem('璁惧绫诲瀷', '_type', true, 'cascader', monitorDevices(sceneType)),
+    // baseInputItem('璁惧绫诲瀷', 'diTypeId', true, 'picker'),
+    // baseInputItem('璁惧瀛愮被', 'diSubtypeId', true, 'picker'),
+    baseInputItem('渚涘簲鍟�', 'diSupplier'),
+    baseInputItem('杩愮淮鍟�', 'diMaintainer'),
+    baseInputItem('杩愮淮棰戞', 'diMaintainFrequency', true, 'picker', freq),
+    baseInputItem('杩愮淮浜哄憳', 'diMaintainStaff'),
+    baseInputItem('杩愮淮鐢佃瘽', 'diMaintainTel'),
+    baseInputItem('杩愯鐘舵��', 'diRunningStatus', true, 'picker', status),
+    baseInputItem('鍝佺墝鍨嬪彿', 'diBrandModel'),
+    baseInputItem('璁惧鍙傛暟', 'diDeviceParam'),
+    baseInputItem('鎵�鏈夋潈', 'diOwnership', true, 'picker', ownership),
+
+    // todo 2024/8/12: 鍚庣画瑕佹坊鍔犱簩缁寸爜鐨勪俊鎭壂鎻忓綍鍏�
+    // baseInputItem('鏍囪瘑浜岀淮鐮�', 'DI_QR_Code'),
+    // baseInputItem('鍏朵粬绗笁鏂规垨璁惧鑷甫浜岀淮鐮�', 'DI_Other_QR_Code'),
+  ];
+}
+
+/**
+ * 娌荤悊璁惧琛ㄥ崟
+ */
+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 productionDeviceForm(sceneType) {
+  return [
+    baseInputItem('绔欑偣鍚嶇О', 'diName', true),
+    baseInputItem('璁惧缂栧彿', 'diDeviceCode'),
+    baseInputItem('璁惧绫诲瀷', 'diType', true),
+    baseInputItem('渚涘簲鍟�', 'diSupplier'),
+    baseInputItem('杩愮淮鍟�', 'diMaintainer'),
+    baseInputItem('鏄惁涓婄嚎', 'diRunningStatus', true, 'switch'),
+    baseInputItem('鏄惁鎷嗛櫎', 'diRemoved', true, 'switch'),
+  ];
+}

--
Gitblit v1.9.3