king
2023-12-12 49f09cc6f8ff8c30a75ed1a9d6f510b69b73962a
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,7 +22,6 @@
  }
  state = {
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    appType: sessionStorage.getItem('appType'),
    card: null,          // 编辑中元素
    formlist: null,      // 表单信息
@@ -66,6 +63,10 @@
      group.subButton.style = style
    } else if (card.type === 'next') {
      group.nextButton.style = style
    } else if (card.type === 'close') {
      group.closeButton.style = style
    } else if (card.type === 'reset') {
      group.resetButton.style = style
    }
    this.props.updateconfig(group)
@@ -75,7 +76,7 @@
   * @description 按钮编辑,获取按钮表单信息
   */
  handleAction = (card) => {
    const { config } = this.props
    const { config, group } = this.props
    let usefulFields = sessionStorage.getItem('permFuncField')
    if (usefulFields) {
@@ -89,8 +90,9 @@
    }
    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 supId = ''
@@ -98,7 +100,7 @@
      supId = config.wrap.supModule[config.wrap.supModule.length - 1]
    }
    let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, config.uuid, supId) || []
    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) {
@@ -108,7 +110,7 @@
    this.setState({
      visible: true,
      card: card,
      formlist: getActionForm(card, functip, config.setting.tableName, usefulFields, modules, anchors)
      formlist: getActionForm(card, functip, config.setting.tableName, usefulFields, modules, anchors, group.uuid, group.fields)
    })
  }
@@ -138,11 +140,20 @@
      let group = fromJS(this.props.group).toJS()
      if (res.type === 'prev') {
        res.enable = group.prevButton.enable || 'true'
        group.prevButton = res
      } else if (res.type === 'submit') {
        res.enable = group.subButton.enable || 'true'
        group.subButton = res
      } else if (res.type === 'next') {
        res.enable = group.nextButton.enable || 'true'
        group.nextButton = res
      } else if (res.type === 'close') {
        res.enable = group.closeButton.enable || 'true'
        group.closeButton = res
      } else if (res.type === 'reset') {
        res.enable = group.resetButton.enable || 'true'
        group.resetButton = res
      }
      this.setState({
@@ -159,7 +170,6 @@
    this.setState({
      profVisible: true
    })
    MKEmitter.emit('modalStatus', '验证信息')
  }
  /**
@@ -175,7 +185,6 @@
        profVisible: false
      })
      this.props.updateconfig(group)
      MKEmitter.emit('modalStatus', false)
    })
  }
@@ -196,11 +205,11 @@
  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">
        {group.prevButton && group.prevButton.enable !== 'false' && group.sort !== 1 ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
        {group.prevButton && group.prevButton.enable === 'true' ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
          <div className="mk-popover-control">
            <EditOutlined className="edit" title="编辑" onClick={() => this.handleAction(group.prevButton)} />
            <FontColorsOutlined className="style" title="调整样式" onClick={() => this.handleStyle(group.prevButton)}/>
@@ -217,7 +226,23 @@
        } trigger="hover">
          <Button type="link" className="submit mk-primary" onDoubleClick={this.changeMenu} style={resetStyle(group.subButton.style)}>{group.subButton.label}</Button>
        </Popover>
        {group.nextButton && group.nextButton.enable !== 'false' && group.sort !== config.subcards.length ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
        {group.resetButton && group.resetButton.enable === 'true' ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
          <div className="mk-popover-control">
            <EditOutlined className="edit" title="编辑" onClick={() => this.handleAction(group.resetButton)} />
            <FontColorsOutlined className="style" title="调整样式" onClick={() => this.handleStyle(group.resetButton)}/>
          </div>
        } trigger="hover">
          <Button type="link" className="reset" style={resetStyle(group.resetButton.style)}>{group.resetButton.label}</Button>
        </Popover> : null}
        {group.closeButton && group.closeButton.enable === 'true' ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
          <div className="mk-popover-control">
            <EditOutlined className="edit" title="编辑" onClick={() => this.handleAction(group.closeButton)} />
            <FontColorsOutlined className="style" title="调整样式" onClick={() => this.handleStyle(group.closeButton)}/>
          </div>
        } trigger="hover">
          <Button type="link" className="reset" style={resetStyle(group.closeButton.style)}>{group.closeButton.label}</Button>
        </Popover> : null}
        {group.nextButton && group.nextButton.enable === 'true' ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
          <div className="mk-popover-control">
            <EditOutlined className="edit" title="编辑" onClick={() => this.handleAction(group.nextButton)} />
            <FontColorsOutlined className="style" title="调整样式" onClick={() => this.handleStyle(group.nextButton)}/>
@@ -227,19 +252,18 @@
        </Popover> : null}
        {/* 编辑按钮:复制、编辑 */}
        <Modal
          title={dict['model.edit']}
          title="编辑"
          visible={visible}
          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}
@@ -253,24 +277,21 @@
          visible={profVisible}
          width={'90vw'}
          maskClosable={false}
          okText={dict['model.submit']}
          okText="提交"
          onOk={this.verifySubmit}
          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
        >
          <VerifyCard
            card={{...group.subButton, modal: {fields: group.fields}}}
            dict={dict}
            config={config}
            columns={config.columns}
            wrappedComponentRef={(inst) => this.verifyRef = inst}