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

---
 src/templates/modalconfig/modalform/index.jsx |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/src/templates/modalconfig/modalform/index.jsx b/src/templates/modalconfig/modalform/index.jsx
index ff106e1..37555a0 100644
--- a/src/templates/modalconfig/modalform/index.jsx
+++ b/src/templates/modalconfig/modalform/index.jsx
@@ -26,7 +26,7 @@
 
     let type = formlist.filter(cell => cell.key === 'type')[0].initVal
     let resourceType = formlist.filter(cell => cell.key === 'resourceType')[0].initVal
-    let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required'] // 榛樿鏄剧ず椤�
+    let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden'] // 榛樿鏄剧ず椤�
 
     if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') { // 閫夋嫨绫诲瀷銆佽嚜瀹氫箟璧勬簮
       _options = [..._options, 'resourceType', 'options']
@@ -55,9 +55,8 @@
           form.type = 'select'
         } else if (type === 'number' && form.key === 'initval') {
           form.type = 'number'
-          form.initVal = 0
         }
-        form.hidden = !_options.includes(form.key)
+        form.show = _options.includes(form.key)
         return form
       })
     })
@@ -78,7 +77,7 @@
 
   openTypeChange = (key, value) => {
     if (key === 'type') {
-      let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required']
+      let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden']
 
       if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '0') { // 閫夋嫨绫诲瀷銆佽嚜瀹氫箟璧勬簮
         _options = [..._options, 'resourceType', 'options']
@@ -101,20 +100,18 @@
       this.setState({
         openType: value,
         formlist: this.state.formlist.map(form => {
-          form.hidden = !_options.includes(form.key)
+          form.show = _options.includes(form.key)
           if (form.key === 'initval') {
             if (dateOptions.hasOwnProperty(value)) {
               form.options = dateOptions[value]
               form.type = 'select'
-              form.initVal = ''
             } else if (value === 'number') {
               form.type = 'number'
-              form.initVal = 0
             } else {
               form.type = 'text'
-              form.initVal = ''
             }
-            form.hidden = true
+            form.initVal = ''
+            form.show = false
           }
           return form
         })
@@ -122,7 +119,7 @@
         this.setState({
           formlist: this.state.formlist.map(form => {
             if (form.key === 'initval' && value !== 'fileupload' && value !== 'funcvar') {
-              form.hidden = false
+              form.show = true
             }
             return form
           })
@@ -151,7 +148,7 @@
       this.setState({
         resourceType: value,
         formlist: this.state.formlist.map(form => {
-          form.hidden = !_options.includes(form.key)
+          form.show = _options.includes(form.key)
           return form
         })
       })
@@ -163,7 +160,7 @@
     const fields = []
 
     this.state.formlist.forEach((item, index) => {
-      if (item.hidden) return
+      if (!item.show) return
 
       if (item.type === 'text') { // 鏂囨湰鎼滅储
         let rules = []

--
Gitblit v1.8.0