| | |
| | | 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' |
| | | |
| | |
| | | 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 () { |
| | |
| | | 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' |
| | |
| | | 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') { |