king
2022-08-06 cbeffcc0902631909c0373f274752a97ddaf2d4e
src/templates/sharecomponent/actioncomponent/index.jsx
@@ -1,7 +1,8 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Icon, Tooltip, Modal, notification, Button } from 'antd'
import { Tooltip, Modal, notification, Button } from 'antd'
import { QuestionCircleOutlined } from '@ant-design/icons'
import moment from 'moment'
import Api from '@/api'
@@ -23,6 +24,7 @@
const VerifyCard = asyncSpinComponent(() => import('@/templates/zshare/verifycard'))
const VerifyPrint = asyncSpinComponent(() => import('@/templates/sharecomponent/actioncomponent/verifyprint'))
const VerifyExcelIn = asyncSpinComponent(() => import('@/templates/sharecomponent/actioncomponent/verifyexcelin'))
const VerifyMegvii = asyncSpinComponent(() => import('@/templates/sharecomponent/actioncomponent/verifymegvii'))
const VerifyExcelOut = asyncSpinComponent(() => import('@/templates/sharecomponent/actioncomponent/verifyexcelout'))
class ActionComponent extends Component {
@@ -43,7 +45,8 @@
    copying: false,      // 按钮复制中
    visible: false,      // 模态框控制
    printTemps: [],      // 单据打印模板
    profVisible: false   // 验证信息模态框
    profVisible: false,  // 验证信息模态框
    record: null
  }
  /**
@@ -57,7 +60,14 @@
  componentDidMount () {
    this.getBillPrintTemp()
    MKEmitter.addListener('revert', this.revert)
    MKEmitter.addListener('pasteButton', this.pasteButton)
  }
  revert = () => {
    this.setState({
      actionlist: fromJS(this.props.config.action).toJS()
    })
  }
  pasteButton = (MenuId, btn) => {
@@ -177,7 +187,7 @@
    this.setState({
      visible: true,
      card: card,
      formlist: getActionForm(card, this.props.config, usefulFields, this.props.type, menulist, this.state.printTemps)
      formlist: getActionForm(card, this.props.config, usefulFields, this.props.type, menulist, this.state.printTemps, this.props.tabs)
    })
  }
@@ -669,6 +679,8 @@
      profVisible: true,
      card: element
    })
    MKEmitter.emit('modalStatus', '验证信息')
  }
  /**
@@ -696,6 +708,8 @@
      }, () => {
        this.props.updateaction({...config, action: _actionlist})
      })
      MKEmitter.emit('modalStatus', false)
    })
  }
@@ -846,17 +860,63 @@
    this.setState = () => {
      return
    }
    MKEmitter.removeListener('revert', this.revert)
    MKEmitter.removeListener('pasteButton', this.pasteButton)
  }
  getVerify = (card) => {
    const { config } = this.props
    const { dict } = this.state
    if (!card) return null
    if (['pop', 'prompt', 'exec'].includes(card.OpenType)) {
      return <VerifyCard
        card={card}
        dict={dict}
        config={config}
        columns={config.columns}
        wrappedComponentRef={(inst) => this.verifyRef = inst}
      />
    } else if (card.OpenType === 'excelIn') {
      return <VerifyExcelIn
        card={card}
        dict={dict}
        columns={config.columns}
        wrappedComponentRef={(inst) => this.verifyRef = inst}
      />
    } else if (card.OpenType === 'excelOut') {
      return <VerifyExcelOut
        card={card}
        dict={dict}
        config={config}
        wrappedComponentRef={(inst) => this.verifyRef = inst}
      />
    } else if (card.OpenType === 'funcbutton' && card.funcType === 'print') {
      return <VerifyPrint
        card={card}
        dict={dict}
        columns={config.columns}
        wrappedComponentRef={(inst) => this.verifyRef = inst}
      />
    } else if (card.OpenType === 'funcbutton' && card.funcType === 'megvii') {
      return <VerifyMegvii
        card={card}
        dict={dict}
        columns={config.columns}
        wrappedComponentRef={(inst) => this.verifyRef = inst}
      />
    }
  }
  render() {
    const { config } = this.props
    const { actionlist, visible, card, dict, copying, profVisible } = this.state
    const { actionlist, visible, card, dict, copying, profVisible, record } = this.state
    return (
      <div className="model-table-action-list" style={config.charts.length > 1 ? {paddingTop: 25} : null}>
        <Tooltip placement="bottomLeft" overlayClassName="middle" title={dict['model.tooltip.action.guide']}>
          <Icon type="question-circle" />
      <div className="model-table-action-list" style={config.charts && config.charts.length > 1 ? {paddingTop: 25} : null}>
        <Tooltip placement="bottomLeft" overlayClassName="middle" title="在左侧工具栏《按钮》中,选择对应类型的按钮拖至此处添加,如选择按钮类型为表单、新标签页等含有配置页面的按钮,可在左侧工具栏-按钮-可配置按钮处,点击按钮完成相关配置。注:当设置按钮显示位置为表格时,显示列会增加操作列。">
          <QuestionCircleOutlined style={{color: '#c49f47', position: 'absolute', left: '5px', top: '5px'}} />
        </Tooltip>
        <DragElement
          list={actionlist}
@@ -866,19 +926,18 @@
          deleteMenu={this.deleteElement}
          profileMenu={this.profileAction}
          doubleClickCard={this.btnDoubleClick}
          placeholder={dict['header.form.action.placeholder']}
        />
        {/* 编辑按钮:复制、编辑 */}
        <Modal
          title={dict['model.action'] + '-' + (card && card.copyType === 'action' ? dict['model.copy'] : dict['model.edit'])}
          wrapClassName="model-table-action-edit-modal"
          visible={visible}
          width={850}
          width={920}
          maskClosable={false}
          onCancel={this.editModalCancel}
          footer={[
            <CreateInterface key="interface" dict={dict} ref="btnCreatInterface" trigger={this.btnCreatInterface}/>,
            <CreateFunc key="create" dict={dict} ref="btnCreatFunc" trigger={this.creatFunc}/>,
            record && ['pop', 'exec', 'prompt'].includes(record.OpenType) && record.intertype === 'system' ? <CreateInterface key="interface" dict={dict} ref="btnCreatInterface" trigger={this.btnCreatInterface}/> : null,
            record && record.intertype === 'inner' ? <CreateFunc key="create" dict={dict} ref="btnCreatFunc" trigger={this.creatFunc}/> : null,
            <Button key="cancel" onClick={this.editModalCancel}>{dict['model.cancel']}</Button>,
            <Button key="confirm" type="primary" loading={copying} onClick={this.handleSubmit}>{dict['model.confirm']}</Button>
          ]}
