king
2023-04-27 6b5cb9058495b03f0a3ad36e0169c1c2e5dbabc4
src/templates/zshare/modalform/index.jsx
@@ -808,6 +808,52 @@
    return fields
  }
  transfer = (options) => {
    if (options.length === 0) return options
    let isNumber = true
    options.forEach(item => {
      if (!/^([0-9]|[1-9]\d{0,2})$/.test(item.Value)) {
        isNumber = false
      }
    })
    if (isNumber) {
      return options.map(item => {
        item.Value = +item.Value
        return item
      })
    } else {
      return options.map(item => {
        item.Value = item.Value + ''
        return item
      })
    }
  }
  transferCard = (options) => {
    if (options.length === 0) return options
    let isNumber = true
    options.forEach(item => {
      if (!/^([0-9]|[1-9]\d{0,2})$/.test(item.$value)) {
        isNumber = false
      }
    })
    if (isNumber) {
      return options.map(item => {
        item.$value = +item.$value
        return item
      })
    } else {
      return options.map(item => {
        item.$value = item.$value + ''
        return item
      })
    }
  }
  handleConfirm = () => {
    // 表单提交时检查输入值是否正确
    return new Promise((resolve, reject) => {
@@ -823,6 +869,8 @@
              if (values.type === 'radio' && values.linkField) {
                type = 'link'
              }
              values.options = this.transfer(values.options)
              if (values.options.filter(op => op.Text === '').length > 0) {
                notification.warning({
@@ -877,6 +925,8 @@
                return m
              })
              values.options = this.transferCard(values.options)
              let type = values.type
              if (values.linkField) {
                type = 'link'