From b69b5f6329ca5f87932436b7a6c1ddfc3377e10f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 16 五月 2024 10:56:41 +0800
Subject: [PATCH] 2024-05-16

---
 src/tabviews/custom/components/card/prop-card/index.jsx |   71 +++++++++++++++++------------------
 1 files changed, 35 insertions(+), 36 deletions(-)

diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx
index f114efa..cda84d4 100644
--- a/src/tabviews/custom/components/card/prop-card/index.jsx
+++ b/src/tabviews/custom/components/card/prop-card/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Spin, notification, Col, Row, Modal } from 'antd'
+import { Spin, Col, Row } from 'antd'
 
 import Api from '@/api'
 import UtilsDM from '@/utils/utils-datamanage.js'
@@ -72,10 +72,26 @@
       this.loaded = true
     } else if (_config.wrap.datatype === 'static') {
       this.loaded = true
+      _config.subcards.forEach(card => {
+        card.elements.forEach(ele => {
+          if (ele.eleType === 'button') return
+          if (ele.datatype === 'dynamic' && ele.field) {
+            ele.field = ele.field.toLowerCase()
+          }
+        })
+      })
     }
 
     _data.$$BID = BID || ''
     _data.$$BData = BData || ''
+
+    if (_config.wrap.datatype === 'static' && BData) {
+      Object.keys(BData).forEach(key => {
+        if (/\$/.test(key)) return
+        _data[key.toLowerCase()] = BData[key]
+      })
+    }
+
     if (_config.setting.primaryKey) {
       _data.$$uuid = _data[_config.setting.primaryKey] || ''
     }
@@ -131,16 +147,14 @@
     MKEmitter.addListener('queryModuleParam', this.queryModuleParam)
     MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult)
 
-    if (config.setting.useMSearch) {
-      MKEmitter.addListener('searchRefresh', this.searchRefresh)
-    }
-
     if (config.setting.sync === 'true') {
       MKEmitter.addListener('transferSyncData', this.transferSyncData)
     }
 
     if (config.wrap.datatype === 'public') {
       MKEmitter.addListener('mkPublicData', this.mkPublicData)
+    } else if (config.setting.useMSearch) {
+      MKEmitter.addListener('searchRefresh', this.searchRefresh)
     }
 
     if (config.timer && config.wrap.datatype === 'dynamic') {
@@ -352,7 +366,6 @@
 
       _data.$$BID = BID || ''
       _data.$$BData = BData || ''
-      _data.$$uuid = _data[config.setting.primaryKey] || ''
 
       this.loaded = true
 
@@ -376,11 +389,11 @@
   autoExec = (times) => {
     const { config, data } = this.state
 
-    if (!config.wrap.autoExec) return
+    if (!config.wrap.autoExec || (config.wrap.emptyExec === 'false' && data.$$empty)) return
 
     let btn = document.getElementById('button' + config.wrap.autoExec)
 
-    clearTimeout(this.autoTimer)
+    this.autoTimer && clearTimeout(this.autoTimer)
 
     if (btn) {
       MKEmitter.emit('triggerBtnId', config.wrap.autoExec, data.$$empty ? [] : [data])
@@ -429,8 +442,8 @@
 
     if (config.uuid !== menuId) return
 
-    if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { // 鍒锋柊婧愮粍浠舵椂锛岄檮甯﹀埛鏂颁笂绾ц涓庡綋鍓嶇粍浠�
-      MKEmitter.emit('reloadData', config.setting.supModule, BID)
+    if (['mainline', 'maingrid', 'popclose'].includes(position) && config.setting.supModule) {
+      MKEmitter.emit('reloadData', config.setting.supModule, position === 'maingrid' ? '' : BID)
     } else {
       this.loadData('', btn)
     }
@@ -497,8 +510,16 @@
     }
     
     if (config.wrap.datatype === 'static') {
+      let _data = {$$BID: BID || '', $$BData: BData, $$empty: true, $$time: new Date().getTime()}
+      if (BData) {
+        Object.keys(BData).forEach(key => {
+          if (/\$/.test(key)) return
+          _data[key.toLowerCase()] = BData[key]
+        })
+      }
+
       this.setState({
-        data: {$$BID: BID || '', $$BData: BData, $$empty: true},
+        data: _data,
       })
 
       if (!btn) {
@@ -576,37 +597,15 @@
           this.timer && this.timer.stop()
         }
       }
-      if (result.message) {
-        if (result.ErrCode === 'Y') {
-          Modal.success({
-            title: result.message
-          })
-        } else if (result.ErrCode === 'S') {
-          notification.success({
-            top: 92,
-            message: result.message,
-            duration: 2
-          })
-        }
-      }
+      
+      UtilsDM.querySuccess(result)
     } else {
       this.setState({
         loading: false
       })
       this.timer && this.timer.stop()
 
-      if (!result.message) return
-      if (result.ErrCode === 'N') {
-        Modal.error({
-          title: result.message,
-        })
-      } else if (result.ErrCode !== '-2') {
-        notification.error({
-          top: 92,
-          message: result.message,
-          duration: 10
-        })
-      }
+      UtilsDM.queryFail(result)
     }
   }
 

--
Gitblit v1.8.0