From 24842b40de5cd60700bf69dfd38a0332f5431e36 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 23 五月 2025 10:55:07 +0800
Subject: [PATCH] Merge branch 'master' into positec

---
 src/tabviews/custom/components/table/edit-table/index.jsx |   94 ++++++++++++++++++++++++++++++-----------------
 1 files changed, 60 insertions(+), 34 deletions(-)

diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx
index 116551f..7f9b250 100644
--- a/src/tabviews/custom/components/table/edit-table/index.jsx
+++ b/src/tabviews/custom/components/table/edit-table/index.jsx
@@ -1,6 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
+import { notification } from 'antd'
 import moment from 'moment'
 
 import Api from '@/api'
@@ -210,6 +211,10 @@
       _config.colsCtrls = null
     }
 
+    if (_config.setting.supModule && !BID) {
+      _config.setting.onload = 'false'
+    }
+
     this.setState({
       pageSize: setting.pageSize || 10,
       BID: BID || '',
@@ -224,7 +229,7 @@
     }, () => {
       if (_config.setting.onload === 'true') {
         setTimeout(() => {
-          this.loadmaindata()
+          this.loadData()
         }, _config.setting.delay || 0)
       }
     })
@@ -251,6 +256,7 @@
     config.dataSource = config.dataSource.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`)
     config.dataSource = config.dataSource.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`)
     config.dataSource = config.dataSource.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`)
+    config.dataSource = config.dataSource.replace(/@lang@/ig, `'${sessionStorage.getItem('lang')}'`)
 
     if (/\s/.test(config.dataSource)) { // 鎷兼帴鍒悕
       config.dataSource = '(' + config.dataSource + ') tb'
@@ -338,8 +344,18 @@
 
       if (col.supField) {
         names = []
-        if (BData && BData[col.supField]) {
-          names = BData[col.supField].split(',')
+        let val = ''
+        if (BData) {
+          let field = col.supField.toLowerCase()
+          Object.keys(BData).forEach(key => {
+            if (key.toLowerCase() === field) {
+              val = BData[key] + ''
+            }
+          })
+        }
+
+        if (val) {
+          names = val.split(',')
 
           if (names.length > fields.length) {
             names.length = fields.length
@@ -409,10 +425,8 @@
 
   /**
    * @description 涓昏〃鏁版嵁鍔犺浇
-   * @param { Boolean } reset  琛ㄦ牸鏄惁閲嶇疆
-   * @param { String }  repage 琛ㄦ牸鏄惁閲嶇疆椤电爜
    */
-  async loadmaindata (reset, repage) {
+  async loadData (reset, repage) {
     const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state
 
     if (setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇�
@@ -423,6 +437,7 @@
         total: 0
       })
       reset && MKEmitter.emit('resetTable', config.uuid, 'true') // 鍒楄〃閲嶇疆
+      MKEmitter.emit('transferData' + setting.tableId, [])
 
       this.requestId = ''
       return
@@ -518,11 +533,6 @@
    */ 
   async loadLinedata (id, position) {
     const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state
-
-    if (config.forbidLine) {
-      this.reloadtable()
-      return
-    }
     
     let searches = fromJS(search).toJS()
     if (config.setting.useMSearch) { // 涓昏〃鎼滅储鏉′欢
@@ -545,7 +555,7 @@
     let result = await Api.genericInterface(param)
     if (result.status) {
       if (position === 'line_grid' && (!result.data || !result.data[0])) {
-        this.loadmaindata(true, 'false')
+        this.reloadIndex()
         return
       }
 
@@ -622,11 +632,25 @@
    * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃�
    */
   refreshbysearch = (searches) => {
+    const { setting, BID } = this.state
+
+    if (setting.supModule && !BID) {
+      notification.warning({
+        top: 92,
+        message: setting.supModTip || window.GLOB.dict['sup_key_req'] || '闇�瑕佷笂绾т富閿�硷紒',
+        duration: 5
+      })
+      this.setState({
+        search: searches
+      })
+      return
+    }
+
     this.setState({
       pageIndex: 1,
       search: searches
     }, () => {
-      this.loadmaindata(true, 'true')
+      this.loadData(true, 'true')
     })
   }
 
@@ -647,23 +671,19 @@
       pageSize: pagination.pageSize,
       orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : ''
     }, () => {
-      this.loadmaindata()
+      this.loadData()
     })
   }
 
   /**
    * @description 琛ㄦ牸鍒锋柊
    */
-  reloadtable = (btn) => {
-    if (!btn || btn.resetPageIndex !== 'false') {
-      this.setState({
-        pageIndex: 1
-      }, () => {
-        this.loadmaindata(true, 'true')
-      })
-    } else {
-      this.loadmaindata(true, 'false')
-    }
+  reloadIndex = () => {
+    this.setState({
+      pageIndex: 1
+    }, () => {
+      this.loadData(true, 'true')
+    })
   }
 
   /**
@@ -697,7 +717,9 @@
     if (config.uuid !== menuId) return
 
     if (!id) {
-      this.reloadtable()
+      this.reloadIndex()
+    } else if (config.forbidLine) {
+      this.loadData(true, 'false')
     } else {
       this.loadLinedata(id)
     }
@@ -719,7 +741,7 @@
       }, () => {
         if (!setting.checkBid) {
           setTimeout(() => {
-            this.loadmaindata(true, 'true')
+            this.loadData(true, 'true')
           }, setting.delay || 0)
         }
       })
@@ -739,14 +761,20 @@
 
     if (position === 'line' || position === 'line_grid') {
       if (lines && lines.length === 1) {
-        this.loadLinedata(lines[0].$$uuid, position)
+        if (config.forbidLine) {
+          this.loadData(true, 'false')
+        } else {
+          this.loadLinedata(lines[0].$$uuid, position)
+        }
       } else {
-        this.reloadtable(btn)
+        this.loadData(true, 'false')
       }
-    } else if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { // 鍒锋柊婧愮粍浠舵椂锛岄檮甯﹀埛鏂颁笂绾ц涓庡綋鍓嶇粍浠�
-      MKEmitter.emit('reloadData', config.setting.supModule, BID)
+    } else if (['mainline', 'maingrid', 'popclose'].includes(position) && config.setting.supModule) {
+      MKEmitter.emit('reloadData', config.setting.supModule, position === 'maingrid' ? '' : BID)
+    } else if (btn.resetPageIndex !== 'false') {
+      this.reloadIndex()
     } else {
-      this.reloadtable(btn)
+      this.loadData(true, 'false')
     }
   }
 
@@ -779,9 +807,7 @@
 
     if (config.$searchId !== searchId) return
     
-    this.setState({pageIndex: 1}, () => {
-      this.reloadtable()
-    })
+    this.reloadIndex()
   }
 
   shouldComponentUpdate (nextProps, nextState) {

--
Gitblit v1.8.0