From 093afd3be27ea5e9692839845b69bd56e2405518 Mon Sep 17 00:00:00 2001 From: Riku <risaku@163.com> Date: 星期二, 13 八月 2024 23:49:45 +0800 Subject: [PATCH] 204.8.13 --- common/dataProductionDeviceType.js | 56 +++++++++++++++++++++++++++++++------------------------- 1 files changed, 31 insertions(+), 25 deletions(-) diff --git a/common/dataProductionDeviceType.js b/common/dataProductionDeviceType.js index 916109e..856e2f3 100644 --- a/common/dataProductionDeviceType.js +++ b/common/dataProductionDeviceType.js @@ -3,10 +3,11 @@ label: '闈為亾', value: '1', children: [ - { - label: '鎸栨帢鏈�', - value: '1', - }, + { label: '鎸栨帢鏈�', value: '1' }, + { label: '鍙夎溅', value: '2' }, + { label: '灞ュ甫鍚�', value: '3' }, + { label: '閾茶溅', value: '4' }, + { label: '鍙戝姩鏈�', value: '5' }, ], }, ]; @@ -15,12 +16,7 @@ { label: '鍘ㄥ叿', value: '1', - children: [ - { - label: '鍘ㄥ叿', - value: '1', - }, - ], + children: [{ label: '鍘ㄥ叿', value: '1' }], }, ]; @@ -28,34 +24,44 @@ { label: 'VOC', value: '1', - children: [ - { - label: 'VOC', - value: '1', - }, - ], + children: [{ label: 'VOC', value: '1' }], }, ]; // 鐢熶骇璁惧绫诲瀷 function productionDevices(sceneType) { - switch (sceneType) { + switch (parseInt(sceneType)) { // 宸ュ湴,鐮佸ご,鎼呮媽绔�,鍫嗗満 - case '1': - case '2': - case '3': - case '14': + case 1: + case 2: + case 3: + case 14: return dustDeviceType; // 椁愰ギ - case '5': + case 5: return fumeDeviceType; // 宸ヤ笟浼佷笟,姹戒慨 - case '4': - case '6': + case 4: + case 6: return vocDeviceType; default: return dustDeviceType; } } -export { productionDevices }; +function toLabel(sceneType, valueArr) { + const labelArr = []; + let options = productionDevices(sceneType); + valueArr.forEach(v => { + if (options) { + const op = options.find(o => { + return o.value == v; + }); + labelArr.push(op.label); + options = options.children; + } + }); + return labelArr; +} + +export { productionDevices, toLabel }; -- Gitblit v1.9.3