| | |
| | | dateweek: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced'], |
| | | datemonth: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced'], |
| | | daterange: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced'], |
| | | group: ['label', 'type', 'field', 'datefield', 'initval', 'blacklist', 'ratio', 'items', 'required', 'labelShow'] |
| | | group: ['label', 'type', 'field', 'datefield', 'initval', 'blacklist', 'ratio', 'items', 'required', 'labelShow'], |
| | | range: ['label', 'type', 'field', 'initval', 'blacklist', 'maxValue', 'minValue', 'step', 'labelShow'] |
| | | } |
| | | |
| | | class MainSearch extends Component { |
| | |
| | | form.options = matchReg.date |
| | | } else if (type === 'datemonth') { |
| | | form.options = matchReg.datemonth |
| | | } else if (type === 'dateweek' || type === 'daterange') { |
| | | } else if (type === 'dateweek' || type === 'daterange' || type === 'range') { |
| | | form.options = matchReg.daterange |
| | | } |
| | | } else if (form.key === 'field' && (type === 'text' || type === 'select')) { |
| | |
| | | form.options = matchReg.date |
| | | } else if (value === 'datemonth') { |
| | | form.options = matchReg.datemonth |
| | | } else if (value === 'dateweek' || value === 'daterange') { |
| | | } else if (value === 'dateweek' || value === 'daterange' || value === 'range') { |
| | | form.options = matchReg.daterange |
| | | } |
| | | matchs = form.options |
| | |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal || 6, |
| | | initialValue: item.initVal, |
| | | rules: [ |
| | | { |
| | | required: item.required, |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | } |
| | | ] |
| | | })(<InputNumber min={item.min} max={item.max} precision={0} onPressEnter={this.handleSubmit}/>)} |
| | | })(item.max ? |
| | | <InputNumber min={item.min} max={item.max} precision={0} onPressEnter={this.handleSubmit}/> : |
| | | <InputNumber onPressEnter={this.handleSubmit}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | |
| | | values.options = [] |
| | | } |
| | | |
| | | if (values.type === 'range') { |
| | | let error = '' |
| | | if (values.maxValue <= values.minValue) { |
| | | error = '最大值必须大于最小值' |
| | | } else if (values.step <= 0) { |
| | | error = '步长必须大于0' |
| | | } else { |
| | | let s = (values.maxValue - values.minValue) / values.step |
| | | if (s !== parseInt(s)) { |
| | | error = '步长必须被 (max - min) 整除' |
| | | } |
| | | } |
| | | |
| | | if (!error && values.initval) { |
| | | let vals = values.initval.split(',') |
| | | if (vals.length !== 2) { |
| | | error = '初始值设置错误!' |
| | | } else if (isNaN(parseFloat(vals[0])) || isNaN(parseFloat(vals[1]))) { |
| | | error = '初始值设置错误!' |
| | | } else { |
| | | let start = parseFloat(vals[0]) |
| | | let end = parseFloat(vals[1]) |
| | | let s = (values.maxValue - start) / values.step |
| | | let e = (values.maxValue - end) / values.step |
| | | if (start > end || start < values.minValue || end > values.maxValue) { |
| | | error = '初始值设置错误!' |
| | | } else if (s !== parseInt(s) || e !== parseInt(e)) { |
| | | error = '初始值设置错误!' |
| | | } |
| | | } |
| | | } |
| | | if (error) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: error, |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | |
| | | if (isvalid) { |
| | | ['linkField', 'valueField', 'valueText', 'orderBy'].forEach(item => { |
| | | if (values[item]) { |