From 8190d6e5ac14616d85e3992169ecef6d99d03b76 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 13 十一月 2020 15:29:57 +0800
Subject: [PATCH] 2020-11-13

---
 src/tabviews/commontable/index.jsx |  519 +++++++++++++++++++--------------------------------------
 1 files changed, 172 insertions(+), 347 deletions(-)

diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx
index ccabdc5..6b8431d 100644
--- a/src/tabviews/commontable/index.jsx
+++ b/src/tabviews/commontable/index.jsx
@@ -3,16 +3,18 @@
 import {connect} from 'react-redux'
 import { is, fromJS } from 'immutable'
 import { notification, Spin, Tabs, Icon, Switch, Modal, Button, message, Tree, Typography, Row, Col } from 'antd'
-import moment from 'moment'
 
 import Api from '@/api'
 import options from '@/store/options.js'
 import zhCN from '@/locales/zh-CN/main.js'
 import enUS from '@/locales/en-US/main.js'
 import Utils from '@/utils/utils.js'
+import UtilsDM from '@/utils/utils-datamanage.js'
+import UtilsUpdate from '@/utils/utils-update.js'
 import asyncComponent from '@/utils/asyncComponent'
 import asyncSpinComponent from '@/utils/asyncSpinComponent'
 import { refreshTabView } from '@/store/action'
+import MKEmitter from '@/utils/events.js'
 
 import MainSearch from '@/tabviews/zshare/topSearch'
 import NotFount from '@/components/404'
@@ -25,9 +27,6 @@
 const SubTable = asyncSpinComponent(() => import('@/tabviews/subtable'))
 const CardComponent = asyncSpinComponent(() => import('@/tabviews/zshare/cardcomponent'))
 const ChartComponent = asyncSpinComponent(() => import('@/tabviews/zshare/chartcomponent'))
-
-// 鑷畾涔夋爣绛�
-const SecretKeyTable = asyncSpinComponent(() => import('./secretKeyTable'))
 
 const { TabPane } = Tabs
 const { TreeNode } = Tree
@@ -58,7 +57,6 @@
     setting: null,        // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑
     data: null,           // 鍒楄〃鏁版嵁闆�
     selectedData: [],     // 宸查�夎〃鏍兼暟鎹�
-    resetTable: false,    // 琛ㄦ牸閲嶇疆锛屽�煎湪true涓巉alse涔嬮棿鍒囨崲锛屽垏鎹㈡椂琛ㄦ牸閲嶇疆
     total: 0,             // 鎬绘暟
     loading: false,       // 鍒楄〃鏁版嵁鍔犺浇涓�
     pageIndex: 1,         // 椤电爜
@@ -69,9 +67,10 @@
     pickup: false,        // 涓昏〃鏁版嵁闅愯棌鏄剧ず鍒囨崲
     treevisible: false,   // 鑿滃崟缁撴瀯鏍戝脊妗嗘樉绀洪殣钘忔帶鍒�
     refreshtabs: null,    // 闇�瑕佸埛鏂扮殑鏍囩闆�
-    triggerBtn: null,     // 鐐瑰嚮琛ㄦ牸涓垨蹇嵎閿Е鍙戠殑鎸夐挳
     tabActive: null,      // 鏍囩椤靛睍寮�鎺у埗
