From d38dc481492878c04ddf2d6bc2e9bf7d44c57fd7 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 23 十二月 2019 18:29:38 +0800
Subject: [PATCH] 2019-12-23

---
 src/tabviews/commontable/index.jsx |   61 ++++++++++++++++++++----------
 1 files changed, 40 insertions(+), 21 deletions(-)

diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx
index 2e4b459..b8fe773 100644
--- a/src/tabviews/commontable/index.jsx
+++ b/src/tabviews/commontable/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { BackTop, notification, Spin, Tabs} from 'antd'
+import { BackTop, notification, Spin, Tabs, Icon} from 'antd'
 import moment from 'moment'
 import Api from '@/api'
 import MainSearch from './mainSearch'
@@ -56,7 +56,7 @@
       MenuID: this.props.MenuID
     }
     let result = await Api.getSystemCacheConfig(param)
-    if (result.status && result.LongParam) {
+    if (result.status) {
       let config = ''
 
       try { // 閰嶇疆淇℃伅瑙f瀽
@@ -68,10 +68,9 @@
 
       // 椤甸潰閰嶇疆瑙f瀽閿欒鏃舵彁绀�
       if (!config) {
-        notification.warning({
-          top: 92,
-          message: this.state.dict['main.page.settingerror'],
-          duration: 10
+        this.setState({
+          loadingview: false,
+          viewlost: true
         })
         return
       }
@@ -147,7 +146,9 @@
         loading: true
       }, () => {
         this.improveSearch()
-        this.loadmaindata()
+        if (config.setting.onload !== 'false') {
+          this.loadmaindata()
+        }
       })
     } else {
       this.setState({
@@ -321,16 +322,29 @@
   }
 
   refreshbysearch = (searches) => {
+    const { setting } = this.state
     // 鎼滅储鏉′欢鍙樺寲
-    this.refs.mainTable.resetTable()
 
-    this.setState({
-      loading: true,
-      pageIndex: 1,
-      search: searches
-    }, () => {
-      this.loadmaindata()
-    })
+    if (setting.onload === 'false') {
+      this.setState({
+        loading: true,
+        pageIndex: 1,
+        search: searches,
+        setting: {...setting, onload: 'true'}
+      }, () => {
+        this.loadmaindata()
+      })
+    } else {
+      this.refs.mainTable.resetTable()
+
+      this.setState({
+        loading: true,
+        pageIndex: 1,
+        search: searches
+      }, () => {
+        this.loadmaindata()
+      })
+    }
   }
 
   refreshbytable = (pagination, filters, sorter) => {
@@ -474,7 +488,7 @@
 
   render() {
     const { setting, searchlist, actions, columns, loadingview, viewlost, tabviews } = this.state
-    console.log(setting)
+
     return (
       <div className="commontable" id={'commontable' + this.props.MenuID}>
         {loadingview && <Spin size="large" />}
@@ -485,7 +499,7 @@
             dict={this.state.dict}
           /> : null
         }
-        {actions &&
+        {actions && setting.onload !== 'false' &&
           <MainAction
             ref="mainButton"
             MenuID={this.props.MenuID}
@@ -496,7 +510,7 @@
             dict={this.state.dict}
           />
         }
-        {columns &&
+        {columns && setting.onload !== 'false' &&
           <MainTable
             ref="mainTable"
             dict={this.state.dict}
@@ -510,11 +524,16 @@
             buttonTrigger={this.buttonTrigger}
           />
         }
-        {setting && setting.tabshow !== 'vertical' && tabviews && tabviews.length > 0 && 
+        {setting && setting.onload !== 'false' && setting.tabshow !== 'vertical' && tabviews && tabviews.length > 0 && 
           <Tabs defaultActiveKey="0" tabPosition="top">
             {tabviews.map((_tab, index) => (
-              <TabPane tab={ _tab.label } key={`${index}`}>
-                {_tab.type === 'SubTable' ? <SubTable SupMenuID={this.props.MenuID} MenuID={this.props.MenuID} BID={this.state.BID} /> : null}
+              <TabPane tab={
+                <span>
+                  {_tab.icon ? <Icon type={_tab.icon} /> : null}
+                  {_tab.label}
+                </span>
+              } key={`${index}`}>
+                {_tab.type === 'SubTable' ? <SubTable SupMenuID={this.props.MenuID} MenuID={_tab.linkTab} BID={this.state.BID} /> : null}
               </TabPane>
             ))}
           </Tabs>

--
Gitblit v1.8.0