From d835d1b51f832889929cdf69010034a30ef44d02 Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期四, 17 十月 2024 13:57:29 +0800
Subject: [PATCH] #
---
zy-asrs-flow/src/pages/map/header/search.jsx | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 101 insertions(+), 14 deletions(-)
diff --git a/zy-asrs-flow/src/pages/map/header/search.jsx b/zy-asrs-flow/src/pages/map/header/search.jsx
index 4fb895d..61f1ad1 100644
--- a/zy-asrs-flow/src/pages/map/header/search.jsx
+++ b/zy-asrs-flow/src/pages/map/header/search.jsx
@@ -26,17 +26,61 @@
)
})
break;
- case Utils.SENSOR_TYPE.AGV:
+ case Utils.SENSOR_TYPE.CONVEYOR:
options.push({
value: value,
label:
(
<>
- <span style={{ fontWeight: 'bold' }} >{intl.formatMessage({ id: 'map.sensor.type.agv', defaultMessage: '鏃犱汉灏忚溅' })}</span>
+ <span style={{ fontWeight: 'bold' }} >{intl.formatMessage({ id: 'map.sensor.type.conveyor', defaultMessage: '杈撻�佺嚎' })}</span>
</>
)
})
break;
+ case Utils.SENSOR_TYPE.SHUTTLE:
+ options.push({
+ value: value,
+ label:
+ (
+ <>
+ <span style={{ fontWeight: 'bold' }} >{intl.formatMessage({ id: 'map.sensor.type.shuttle', defaultMessage: '绌挎杞�' })}</span>
+ </>
+ )
+ })
+ break;
+ case Utils.SENSOR_TYPE.LIFT:
+ options.push({
+ value: value,
+ label:
+ (
+ <>
+ <span style={{ fontWeight: 'bold' }} >{intl.formatMessage({ id: 'map.sensor.type.lift', defaultMessage: '鎻愬崌鏈�' })}</span>
+ </>
+ )
+ })
+ break;
+ // case Utils.SENSOR_TYPE.AGV:
+ // options.push({
+ // value: value,
+ // label:
+ // (
+ // <>
+ // <span style={{ fontWeight: 'bold' }} >{intl.formatMessage({ id: 'map.sensor.type.agv', defaultMessage: 'AGV' })}</span>
+ // </>
+ // )
+ // })
+ // break;
+ // case Utils.SENSOR_TYPE.POINT:
+ // options.push({
+ // value: value,
+ // label:
+ // (
+ // <>
+ // <span style={{ fontWeight: 'bold' }} >{intl.formatMessage({ id: 'map.sensor.type.point', defaultMessage: '瀹氫綅鐐�' })}</span>
+ // </>
+ // )
+ // })
+ // break;
default:
break;
}
@@ -54,13 +98,29 @@
label: renderTitle(child.data.no, child.data.uuid)
})
}
+ // lift special handling
+ if (curSensorType === Utils.SENSOR_TYPE.LIFT) {
+ if (child?.data?.type === Utils.SENSOR_TYPE.SHELF && child?.data?.shelfType === Utils.SHELF_TYPE.LIFT) {
+ sensorListAll.push({
+ value: child.data.liftNo + '',
+ label: renderTitle(child.data.liftNo + '', child.data.uuid)
+ })
+ }
+ }
});
return sensorListAll;
}
const MapSearch = (props) => {
const intl = useIntl();
- const { curSprite: curSensor, setCurSPrite: setCurSensor } = props;
+ const {
+ curSprite: curSensor,
+ setCurSPrite: setCurSensor,
+ setSpriteBySettings,
+ model,
+ setModel,
+ ModelEnum,
+ } = props;
const sensorTypeSelectOptions = sensorTypeSelectOptionsFn(intl);
const [curSensorType, setCurSensorType] = React.useState(sensorTypeSelectOptions?.[0]?.value);
@@ -69,23 +129,53 @@
const [filterSensorList, setFilterSensorList] = React.useState([]);
const [curSensorLabel, setCurSensorLabel] = React.useState(null);
- // first select
- React.useEffect(() => {
- if (!Utils.getMapContainer()) { return; }
+ const resetSearch = () => {
let sensorListAll = getAllSensorList(curSensorType);
setSensorList(sensorListAll);
setFilterSensorList(sensorListAll);
setCurSensorLabel(null);
- }, [curSensorType])
+ }
- // second select
+ // first select and switch floor
+ React.useEffect(() => {
+ if (!Utils.getMapContainer()) { return }
+ setTimeout(() => {
+ resetSearch();
+ }, 200)
+ }, [curSensorType, props.curFloor])
+
+ // second select condition
React.useEffect(() => {
if (!Utils.getMapContainer()) { return; }
- if ((curSensorLabel !== null || curSensorLabel != undefined)
- && sensorList && sensorList.length > 0) {
+ if (!Utils.isNullOfUndefined(curSensorLabel) && sensorList && sensorList.length > 0) {
setFilterSensorList(sensorList.filter(item => item.value.includes(curSensorLabel)));
}
}, [curSensorLabel])
+
+ const onSecondSelect = (value, option) => {
+ const uuid = option.label?.props?.children?.[1].props.children;
+ const selectSensor = Utils.findSpriteByUuid(uuid);
+ if (selectSensor) {
+ Utils.beCenter(selectSensor);
+ }
+ switch (model) {
+ case ModelEnum.OBSERVER_MODEL:
+ setCurSensor(selectSensor);
+ break;
+ case ModelEnum.MOVABLE_MODEL:
+ setModel(ModelEnum.SETTINGS_MODEL);
+ // avoid model modify which will clear spriteBySettings
+ setTimeout(() => {
+ setSpriteBySettings(selectSensor);
+ }, 200)
+ break;
+ case ModelEnum.SETTINGS_MODEL:
+ setSpriteBySettings(selectSensor);
+ break;
+ default:
+ break;
+ }
+ }
return (
<>
@@ -114,10 +204,7 @@
popupMatchSelectWidth={500}
options={filterSensorList}
value={curSensorLabel}
- onSelect={(value, option) => {
- const uuid = option.label?.props?.children?.[1].props.children;
- setCurSensor(Utils.findSpriteByUuid(uuid));
- }}
+ onSelect={onSecondSelect}
onChange={setCurSensorLabel}
/>
</>
--
Gitblit v1.9.1