-    chartId: ''           // 灞曞紑鍥捐〃ID
+    chartId: '',          // 灞曞紑鍥捐〃ID
+    statFields: [],       // 鍚堣瀛楁
+    statFValue: []        // 鍚堣鍊�
   }
 
   /**
@@ -128,53 +127,8 @@
         return
       }
 
-      if (!config.version || config.version < '1.0') {
-        // 鍏煎鏍囩
-        if (!config.tabgroups) {
-          config.tabgroups = [{ uuid: 'tabs', sublist: [] }]
-        } else if (typeof(config.tabgroups[0]) === 'string') {
-          let _tabgroups = []
-          config.tabgroups.forEach(groupId => {
-            let _group = {
-              uuid: groupId,
-              sublist: fromJS(config[groupId]).toJS()
-            }
-    
-            delete config[groupId]
-    
-            _tabgroups.push(_group)
-          })
-    
-          config.tabgroups = _tabgroups
-        }
-    
-        // 鍏煎鍥捐〃
-        if (!config.charts) {
-          config.expand = true
-          config.charts = [{ uuid: Utils.getuuid(), label: '', title: '', chartType: 'table', icon: 'table', Hide: 'false', blacklist: [] }]
-        } else {
-          config.charts.forEach(card => {
-            if (card.chartType === 'card') {
-              card.details = card.details.map(_cell => {
-                _cell.fontSize = _cell.fontSize || 14
-                if (!_cell.width) {
-                  _cell.width = 100
-                } else if (_cell.width === 'helf') {
-                  _cell.width = 50
-                } else if (_cell.width === 'third') {
-                  _cell.width = 33
-                }
-                if (!_cell.fontWeight && _cell.bold === 'true') {
-                  _cell.fontWeight = 'normal'
-                }
-                _cell.height = _cell.height || 1
-  
-                return _cell
-              })
-            }
-          })
-        }
-      }
+      // 鐗堟湰鍏煎
+      config = UtilsUpdate.updateCommonTable(config)
 
       // 鏉冮檺杩囨护
       if (this.props.menuType !== 'HS') {
@@ -185,18 +139,6 @@
       }
       // 鍘婚櫎绌鸿鏍囩
       config.tabgroups = config.tabgroups.filter(group => group.sublist.length > 0)
-
-      // HS涓嬭嚜瀹氫箟澶勭悊鐨勬爣绛�
-      if (this.props.menuType === 'HS') {
-        config.tabgroups.forEach(group => {
-          group.sublist = group.sublist.map(tab => {
-            if (tab.linkTab === '1586577325055l2ng7t75g7i4ek2ng8o') {
-              tab.type = 'SecretKeyTable'
-            }
-            return tab
-          })
-        })
-      }
 
       // 瑙嗗浘鏉冮檺
       config.charts = config.charts.filter(item => {
@@ -225,8 +167,10 @@
         if (['text', 'select', 'link'].includes(item.type) && param) {
           if (param.searchkey === item.field) {
             item.initval = param.searchval
-          } else if (param.BID && item.field === 'BID') {
+          } else if (param.BID && item.field.toLowerCase() === 'bid') {
             item.initval = param.BID
+          } else if (param.data && param.data[item.field]) {
+            item.initval = param.data[item.field]
           }
         }
 
@@ -259,6 +203,43 @@
 
       // 鏍囪涓婚〉闈紝鐢ㄤ簬鎸夐挳鍥哄畾鍙婅〃鍗曟寕杞借缃�
       config.setting.tabType = 'main'
+
+      // 鏁版嵁婧愪俊鎭澶勭悊
+      config.setting.laypage = config.setting.laypage !== 'false'     // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡
+      config.setting.execute = config.setting.default !== 'false'     // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡
+      config.setting.customScript = ''                                // 鑷畾涔夎剼鏈�
+
+      if (config.setting.interType === 'system') {
+        if (config.setting.scripts && config.setting.scripts.length > 0) {
+          let _customScript = ''
+          config.setting.scripts.forEach(item => {
+            if (item.status === 'false') return
+            _customScript += `
+              ${item.sql}
+            `
+          })
+          config.setting.customScript = _customScript
+        }
+  
+        if (!config.setting.execute) { // 榛樿sql 涓嶆墽琛屾椂 缃┖
+          config.setting.dataresource = ''
+        } else {
+          config.setting.dataresource = config.setting.dataresource || ''
+        }
+        if (/\s/.test(config.setting.dataresource)) {
+          config.setting.dataresource = '(' + config.setting.dataresource + ') tb'
+        }
+  
+        if (this.props.dataManager) { // 鏁版嵁鏉冮檺
+          config.setting.dataresource = config.setting.dataresource.replace(/\$@/ig, '/*')
+          config.setting.dataresource = config.setting.dataresource.replace(/@\$/ig, '*/')
+          config.setting.customScript = config.setting.customScript.replace(/\$@/ig, '/*')
+          config.setting.customScript = config.setting.customScript.replace(/@\$/ig, '*/')
+        } else {
+          config.setting.dataresource = config.setting.dataresource.replace(/@\$|\$@/ig, '')
+          config.setting.customScript = config.setting.customScript.replace(/@\$|\$@/ig, '')
+        }
+      }
 
       if (_curUserConfig) {
         config.setting = {...config.setting, ..._curUserConfig.setting}
@@ -300,6 +281,7 @@
       let _logcolumns = []   // 鏃ュ織鏄剧ず鍒�
       let _hideCol = []      // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆�
       let colMap = new Map() // 鐢ㄤ簬瀛楁杩囨护
+      let statFields = []    // 鍚堣瀛楁淇℃伅
 
       let _actions = []      // 宸ュ叿鏍忔寜閽�
       let _operations = []   // 鎿嶄綔鍒楁寜閽紙瀛樺湪鏃讹級
@@ -323,6 +305,9 @@
           _logcolumns.push(col)
 
           col.nameField && _arrField.push(col.nameField) // 閾炬帴鍚嶅瓧娈�
+          if (col.Hide !== 'true' && col.type === 'number' && col.sum === 'true') {
+            statFields.push(col)
+          }
         }
         if (col.type === 'colspan' && col.sublist) { // 绛涢�夐殣钘忓垪
           _hideCol = _hideCol.concat(col.sublist)
@@ -392,6 +377,7 @@
         loadingview: false,
         chartId: chartId,
         config: config,
+        statFields: statFields,
         tabActive: _tabActive,
         userConfig: userConfig,
         setting: config.setting,
@@ -404,6 +390,7 @@
       }, () => {
         if (config.setting.onload !== 'false' && valid) { // 鍒濆鍖栧彲鍔犺浇
           this.loadmaindata()
+          this.getStatFieldsValue()
         }
         this.setShortcut()
       })
