/** * 设备运行状态 */ const status = [ { value: '0', label: '未联网' }, { value: '1', label: '上线中' }, { value: '2', label: '已下线' }, { value: '3', label: '已拆除' }, ]; function toLabel(value) { let r = status.find(item => { return item.value == value; }); if (!r) r = status[0] return r.label } function toValue(label) { const r = status.find(item => { return item.label == label; }); return r.value } export { status, toLabel, toValue };