Merge remote-tracking branch 'origin/Four-Way-Rack' into Four-Way-Rack
| | |
| | | } |
| | | }) |
| | | |
| | | const floorSelectOptions = [ |
| | | { |
| | | label: '1F', |
| | | value: 1 |
| | | }, |
| | | { |
| | | label: '2F', |
| | | value: 2 |
| | | }, |
| | | { |
| | | label: '3F', |
| | | value: 3 |
| | | }, |
| | | { |
| | | label: '4F', |
| | | value: 4 |
| | | }, |
| | | { |
| | | label: '5F', |
| | | value: 5 |
| | | }, |
| | | ] |
| | | |
| | | const MapFloor = (props) => { |
| | | const intl = useIntl(); |
| | | const { styles } = useStyles(); |
| | | |
| | | const [floorSelectOptions, setFloorSelectOptions] = useState([]); |
| | | |
| | | React.useEffect(() => { |
| | | const initFloorList = async () => { |
| | | const data = await Utils.fetchMapFloor(); |
| | | setFloorSelectOptions(data) |
| | | } |
| | | initFloorList(); |
| | | }, []); |
| | | |
| | | const floorChange = (floor) => { |
| | |
| | | DISABLE: 1, |
| | | }) |
| | | |
| | | export const NOTIFY_TYPE = Object.freeze({ |
| | | OPEN: 'open', |
| | | SUCCESS: 'success', |
| | | INFO: 'info', |
| | | WARNING: 'warning', |
| | | ERROR: 'error', |
| | | }) |
| | | |
| | | export const getRealPosition = (x, y, mapContainer) => { |
| | | const rect = app.view.getBoundingClientRect(); |
| | | return { |
| | |
| | | return options; |
| | | } |
| | | |
| | | export const fetchMapFloor = async () => { |
| | | const res = await Http.doPost('api/map/floor/list'); |
| | | if (res.code === 200) { |
| | | return eval(res.data); |
| | | } |
| | | mapNotify(res.msg, NOTIFY_TYPE.ERROR); |
| | | } |
| | | |
| | | export const fetchMapData = async (curFloor) => { |
| | | clearMapData(); |
| | | await Http.doPostPromise('api/map/list', { floor: curFloor }, (res) => { |
| | |
| | | .to(targetPos, 500).start(); |
| | | } |
| | | |
| | | export const mapNotify = (msg) => { |
| | | notify.open({ |
| | | export const mapNotify = (msg, type = NOTIFY_TYPE.OPEN) => { |
| | | notify[type]({ |
| | | description: msg, |
| | | duration: 1.5, |
| | | style: { width: 300 }, |
| | |
| | | public String getMapFloorList(Long userId) { |
| | | String floorKey = "map-floor-list"; |
| | | Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>().eq(Dict::getFlag, floorKey)); |
| | | if (null == dict) { |
| | | dict = new Dict(); |
| | | dict.setName(floorKey); |
| | | dict.setFlag(floorKey); |
| | | dict.setType(DictType.JSON.flag); |
| | | dict.setValue("[\n" + |
| | | " {\n" + |
| | | " label: '1F',\n" + |
| | | " value: 1\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " label: '2F',\n" + |
| | | " value: 2\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " label: '3F',\n" + |
| | | " value: 3\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " label: '4F',\n" + |
| | | " value: 4\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " label: '5F',\n" + |
| | | " value: 5\n" + |
| | | " },\n" + |
| | | "]"); |
| | | dict.setCreateBy(userId); |
| | | dict.setUpdateBy(userId); |
| | | if (!dictService.save(dict)) { |
| | | throw new CoolException("服务器内部错误"); |
| | | } |
| | | } |
| | | return Optional.ofNullable(dict).map(Dict::getValue).orElse(null); |
| | | } |
| | | |