From 295b93984fd94a11d0337637f76ff91b5a618215 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 24 四月 2023 09:49:26 +0800
Subject: [PATCH] 2023-04-24

---
 src/menu/modalconfig/controller.jsx                                  |    2 
 src/menu/components/module/voucher/options.jsx                       |   20 +++
 src/views/menudesign/popview/index.jsx                               |   33 +++-
 src/tabviews/custom/components/module/voucher/index.jsx              |   43 ++++++
 src/tabviews/custom/components/module/account/index.jsx              |    8 
 src/views/pcdesign/index.jsx                                         |   35 +++--
 src/views/main/index.jsx                                             |   14 ++
 src/views/mobdesign/popview/index.jsx                                |   33 +++-
 src/menu/components/module/voucher/index.jsx                         |    4 
 src/views/tabledesign/index.jsx                                      |   35 +++--
 src/tabviews/custom/components/module/voucher/voucherTable/index.jsx |    4 
 src/tabviews/custom/components/module/voucher/index.scss             |   11 +
 src/menu/components/module/voucher/index.scss                        |   10 +
 src/views/mobdesign/index.jsx                                        |   35 +++--
 src/views/menudesign/index.jsx                                       |   38 ++++--
 15 files changed, 242 insertions(+), 83 deletions(-)

diff --git a/src/menu/components/module/voucher/index.jsx b/src/menu/components/module/voucher/index.jsx
index beb0972..905ef23 100644
--- a/src/menu/components/module/voucher/index.jsx
+++ b/src/menu/components/module/voucher/index.jsx
@@ -158,8 +158,8 @@
                 妯℃澘绫诲瀷:
                 <div>鏃ュ父鏀嚭<DownOutlined/></div>
               </div>
-              <Button className="out-background header-btn">鍏抽棴</Button>
-              <Button className="add-background header-btn">淇濆瓨</Button>
+              <Button className="close-temp header-btn">鍏抽棴</Button>
+              <Button className="save-temp header-btn">淇濆瓨</Button>
             </div> : null}
             <VoucherTable config={card}/>
             {card.wrap.type === 'createVoucher' || card.wrap.type === 'checkVoucher' ? <div className="user">鍒跺崟浜猴細</div> : null}
diff --git a/src/menu/components/module/voucher/index.scss b/src/menu/components/module/voucher/index.scss
index f7b22db..964fd36 100644
--- a/src/menu/components/module/voucher/index.scss
+++ b/src/menu/components/module/voucher/index.scss
@@ -134,6 +134,16 @@
     border-color: rgb(50, 197, 210);
     color: #ffffff;
   }
+  .save-temp {
+    background-color: #1890ff;
+    border-color: #1890ff;
+    color: #ffffff;
+  }
+  .close-temp {
+    background-color: #ffffff;
+    border-color: #f5222d;
+    color: #f5222d;
+  }
 
   .system-background {
     background: #1890ff;
diff --git a/src/menu/components/module/voucher/options.jsx b/src/menu/components/module/voucher/options.jsx
index bd1bee2..a320698 100644
--- a/src/menu/components/module/voucher/options.jsx
+++ b/src/menu/components/module/voucher/options.jsx
@@ -18,6 +18,17 @@
     }
   })
 
+  let menulist = sessionStorage.getItem('fstMenuList')
+  if (menulist) {
+    try {
+      menulist = JSON.parse(menulist)
+    } catch (e) {
+      menulist = []
+    }
+  } else {
+    menulist = []
+  }
+
   modules = modules.filter(item => !bookids.includes(item.value))
 
   const wrapForm = [
@@ -134,6 +145,15 @@
       tooltip: '琛ㄦ牸涓讳綋閮ㄥ垎涓ょ鐨勭┖鐧借窛绂伙紝琛ㄦ牸鍦ㄧ紪杈戞椂涓ょ浼氭湁娣诲姞鍜屽垹闄ゅ浘鏍囥��',
       required: false
     },
