From 6d0137932fcc8f9848123743c1aad5cff8172d8a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 09 二月 2020 13:09:39 +0800
Subject: [PATCH] 2020-02-09

---
 src/templates/tableshare/columnform/index.jsx |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/templates/tableshare/columnform/index.jsx b/src/templates/tableshare/columnform/index.jsx
index 7bfec98..acd1c18 100644
--- a/src/templates/tableshare/columnform/index.jsx
+++ b/src/templates/tableshare/columnform/index.jsx
@@ -17,14 +17,14 @@
 
   UNSAFE_componentWillMount () {
     let _type = this.props.formlist.filter(form => form.key === 'type')[0].initVal
-    let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width']
+    let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength']
 
     if (_type === 'text') {
-      _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color']
+      _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength']
     } else if (_type === 'number') {
       _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'match', 'matchVal', 'color']
     } else if (_type === 'textarea') {
-      _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color']
+      _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength']
     }
 
     this.setState({
@@ -55,14 +55,14 @@
 
   typeChange = (key, value) => {
     if (key === 'type') {
-      let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width']
+      let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength']
 
       if (value === 'text') {
-        _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color']
+        _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength']
       } else if (value === 'number') {
         _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'match', 'matchVal', 'color']
       } else if (value === 'textarea') {
-        _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color']
+        _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength']
       }
 
       this.setState({
@@ -74,6 +74,13 @@
             item.type = 'number'
             item.initVal = ''
             item.hidden = true
+          } else if (item.key === 'fieldlength') {
+            if (value === 'text') {
+              item.initVal = 50
+            } else {
+              item.initVal = 512
+            }
+            item.hidden = true
           }
           return item
         })
@@ -82,6 +89,8 @@
           formlist: this.props.formlist.map(item => {
             if (item.key === 'matchVal' && value === 'number') {
               item.hidden = false
+            } else if (item.key === 'fieldlength' && value !== 'number') {
+              item.hidden = false
             }
             return item
           })

--
Gitblit v1.8.0