king
2022-10-17 e8edfdadb561cd83bf6e1c3e00d55b8cc2aee6d5
src/menu/components/share/actioncomponent/index.jsx
@@ -4,8 +4,6 @@
import { Modal, notification, Button } from 'antd'
import Utils, { FuncUtils } from '@/utils/utils.js'
import zhCN from '@/locales/zh-CN/model.js'
import enUS from '@/locales/en-US/model.js'
import { getActionForm } from './formconfig'
import asyncSpinComponent from '@/utils/asyncSpinComponent'
@@ -31,7 +29,6 @@
  }
  state = {
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    appType: sessionStorage.getItem('appType'),
    card: null,          // 编辑中元素
    formlist: null,      // 表单信息
@@ -163,23 +160,13 @@
    }
    let ableField = usefulFields.join(', ')
    let msg = `函数名称需以${ableField}等字符开始;`
    let functip = <div>
      <p style={{marginBottom: '5px'}}>{this.state.dict['model.tooltip.func.innerface'].replace('@ableField', ableField)}</p>
      <p style={{marginBottom: '5px'}}>{msg}</p>
    </div>
    
    if (!ableField) { // 无字段限制
      functip = ''
    }
    let menulist = sessionStorage.getItem('fstMenuList')
    if (menulist) {
      try {
        menulist = JSON.parse(menulist)
      } catch (e) {
        menulist = []
      }
    } else {
      menulist = []
    }
    let supId = ''
@@ -198,7 +185,7 @@
    this.setState({
      visible: true,
      card: card,
      formlist: getActionForm(card, functip, config, usefulFields, menulist, modules, anchors)
      formlist: getActionForm(card, functip, config, usefulFields, modules, anchors)
    })
  }
@@ -283,25 +270,20 @@
   */
  deleteElement = (card) => {
    const { config } = this.props
    const { dict, appType } = this.state
    const { appType } = this.state
    let _this = this
    confirm({
      content: dict['model.confirm'] + dict['model.delete'] + ` - ${card.label} ?`,
      content: `确定删除 - ${card.label} ?`,
      onOk() {
        let _actionlist = fromJS(_this.state.actionlist).toJS()
        _actionlist = _actionlist.filter(item => item.uuid !== card.uuid)
        let btnlog = config.btnlog || []
        if (card.OpenType === 'popview' || card.verify || card.modal) {
          btnlog.push(card)
        }
        _this.setState({
          actionlist: _actionlist
        }, () => {
          _this.props.updateaction({...config, action: _actionlist, btnlog})
          _this.props.updateaction({...config, action: _actionlist})
        })
        if (card.origin || appType === 'mob') return
@@ -464,14 +446,12 @@
  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}
@@ -479,28 +459,24 @@
    } 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}
      />
@@ -509,7 +485,7 @@
  render() {
    const { config } = this.props
    const { actionlist, visible, appType, card, dict, profVisible, record } = this.state
    const { actionlist, visible, appType, card, profVisible, record } = this.state
    return (
      <div className={'model-menu-action-list length' + actionlist.length}>
@@ -532,14 +508,13 @@
          maskClosable={false}
          onCancel={this.editModalCancel}
          footer={[
            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" onClick={this.handleSubmit}>{dict['model.confirm']}</Button>
            record && record.intertype === 'inner' ? <CreateFunc key="create" ref="btnCreatFunc" trigger={this.creatFunc}/> : null,
            <Button key="cancel" onClick={this.editModalCancel}>取消</Button>,
            <Button key="confirm" type="primary" onClick={this.handleSubmit}>确定</Button>
          ]}
          destroyOnClose
        >
          <ActionForm
            dict={dict}
            card={card}
            formlist={this.state.formlist}
            inputSubmit={this.handleSubmit}
@@ -554,7 +529,7 @@
          visible={profVisible}
          width={'90vw'}
          maskClosable={false}
          okText={dict['model.submit']}
          okText="提交"
          onOk={this.verifySubmit}
          onCancel={() => {
            if (this.verifyRef.handleCancel) {