| | |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import SettingForm from './settingform' |
| | | import { resetStyle } from '@/utils/utils-custom.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | |
| | | class MenuBoxComponent extends Component { |
| | |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | card: null, // 卡片信息,包括正反面 |
| | | formlist: null, // 设置表单信息 |
| | | visible: false, // 模态框控制 |
| | | card: null, |
| | | formlist: null, |
| | | visible: false |
| | | } |
| | | |
| | | /** |
| | | * @description 搜索条件初始化 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { card } = this.props |
| | | |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { card } = this.props |
| | | MKEmitter.addListener('submitStyle', this.getStyle) |
| | | |
| | | if (card.isnew) { |
| | | this.setState({ |
| | | visible: true |
| | | }) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | const { card } = this.state |
| | | |
| | | this.settingRef.handleConfirm().then(res => { |
| | | this.setState({ |
| | | visible: false, |
| | | card: {...card, setting: res} |
| | | }) |
| | | let _card = {...card, setting: res} |
| | | |
| | | this.props.updateElement({...card, setting: res}) |
| | | if (!card.isnew && card.setting.type === 'menu' && _card.setting.type !== 'menu') { |
| | | const _this = this |
| | | confirm({ |
| | | content: '菜单属性由“菜单”切换至其他类型时,菜单将被重置,即解除之前菜单的绑定关系,确定修改吗?', |
| | | onOk() { |
| | | _card.uuid = Utils.getuuid() |
| | | _this.setState({ visible: false, card: _card }) |
| | | _this.props.updateElement(_card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | delete _card.isnew |
| | | this.setState({ visible: false, card: _card }) |
| | | this.props.updateElement(_card) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | cancel = () => { |
| | | const { card } = this.state |
| | | |
| | | if (card.isnew) { |
| | | let _card = fromJS(card).toJS() |
| | | delete _card.isnew |
| | | |
| | | this.setState({ visible: false, card: _card }) |
| | | this.props.updateElement(_card) |
| | | } else { |
| | | this.setState({ visible: false }) |
| | | } |
| | | } |
| | | |
| | | changeMenu = () => { |
| | |
| | | maskClosable={false} |
| | | okText={dict['model.submit']} |
| | | onOk={this.settingSubmit} |
| | | onCancel={() => { this.setState({ visible: false }) }} |
| | | onCancel={this.cancel} |
| | | destroyOnClose |
| | | > |
| | | <SettingForm |