| | |
| | | import * as Utils from '../utils' |
| | | import { values } from 'lodash'; |
| | | |
| | | const renderTitle = (title) => ( |
| | | <span |
| | | style={{ |
| | | fontWeight: 'bold' |
| | | }} |
| | | > |
| | | {title} |
| | | </span> |
| | | const renderTitle = (title, uuid) => ( |
| | | <> |
| | | <span |
| | | style={{ |
| | | fontWeight: 'bold' |
| | | }} |
| | | > |
| | | {title} |
| | | </span> |
| | | <span |
| | | style={{ |
| | | float: 'right', |
| | | opacity: .3 |
| | | }} |
| | | > |
| | | {uuid} |
| | | </span> |
| | | </> |
| | | |
| | | ); |
| | | |
| | | const MapSearch = (props) => { |
| | |
| | | if (child?.data?.type === Utils.SENSOR_TYPE.SHELF) { |
| | | setSensorList(prevArr => [...prevArr, { |
| | | value: child.data.uuid, |
| | | label: renderTitle(child.data.shelfNo) |
| | | label: renderTitle(child.data.shelfNo, child.data.uuid) |
| | | }]); |
| | | } |
| | | }) |
| | |
| | | value={curSensorLabel} |
| | | onSelect={(value, option) => { |
| | | setCurSensorUuid(value); |
| | | if (option.label?.props?.children) { |
| | | setCurSensorLabel(option.label?.props?.children) |
| | | let showLable = option.label?.props?.children?.[0].props.children; |
| | | if (showLable) { |
| | | setCurSensorLabel(showLable) |
| | | } else { |
| | | return setCurSensorLabel(value); |
| | | } |
| | | }} |
| | | onChange={(value) => { |
| | | setCurSensorLabel(value); |
| | | if (!value) { |
| | | setCurSensorUuid(null); |
| | | setCurSensorLabel(null); |
| | | setCurSensor(null); |
| | | } else { |
| | | |
| | | } |
| | | }} |
| | | /> |
| | | </> |
| | | ) |