From 86aab033b5129b00651b716ee70ce871cf670008 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 31 三月 2020 20:12:30 +0800 Subject: [PATCH] 2020-03-31 --- src/tabviews/zshare/mutilform/index.jsx | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx index 3e321f5..7986556 100644 --- a/src/tabviews/zshare/mutilform/index.jsx +++ b/src/tabviews/zshare/mutilform/index.jsx @@ -256,6 +256,20 @@ } } + handleConfirmPassword = (rule, value, callback, item) => { + let val = parseFloat(value) + + if (!isNaN(val)) { + if (typeof(item.min) === 'number' && val < item.min) { + callback(item.label + '鏈�灏忓�间负 ' + item.min) + } else if (typeof(item.max) === 'number' && val > item.max) { + callback(item.label + '鏈�澶у�间负 ' + item.max) + } + } + + callback() + } + getFields() { const { getFieldDecorator } = this.props.form const { cols } = this.state @@ -315,8 +329,6 @@ </Col> ) } else if (item.type === 'number') { // 鏁板瓧 - let min = (item.min || item.min === 0) ? item.min : -Infinity - let max = (item.max || item.max === 0) ? item.max : Infinity let _initval = item.initval let precision = (item.decimal || item.decimal === 0) ? item.decimal : null @@ -329,12 +341,15 @@ { required: true, message: this.props.dict['form.required.input'] + item.label + '!' + }, + { + validator: (rule, value, callback) => this.handleConfirmPassword(rule, value, callback, item) } ] })( precision === null ? - <InputNumber min={min} max={max} disabled={item.readonly === 'true'} onPressEnter={this.handleSubmit} /> : - <InputNumber min={min} max={max} precision={precision} disabled={item.readonly === 'true'} onPressEnter={this.handleSubmit} /> + <InputNumber disabled={item.readonly === 'true'} onPressEnter={this.handleSubmit} /> : + <InputNumber precision={precision} disabled={item.readonly === 'true'} onPressEnter={this.handleSubmit} /> )} </Form.Item> </Col> -- Gitblit v1.8.0