const dustDeviceType = [ { label: '非道', value: '1', children: [ { label: '挖掘机', value: '1' }, { label: '叉车', value: '2' }, { label: '履带吊', value: '3' }, { label: '铲车', value: '4' }, { label: '发动机', value: '5' }, ], }, ]; const fumeDeviceType = [ { label: '厨具', value: '1', children: [{ label: '厨具', value: '1' }], }, ]; const vocDeviceType = [ { label: 'VOC', value: '1', children: [{ label: 'VOC', value: '1' }], }, ]; // 生产设备类型 function productionDevices(sceneType) { switch (parseInt(sceneType)) { // 工地,码头,搅拌站,堆场 case 1: case 2: case 3: case 14: return dustDeviceType; // 餐饮 case 5: return fumeDeviceType; // 工业企业,汽修 case 4: case 6: return vocDeviceType; default: return dustDeviceType; } } 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 default { productionDevices, toLabel };