+    {
+      type: 'cascader',
+      field: 'linkmenu',
+      label: '鍒锋柊鑿滃崟',
+      initval: wrap.linkmenu || [],
+      tooltip: '鐐瑰嚮鍏抽棴鏃堕渶瑕佸埛鏂扮殑鑿滃崟銆�',
+      required: false,
+      options: menulist
+    }
   ]
 
   return wrapForm
diff --git a/src/menu/modalconfig/controller.jsx b/src/menu/modalconfig/controller.jsx
index 683598d..5a7c777 100644
--- a/src/menu/modalconfig/controller.jsx
+++ b/src/menu/modalconfig/controller.jsx
@@ -35,6 +35,8 @@
       config: fromJS(config).toJS(),
       btn: fromJS(btn).toJS()
     })
+
+    window.GLOB.formId = ''
   }
 
   handleBack = () => {
diff --git a/src/tabviews/custom/components/module/account/index.jsx b/src/tabviews/custom/components/module/account/index.jsx
index 4996d2c..b7001bc 100644
--- a/src/tabviews/custom/components/module/account/index.jsx
+++ b/src/tabviews/custom/components/module/account/index.jsx
@@ -171,7 +171,7 @@
 
     return (
       <div className="menu-account-wrap" style={config.style}>
-        {config.wrap.MenuID ? <Select value={activeItem ? activeItem.id : ''} placeholder="璇烽�夋嫨璐﹀" onChange={this.changeBook} dropdownRender={menu => (
+        {config.wrap.MenuID ? <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} value={activeItem ? activeItem.id : ''} placeholder="璇烽�夋嫨璐﹀" onChange={this.changeBook} dropdownRender={menu => (
           <div>
             {menu}
             <Divider style={{ margin: '4px 0' }} />
@@ -181,11 +181,11 @@
           </div>
         )}>
           {books.map(item => (
-            <Option disabled={!item.months} key={item.id}>{item.account_name}</Option>
+            <Option key={item.id}>{item.account_name}</Option>
           ))}
-        </Select> : <Select value={activeItem ? activeItem.id : ''} disabled={config.wrap.readonly === 'true'} placeholder="璇烽�夋嫨璐﹀" onChange={this.changeBook}>
+        </Select> : <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} value={activeItem ? activeItem.id : ''} disabled={config.wrap.readonly === 'true'} placeholder="璇烽�夋嫨璐﹀" onChange={this.changeBook}>
           {books.map(item => (
-            <Option disabled={!item.months} key={item.id}>{item.account_name}</Option>
+            <Option key={item.id}>{item.account_name}</Option>
           ))}
         </Select>}
         {activeItem ? <span className="date">{activeItem.date}</span> : null}
diff --git a/src/tabviews/custom/components/module/voucher/index.jsx b/src/tabviews/custom/components/module/voucher/index.jsx
index c230975..87bde0b 100644
--- a/src/tabviews/custom/components/module/voucher/index.jsx
+++ b/src/tabviews/custom/components/module/voucher/index.jsx
@@ -208,6 +208,8 @@
       let employee = []
       let cash_flow = []
       let others = []
+      let logistics = []
+      let lessor = []
 
       res.sup && res.sup.forEach(item => {
         names[item.sup_type_code] = item.sup_type_name
@@ -215,6 +217,14 @@
 
       res.supplier && res.supplier.forEach(item => {
         supplier.push({value: item.suppliercode, label: item.suppliername})
+      })
+
+      res.logistics && res.logistics.forEach(item => {
+        logistics.push({value: item.suppliercode, label: item.suppliername})
+      })
+
+      res.lessor && res.lessor.forEach(item => {
+        lessor.push({value: item.suppliercode, label: item.suppliername})
       })
 
       res.customer && res.customer.forEach(item => {
@@ -249,6 +259,8 @@
         subjects: res.subjects || [],
         names: names,
         supplier: supplier,
+        logistics: logistics,
+        lessor: lessor,
         customer: customer,
         department: department,
         project: project,
@@ -406,6 +418,14 @@
       } else if (line.sup_accounting && line.supAccounts) {
         line.supAccounts.forEach(item => {
           if (item.sup_acc_type === 'supplier') {
+            if (!item.suppliercode || !item.suppliername) {
+              err = `绗�${_index}琛岋紝璇烽�夋嫨杈呭姪鏍哥畻銆俙
+            }
+          } else if (item.sup_acc_type === 'logistics') {
+            if (!item.suppliercode || !item.suppliername) {
+              err = `绗�${_index}琛岋紝璇烽�夋嫨杈呭姪鏍哥畻銆俙
+            }
+          } else if (item.sup_acc_type === 'lessor') {
             if (!item.suppliercode || !item.suppliername) {
               err = `绗�${_index}琛岋紝璇烽�夋嫨杈呭姪鏍哥畻銆俙
             }
@@ -700,6 +720,14 @@
       } else if (line.sup_accounting && line.supAccounts) {
         line.supAccounts.forEach(item => {
           if (item.sup_acc_type === 'supplier') {
+            if (!item.suppliercode || !item.suppliername) {
+              err = `绗�${_index}琛岋紝璇烽�夋嫨杈呭姪鏍哥畻銆俙
+            }
+          } else if (item.sup_acc_type === 'logistics') {
+            if (!item.suppliercode || !item.suppliername) {
+              err = `绗�${_index}琛岋紝璇烽�夋嫨杈呭姪鏍哥畻銆俙
+            }
+          } else if (item.sup_acc_type === 'lessor') {
             if (!item.suppliercode || !item.suppliername) {
               err = `绗�${_index}琛岋紝璇烽�夋嫨杈呭姪鏍哥畻銆俙
             }
@@ -1020,16 +1048,27 @@
   triggerclose = () => {
     const { config, status } = this.state
 
+    let tabId = ''
+    if (config.wrap.linkmenu && config.wrap.linkmenu.length > 0) {
+      tabId = config.wrap.linkmenu[config.wrap.linkmenu.length - 1]
+    }
+
     if (status === 'change') {
       confirm({
         content: '鍐呭宸插彉鏇达紝纭畾瑕佸叧闂悧锛�',
         onOk() {
           MKEmitter.emit('closeTabView', config.$pageId)
+          if (tabId) {
+            MKEmitter.emit('reloadMenuView', tabId, 'table')
+          }
         },
         onCancel() {}
       })
     } else {
       MKEmitter.emit('closeTabView', config.$pageId)
+      if (tabId) {
+        MKEmitter.emit('reloadMenuView', tabId, 'table')
+      }
     }
   }
 
@@ -1150,8 +1189,8 @@
               </Select>
             </div>
             <div className="temp-action">
-              <Button className="add-background header-btn" onClick={() => this.triggerTempsave()}>淇濆瓨</Button>
-              <Button className="out-background header-btn" onClick={this.triggerclose}>鍏抽棴</Button>
+              <Button className="save-temp header-btn" onClick={() => this.triggerTempsave()}>淇濆瓨</Button>
+              <Button className="close-temp header-btn" onClick={this.triggerclose}>鍏抽棴</Button>
             </div>
           </div> : null}
           <VoucherTable config={config} loading={loading} data={data} onChange={this.dataChange}/>
diff --git a/src/tabviews/custom/components/module/voucher/index.scss b/src/tabviews/custom/components/module/voucher/index.scss
index a2bae1b..4eec234 100644
--- a/src/tabviews/custom/components/module/voucher/index.scss
+++ b/src/tabviews/custom/components/module/voucher/index.scss
@@ -111,6 +111,17 @@
     color: #ffffff;
   }
 
+  .save-temp {
+    background-color: var(--mk-sys-color);
+    border-color: var(--mk-sys-color);
+    color: #ffffff;
+  }
+  .close-temp {
+    background-color: #ffffff;
+    border-color: #f5222d;
+    color: #f5222d;
+  }
+
   .system-background {
     background: var(--mk-sys-color);
     border-color: var(--mk-sys-color);
diff --git a/src/tabviews/custom/components/module/voucher/voucherTable/index.jsx b/src/tabviews/custom/components/module/voucher/voucherTable/index.jsx
index 2acf108..5e3b17c 100644
--- a/src/tabviews/custom/components/module/voucher/voucherTable/index.jsx
+++ b/src/tabviews/custom/components/module/voucher/voucherTable/index.jsx
@@ -108,7 +108,7 @@
       let account = {}
 
       subAccounts.forEach(item => {
-        if (item.field === 'supplier') {
+        if (item.field === 'supplier' || item.field === 'logistics' || item.field === 'lessor') {
           account[item.field] = {suppliercode: item.value, suppliername: item.name}
         } else if (item.field === 'customer') {
           account[item.field] = {customercode: item.value, customername: item.name}
@@ -762,7 +762,7 @@
 
             if (record.sup_accounting && record.supAccounts) {
               record.supAccounts.forEach(item => {
-                if (item.sup_acc_type === 'supplier') {
+                if (item.sup_acc_type === 'supplier' || item.sup_acc_type === 'logistics' || item.sup_acc_type === 'lessor') {
                   val += item.suppliercode ? '_' + item.suppliercode + ' ' + item.suppliername : ''
                 } else if (item.sup_acc_type === 'customer') {
                   val += item.customercode ? '_' + item.customercode + ' ' + item.customername : ''
diff --git a/src/views/main/index.jsx b/src/views/main/index.jsx
index 8dd7821..3fa342e 100644
--- a/src/views/main/index.jsx
+++ b/src/views/main/index.jsx
@@ -17,7 +17,15 @@
 const _locale = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
 
 class Main extends Component {
-  state = {}
+  state = {
+    userId: sessionStorage.getItem('UserID')
+  }
+
+  UNSAFE_componentWillMount() {
+    if (!this.state.userId) {
+      this.props.history.replace('/login')
+    }
+  }
 
   componentDidMount () {
     MKEmitter.addListener('resetSelectLine', this.resetParentParam)
@@ -50,7 +58,9 @@
 
   render () {
     const navBar = window.GLOB.navBar
-    
+
+    if (!this.state.userId) return null
+
     return (
       <div className="mk-main-view">
         <ConfigProvider locale={_locale}>
diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx
index e816b50..57e7d08 100644
--- a/src/views/menudesign/index.jsx
+++ b/src/views/menudesign/index.jsx
@@ -805,8 +805,14 @@
     })
 
     setTimeout(() => {
-      if (config.enabled && this.verifyConfig()) {
+      let _pass = this.verifyConfig(config)
+
+      if (config.enabled && !_pass) {
         config.enabled = false
+        config.force = true
+      } else if (!config.enabled && config.force && _pass) {
+        config.enabled = true
+        delete config.force
       }
 
       if (config.cacheUseful !== 'true') {
@@ -1030,17 +1036,23 @@
   onEnabledChange = () => {
     const { config } = this.state
 
-    if (!config || (!config.enabled && this.verifyConfig(true))) {
-      return
-    }
+    let _config = {...config, enabled: !config.enabled}
 
-    this.setState({
-      config: {...config, enabled: !config.enabled}
-    })
+    delete _config.force
+
+    if (!_config.enabled) {
+      this.setState({
+        config: _config
+      })
+    } else if (this.verifyConfig(_config)) {
+      this.setState({
+        config: _config
+      })
+    }
   }
 
-  verifyConfig = (show) => {
-    const { config, MenuType } = this.state
+  verifyConfig = (config) => {
+    const { MenuType } = this.state
     let error = ''
 
     let check = (components) => {
@@ -1068,7 +1080,7 @@
 
     check(config.components)
 
-    if (show && error) {
+    if (config.enabled && error) {
       notification.warning({
         top: 92,
         message: error,
@@ -1102,7 +1114,7 @@
         }
       })
 
-      if (show && error) {
+      if (config.enabled && error) {
         notification.warning({
           top: 92,
           message: error,
@@ -1111,7 +1123,7 @@
       }
     }
 
-    return error
+    return error === ''
   }
 
   // 鏇存柊閰嶇疆淇℃伅
@@ -1226,7 +1238,7 @@
                     <PictureController/>
                     <StyleCombControlButton menu={config} />
                     <PasteController insert={this.insert} />
-                    <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config && config.enabled} onChange={this.onEnabledChange} />
+                    {config ? <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> : null}
                     <Button type="primary" id="save-config" className={needUpdate ? 'update-tip' : ''} onClick={this.submitConfig} loading={menuloading}>淇濆瓨</Button>
                     <Button type="default" onClick={this.closeView}>鍏抽棴</Button>
                   </div>
diff --git a/src/views/menudesign/popview/index.jsx b/src/views/menudesign/popview/index.jsx
index 7e63303..8a783ea 100644
--- a/src/views/menudesign/popview/index.jsx
+++ b/src/views/menudesign/popview/index.jsx
@@ -130,8 +130,14 @@
       return
     }
 
-    if (config.enabled && this.verifyConfig()) {
+    let _pass = this.verifyConfig(config)
+
+    if (config.enabled && !_pass) {
       config.enabled = false
+      config.force = true
+    } else if (!config.enabled && config.force && _pass) {
+      config.enabled = true
+      delete config.force
     }
 
     this.getMenuMessage(config)
@@ -149,17 +155,22 @@
   onEnabledChange = () => {
     const { config } = this.state
 
-    if (!config.enabled && this.verifyConfig(true)) {
-      return
-    }
+    let _config = {...config, enabled: !config.enabled}
 
-    this.setState({
-      config: {...config, enabled: !config.enabled}
-    })
+    delete _config.force
+
+    if (!_config.enabled) {
+      this.setState({
+        config: _config
+      })
+    } else if (this.verifyConfig(_config)) {
+      this.setState({
+        config: _config
+      })
+    }
   }
 
-  verifyConfig = (show) => {
-    const { config } = this.state
+  verifyConfig = (config) => {
     let error = ''
 
     let check = (components) => {
@@ -186,7 +197,7 @@
 
     check(config.components)
 
-    if (show && error) {
+    if (config.enabled && error) {
       notification.warning({
         top: 92,
         message: error,
@@ -194,7 +205,7 @@
       })
     }
 
-    return error
+    return error === ''
   }
 
   // 鏇存柊閰嶇疆淇℃伅
diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx
index dc5675f..1504072 100644
--- a/src/views/mobdesign/index.jsx
+++ b/src/views/mobdesign/index.jsx
@@ -1384,8 +1384,14 @@
     })
 
     setTimeout(() => {
-      if (config.enabled && this.verifyConfig()) {
+      let _pass = this.verifyConfig(config)
+
+      if (config.enabled && !_pass) {
         config.enabled = false
+        config.force = true
+      } else if (!config.enabled && config.force && _pass) {
+        config.enabled = true
+        delete config.force
       }
 
       if (config.cacheUseful !== 'true') {
@@ -1713,17 +1719,22 @@
   onEnabledChange = () => {
     const { config } = this.state
 
-    if (!config || (!config.enabled && this.verifyConfig(true))) {
-      return
-    }
+    let _config = {...config, enabled: !config.enabled}
 
-    this.setState({
-      config: {...config, enabled: !config.enabled}
-    })
+    delete _config.force
+
+    if (!_config.enabled) {
+      this.setState({
+        config: _config
+      })
+    } else if (this.verifyConfig(_config)) {
+      this.setState({
+        config: _config
+      })
+    }
   }
 
-  verifyConfig = (show) => {
-    const { config } = this.state
+  verifyConfig = (config) => {
     let error = ''
     let searchSum = 0
     let swipes = []
@@ -1790,7 +1801,7 @@
       }
     }
 
-    if (show && error) {
+    if (config.enabled && error) {
       notification.warning({
         top: 92,
         message: error,
@@ -1798,7 +1809,7 @@
       })
     }
 
-    return error
+    return error === ''
   }
 
   // 鏇存柊閰嶇疆淇℃伅
@@ -2091,7 +2102,7 @@
               </div>
               <div className="wrap">
                 <Button type="primary" className={needUpdate ? 'update-tip' : ''} onClick={this.submitConfig} id="save-config" loading={menuloading}>淇濆瓨</Button>
-                <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config && config.enabled} onChange={this.onEnabledChange} />
+                {config ? <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> : null}
                 <ArrowLeftOutlined title="鍚庨��" className="back-view" onClick={this.backView}/>
                 <Button className="mk-border-purple" onClick={() => this.setState({eyeopen: !eyeopen})}>{!eyeopen ? <EyeOutlined /> : <EyeInvisibleOutlined />} 缁勪欢鍚�</Button>
                 <CreateView resetmenu={this.getAppMenus} />
diff --git a/src/views/mobdesign/popview/index.jsx b/src/views/mobdesign/popview/index.jsx
index 316deca..03cfee3 100644
--- a/src/views/mobdesign/popview/index.jsx
+++ b/src/views/mobdesign/popview/index.jsx
@@ -132,8 +132,14 @@
       return
     }
 
-    if (config.enabled && this.verifyConfig()) {
+    let _pass = this.verifyConfig(config)
+
+    if (config.enabled && !_pass) {
       config.enabled = false
+      config.force = true
+    } else if (!config.enabled && config.force && _pass) {
+      config.enabled = true
+      delete config.force
     }
 
     this.getMenuMessage(config)
@@ -151,17 +157,22 @@
   onEnabledChange = () => {
     const { config } = this.state
 
-    if (!config.enabled && this.verifyConfig(true)) {
-      return
-    }
+    let _config = {...config, enabled: !config.enabled}
 
-    this.setState({
-      config: {...config, enabled: !config.enabled}
-    })
+    delete _config.force
+
+    if (!_config.enabled) {
+      this.setState({
+        config: _config
+      })
+    } else if (this.verifyConfig(_config)) {
+      this.setState({
+        config: _config
+      })
+    }
   }
 
-  verifyConfig = (show) => {
-    const { config } = this.state
+  verifyConfig = (config) => {
     let error = ''
 
     let check = (components) => {
@@ -188,7 +199,7 @@
 
     check(config.components)
 
-    if (show && error) {
+    if (config.enabled && error) {
       notification.warning({
         top: 92,
         message: error,
@@ -196,7 +207,7 @@
       })
     }
 
-    return error
+    return error === ''
   }
 
   // 鏇存柊閰嶇疆淇℃伅
diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx
index 1f071f1..b6b2760 100644
--- a/src/views/pcdesign/index.jsx
+++ b/src/views/pcdesign/index.jsx
@@ -1125,8 +1125,14 @@
     })
 
     setTimeout(() => {
-      if (config.enabled && this.verifyConfig()) {
+      let _pass = this.verifyConfig(config)
+
+      if (config.enabled && !_pass) {
         config.enabled = false
+        config.force = true
+      } else if (!config.enabled && config.force && _pass) {
+        config.enabled = true
+        delete config.force
       }
 
       if (config.cacheUseful !== 'true') {
@@ -1435,17 +1441,22 @@
   onEnabledChange = () => {
     const { config } = this.state
 
-    if (!config || (!config.enabled && this.verifyConfig(true))) {
-      return
-    }
+    let _config = {...config, enabled: !config.enabled}
 
-    this.setState({
-      config: {...config, enabled: !config.enabled}
-    })
+    delete _config.force
+
+    if (!_config.enabled) {
+      this.setState({
+        config: _config
+      })
+    } else if (this.verifyConfig(_config)) {
+      this.setState({
+        config: _config
+      })
+    }
   }
 
-  verifyConfig = (show) => {
-    const { config } = this.state
+  verifyConfig = (config) => {
     let error = ''
 
     let check = (components) => {
@@ -1472,7 +1483,7 @@
 
     check(config.components)
 
-    if (show && error) {
+    if (config.enabled && error) {
       notification.warning({
         top: 92,
         message: error,
@@ -1480,7 +1491,7 @@
       })
     }
 
-    return error
+    return error === ''
   }
 
   // 鏇存柊閰嶇疆淇℃伅
@@ -1707,7 +1718,7 @@
               </div>
               <div className="wrap">
                 <Button type="primary" className={needUpdate ? 'update-tip' : ''} id="save-config" onClick={this.submitConfig} loading={menuloading}>淇濆瓨</Button>
-                <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config && config.enabled} onChange={this.onEnabledChange} />
+                {config ? <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> : null}
                 <ArrowLeftOutlined title="鍚庨��" className="back-view" onClick={this.backView}/>
                 <Button className="mk-border-purple" onClick={() => this.setState({eyeopen: !eyeopen})}>{!eyeopen ? <EyeOutlined /> : <EyeInvisibleOutlined />} 缁勪欢鍚�</Button>
                 <CreateView resetmenu={this.getAppMenus} />
diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx
index 0689387..18311e8 100644
--- a/src/views/tabledesign/index.jsx
+++ b/src/views/tabledesign/index.jsx
@@ -518,8 +518,14 @@
     })
 
     setTimeout(() => {
-      if (config.enabled && this.verifyConfig()) {
+      let _pass = this.verifyConfig(config)
+
+      if (config.enabled && !_pass) {
         config.enabled = false
+        config.force = true
+      } else if (!config.enabled && config.force && _pass) {
+        config.enabled = true
+        delete config.force
       }
 
       let tbs = []
@@ -681,17 +687,22 @@
   onEnabledChange = () => {
     const { config } = this.state
 
-    if (!config || (!config.enabled && this.verifyConfig(true))) {
-      return
-    }
+    let _config = {...config, enabled: !config.enabled}
 
-    this.setState({
-      config: {...config, enabled: !config.enabled}
-    })
+    delete _config.force
+
+    if (!_config.enabled) {
+      this.setState({
+        config: _config
+      })
+    } else if (this.verifyConfig(_config)) {
+      this.setState({
+        config: _config
+      })
+    }
   }
 
-  verifyConfig = (show) => {
-    const { config } = this.state
+  verifyConfig = (config) => {
     let error = ''
 
     config.components.forEach(item => {
@@ -725,7 +736,7 @@
       }
     }
 
-    if (show && error) {
+    if (config.enabled && error) {
       notification.warning({
         top: 92,
         message: error,
@@ -733,7 +744,7 @@
       })
     }
 
-    return error
+    return error === ''
   }
 
   // 鏇存柊閰嶇疆淇℃伅
@@ -843,7 +854,7 @@
                     <TableNodes config={config} />
                     <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/>
                     <PasteBaseTable type="page" insert={this.insert}/>
-                    <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config && config.enabled} onChange={this.onEnabledChange} />
+                    {config ? <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> : null}
                     <Button type="primary" id="save-config" onClick={this.submitConfig} loading={menuloading}>淇濆瓨</Button>
                     <Button type="default" onClick={this.closeView}>鍏抽棴</Button>
                   </div>

--
Gitblit v1.8.0