king
2023-08-19 26ae5c1358c51f3213362d7ad1fb0054cbf2790e
2023-08-19
4个文件已修改
144 ■■■■ 已修改文件
src/tabviews/custom/components/module/voucher/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/mkRadio/index.jsx 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/mkSelect/index.jsx 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/modalform/modaleditable/index.jsx 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/module/voucher/index.jsx
@@ -362,7 +362,7 @@
          attachments: res.attachments_int,
          title: res.voucher_text || '',
          remark: res.remark || '',
          status: 'saved'
          status: res.copy_type === 'true' ? 'copy' : 'saved'
        })
      } else {
        this.setState({
src/tabviews/zshare/mutilform/mkRadio/index.jsx
@@ -20,15 +20,11 @@
  UNSAFE_componentWillMount () {
    const { config } = this.props
    let value = config.initval
    let option = config.oriOptions[0]
    if (value) {
      let option = null
      option= config.oriOptions[0]
      if (typeof(value) === 'string' && option && typeof(option.value) === 'number') {
    if (value && option && typeof(option.value) !== typeof(value)) {
      if (typeof(option.value) === 'number' && !isNaN(value)) {
        value = +value
        if (isNaN(value)) {
          value = config.initval
        }
      }
    }
@@ -44,7 +40,7 @@
  }
  UNSAFE_componentWillReceiveProps (nextProps) {
    const { config } = this.state
    const { config, value } = this.state
    if (!is(fromJS(config.oriOptions), fromJS(nextProps.config.oriOptions))) {
      this.setState({
@@ -52,10 +48,18 @@
        options: fromJS(nextProps.config.options).toJS()
      })
      let option = nextProps.config.oriOptions[0]
      if (config.$first) {
        this.setState({
          value: nextProps.config.initval,
        })
      } else if (option && typeof(option.value) !== typeof(value)) {
        if (typeof(option.value) === 'number' && !isNaN(value)) {
          this.setState({
            value: +value
          })
        }
      }
    }
  }
src/tabviews/zshare/mutilform/mkSelect/index.jsx
@@ -18,12 +18,11 @@
        value = []
      }
    } else if (value) {
      let option = null
      option= config.oriOptions[0]
      if (typeof(value) === 'string' && option && typeof(option.value) === 'number') {
        value = +value
        if (isNaN(value)) {
          value = config.initval
      let option = config.oriOptions[0]
      if (option && typeof(option.value) !== typeof(value)) {
        if (typeof(option.value) === 'number' && !isNaN(value)) {
          value = +value
        }
      }
    }
@@ -57,20 +56,16 @@
        options: fromJS(nextProps.config.options).toJS()
      })
      let option = nextProps.config.oriOptions[0]
      if (config.$first) {
        this.setState({
          value: nextProps.config.initval,
        })
      } else {
        let option = null
        option= nextProps.config.oriOptions[0]
        if (option && typeof(option.value) === 'number') {
          let val = +value
          if (!isNaN(val)) {
            this.setState({
              value: val
            })
          }
      } else if (option && typeof(option.value) !== typeof(value)) {
        if (typeof(option.value) === 'number' && !isNaN(value)) {
          this.setState({
            value: +value
          })
        }
      }
    }
src/templates/zshare/modalform/modaleditable/index.jsx
@@ -4,7 +4,6 @@
import { Table, Input, Popconfirm, Form, message } from 'antd'
import { ArrowUpOutlined, ArrowDownOutlined, DeleteOutlined, PlusOutlined, SwapOutlined } from '@ant-design/icons'
import { formRule } from '@/utils/option.js'
import Utils from '@/utils/utils.js'
import './index.scss'
@@ -35,16 +34,8 @@
  }
  save = e => {
    const { record, handleSave, datatype } = this.props
    const { record, handleSave } = this.props
    this.form.validateFields((error, values) => {
      if (datatype === 'number') {
        Object.keys(values).forEach(key => {
          values[key] = parseFloat(values[key])
          if (isNaN(values[key])) {
            values[key] = 0
          }
        })
      }
      handleSave({ ...record, ...values })
      if (error && error[e.currentTarget.id]) {
        return
@@ -55,16 +46,8 @@
  renderCell = form => {
    this.form = form
    const { children, dataIndex, record, datatype } = this.props
    const { children, dataIndex, record } = this.props
    const { editing } = this.state
    let rules = []
    if (datatype === 'number') {
      rules.push({
        pattern: /^(-?\d+)(\.\d+)?$/,
        message: formRule.input.numbermsg
      })
    }
    return editing ? (
      <Form.Item style={{ margin: '0 -5px 0 -5px' }}>
@@ -73,8 +56,7 @@
            {
              required: dataIndex === 'Text',
              message: '不可为空.',
            },
            ...rules
            }
          ],
          initialValue: record[dataIndex]
        })(<Input ref={node => (this.input = node)} autoComplete="off" onPressEnter={this.save} onBlur={this.save} />)}
@@ -139,52 +121,6 @@
      count: data.length
    })
  }
  // changeDatatype = (column) => {
  //   const { columns, dataSource } = this.state
  //   let value = column.datatype !== 'number' ? 'number' : 'string'
  //   let _data = dataSource.map(item => {
  //     let val = item[column.dataIndex]
  //     if (value === 'number') {
  //       val = parseFloat(val)
  //       if (isNaN(val)) {
  //         val = 0
  //       }
  //     } else {
  //       val = '' + val
  //     }
  //     item[column.dataIndex] = val
  //     return item
  //   })
  //   this.setState({
  //     dataSource: _data,
  //     columns: columns.map(col => {
  //       if (col.dataIndex === column.dataIndex) {
  //         col.datatype = value
  //       }
  //       if (col.dataIndex !== 'operation') {
  //         col.title = <div>
  //           {col.$title}
  //           {/* <Popconfirm
  //             title={`确定切换为${col.datatype === 'number' ? '文本' : '数值'}吗?`}
  //             overlayClassName="popover-confirm"
  //             onConfirm={() => this.changeDatatype(col)
  //           }>
  //             <SwapOutlined style={{ color: col.datatype === 'number' ? '#1890ff' : ''}} />
  //           </Popconfirm> */}
  //         </div>
  //       }
  //       return col
  //     })
  //   }, () => {
  //     this.props.onChange(_data)
  //   })
  // }
  handleUpDown = (record, direction) => {
    const { dataSource } = this.state
@@ -292,7 +228,6 @@
    let _dataSource = fromJS(dataSource).toJS()
    let fields = []
    let dataItem = ''
    let subFields = linkSubFields.filter(m => m !== 'Value' && m !== 'Text')
    if (subFields.length > 0) {
@@ -304,19 +239,14 @@
        return data
      })
      dataItem = _dataSource ? _dataSource[0] : ''
      fields = subFields.map(field => {
        return {
          title: transfield[field] || field,
          $title: transfield[field] || field,
          dataIndex: field,
          editable: true,
          datatype: dataItem && typeof(dataItem[field]) === 'number' ? 'number' : 'string'
        }
      })
    } else {
      dataItem = _dataSource ? _dataSource[0] : ''
    }
    let columns = [
@@ -324,15 +254,13 @@
        title: 'Value',
        $title: 'Value',
        dataIndex: 'Value',
        editable: true,
        datatype: dataItem && typeof(dataItem.Value) === 'number' ? 'number' : 'string'
        editable: true
      },
      {
        title: 'Text',
        $title: 'Text',
        dataIndex: 'Text',
        editable: true,
        datatype: dataItem && typeof(dataItem.Text) === 'number' ? 'number' : 'string'
        editable: true
      },
      ...fields,
      {
@@ -363,8 +291,7 @@
        title: 'ParentID',
        $title: 'ParentID',
        dataIndex: 'ParentID',
        editable: true,
        datatype: dataItem && typeof(dataItem.ParentID) === 'number' ? 'number' : 'string'
        editable: true
      })
    }
@@ -373,13 +300,6 @@
        if (col.dataIndex !== 'operation') {
          col.title = <div>
            {col.$title}
            {/* <Popconfirm
              title={`确定切换为${col.datatype === 'number' ? '文本' : '数值'}吗?`}
              overlayClassName="popover-confirm"
              onConfirm={() => this.changeDatatype(col)
            }>
              <SwapOutlined style={{ color: col.datatype === 'number' ? '#1890ff' : ''}} />
            </Popconfirm> */}
          </div>
        }
        return col
@@ -460,8 +380,7 @@
          editable: col.editable,
          dataIndex: col.dataIndex,
          title: col.title,
          datatype: col.datatype,
          handleSave: this.handleSave,
          handleSave: this.handleSave
        })
      }
    })