From 80deba0c2dcffd9e6b6f07815c7c52199309ce42 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 23 六月 2025 17:36:03 +0800
Subject: [PATCH] 2025-06-23

---
 src/tabviews/custom/components/interfaces/interItem/index.jsx |   87 +++++++++++++++++++++++++++++++++----------
 1 files changed, 66 insertions(+), 21 deletions(-)

diff --git a/src/tabviews/custom/components/interfaces/interItem/index.jsx b/src/tabviews/custom/components/interfaces/interItem/index.jsx
index ab62d9b..bd37fa6 100644
--- a/src/tabviews/custom/components/interfaces/interItem/index.jsx
+++ b/src/tabviews/custom/components/interfaces/interItem/index.jsx
@@ -1,6 +1,5 @@
-import {Component} from 'react'
+import { Component } from 'react'
 import PropTypes from 'prop-types'
-import { notification, Modal } from 'antd'
 
 import Api from '@/api'
 import UtilsDM from '@/utils/utils-datamanage.js'
@@ -16,6 +15,7 @@
   }
 
   loading = false
+  loadTimer = null
   
   state = {
     BID: ''
@@ -39,9 +39,15 @@
       }
     }
 
-    setTimeout(() => {
+    if (config.setting.onload !== 'false') {
       this.loadData()
-    }, config.setting.delay)
+    } else {
+      MKEmitter.addListener('initFinish', this.initFinish)
+    }
+
+    if (config.setting.useMSearch) {
+      MKEmitter.addListener('searchRefresh', this.searchRefresh)
+    }
 
     MKEmitter.addListener('reloadData', this.reloadData)
     MKEmitter.addListener('resetSelectLine', this.resetParentParam)
@@ -57,8 +63,28 @@
       return
     }
     this.timer && this.timer.stop()
+    MKEmitter.removeListener('initFinish', this.initFinish)
     MKEmitter.removeListener('reloadData', this.reloadData)
+    MKEmitter.removeListener('searchRefresh', this.searchRefresh)
     MKEmitter.removeListener('resetSelectLine', this.resetParentParam)
+  }
+
+  searchRefresh = (searchId) => {
+    const { config } = this.props
+
+    if (config.$searchId !== searchId) return
+    
+    this.loadData()
+  }
+
+  initFinish = (MenuID) => {
+    const { config } = this.props
+
+    if (config.MenuID !== MenuID) return
+
+    if (config.setting.onload === 'false') {
+      this.loadData()
+    }
   }
 
   resetParentParam = (MenuID, id) => {
@@ -78,22 +104,43 @@
     this.loadData()
   }
 
-  async loadData () {
+  loadData = () => {
+    const { config } = this.props
+
+    this.loadTimer && clearTimeout(this.loadTimer)
+
+    this.loadTimer = setTimeout(() => {
+      this.execLoadData()
+    }, config.setting.delay)
+  }
+
+  async execLoadData () {
     const { config } = this.props
     const { BID } = this.state
 
     if (config.setting.supModule && !BID) {
-      MKEmitter.emit('mkPublicData', config.uuid, { $$empty: true, $$uuid: '' })
-      MKEmitter.emit('resetSelectLine', config.uuid, '', { $$empty: true, $$uuid: '' })
+      setTimeout(() => {
+        MKEmitter.emit('mkPublicData', config.uuid, { $$empty: true, $$uuid: '' })
+        MKEmitter.emit('resetSelectLine', config.uuid, '', { $$empty: true, $$uuid: '' })
+      }, 20)
       this.loading = false
       return
     }
 
     if (this.loading) return
 
+    let searches = []
+    if (config.setting.useMSearch) {
+      searches = window.GLOB.SearchBox.get(config.$searchId) || []
+
+      if (window.GLOB.SearchBox.has(config.$searchId + 'required') && searches.filter(item => item.required && item.value === '').length > 0) {
+        return
+      }
+    }
+
     this.loading = true
 
-    let param = UtilsDM.getQueryDataParams(config.setting, config.columns.map(col => col.field).join(','), [], config.setting.order, 1, 1, BID)
+    let param = UtilsDM.getQueryDataParams(config.setting, searches, config.setting.order, 1, 1, BID)
 
     let result = await Api.genericInterface(param)
     if (result.status) {
@@ -105,27 +152,25 @@
         _data.$$uuid = _data[config.setting.primaryKey] || ''
       }
       
-      _data.$$loaded = true
-
       window.GLOB.CacheData.set(config.uuid, _data)
 
       MKEmitter.emit('mkPublicData', config.uuid, _data)
       MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid, _data)
+
+      if (config.setting.loadlevel === 'init') {
+        MKEmitter.emit('interFinish', config.MenuID, config.uuid)
+      }
+
+      UtilsDM.querySuccess(result)
     } else {
       this.loading = false
       this.timer && this.timer.stop()
-      
-      if (result.ErrCode === 'N') {
-        Modal.error({
-          title: result.message,
-        })
-      } else {
-        notification.error({
-          top: 92,
-          message: result.message,
-          duration: 10
-        })
+
+      if (config.setting.loadlevel === 'init') {
+        MKEmitter.emit('interFinish', config.MenuID, config.uuid)
       }
+
+      UtilsDM.queryFail(result)
     }
   }
 

--
Gitblit v1.8.0