From 5223edbcccfed84a33a706e5637ee65a61f377aa Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 22 十二月 2021 18:00:39 +0800
Subject: [PATCH] 2021-12-22

---
 src/tabviews/custom/components/table/normal-table/index.jsx |   43 +++++++++++++++++++++++--------------------
 1 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx
index 6fdb93b..63af99d 100644
--- a/src/tabviews/custom/components/table/normal-table/index.jsx
+++ b/src/tabviews/custom/components/table/normal-table/index.jsx
@@ -6,8 +6,6 @@
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
-import zhCN from '@/locales/zh-CN/main.js'
-import enUS from '@/locales/en-US/main.js'
 import UtilsDM from '@/utils/utils-datamanage.js'
 import asyncComponent from '@/utils/asyncComponent'
 import MKEmitter from '@/utils/events.js'
@@ -31,7 +29,6 @@
   }
 
   state = {
-    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     BID: '',              // 涓婄骇ID
     BData: '',            // 涓婄骇缁勪欢琛屾暟鎹�
     config: {},           // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑
@@ -56,7 +53,7 @@
    * 1銆� initdata 涓烘墦鍗版椂浣跨敤鐨勬暟鎹泦
    */
   UNSAFE_componentWillMount () {
-    const { data, initdata, BID } = this.props
+    const { data, initdata, BID, BData } = this.props
     let _config = fromJS(this.props.config).toJS()
     let _cols = new Map()
     let _data = null
@@ -80,11 +77,12 @@
         item.key = index
         item.$$uuid = item[_config.setting.primaryKey] || ''
         item.$$BID = BID || ''
+        item.$$BData = BData || ''
         item.$Index = index + 1 + ''
         return item
       })
 
-      if (setting.selected !== 'false') {
+      if (setting.selected !== 'false' && _data && _data.length > 0) {
         setTimeout(() => {
           MKEmitter.emit('mkCheckTopLine', _config.uuid)
         }, 200)
@@ -123,7 +121,9 @@
     }
 
     this.setState({
+      pageSize: setting.pageSize || 10,
       BID: BID || '',
+      BData: BData || '',
       title: _config.wrap.title,
       sync: _sync,
       data: _data,
@@ -191,7 +191,7 @@
 
     let result = await Api.genericInterface(param)
     if (result.status) {
-      if (setting.selected !== 'false') {
+      if (setting.selected !== 'false' && result.data && result.data.length > 0) {
         setTimeout(() => {
           MKEmitter.emit('mkCheckTopLine', config.uuid)
         }, 200)
@@ -200,6 +200,9 @@
         }
       } else {
         MKEmitter.emit('resetSelectLine', config.uuid, '', '') // 骞挎挱鏁版嵁鍒囨崲
+        if (setting.$hasSyncModule) {
+          MKEmitter.emit('syncBalconyData', config.uuid, [], false)
+        }
       }
       
       reset && MKEmitter.emit('resetTable', config.uuid, repage) // 鍒楄〃閲嶇疆
@@ -222,9 +225,6 @@
         total: result.total,
         loading: false
       })
-      if (setting.$hasSyncModule) {
-        MKEmitter.emit('syncBalconyData', config.uuid, [], false)
-      }
     } else {
       this.setState({
         loading: false
@@ -483,7 +483,7 @@
     const { setting } = this.state
 
     if (!setting.supModule || setting.supModule !== MenuID) return
-    if (id !== this.state.BID) {
+    if (id !== this.state.BID || id !== '') {
       this.setState({
         pageIndex: 1,
         BID: id,
@@ -501,12 +501,16 @@
    * @param {*} position   // 鍒锋柊浣嶇疆
    * @param {*} btn        // 鎵ц鐨勬寜閽�
    */
-  refreshByButtonResult = (menuId, position, btn) => {
+  refreshByButtonResult = (menuId, position, btn, id, lines) => {
     const { config, BID } = this.state
 
     if (config.uuid !== menuId) return
 
-    this.reloadtable(btn)                                                      // 鏁版嵁鍒锋柊
+    if (position === 'line' && lines && lines.length === 1) {
+      this.loadmainLinedata(lines[0].$$uuid)
+    } else {
+      this.reloadtable(btn)                                                    // 鏁版嵁鍒锋柊
+    }
 
     if (btn.syncComponentId && btn.syncComponentId !== config.uuid && btn.syncComponentId !== config.setting.supModule) {
       MKEmitter.emit('reloadData', btn.syncComponentId)                        // 鍚岀骇鏍囩鍒锋柊
@@ -521,7 +525,7 @@
   }
 
   UNSAFE_componentWillReceiveProps(nextProps) {
-    const { sync, config, setting, BID } = this.state
+    const { sync, config, setting, BID, BData } = this.state
 
     if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) {
       let _data = []
@@ -531,11 +535,12 @@
           item.key = index
           item.$$uuid = item[config.setting.primaryKey] || ''
           item.$$BID = BID || ''
+          item.$$BData = BData || ''
           item.$Index = index + 1 + ''
           return item
         })
 
-        if (setting.selected !== 'false') {
+        if (setting.selected !== 'false' && _data && _data.length > 0) {
           setTimeout(() => {
             MKEmitter.emit('mkCheckTopLine', config.uuid)
           }, 200)
@@ -578,7 +583,7 @@
   }
 
   render() {
-    const { BID, setting, searchlist, actions, config, columns, selectedData } = this.state
+    const { BID, setting, searchlist, actions, config, columns, selectedData, BData } = this.state
 
     return (
       <div className="custom-normal-table" style={config.style}>
@@ -591,7 +596,7 @@
               BID={BID}
               setting={setting}
               actions={actions}
-              BData={this.state.BData}
+              BData={BData}
               columns={config.columns}
               selectedData={selectedData}
             />
@@ -620,7 +625,7 @@
             BID={BID}
             setting={setting}
             actions={actions}
-            BData={this.state.BData}
+            BData={BData}
             columns={config.columns}
             selectedData={selectedData}
           />
@@ -647,9 +652,7 @@
 
 const mapStateToProps = (state) => {
   return {
-    menuType: state.editLevel,
-    permAction: state.permAction,
-    permMenus: state.permMenus
+    menuType: state.editLevel
   }
 }
 

--
Gitblit v1.8.0