#
luxiaotao1123
2024-03-15 3c190ac12e00e0f3435984c5d57351d136530c09
#
4个文件已修改
81 ■■■■■ 已修改文件
zy-asrs-flow/src/locales/en-US/map.ts 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/map/index.jsx 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/map/utils.js 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/entity/MapItem.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/locales/en-US/map.ts
@@ -5,6 +5,7 @@
    'map.device.oper': 'Device Settings',
    'map.model.observer': 'Observer Pattern',
    'map.model.editor': 'Editor Pattern',
    'map.save': 'Save Map',
    '': '',
    '': '',
    '': '',
zy-asrs-flow/src/pages/map/index.jsx
@@ -237,9 +237,19 @@
                        {/* 3C40C6 */}
                        <Col span={12} style={{ backgroundColor: '#4a69bd' }}>
                            <Flex className={styles.flex} gap={'large'} justify={'flex-end'} align={'center'}>
                                <span>
                                    {curSprite?.data?.uuid}
                                </span>
                                {model !== MapModel.OBSERVER_MODEL && (
                                    <>
                                        <Button
                                            onClick={() => {
                                                Utils.saveMapData();
                                            }}
                                        >
                                            <FormattedMessage id='map.save' defaultMessage='保存地图' />
                                        </Button>
                                    </>
                                )}
                                <Select
                                    className='map-header-select'
                                    size={'large'}
zy-asrs-flow/src/pages/map/utils.js
@@ -1,5 +1,6 @@
import * as PIXI from 'pixi.js';
import * as TWEEDLE from 'tweedle.js';
import Http from '@/utils/http';
let app = null;
let mapContainer = null;
@@ -76,7 +77,7 @@
            dragTarget = event.currentTarget;
            mapContainer.parent.off('pointermove');
            mapContainer.parent.on('pointermove', onDragMove, dragTarget);
            mapContainer.parent.off('pointerup');
            mapContainer.parent.on('pointerup', onDragEnd.bind(mapContainer));
        }
@@ -269,6 +270,20 @@
    }
}
export const rotationToNum = (rotation) => {
    let res = rotation * 180 / Math.PI;
    if (res < 0) {
        res += 360;
    } else if (res > 360) {
        res -= 360;
    }
    return res;
}
export const rotationParseNum = (num) => {
}
export const findSpriteByUuid = (uuid) => {
    return mapContainer?.children?.find(child => child?.data?.uuid === uuid);
}
@@ -295,4 +310,38 @@
    })
    return options;
}
export const fetchMapData = () => {
}
export const saveMapData = async () => {
    if (!mapContainer) {
        return;
    }
    let mapItemList = [];
    mapContainer?.children.forEach(child => {
        if (child.data?.uuid) {
            console.log(child.scale, child.rotation);
            mapItemList.push({
                // data
                type: child.data.type,
                uuid: child.data.uuid,
                no: child.data.no,
                // graph
                positionX: child.position.x,
                positionY: child.position.y,
                scaleX: child.scale.x,
                scaleY: child.scale.y,
                rotation: rotationToNum(child.rotation)
            })
        }
    })
    const resp = await Http.doPost('api/map/save', { itemList: mapItemList })
    console.log(resp);
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/entity/MapItem.java
@@ -8,8 +8,21 @@
@Data
public class MapItem {
    private String type;
    private String uuid;
    private String no;
    private Double positionX;
    private Double positionY;
    private Double scaleX;
    private Double scaleY;
    private Double rotation;
}