king
2023-11-27 aa53227bc006816a30258c6390084aa74defb4d1
src/components/normalform/modalform/index.jsx
@@ -7,6 +7,7 @@
import asyncComponent from '@/utils/asyncComponent'
import MKEInput from './mkInput'
import MKNumberInput from './mkNumberInput'
import MKEmitter from '@/utils/events.js'
import MKSelect from './mkSelect'
import './index.scss'
@@ -23,8 +24,9 @@
class ModalForm extends Component {
  static propTpyes = {
    formlist: PropTypes.array,   // 表单列表
    inputSubmit: PropTypes.func  // input回车提交
    formlist: PropTypes.array,
    inputSubmit: PropTypes.func,
    transVals: PropTypes.func,
  }
  state = {
@@ -108,7 +110,7 @@
      let supItem = fieldMap.get(key)
      let supval = supItem.initval
      if (supItem.initval && supItem.type !== 'checkbox' && JSON.stringify(supItem.initval) === '[]') {
      if (supItem.initval && supItem.type !== 'checkbox' && supItem.type !== 'multiselect' && JSON.stringify(supItem.initval) === '[]') {
        supval = ''
      }
@@ -124,7 +126,7 @@
        } else if (supItem.hidden) {
          cell.hidden = true
        } else if (supItem.type === 'checkbox') {
        } else if (supItem.type === 'checkbox' || supItem.type === 'multiselect') {
          let vals = [...supval, ...item.values]
          if (vals.length === new Set(vals).size) {
            cell.hidden = true
@@ -180,6 +182,10 @@
    if (!item) return
    
    if (item.$trans) {
      this.props.transVals && this.props.transVals(values, item.field)
    }
    if (item.controlFields) {
      let map = new Map()
      this.state.formlist.forEach(cell => {
@@ -190,7 +196,7 @@
      let reset = (current) => {
        let val = this.record[current.field]
        if (val && current.type !== 'checkbox' && JSON.stringify(val) === '[]') {
        if (val && current.type !== 'checkbox' && current.type !== 'multiselect' && JSON.stringify(val) === '[]') {
          val = ''
        }
@@ -199,7 +205,7 @@
          if (current.hidden) {
            m.hidden = true
          } else if (current.type === 'checkbox') {
          } else if (current.type === 'checkbox' || current.type === 'multiselect') {
            let vals = [...val, ...cell.values]
            if (vals.length !== new Set(vals).size) {
              m.hidden = false
@@ -248,7 +254,7 @@
        map.set(cell.field, cell)
      })
      item.callback(map, this.record)
      item.callback(map, this.record, MKEmitter)
      this.setState({
        formlist: this.state.formlist.map(cell => {