| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Icon, Modal, Button, notification } from 'antd' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import './index.scss' |
| | | |
| | |
| | | this.setState({visible: true}) |
| | | } |
| | | |
| | | resetconfig = (item, Tab, isgroup) => { |
| | | resetconfig = (item, Tab, isgroup, copyBtns) => { |
| | | item.uuid = Utils.getuuid() |
| | | item.floor = Tab ? (Tab.floor + 1) : 1 |
| | | |
| | |
| | | } |
| | | |
| | | tab.components = tab.components.map(cell => { |
| | | cell = this.resetconfig(cell, tab) |
| | | cell = this.resetconfig(cell, tab, copyBtns) |
| | | return cell |
| | | }) |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | item.components = item.components.forEach(cell => { |
| | | cell = this.resetconfig(cell, item, true) |
| | | item.components = item.components.map(cell => { |
| | | cell = this.resetconfig(cell, item, true, copyBtns) |
| | | return cell |
| | | }) |
| | | } else if (item.type === 'card' || (item.type === 'table' && item.subtype === 'tablecard')) { |
| | |
| | | card.elements = card.elements.filter(b => b.OpenType !== 'popview' && b.OpenType !== 'funcbutton') |
| | | } |
| | | card.elements = card.elements.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | | let _uuid = Utils.getuuid() |
| | | if (cell.OpenType === 'popview') { |
| | | let _cell = fromJS(cell).toJS() |
| | | _cell.$originUuid = _cell.uuid |
| | | _cell.uuid = _uuid |
| | | copyBtns.set(_uuid, _cell) |
| | | } |
| | | cell.uuid = _uuid |
| | | return cell |
| | | }) |
| | | } |
| | |
| | | card.elements = card.elements.filter(b => b.OpenType !== 'popview' && b.OpenType !== 'funcbutton') |
| | | } |
| | | card.backElements = card.backElements.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | | let _uuid = Utils.getuuid() |
| | | if (cell.OpenType === 'popview') { |
| | | let _cell = fromJS(cell).toJS() |
| | | _cell.$originUuid = _cell.uuid |
| | | _cell.uuid = _uuid |
| | | copyBtns.set(_uuid, _cell) |
| | | } |
| | | cell.uuid = _uuid |
| | | return cell |
| | | }) |
| | | } |
| | |
| | | if (c.type === 'colspan' && c.subcols) { |
| | | c = loopCol(c) |
| | | } else if (c.type === 'custom' && c.elements) { |
| | | c.elements = c.elements.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | | return cell |
| | | }) |
| | | } else if (c.type === 'action' && c.elements) { |
| | | if (sessionStorage.getItem('editMenuType') === 'popview') { |
| | | c.elements = c.elements.filter(b => b.OpenType !== 'popview' && b.OpenType !== 'funcbutton') |
| | | } |
| | | c.elements = c.elements.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | | return cell |
| | |
| | | col.elements = col.elements.filter(c => c.OpenType !== 'popview' && c.OpenType !== 'funcbutton') |
| | | } |
| | | col.elements = col.elements.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | | let _uuid = Utils.getuuid() |
| | | if (cell.OpenType === 'popview') { |
| | | let _cell = fromJS(cell).toJS() |
| | | _cell.$originUuid = _cell.uuid |
| | | _cell.uuid = _uuid |
| | | copyBtns.set(_uuid, _cell) |
| | | } |
| | | cell.uuid = _uuid |
| | | return cell |
| | | }) |
| | | } |
| | |
| | | item.action = item.action.filter(c => c.OpenType !== 'popview' && c.OpenType !== 'funcbutton') |
| | | } |
| | | item.action = item.action.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | | let _uuid = Utils.getuuid() |
| | | if (cell.OpenType === 'popview') { |
| | | let _cell = fromJS(cell).toJS() |
| | | _cell.$originUuid = _cell.uuid |
| | | _cell.uuid = _uuid |
| | | copyBtns.set(_uuid, _cell) |
| | | } |
| | | cell.uuid = _uuid |
| | | return cell |
| | | }) |
| | | } |
| | |
| | | return |
| | | } |
| | | |
| | | res = this.resetconfig(res, Tab, isgroup) |
| | | let copyBtns = new Map() |
| | | |
| | | res = this.resetconfig(res, Tab, isgroup, copyBtns) |
| | | |
| | | delete res.copyType |
| | | |
| | | |
| | | this.props.insert(res, Tab) |
| | | |
| | | copyBtns = [...copyBtns.values()] |
| | | |
| | | if (copyBtns.length > 0) { |
| | | MKEmitter.emit('copyButtons', copyBtns) |
| | | } |
| | | |
| | | this.setState({visible: false}) |
| | | |
| | | notification.success({ |