king
2021-09-12 f497f734966504bd8a7e98bf602da582a53d91e5
src/menu/components/card/table-card/index.jsx
@@ -22,6 +22,7 @@
const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent'))
const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent'))
const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader'))
const ActionComponent = asyncComponent(() => import('@/menu/components/share/actioncomponent'))
const { confirm } = Modal
@@ -71,6 +72,7 @@
          },
          elements: []
        }],
        action: [],
        btnlog: [],
      }
      
@@ -94,14 +96,24 @@
          col.uuid = Utils.getuuid()
          return col
        })
        if (config.action) {
          _card.action = config.action.map(col => {
            col.uuid = Utils.getuuid()
            return col
          })
        }
      }
      this.setState({
        card: _card
      })
      this.props.updateConfig(_card)
    } else {
      let _card = fromJS(card).toJS()
      if (!_card.action) {
        _card.action = []
      }
      this.setState({
        card: fromJS(card).toJS()
        card: _card
      })
    }
  }
@@ -443,6 +455,58 @@
    }
  }
  addButton = (copy) => {
    const { card } = this.state
    let newcard = {}
    if (copy) {
      newcard = copy
      newcard.focus = true
    } else {
      newcard.uuid = Utils.getuuid()
      newcard.focus = true
      newcard.label = 'label'
      newcard.Ot = 'requiredSgl'
      newcard.OpenType = 'pop'
      newcard.icon = ''
      newcard.class = 'green'
      newcard.intertype = card.setting.interType || 'system'
      newcard.innerFunc = card.setting.innerFunc || ''
      newcard.sysInterface = card.setting.sysInterface || ''
      newcard.outerFunc = card.setting.outerFunc || ''
      newcard.interface = card.setting.interface || ''
      newcard.execSuccess = 'grid'
      newcard.execError = 'never'
      newcard.verify = null
      newcard.show = 'button'
      newcard.style = {marginRight: '15px'}
    }
    // 注册事件-添加按钮
    MKEmitter.emit('addButton', card.uuid, newcard)
  }
  setSubConfig = (item) => {
    const { card, appType } = this.state
    let btn = fromJS(item).toJS()
    if (btn.OpenType === 'pop' || btn.execMode === 'pop') {
      if (!btn.modal) {
        btn.modal = {
          setting: { title: btn.label, width: appType === 'mob' ? 100 : 60, cols: '2', container: 'view', focus: '', finish: 'close', clickouter: 'unclose', display: 'modal' },
          tables: [],
          groups: [],
          fields: []
        }
      }
      MKEmitter.emit('changeModal', card, btn)
    } else if (btn.OpenType === 'popview' && appType !== 'mob') {
      MKEmitter.emit('changePopview', card, btn)
    }
  }
  clickComponent = (e) => {
    if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') {
      e.stopPropagation()
@@ -461,6 +525,7 @@
          <div className="mk-popover-control">
            <Icon className="plus" title="添加卡片" onClick={() => this.addCard()} type="plus" />
            {appType !== 'mob' ? <Icon className="plus" title="添加搜索" onClick={() => this.addSearch()} type="plus-circle" /> : null}
            <Icon className="plus" title="添加按钮" onClick={() => this.addButton()} type="plus-square" />
            <NormalForm title="表格设置" width={800} update={this.updateWrap} getForms={this.getWrapForms}>
              <Icon type="edit" style={{color: '#1890ff'}} title="编辑"/>
            </NormalForm>
@@ -475,6 +540,7 @@
        } trigger="hover">
          <Icon type="tool" />
        </Popover>
        <ActionComponent config={card} type="datacard" setSubConfig={this.setSubConfig} updateaction={this.updateComponent}/>
        <div style={{minHeight: 'calc(100% - 90px)'}}>
          {card.subcards.map(subcard => (<CardSimpleComponent key={subcard.uuid} cards={card} card={subcard} updateElement={this.updateCard} move={this.move} deleteElement={this.deleteCard}/>))}
        </div>