From b9a0e8541f0959db5d848f7b893c8838851ce411 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 09 四月 2020 13:29:49 +0800
Subject: [PATCH] 2020-04-09

---
 src/templates/zshare/columnform/index.jsx |   36 +++++++++++-------------------------
 1 files changed, 11 insertions(+), 25 deletions(-)

diff --git a/src/templates/zshare/columnform/index.jsx b/src/templates/zshare/columnform/index.jsx
index 249153a..40d8022 100644
--- a/src/templates/zshare/columnform/index.jsx
+++ b/src/templates/zshare/columnform/index.jsx
@@ -7,6 +7,13 @@
 import Api from '@/api'
 import './index.scss'
 
+const columnTypeOptions = {
+  text: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength', 'blacklist', 'linkmenu'],
+  number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'match', 'matchVal', 'color', 'blacklist', 'linkmenu'],
+  textarea: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength', 'blacklist'],
+  picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength', 'blacklist', 'scale']
+}
+
 class MainSearch extends Component {
   static propTpyes = {
     dict: PropTypes.object,     // 瀛楀吀椤�
@@ -25,17 +32,7 @@
     let _type = this.props.formlist.filter(form => form.key === 'type')[0].initVal
     let _menulist = this.props.formlist.filter(form => form.key === 'linkmenu')[0] || ''
 
-    let _options = null
-
-    if (_type === 'text') {
-      _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength', 'blacklist', 'linkmenu']
-    } else if (_type === 'number') {
-      _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'match', 'matchVal', 'color', 'blacklist', 'linkmenu']
-    } else if (_type === 'textarea') {
-      _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength', 'blacklist']
-    } else if (_type === 'picture') {
-      _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength', 'blacklist', 'scale']
-    }
+    let _options = columnTypeOptions[_type]
 
     this.setState({
       menulist: _menulist.options || [],
@@ -66,17 +63,7 @@
 
   typeChange = (key, value) => {
     if (key === 'type') {
-      let _options = null
-
-      if (value === 'text') {
-        _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength', 'blacklist', 'linkmenu']
-      } else if (value === 'number') {
-        _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'match', 'matchVal', 'color', 'blacklist', 'linkmenu']
-      } else if (value === 'textarea') {
-        _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength', 'blacklist']
-      } else if (value === 'picture') {
-        _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength', 'blacklist', 'scale']
-      }
+      let _options = columnTypeOptions[value]
 
       this.setState({
         formlist: this.props.formlist.map(item => {
@@ -304,12 +291,11 @@
                 MenuNo: cell.MenuNo,
                 Ot: cell.Ot,
                 PageParam: cell.PageParam,
-                LinkUrl: cell.LinkUrl
+                LinkUrl: cell.LinkUrl,
+                disabled: cell.MenuID === MenuID
               }
             })
           }
-
-          submenu.children = submenu.children.filter(cell => cell.MenuID !== MenuID)
 
           return submenu
         })

--
Gitblit v1.8.0