| | |
| | | import { FormattedMessage, useIntl, useModel } from '@umijs/max'; |
| | | import { createStyles } from 'antd-style'; |
| | | import * as Utils from '../utils' |
| | | import * as PIXI from 'pixi.js'; |
| | | |
| | | const useStyles = createStyles(({ token, css }) => { |
| | | |
| | |
| | | const { styles } = useStyles(); |
| | | const { curSprite, configForm: form } = props; |
| | | |
| | | const [showLiftNoItem, setShowLiftNoItem] = React.useState(false); |
| | | const [showConveyorNoItem, setShowConveyorNoItem] = React.useState(false); |
| | | |
| | | useEffect(() => { |
| | | form.resetFields(); |
| | | if (curSprite) { |
| | | form.setFieldsValue({ |
| | | shelfType: Utils.SHELF_TYPE.STORE, |
| | | ...curSprite.data |
| | | }) |
| | | setShowLiftNoItem(form.getFieldValue('shelfType') === Utils.SHELF_TYPE.LIFT); |
| | | setShowConveyorNoItem(form.getFieldValue('shelfType') === Utils.SHELF_TYPE.CONVEYOR); |
| | | } |
| | | }, [props, form]); |
| | | |
| | |
| | | }); |
| | | } |
| | | break; |
| | | case 'shelfType': |
| | | const shelfType = form.getFieldValue('shelfType'); |
| | | setShowLiftNoItem(shelfType === Utils.SHELF_TYPE.LIFT); |
| | | setShowConveyorNoItem(shelfType === Utils.SHELF_TYPE.CONVEYOR); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | |
| | | // execute where the form was finished |
| | | const confirmSettings = () => { |
| | | if (curSprite && curSprite?.data?.type) { |
| | | curSprite.data = { ...curSprite.data, ...values } |
| | | curSprite.data = { ...curSprite.data, ...values }; |
| | | Utils.showSheflType(curSprite); |
| | | } |
| | | message.success(intl.formatMessage({ id: 'common.success', defaultMessage: '操作成功' })); |
| | | } |
| | | |
| | | console.log(values); |
| | | props.onSubmit({ ...values }, confirmSettings); |
| | | } |
| | | |
| | |
| | | <span>{curSprite?.data?.type}</span> |
| | | </Form.Item> |
| | | <Form.Item |
| | | label={intl.formatMessage({ id: 'map.settings.uuid', defaultMessage: '地图号' })} |
| | | label={intl.formatMessage({ id: 'map.settings.uuid', defaultMessage: '图号' })} |
| | | > |
| | | <span>{curSprite?.data?.uuid}</span> |
| | | </Form.Item> |
| | | |
| | | {curSprite?.data?.type === Utils.SENSOR_TYPE.AGV && ( |
| | | <> |
| | | |
| | | </> |
| | | )} |
| | | |
| | | {curSprite?.data?.type === Utils.SENSOR_TYPE.SHUTTLE && ( |
| | | <> |
| | | |
| | | </> |
| | |
| | | options={[ |
| | | { |
| | | label: intl.formatMessage({ id: 'map.settings.shelf.store', defaultMessage: '库位' }), |
| | | value: 0 |
| | | value: Utils.SHELF_TYPE.STORE |
| | | }, |
| | | { |
| | | label: intl.formatMessage({ id: 'map.settings.shelf.track', defaultMessage: '轨道' }), |
| | | value: 3 |
| | | value: Utils.SHELF_TYPE.TRACK |
| | | }, |
| | | { |
| | | label: intl.formatMessage({ id: 'map.settings.shelf.lift', defaultMessage: '提升机' }), |
| | | value: Utils.SHELF_TYPE.LIFT |
| | | }, |
| | | { |
| | | label: intl.formatMessage({ id: 'map.settings.shelf.charge', defaultMessage: '充电站' }), |
| | | value: Utils.SHELF_TYPE.CHARGE |
| | | }, |
| | | { |
| | | label: intl.formatMessage({ id: 'map.settings.shelf.conveyor', defaultMessage: '输送线' }), |
| | | value: Utils.SHELF_TYPE.CONVEYOR |
| | | }, |
| | | { |
| | | label: intl.formatMessage({ id: 'map.settings.shelf.diable', defaultMessage: '禁用' }), |
| | | value: 1 |
| | | value: Utils.SHELF_TYPE.DISABLE |
| | | }, |
| | | ]} |
| | | defaultValue={0} |
| | | /> |
| | | </Form.Item> |
| | | |
| | | {showLiftNoItem && ( |
| | | <> |
| | | <Form.Item |
| | | name='liftNo' |
| | | label={intl.formatMessage({ id: 'map.settings.lift.no', defaultMessage: '提升机编号' })} |
| | | rules={[ |
| | | { |
| | | required: true, |
| | | }, |
| | | ]} |
| | | > |
| | | <InputNumber |
| | | style={{ |
| | | width: '50%', |
| | | }} |
| | | /> |
| | | </Form.Item> |
| | | </> |
| | | )} |
| | | |
| | | {showConveyorNoItem && ( |
| | | <> |
| | | <Form.Item |
| | | name='conveyorNo' |
| | | label={intl.formatMessage({ id: 'map.settings.conveyor.no', defaultMessage: '输送站号' })} |
| | | rules={[ |
| | | { |
| | | required: true, |
| | | }, |
| | | ]} |
| | | > |
| | | <InputNumber |
| | | style={{ |
| | | width: '50%', |
| | | }} |
| | | /> |
| | | </Form.Item> |
| | | <Form.Item |
| | | name='conveyorHasGo' |
| | | label={intl.formatMessage({ id: 'map.settings.conveyor.hasGo', defaultMessage: '小车可走' })} |
| | | valuePropName="checked" |
| | | > |
| | | <Checkbox |
| | | style={{ |
| | | width: '50%', |
| | | }} |
| | | /> |
| | | </Form.Item> |
| | | </> |
| | | )} |
| | | |
| | | <Form.Item |
| | | label={intl.formatMessage({ id: 'map.settings.shelf.space', defaultMessage: '间距' })} |
| | | > |
| | |
| | | </Space.Compact> |
| | | </Form.Item> |
| | | <Form.Item |
| | | label={intl.formatMessage({ id: 'map.settings.shelf.reference', defaultMessage: '基准值' })} |
| | | > |
| | | <Space.Compact> |
| | | <Form.Item |
| | | name='refx' |
| | | noStyle |
| | | rules={[ |
| | | { |
| | | required: false, |
| | | }, |
| | | ]} |
| | | > |
| | | <InputNumber |
| | | addonBefore={<Space.Compact><FormattedMessage id='map.x' defaultMessage='x' /></Space.Compact>} |
| | | style={{ |
| | | width: '50%', |
| | | }} |
| | | /> |
| | | </Form.Item> |
| | | <Form.Item |
| | | name='refy' |
| | | noStyle |
| | | rules={[ |
| | | { |
| | | required: false, |
| | | }, |
| | | ]} |
| | | > |
| | | <InputNumber |
| | | addonBefore={<Space.Compact><FormattedMessage id='map.y' defaultMessage='y' /></Space.Compact>} |
| | | style={{ |
| | | width: '50%', |
| | | }} |
| | | /> |
| | | </Form.Item> |
| | | </Space.Compact> |
| | | </Form.Item> |
| | | <Form.Item |
| | | name='value' |
| | | label={intl.formatMessage({ id: 'map.settings.shelf.value', defaultMessage: '地图值' })} |
| | | > |
| | |
| | | </> |
| | | )} |
| | | |
| | | {curSprite?.data?.type === Utils.SENSOR_TYPE.CONVEYOR && ( |
| | | <> |
| | | <Form.Item |
| | | name='plcNo' |
| | | label={intl.formatMessage({ id: 'map.settings.conveyor.plc.no', defaultMessage: 'PLC编号' })} |
| | | rules={[ |
| | | { |
| | | required: true, |
| | | }, |
| | | ]} |
| | | > |
| | | <InputNumber |
| | | style={{ |
| | | width: '50%', |
| | | }} |
| | | /> |
| | | </Form.Item> |
| | | </> |
| | | )} |
| | | |
| | | {curSprite?.data?.type === Utils.SENSOR_TYPE.POINT && ( |
| | | <> |
| | | <Form.Item |