| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Modal, Popover, Icon, Col } from 'antd' |
| | | import { Popover, Icon, Col } from 'antd' |
| | | |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | const NormalForm = asyncIconComponent(() => import('@/components/normalform')) |
| | | |
| | |
| | | MKEmitter.emit('changeStyle', [cards.uuid, card.uuid], options, _style) |
| | | } |
| | | |
| | | cancel = () => { |
| | | const { card } = this.state |
| | | |
| | | if (card.isnew) { |
| | | let _card = fromJS(card).toJS() |
| | | delete _card.isnew |
| | | |
| | | this.setState({ card: _card }) |
| | | this.props.updateElement(_card) |
| | | } |
| | | } |
| | | |
| | | getSettingForms = () => { |
| | | const { card } = this.state |
| | | |
| | | return getSettingForm(card.setting) |
| | | } |
| | | |
| | | updateSetting = (res, resolve) => { |
| | | updateSetting = (res) => { |
| | | const { card } = this.state |
| | | let _card = {...card, setting: res} |
| | | |
| | | if (!card.isnew && card.setting.type === 'menu' && _card.setting.type !== 'menu') { |
| | | const _this = this |
| | | confirm({ |
| | | content: '菜单将被重置,确定修改吗?', |
| | | onOk() { |
| | | _card.oriuuid = _card.uuid |
| | | _card.uuid = Utils.getuuid() |
| | | _this.setState({ card: _card }) |
| | | _this.props.updateElement(_card) |
| | | resolve() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | delete _card.isnew |
| | | this.setState({ card: _card }) |
| | | this.props.updateElement(_card) |
| | | resolve() |
| | | if (card.setting.type === 'menu' && _card.setting.type !== 'menu') { |
| | | _card.oriuuid = _card.uuid |
| | | _card.uuid = Utils.getuuid() |
| | | } |
| | | |
| | | this.setState({ card: _card }) |
| | | this.props.updateElement(_card) |
| | | } |
| | | |
| | | changeMenu = () => { |
| | |
| | | <Col span={card.setting.width || 6} offset={offset || 0}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <NormalForm title="菜单编辑" width={900} check update={this.updateSetting} getForms={this.getSettingForms} cancel={this.cancel}> |
| | | <NormalForm title="菜单编辑" width={900} update={this.updateSetting} getForms={this.getSettingForms}> |
| | | <Icon type="edit" style={{color: '#1890ff'}} title="编辑"/> |
| | | </NormalForm> |
| | | <CopyComponent type="menucell" card={card}/> |