king
2020-10-23 407c0f1765c7d085218a91ad8842784977383d05
src/menu/components/card/cardcellcomponent/index.jsx
@@ -25,7 +25,6 @@
const VerifyPrint = asyncComponent(() => import('@/menu/actioncomponent/verifyprint'))
const VerifyExcelIn = asyncComponent(() => import('@/menu/actioncomponent/verifyexcelin'))
const VerifyExcelOut = asyncComponent(() => import('@/menu/actioncomponent/verifyexcelout'))
// const ModalConfig = asyncComponent(() => import('@/menu/modalconfig'))
class CardCellComponent extends Component {
  static propTpyes = {
@@ -43,7 +42,7 @@
    elements: null,      // 按钮组
    visible: false,      // 模态框控制
    actvisible: false,   // 按钮编辑模态框
    profVisible: false
    profVisible: false,  // 验证信息编辑
  }
  /**
@@ -60,6 +59,7 @@
  componentDidMount () {
    MKEmitter.addListener('cardAddElement', this.cardAddElement)
    MKEmitter.addListener('submitStyle', this.getStyle)
    MKEmitter.addListener('submitModal', this.handleSave)
  }
  shouldComponentUpdate (nextProps, nextState) {
@@ -82,6 +82,8 @@
      return
    }
    MKEmitter.removeListener('cardAddElement', this.cardAddElement)
    MKEmitter.removeListener('submitStyle', this.getStyle)
    MKEmitter.removeListener('submitModal', this.handleSave)
  }
  cardAddElement = (ids, element) => {
@@ -406,9 +408,7 @@
    this.actionFormRef.handleConfirm().then(ele => {
      let _elements = elements.map(cell => {
        if (cell.uuid === ele.uuid) {
          ele.eleType = 'button'
          ele.style = cell.style || {}
          ele.btnstyle = cell.btnstyle || {}
          ele = {...cell, ...ele}
          return ele
        }
@@ -460,14 +460,12 @@
   * @description 验证信息保存
   */
  verifySubmit = () => {
    const { elements } = this.state
    const { elements, card } = this.state
    
    this.verifyRef.handleConfirm().then(res => {
      let _elements = elements.map(cell => {
        if (cell.uuid === res.uuid) {
          res.eleType = 'button'
          res.style = cell.style || {}
          return res
        if (cell.uuid === card.uuid) {
          cell.verify = res
        }
        return cell
@@ -475,7 +473,7 @@
      this.setState({
        elements: _elements,
        actvisible: false
        profVisible: false
      }, () => {
        this.props.updateElement(_elements)
      })
@@ -483,7 +481,52 @@
  }
  handleSubConfig = (item) => {
    const { cards } = this.props
    if (item.eleType !== 'button') return
    if (item.OpenType === 'pop') {
      let btn = fromJS(item).toJS()
      if (!btn.modal) {
        btn.modal = {
          setting: {
            title: btn.label,
            width: 60,
            cols: '2',
            container: 'tab',
            focus: '',
            finish: 'close',
            clickouter: 'unclose',
            display: 'modal'
          },
          tables: [],
          groups: [],
          fields: []
        }
      }
      MKEmitter.emit('changeModal', cards, btn)
    }
  }
  handleSave = (_cards, btn, modal) => {
    const { cards } = this.props
    const { elements } = this.state
    if (cards.uuid !== _cards.uuid) return
    let _elements = elements.map(cell => {
      if (cell.uuid === btn.uuid) {
        cell.modal = modal
      }
      return cell
    })
    this.setState({
      elements: _elements
    }, () => {
      this.props.updateElement(_elements)
    })
  }
  render() {
@@ -501,18 +544,6 @@
          handleSubConfig={this.handleSubConfig}
          deleteMenu={this.deleteElement}
        />
          {/* <ModalConfig
            menu={this.state.editMenu}
            editTab={this.state.editTab}
            tabConfig={this.state.tabConfig}
            editSubTab={this.state.editSubTab}
            subTabConfig={this.state.subTabConfig}
            btnTab={this.state.btnTab}
            btnTabConfig={this.state.btnTabConfig}
            editAction={this.state.editAction}
            subConfig={this.state.subConfig}
            handleView={this.handleView}
          /> */}
        {/* 编辑按钮:复制、编辑 */}
        <Modal
          title={'编辑元素'}
@@ -571,7 +602,6 @@
        >
          {card && !card.execMode && card.OpenType !== 'excelIn' && card.OpenType !== 'excelOut' ?
            <VerifyCard
              // floor={this.props.type}
              card={card}
              dict={dict}
              config={cards}