@@ -887,10 +946,10 @@
          <ActionForm
            dict={dict}
            card={card}
            tabs={this.props.tabs}
            formlist={this.state.formlist}
            inputSubmit={this.handleSubmit}
            setting={config.setting}
            updRecord={(record) => this.setState({record: fromJS(record).toJS()})}
            wrappedComponentRef={(inst) => this.actionFormRef = inst}
          />
        </Modal>
@@ -899,46 +958,24 @@
          wrapClassName="model-table-action-verify-modal"
          title={(card && card.label ? card.label + ' - ' : '') + '验证信息'}
          visible={profVisible}
          width={'75vw'}
          width={'90vw'}
          maskClosable={false}
          okText={dict['model.submit']}
          onOk={this.verifySubmit}
          onCancel={() => { this.setState({ profVisible: false }) }}
          onCancel={() => {
            if (this.verifyRef.handleCancel) {
              this.verifyRef.handleCancel().then(() => {
                this.setState({ profVisible: false })
                MKEmitter.emit('modalStatus', false)
              })
            } else {
              this.setState({ profVisible: false })
              MKEmitter.emit('modalStatus', false)
            }
          }}
          destroyOnClose
        >
          {card && !card.execMode && card.OpenType !== 'excelIn' && card.OpenType !== 'excelOut' ?
            <VerifyCard
              card={card}
              dict={dict}
              config={config}
              columns={config.columns}
              wrappedComponentRef={(inst) => this.verifyRef = inst}
            /> : null
          }
          {card && card.execMode ?
            <VerifyPrint
              card={card}
              dict={dict}
              columns={config.columns}
              wrappedComponentRef={(inst) => this.verifyRef = inst}
            /> : null
          }
          {card && card.OpenType === 'excelIn' ?
            <VerifyExcelIn
              card={card}
              dict={dict}
              columns={config.columns}
              wrappedComponentRef={(inst) => this.verifyRef = inst}
            /> : null
          }
          {card && card.OpenType === 'excelOut' ?
            <VerifyExcelOut
              card={card}
              dict={dict}
              config={config}
              wrappedComponentRef={(inst) => this.verifyRef = inst}
            /> : null
          }
          {this.getVerify(card)}
        </Modal>
      </div>
    )