king
2022-10-25 5891206952e2ff63e87aed2f47df5324b019d32e
src/menu/components/form/formaction/index.jsx
@@ -4,8 +4,6 @@
import { Modal, Button, Popover } from 'antd'
import { FontColorsOutlined, EditOutlined, ProfileOutlined } from '@ant-design/icons'
import zhCN from '@/locales/zh-CN/model.js'
import enUS from '@/locales/en-US/model.js'
import asyncComponent from '@/utils/asyncComponent'
import { getActionForm } from './formconfig'
import { resetStyle } from '@/utils/utils-custom.js'
@@ -24,16 +22,11 @@
  }
  state = {
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    appType: sessionStorage.getItem('appType'),
    card: null,          // 编辑中元素
    formlist: null,      // 表单信息
    visible: false,      // 模态框控制
    profVisible: false,  // 验证信息编辑
  }
  componentDidMount () {
    MKEmitter.addListener('submitStyle', this.getStyle)
  }
  shouldComponentUpdate (nextProps, nextState) {
@@ -47,12 +40,9 @@
    this.setState = () => {
      return
    }
    MKEmitter.removeListener('submitStyle', this.getStyle)
  }
  handleStyle = (element) => {
    const { group } = this.props
    let _style = element.style ? fromJS(element.style).toJS() : {}
    let options = ['font', 'border', 'padding', 'margin', 'backgroundColor', 'width']
@@ -60,19 +50,18 @@
      card: element
    })
    MKEmitter.emit('changeStyle', [group.uuid, element.type], options, _style)
    MKEmitter.emit('changeStyle', options, _style, this.getStyle)
  }
  getStyle = (comIds, style) => {
  getStyle = (style) => {
    const { card } = this.state
    let group = fromJS(this.props.group).toJS()
    if (comIds.length !== 2 || comIds[0] !== group.uuid) return
    if (comIds[1] === 'prev') {
    if (card.type === 'prev') {
      group.prevButton.style = style
    } else if (comIds[1] === 'submit') {
    } else if (card.type === 'submit') {
      group.subButton.style = style
    } else if (comIds[1] === 'next') {
    } else if (card.type === 'next') {
      group.nextButton.style = style
    }
@@ -97,16 +86,27 @@
    }
    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>
    let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, config.uuid) || []
    let supId = ''
    if (config.wrap.linkType === 'sup') {
      supId = config.wrap.supModule[config.wrap.supModule.length - 1]
    }
    let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, config.uuid, supId)
    let anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, config.uuid) || []
    if (card.type === 'submit' && !card.Ot) {
      card.Ot = config.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl'
    }
    this.setState({
      visible: true,
      card: card,
      formlist: getActionForm(card, functip, config.setting.tableName, usefulFields, modules)
      formlist: getActionForm(card, functip, config.setting.tableName, usefulFields, modules, anchors)
    })
  }
@@ -192,7 +192,7 @@
  render() {
    const { group, config } = this.props
    const { visible, profVisible, card, dict } = this.state
    const { visible, profVisible, card } = this.state
    return (
      <div className="mk-form-action">
@@ -223,19 +223,18 @@
        </Popover> : null}
        {/* 编辑按钮:复制、编辑 */}
        <Modal
          title={dict['model.edit']}
          title="编辑"
          visible={visible}
          width={800}
          width={920}
          maskClosable={false}
          onCancel={this.editModalCancel}
          footer={[
            <Button key="cancel" onClick={this.editModalCancel}>{dict['model.cancel']}</Button>,
            <Button key="confirm" type="primary" onClick={this.handleActionSubmit}>{dict['model.confirm']}</Button>
            <Button key="cancel" onClick={this.editModalCancel}>取消</Button>,
            <Button key="confirm" type="primary" onClick={this.handleActionSubmit}>确定</Button>
          ]}
          destroyOnClose
        >
          <ActionForm
            dict={dict}
            card={card}
            setting={config.setting}
            formlist={this.state.formlist}
@@ -245,12 +244,11 @@
        </Modal>
        {/* 按钮使用系统存储过程时,验证信息模态框 */}
        <Modal
          wrapClassName="model-table-action-verify-modal"
          title={'验证信息'}
          wrapClassName="mk-pop-modal"
          visible={profVisible}
          width={'75vw'}
          width={'90vw'}
          maskClosable={false}
          okText={dict['model.submit']}
          okText="提交"
          onOk={this.verifySubmit}
          onCancel={() => {
            if (this.verifyRef.handleCancel) {
@@ -265,7 +263,6 @@
        >
          <VerifyCard
            card={{...group.subButton, modal: {fields: group.fields}}}
            dict={dict}
            config={config}
            columns={config.columns}
            wrappedComponentRef={(inst) => this.verifyRef = inst}