king
2021-09-16 73c0258e4e30f1d2e407cb067feea8e79fad081d
src/menu/components/card/cardcomponent/index.jsx
@@ -14,7 +14,7 @@
const NormalForm = asyncIconComponent(() => import('@/components/normalform'))
const CardCellComponent = asyncComponent(() => import('../cardcellcomponent'))
const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent'))
const PasteComponent = asyncIconComponent(() => import('./pastecomponent'))
const PasteController = asyncIconComponent(() => import('@/components/paste'))
class CardBoxComponent extends Component {
  static propTpyes = {
@@ -30,7 +30,8 @@
    card: null,            // 卡片信息,包括正反面
    formlist: null,        // 设置表单信息
    elements: null,        // 编辑组
    side: 'front'
    side: 'front',
    appType: sessionStorage.getItem('appType')
  }
  /**
@@ -85,7 +86,7 @@
    this.props.updateElement(_card)
  }
  updateCard = (elements, type) => {
  updateCard = (elements, btn) => {
    const { card, side } = this.state
    let _card = {}
@@ -96,18 +97,11 @@
      _card = {...card, elements: elements}
    }
    if (type === 'paste') {
      this.setState({
        card: _card,
        elements: fromJS(elements).toJS()
      })
    } else {
      this.setState({
        card: _card
      })
    }
    this.setState({
      card: _card
    })
    this.props.updateElement(_card)
    this.props.updateElement(_card, btn)
  }
  changeSide = () => {
@@ -151,24 +145,9 @@
    const { cards } = this.props
    const { card } = this.state
    let newcard = {}
    let newcard = {eleType: 'button', label: 'button', verify: null, show: 'link', sqlType: '', Ot: 'requiredSgl', OpenType: 'prompt', icon: '', class: 'primary', intertype: 'system', execSuccess: 'grid', execError: 'never', popClose: 'never'}
    newcard.uuid = Utils.getuuid()
    newcard.focus = true
    newcard.eleType = 'button'
    newcard.label = 'button'
    newcard.sqlType = ''
    newcard.Ot = 'requiredSgl'
    newcard.OpenType = 'prompt'
    newcard.icon = ''
    newcard.class = 'primary'
    newcard.intertype = 'system'
    newcard.execSuccess = 'grid'
    newcard.execError = 'never'
    newcard.popClose = 'never'
    newcard.errorTime = 10
    newcard.verify = null
    newcard.show = 'link'
    // 注册事件-添加元素
    MKEmitter.emit('cardAddElement', [cards.uuid, card.uuid], newcard)
@@ -192,17 +171,52 @@
  getSettingForms = () => {
    const { cards } = this.props
    const { setting } = this.state.card
    const { card, appType } = this.state
    return getSettingForm(setting, cards.subtype === 'propcard')
    let buttons = []
    card.elements && card.elements.forEach(item => {
      if (item.eleType === 'button') {
        buttons.push({
          value: item.uuid,
          label: item.label
        })
      }
    })
    if (appType !== 'mob' && card.backElements) {
      card.backElements.forEach(item => {
        if (item.eleType === 'button') {
          buttons.push({
            value: item.uuid,
            label: item.label
          })
        }
      })
    }
    return getSettingForm(card.setting, cards.subtype === 'propcard', buttons)
  }
  updateSetting = (res) => {
    const { card, side } = this.state
    const { card, side, appType } = this.state
    if (res.appmenu) {
      res.menu = res.appmenu
      delete res.appmenu
    if (appType === '' && res.menu) {
      let list = null
      try {
        list = JSON.parse(sessionStorage.getItem('thdMenuList')) || []
      } catch (e) {
        list = []
      }
      let id = res.menu[res.menu.length - 1]
      list.forEach(item => {
        if (item.MenuID === id) {
          res.MenuID = id
          res.MenuName = item.MenuName
          res.MenuNo = item.MenuNo
          res.tabType = item.type
        }
      })
    }
    this.setState({
@@ -217,6 +231,31 @@
    }
    this.props.updateElement({...card, setting: res})
  }
  paste = (element, resolve) => {
    const { cards } = this.props
    const { card } = this.state
    let _uuid = Utils.getuuid()
    if (element.copyType === 'action') {
      element.eleType = 'button'
      if (element.OpenType === 'popview') { // 弹窗标签复制
        let _cell = fromJS(element).toJS()
        _cell.$originUuid = element.uuid
        _cell.uuid = _uuid
        MKEmitter.emit('copyButtons', [_cell])
      }
    }
    element.uuid = _uuid
    element.focus = true
    resolve({status: true})
    // 注册事件-添加元素
    MKEmitter.emit('cardAddElement', [cards.uuid, card.uuid], element)
  }
  clickComponent = (e) => {
@@ -265,7 +304,7 @@
                  <Icon type="edit" className="edit" title="编辑"/>
                </NormalForm>
                <CopyComponent type="cardcell" card={card}/>
                <PasteComponent elements={elements} options={['action', 'customCardElement']} updateConfig={(list) => this.updateCard(list, 'paste')} />
                <PasteController options={['action', 'customCardElement']} updateConfig={this.paste} />
                <Icon className="style" title="调整样式" onClick={this.changeStyle} type="font-colors" />
                <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
                  <div className="mk-popover-control">