From e7aa72fb3038debcaefba16a98b20f2de495f2fb Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 08 一月 2020 19:17:17 +0800
Subject: [PATCH] 2020-01-08

---
 src/templates/modalconfig/modalform/index.jsx |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/src/templates/modalconfig/modalform/index.jsx b/src/templates/modalconfig/modalform/index.jsx
index 8c2d523..49ab211 100644
--- a/src/templates/modalconfig/modalform/index.jsx
+++ b/src/templates/modalconfig/modalform/index.jsx
@@ -32,7 +32,7 @@
     } else if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '1') { // 閫夋嫨绫诲瀷銆佹暟鎹簮
       _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType']
     } else if (type === 'number') {
-      _options = [..._options, 'decimal']
+      _options = [..._options, 'decimal', 'min', 'max']
     } else if (type === 'fileupload') {
       _options = ['label', 'field', 'type', 'readonly', 'required']
     }
@@ -88,7 +88,7 @@
       } else if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '1') { // 閫夋嫨绫诲瀷銆佹暟鎹簮
         _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType']
       } else if (value === 'number') {
-        _options = [..._options, 'decimal']
+        _options = [..._options, 'decimal', 'min', 'max']
       } else if (value === 'fileupload') {
         _options = ['label', 'field', 'type', 'readonly', 'required']
       }
@@ -178,8 +178,8 @@
         let rules = []
         if (item.key === 'field') {
           rules = [{
-            pattern: /^[\u4E00-\u9FA50-9a-zA-Z,_]*$/ig,
-            message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶃�佹眽瀛椾互鍙奯'
+            pattern: /^[\u4E00-\u9FA50-9a-zA-Z,_-]*$/ig,
+            message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶃�佹眽瀛椾互鍙奯-'
           }, {
             max: 50,
             message: '瀛楁鍚嶆渶澶�50涓瓧绗︼紒'
@@ -223,7 +223,7 @@
             <Col span={12} key={index}>
               <Form.Item label={item.label}>
                 {getFieldDecorator(item.key, {
-                  initialValue: item.initVal || 0,
+                  initialValue: item.initVal,
                   rules: [
                     {
                       required: !!item.required,
@@ -337,21 +337,29 @@
             }
             if (emptys.length > 0) {
               isvalid = false
+              notification.warning({
+                top: 92,
+                message: this.props.dict['header.form.selectItem.error'],
+                duration: 10
+              })
             }
           } else if ((values.type === 'multiselect' || values.type === 'select' || values.type === 'link') && values.resourceType === '1') {
             values.options = []
           } else if (values.type === 'funcvar') { // 鍑芥暟鍙橀噺涓哄彧璇诲厓绱�
             values.readonly = 'true'
+          } else if (values.type === 'number' && (values.min || values.min === 0) && (values.max || values.max === 0)) { // 鏁板�煎瀷楠岃瘉鏈�灏忔渶澶у��
+            if (values.min > values.max) {
+              isvalid = false
+              notification.warning({
+                top: 92,
+                message: '鏈�灏忓�间笉鍙ぇ浜庢渶澶у�硷紒',
+                duration: 10
+              })
+            }
           }
 
           if (isvalid) {
             resolve(values)
-          } else {
-            notification.warning({
-              top: 92,
-              message: this.props.dict['header.form.selectItem.error'],
-              duration: 10
-            })
           }
         } else {
           reject(err)

--
Gitblit v1.8.0