king
2019-12-13 a70940450c021a47e69abdf8fa8f7f98594601cc
src/templates/modalconfig/modalform/index.jsx
@@ -1,6 +1,7 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Form, Row, Col, Input, Select, Icon, Radio, notification, InputNumber } from 'antd'
import { dateOptions } from '@/utils/option.js'
import EditTable from '../editable'
import './index.scss'
@@ -16,12 +17,7 @@
  state = {
    openType: null,
    resourceType: null,
    formlist: null,
    dateoptions: {
      date: [{value: '', text: '空'}, {value: '0', text: '当天'}, {value: 1, text: '前一天'}, {value: 3, text: '前三天'}, {value: 7, text: '前七天'}, {value: 30, text: '前30天'}],
      datemonth: [{value: '', text: '空'}, {value: '0', text: '本月'}, {value: 1, text: '上月'}, {value: 3, text: '前三月'}, {value: 6, text: '前六月'}],
      datetime: [{value: '', text: '空'}, {value: '0', text: '现在'}, {value: 1, text: '昨天'}, {value: 3, text: '前三天'}, {value: 7, text: '前七天'}, {value: 30, text: '前30天'}],
    }
    formlist: null
  }
  UNSAFE_componentWillMount () {
@@ -47,8 +43,8 @@
      openType: type,
      resourceType: resourceType,
      formlist: formlist.map(form => {
        if (this.state.dateoptions.hasOwnProperty(type) && form.key === 'initval') {
          form.options = this.state.dateoptions[type]
        if (dateOptions.hasOwnProperty(type) && form.key === 'initval') {
          form.options = dateOptions[type]
          form.type = 'select'
        } else if (type === 'number' && form.key === 'initval') {
          form.type = 'number'
@@ -81,8 +77,8 @@
        formlist: this.state.formlist.map(form => {
          form.hidden = !_options.includes(form.key)
          if (form.key === 'initval') {
            if (this.state.dateoptions.hasOwnProperty(value)) {
              form.options = this.state.dateoptions[value]
            if (dateOptions.hasOwnProperty(value)) {
              form.options = dateOptions[value]
              form.type = 'select'
              form.initVal = ''
            } else if (value === 'number') {