king
2021-05-16 2e90ca02407b187a13efef0ffc2dcc6c9fca0c57
src/menu/components/form/normal-form/index.jsx
@@ -1,6 +1,5 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import {connect} from 'react-redux'
import { is, fromJS } from 'immutable'
import { Icon, Popover, Modal, Button, Switch, notification } from 'antd'
import moment from 'moment'
@@ -45,7 +44,8 @@
    visible: false,
    editform: null,
    formlist: null,
    sqlVerifing: false
    sqlVerifing: false,
    standardform: null
  }
  UNSAFE_componentWillMount () {
@@ -66,7 +66,7 @@
        name: card.name,
        subtype: card.subtype,
        setting: { },
        wrap: { name: card.name, width: card.width || 24, datatype: 'static' },
        wrap: { name: card.name, width: card.width || 24, datatype: 'static', color: '#1890ff' },
        style: { marginLeft: '0px', marginRight: '0px', marginTop: '8px', marginBottom: '8px' },
        columns: [],
        scripts: [],
@@ -77,7 +77,7 @@
          style: {},
          fields: [],
          prevButton: {label: '上一步', type: 'prev'},
          subButton: {label: '提交', type: 'submit'},
          subButton: {label: '提交', type: 'submit', style: {backgroundColor: '#1890ff', color: '#ffffff', paddingLeft: '25px', paddingRight: '25px'}},
          nextButton: {label: '跳过', type: 'next', enable: 'false'}
        }]
      }
@@ -118,7 +118,7 @@
  }
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.state), fromJS(nextState)) || (!this.props.menu && nextProps.menu)
    return !is(fromJS(this.state), fromJS(nextState))
  }
  /**
@@ -236,7 +236,7 @@
      style: {},
      fields: [],
      prevButton: {label: '上一步', type: 'prev'},
      subButton: {label: '提交', type: 'submit'},
      subButton: {label: '提交', type: 'submit', style: {backgroundColor: '#1890ff', color: '#ffffff', paddingLeft: '25px', paddingRight: '25px'}},
      nextButton: {label: '跳过', type: 'next', enable: 'false'}
    }
@@ -429,8 +429,9 @@
    group.fields.push(newcard)
    this.setState({group})
    this.handleForm(newcard)
    this.setState({group}, () => {
      this.handleForm(newcard)
    })
  }
  editModalCancel = () => {
@@ -453,6 +454,7 @@
      value: '',
      text: '空'
    }]
    let standardform = null
    _inputfields = group.fields.filter(item => item.type === 'text' || item.type === 'number' || item.type === 'textarea' || item.type === 'color')
    _tabfields = group.fields.filter(item => _form.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type))
@@ -460,7 +462,11 @@
    let uniq = new Map()
    uniq.set(_form.field, true)
    group.fields.forEach(item => {
    let index = null
    group.fields.forEach((item, i) => {
      if (_form.uuid === item.uuid) {
        index = i
      }
      if (item.type !== 'select' && item.type !== 'link' && item.type !== 'radio') return
      if (item.field && !uniq.has(item.field)) {
        uniq.set(item.field, true)
@@ -475,6 +481,13 @@
        })
      }
    })
    if (index !== null) {
      if (index === 0) {
        standardform = group.fields[index + 1] || null
      } else {
        standardform = group.fields[index - 1] || null
      }
    }
    card.columns.forEach(col => {
      if (col.field && !uniq.has(col.field)) {
@@ -492,7 +505,13 @@
      _form.linkSubField = _form.linkSubField.filter(item => fields.includes(item))
    }
    if (!_form.span && standardform && standardform.span) {
      _form.span = standardform.span
      _form.labelwidth = standardform.labelwidth
    }
    this.setState({
      standardform,
      visible: true,
      editform: _form,
      formlist: getModalForm(_form, _inputfields, _tabfields, _linkableFields, _linksupFields, false)
@@ -673,6 +692,7 @@
            card={this.state.editform}
            formlist={this.state.formlist}
            inputSubmit={this.handleSubmit}
            standardform={this.state.standardform}
            wrappedComponentRef={(inst) => this.formRef = inst}
          />
        </Modal>
@@ -681,14 +701,4 @@
  }
}
const mapStateToProps = (state) => {
  return {
    menu: state.customMenu
  }
}
const mapDispatchToProps = () => {
  return {}
}
export default connect(mapStateToProps, mapDispatchToProps)(PropCardEditComponent)
export default PropCardEditComponent