@@ -439,79 +426,58 @@
 
       if (!preKey) return
 
-      let istrigger = false
+      let triggerId = ''
 
-      actions.forEach(item => {
-        if (!item.shortcut || typeof(item.shortcut) !== 'object' || item.shortcut.length === 0 || istrigger) return
-
-        if (preKey === item.shortcut[0] && keyCode === item.shortcut[1]) {
+      actions.some(item => {
+        if (Array.isArray(item.shortcut) && preKey === item.shortcut[0] && keyCode === item.shortcut[1]) {
           e.preventDefault()
-          istrigger = true
-
-          this.setState({
-            triggerBtn: {
-              uuid: new Date().getTime(),
-              parentId: this.props.MenuID,
-              button: item,
-              data: null
-            }
-          })
+          triggerId = item.uuid
+          return true
         }
+        return false
       })
 
-      if (istrigger) return
+      if (triggerId) {
+        MKEmitter.emit('triggerBtnId', triggerId)
+        return
+      }
 
-      Object.keys(userConfig).forEach(key => {
-        if (key === this.props.MenuID || !userConfig[key].action || istrigger) return
+      Object.keys(userConfig).some(key => {
+        if (key === this.props.MenuID || !userConfig[key].action) return false
 
         let _actions = userConfig[key].action
 
-        Object.keys(_actions).forEach(btnkey => {
+        Object.keys(_actions).some(btnkey => {
           let item = _actions[btnkey]
 
-          if (!item.shortcut || typeof(item.shortcut) !== 'object' || item.shortcut.length === 0 || istrigger) return
-
-          if (preKey === item.shortcut[0] && keyCode === item.shortcut[1]) {
+          if (Array.isArray(item.shortcut) && preKey === item.shortcut[0] && keyCode === item.shortcut[1]) {
             e.preventDefault()
-            istrigger = true
+            triggerId = btnkey
 
             let _groupId = ''
             let _ActiveTabId = ''
             config.tabgroups.forEach(group => {
-              if (group.sublist.length === 0) return
-
               let _tab = group.sublist.filter(tab => tab.uuid === key)[0]
-              if (_tab) {
-                _groupId = group.uuid
-                _ActiveTabId = _tab.uuid
-              }
+
+              if (!_tab) return
+
+              _groupId = group.uuid
+              _ActiveTabId = _tab.uuid
             })
 
-            if (this.state.tabActive[_groupId] === _ActiveTabId) {
-              this.setState({
-                triggerBtn: {
-                  uuid: new Date().getTime(),
-                  parentId: key,
-                  button: {...item, uuid: btnkey},
-                  data: null
-                }
-              })
-            } else {
-              this.setState({
-                tabActive: {...this.state.tabActive, [_groupId]: _ActiveTabId}
-              }, () => {
-                this.setState({
-                  triggerBtn: {
-                    uuid: new Date().getTime(),
-                    parentId: key,
-                    button: {...item, uuid: btnkey},
-                    data: null
-                  }
-                })
-              })
-            }
+            this.setState({
+              tabActive: {...this.state.tabActive, [_groupId]: _ActiveTabId}
+            }, () => {
+              MKEmitter.emit('triggerBtnId', triggerId)
+            })
+
+            return true
           }
+          return false
         })
+
+        if (triggerId) return true
+        return false
       })
     }
   }
@@ -520,9 +486,17 @@
    * @description 涓昏〃鏁版嵁鍔犺浇
    */ 
   async loadmaindata () {
-    const { setting, BIDs, search, BID } = this.state
-    let param = ''
+    const { setting, arr_field, BIDs, search, orderBy, BID, pageIndex, pageSize } = this.state
     let requireFields = search.filter(item => item.required && (!item.value || item.value.length === 0))
+
+    this.setState({
+      selectedData: [],
+      BIDs: {
+        ...BIDs,
+        mainTable: '',
+        mainTabledata: ''
+      }
+    })
 
     if (requireFields.length > 0) {
       let labels = requireFields.map(item => item.label)
@@ -540,18 +514,11 @@
       loading: true
     })
 
-    if (setting.interType !== 'inner' || (setting.interType === 'inner' && setting.innerFunc)) {
-      param = this.getCustomParam()
-    } else {
-      param = this.getDefaultParam()
-    }
+    let _orderBy = orderBy || setting.order
+    let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType, this.props.dataManager)
 
-    if (BID) {
-      param.BID = BID
-    }
-    // 鏁版嵁绠$悊鏉冮檺
-    if (this.props.dataManager) {
-      param.dataM = 'Y'
+    if (param.func === 'sPC_Get_TableData') {
+      param.menuname = this.props.MenuName || ''
     }
 
     let result = await Api.genericInterface(param)
@@ -563,12 +530,7 @@
         }),
         total: result.total,
         loading: false,
-        pickup: false,
-        BIDs: {
-          ...BIDs,
-          mainTable: '',
-          mainTabledata: ''
-        }
+        pickup: false
       })
     } else {
       this.setState({
@@ -583,168 +545,56 @@
   }
 
   /**
-   * @description 鑾峰彇鐢ㄦ埛鑷畾涔夊瓨鍌ㄨ繃绋嬩紶鍙�
+   * @description 鑾峰彇鍚堣瀛楁鍊�
    */
-  getCustomParam = () => {
-    const { pageIndex, pageSize, orderBy, search, setting } = this.state
+  getStatFieldsValue = () => {
+    const { setting, search, BID, orderBy, statFields } = this.state
 
-    let _search = Utils.formatCustomMainSearch(search)
+    if (statFields.length === 0 || setting.interType !== 'system' || !setting.dataresource) return
 
-    let param = {
-      OrderCol: orderBy || setting.order,
-      ..._search
+    let requireFields = search.filter(item => item.required && (!item.value || item.value.length === 0))
+    if (requireFields.length > 0) {
+      return
     }
 
-    if (setting.laypage !== 'false') {
-      param.PageIndex = pageIndex
-      param.PageSize = pageSize
-    }
-
-    if (setting.interType === 'inner') {
-      param.func = setting.innerFunc
-    } else {
-      if (this.props.menuType === 'HS') {
-        if (setting.sysInterface === 'true' && options.cloudServiceApi) {
-          param.rduri = options.cloudServiceApi
-        } else if (setting.sysInterface !== 'true') {
-          param.rduri = setting.interface
-        }
-      } else {
-        if (setting.sysInterface === 'true' && window.GLOB.mainSystemApi) {
-          param.rduri = window.GLOB.mainSystemApi
-        } else if (setting.sysInterface !== 'true') {
-          param.rduri = setting.interface
-        }
-      }
-
-      if (setting.outerFunc) {
-        param.func = setting.outerFunc
-      }
-    }
-
-    return param
-  }
-
-  /**
-   * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼ sPC_Get_TableData 鐨勫弬鏁�
-   */
-  getDefaultParam = () => {
-    const { arr_field, pageIndex, pageSize, orderBy, search, setting } = this.state
-
-    if (!arr_field) {
-      notification.warning({
-        top: 92,
-        message: '鏈缃樉绀哄垪锛�',
-        duration: 5
-      })
-      return null
-    }
-
-    let _search = Utils.joinMainSearchkey(search)
-
-    _search = _search ? 'where ' + _search : ''
-    
-    let param = {
-      func: 'sPC_Get_TableData',
-      obj_name: 'data',
-      arr_field: arr_field,
-      custom_script: setting.customScript || '',
-      default_sql: setting.default || 'true'
-    }
-    
     let _orderBy = orderBy || setting.order
-    let _dataresource = setting.dataresource
+    let param = UtilsDM.getStatQueryDataParams(setting, statFields, search, _orderBy, BID, this.props.menuType, this.props.dataManager)
 
-    if (/\s/.test(_dataresource)) {
-      _dataresource = '(' + _dataresource + ') tb'
+    if (param.func === 'sPC_Get_TableData') {
+      param.menuname = this.props.MenuName || ''
     }
 
-    if (this.props.dataManager) { // 鏁版嵁鏉冮檺
-      _dataresource = _dataresource.replace(/\$@/ig, '/*')
-      _dataresource = _dataresource.replace(/@\$/ig, '*/')
-      param.custom_script = param.custom_script.replace(/\$@/ig, '/*')
-      param.custom_script = param.custom_script.replace(/@\$/ig, '*/')
-    } else {
-      _dataresource = _dataresource.replace(/@\$|\$@/ig, '')
-      param.custom_script = param.custom_script.replace(/@\$|\$@/ig, '')
-    }
+    Api.genericInterface(param).then(res => {
+      if (res.status) {
+        let _data = res.data[0]
+        let values = []
 
-    let regoptions = null
-    if (setting.queryType === 'statistics' || param.custom_script) {
-      let allSearch = Utils.getAllSearchOptions(search)
-
-      regoptions = allSearch.map(item => {
-        return {
-          reg: new RegExp('@' + item.key + '@', 'ig'),
-          value: `'${item.value}'`
+        if (_data) {
+          statFields.forEach(item => {
+            if (_data[item.field] || _data[item.field] === 0) {
+              let val = +_data[item.field]
+              if (isNaN(val)) {
+                val = 0
+              }
+              val = val.toFixed(item.decimal)
+              values.push({label: item.label, value: val})
+            }
+          })
         }
-      })
-    }
-
-    if (setting.queryType === 'statistics' && setting.default !== 'false') { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲
-      regoptions.forEach(item => {
-        _dataresource = _dataresource.replace(item.reg, item.value)
-      })
-      _search = ''
-    }
-
-    let LText = ''
-    let DateCount = ''
-
-    if (setting.default !== 'false' && setting.laypage !== 'false') {
-      LText = ` select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows `
-      DateCount = `select count(1) as total from ${_dataresource} ${_search}`
-    } else if (setting.default !== 'false') {
-      LText = ` select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows `
-      DateCount = ''
-    }
-
-    if (param.custom_script) {
-      regoptions.push({
-        reg: new RegExp('@orderBy@', 'ig'),
-        value: _orderBy
-      })
-      if (setting.laypage !== 'false') {
-        regoptions.push({
-          reg: new RegExp('@pageSize@', 'ig'),
-          value: pageSize
-        }, {
-          reg: new RegExp('@pageIndex@', 'ig'),
-          value: pageIndex
+        this.setState({
+          statFValue: values
+        })
+      } else {
+        this.setState({
+          statFValue: []
+        })
+        notification.error({
+          top: 92,
+          message: res.message,
+          duration: 10
         })
       }
-
-      regoptions.forEach(item => {
-        param.custom_script = param.custom_script.replace(item.reg, item.value)
-      })
-
-      if (LText) {
-        LText += `
-          aaa:
-          if @ErrorCode!=''
-            insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ 
-        `
-      } else {
-        param.custom_script += `
-          aaa:
-          if @ErrorCode!=''
-            insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@
-        `
-      }
-
-      param.custom_script = Utils.formatOptions(param.custom_script)
-    }
-
-    param.LText = Utils.formatOptions(LText)
-    param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
-    param.secretkey = Utils.encrypt(param.LText, param.timestamp)
-    param.DateCount = Utils.formatOptions(DateCount)
-
-    if (this.props.menuType === 'HS') { // 浜戠鏁版嵁楠岃瘉
-      param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true)
-    }
-
-    return param
+    })
   }
 
   /**
@@ -761,15 +611,16 @@
         setting: {...setting, onload: 'true'}
       }, () => {
         this.loadmaindata()
+        this.getStatFieldsValue()
       })
     } else {
+      MKEmitter.emit('resetTable', this.props.MenuID + 'mainTable') // 鍒楄〃閲嶇疆
       this.setState({
-        resetTable: !this.state.resetTable,
-        selectedData: [],
         pageIndex: 1,
         search: searches
       }, () => {
         this.loadmaindata()
+        this.getStatFieldsValue()
       })
     }
   }
@@ -787,7 +638,6 @@
     }
 
     this.setState({
-      selectedData: [],
       pageIndex: pagination.current,
       pageSize: pagination.pageSize,
       orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : ''
@@ -800,12 +650,12 @@
    * @description 琛ㄦ牸鍒锋柊
    */
   reloadtable = () => {
+    MKEmitter.emit('resetTable', this.props.MenuID + 'mainTable') // 鍒楄〃閲嶇疆
     this.setState({
-      resetTable: !this.state.resetTable,
-      selectedData: [],
       pageIndex: 1
     }, () => {
       this.loadmaindata()
+      this.getStatFieldsValue()
     })
   }
 
@@ -879,20 +729,6 @@
    */
   changeSelectedData = (selectedData) => {
     this.setState({selectedData})
-  }
-
-  /**
-   * @description 琛ㄦ牸涓紝鎸夐挳瑙﹀彂浜嬩欢浼犻��
-   */
-  buttonTrigger = (btn, record) => {
-    this.setState({
-      triggerBtn: {
-        uuid: new Date().getTime(),
-        parentId: this.props.MenuID,
-        button: btn,
-        data: record
-      }
-    })
   }
 
   /**
@@ -993,11 +829,7 @@
 
   UNSAFE_componentWillReceiveProps(nextProps) {
     if (nextProps.refreshTab && nextProps.refreshTab.MenuID === this.props.MenuID) {
-      if (nextProps.refreshTab.position === 'grid') {
-        this.reloadtable()
-      } else if (nextProps.refreshTab.position === 'view') {
-        this.reloadview()
-      }
+      this.reloadview()
       this.props.refreshTabView('')
     } else if (!is(fromJS(this.props.tabviews), fromJS(nextProps.tabviews))) {
       let selectTab = nextProps.tabviews.filter(tab => tab.selected)[0]
@@ -1030,10 +862,11 @@
   }
 
   render() {
-    const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, triggerBtn, userConfig, tabActive, chartId, search, selectedData } = this.state
+    const { menuType, MenuName } = this.props
+    const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, userConfig, tabActive, chartId, search, selectedData } = this.state
 
     return (
-      <div className="commontable pick-control" id={this.state.ContainerId}>
+      <div className="commontable" id={this.state.ContainerId}>
         {loadingview && <Spin size="large" />}
         {searchlist && searchlist.length > 0 ?
           <MainSearch
@@ -1059,18 +892,17 @@
               return (
                 <Col span={item.width || 24} key={item.uuid}>
                   {config.charts.length > 1 && item.title ? <p className="chart-table chart-title">{item.title}</p> : null}
-                  <div style={{minHeight: '25px'}}>
+                  <div className="commontable-main-action">
                     <MainAction
                       BID={BID}
                       setting={setting}
                       actions={actions}
+                      MenuName={MenuName}
                       dict={this.state.dict}
-                      triggerBtn={triggerBtn}
                       MenuID={this.props.MenuID}
                       selectedData={selectedData}
                       logcolumns={this.state.logcolumns}
                       ContainerId={this.state.ContainerId}
-                      operations={config.gridBtn.operations || []}
                       refreshdata={this.refreshbyaction}
                       getexceloutparam={this.getexceloutparam}
                     />
@@ -1079,9 +911,9 @@
                     {this.props.menuType !== 'HS' ? <SettingComponent
                       config={config}
                       columns={columns}
+                      MenuName={MenuName}
                       dict={this.state.dict}
                       MenuID={this.props.MenuID}
-                      MenuName={this.props.MenuName}
                       permAction={this.props.permAction}
                       permRoles={this.props.permRoles}
                       userConfig={this.state.userConfig}
@@ -1092,10 +924,12 @@
                     }
                     <MainTable
                       tableId="mainTable"
+                      BID={BID}
                       pickup={pickup}
                       config={config}
                       setting={setting}
                       columns={columns}
+                      MenuName={MenuName}
                       pageSize={pageSize}
                       dict={this.state.dict}
                       data={this.state.data}
@@ -1103,9 +937,11 @@
                       MenuID={this.props.MenuID}
                       loading={this.state.loading}
                       refreshdata={this.refreshbytable}
-                      buttonTrigger={this.buttonTrigger}
+                      logcolumns={this.state.logcolumns}
+                      statFValue={this.state.statFValue}
                       handleTableId={this.handleTableId}
-                      resetTable={this.state.resetTable}
+                      ContainerId={this.state.ContainerId}
+                      refreshbyaction={this.refreshbyaction}
                       chgSelectData={this.changeSelectedData}
                     />
                   </div>
@@ -1113,11 +949,12 @@
               )
             } else if (item.chartType === 'card') {
               return (
-                <Col span={item.width} key={item.uuid}>
+                <Col className="card-view" span={item.width} key={item.uuid}>
                   <CardComponent
                     BID={BID}
                     plot={item}
                     config={config}
+                    MenuName={MenuName}
                     tableId="mainTable"
                     data={this.state.data}
                     MenuID={this.props.MenuID}
@@ -1137,6 +974,7 @@
                     BID={BID}
                     plot={item}
                     config={config}
+                    MenuName={MenuName}
                     data={this.state.data}
                     getexceloutparam={this.getexceloutparam}
                     loading={this.state.loading}
@@ -1157,39 +995,26 @@
                       {_tab.label}
                     </span>
                   } key={_tab.uuid}>
-                    {_tab.type === 'SubTable' ?
-                      <SubTable
-                        Tab={_tab}
-                        MenuID={_tab.linkTab}
-                        mainSearch={_tab.searchPass === 'true' ? search : null}
-                        userConfig={userConfig ? userConfig[_tab.uuid] : null}
-                        triggerBtn={triggerBtn}
-                        SupMenuID={this.props.MenuID}
-                        refreshtabs={this.state.refreshtabs}
-                        ContainerId={this.state.ContainerId}
-                        BID={this.state.BIDs[_tab.supMenu] || ''}
-                        BData={this.state.BIDs[_tab.supMenu + 'data'] || ''}
-                        handleTableId={this.handleTableId}
-                        handleMainTable={(type) => this.handleMainTable(type, _tab)}
-                      /> : null}
-                    {_tab.type === 'SecretKeyTable' ?
-                      <SecretKeyTable
-                        Tab={_tab}
-                        MenuID={_tab.linkTab}
-                        SupMenuID={this.props.MenuID}
-                        refreshtabs={this.state.refreshtabs}
-                        ContainerId={this.state.ContainerId}
-                        BID={this.state.BIDs[_tab.supMenu] || ''}
-                        BData={this.state.BIDs[_tab.supMenu + 'data'] || ''}
-                        handleMainTable={(type) => this.handleMainTable(type, _tab)}
-                      /> : null}
+                    <SubTable
+                      Tab={_tab}
+                      MenuID={_tab.linkTab}
+                      mainSearch={_tab.searchPass === 'true' ? search : null}
+                      userConfig={userConfig ? userConfig[_tab.uuid] : null}
+                      SupMenuID={this.props.MenuID}
+                      refreshtabs={this.state.refreshtabs}
+                      ContainerId={this.state.ContainerId}
+                      BID={this.state.BIDs[_tab.supMenu] || ''}
+                      BData={this.state.BIDs[_tab.supMenu + 'data'] || ''}
+                      handleTableId={this.handleTableId}
+                      handleMainTable={(type) => this.handleMainTable(type, _tab)}
+                    />
                   </TabPane>
                 )
               })}
             </Tabs>)
           )
         }
-        {options.sysType !== 'cloud' ? <Button
+        {options.sysType !== 'cloud' && menuType !== 'HS' ? <Button
           icon="copy"
           shape="circle"
           className="common-table-copy"

--
Gitblit v1.8.0