From 0ecde1c329ef1136f8f2a261c856ea405b327914 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 24 一月 2025 20:22:25 +0800
Subject: [PATCH] 2025-01-24

---
 src/menu/components/search/main-search/index.jsx       |   11 +++
 src/menu/components/chart/antv-bar/index.jsx           |    4 
 src/menu/components/chart/antv-scatter/index.jsx       |    4 
 src/menu/components/share/pastecomponent/index.jsx     |   24 ++++---
 src/menu/components/card/table-card/index.jsx          |   25 +++++--
 src/menu/components/share/searchcomponent/index.jsx    |   16 ++++
 src/templates/zshare/verifycard/index.jsx              |    3 
 src/menu/components/card/double-data-card/index.jsx    |   25 +++++--
 src/menu/components/card/data-card/index.jsx           |   25 +++++--
 src/templates/sharecomponent/searchcomponent/index.jsx |   12 ++++
 10 files changed, 108 insertions(+), 41 deletions(-)

diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx
index 6e8d9fd..6723bb4 100644
--- a/src/menu/components/card/data-card/index.jsx
+++ b/src/menu/components/card/data-card/index.jsx
@@ -207,7 +207,7 @@
     this.updateComponent(_card)
   }
 
-  addSearch = (copy) => {
+  addSearch = (copy, type = '') => {
     const { card } = this.state
 
     let newcard = {}
@@ -228,7 +228,7 @@
     }
 
     // 娉ㄥ唽浜嬩欢-娣诲姞鎼滅储
-    MKEmitter.emit('addSearch', card.uuid, newcard)
+    MKEmitter.emit('addSearch', card.uuid, newcard, type)
   }
 
   addButton = (copy) => {
@@ -501,13 +501,22 @@
         }
   
         if (res.field && keys.includes(res.field.toLowerCase())) {
-          resolve({status: false, message: '鎼滅储瀛楁宸插瓨鍦紒'})
-          return
+          resolve({status: false})
+          const that = this
+          confirm({
+            title: '鎼滅储瀛楁宸插瓨鍦紒',
+            okText: '鐭ラ亾浜�',
+            cancelText: '鏇挎崲',
+            onOk() {},
+            onCancel() {
+              that.addSearch(res, 'replace')
+            }
+          })
+        } else {
+          resolve({status: true})
+  
+          this.addSearch(res)
         }
-
-        resolve({status: true})
-
-        this.addSearch(res)
       }
     } else if (type === 'action') {
       if (res.style) {
diff --git a/src/menu/components/card/double-data-card/index.jsx b/src/menu/components/card/double-data-card/index.jsx
index 62a639f..ca1be3d 100644
--- a/src/menu/components/card/double-data-card/index.jsx
+++ b/src/menu/components/card/double-data-card/index.jsx
@@ -201,7 +201,7 @@
     this.updateComponent(_card)
   }
 
-  addSearch = (copy) => {
+  addSearch = (copy, type = '') => {
     const { card } = this.state
 
     let newcard = {}
@@ -222,7 +222,7 @@
     }
 
     // 娉ㄥ唽浜嬩欢-娣诲姞鎼滅储
-    MKEmitter.emit('addSearch', card.uuid, newcard)
+    MKEmitter.emit('addSearch', card.uuid, newcard, type)
   }
 
   addButton = (copy) => {
@@ -466,13 +466,22 @@
         }
   
         if (res.field && keys.includes(res.field.toLowerCase())) {
-          resolve({status: false, message: '鎼滅储瀛楁宸插瓨鍦紒'})
-          return
+          resolve({status: false})
+          const that = this
+          confirm({
+            title: '鎼滅储瀛楁宸插瓨鍦紒',
+            okText: '鐭ラ亾浜�',
+            cancelText: '鏇挎崲',
+            onOk() {},
+            onCancel() {
+              that.addSearch(res, 'replace')
+            }
+          })
+        } else {
+          resolve({status: true})
+  
+          this.addSearch(res)
         }
-
-        resolve({status: true})
-
-        this.addSearch(res)
       }
     } else if (type === 'action') {
       if (appType === 'mob' && !['pop', 'prompt', 'exec', 'innerpage'].includes(res.OpenType)) {
diff --git a/src/menu/components/card/table-card/index.jsx b/src/menu/components/card/table-card/index.jsx
index 0f61b77..2cb6e75 100644
--- a/src/menu/components/card/table-card/index.jsx
+++ b/src/menu/components/card/table-card/index.jsx
@@ -220,7 +220,7 @@
     this.updateComponent(card)
   }
 
-  addSearch = (copy) => {
+  addSearch = (copy, type = '') => {
     const { card } = this.state
 
     let newcard = {}
@@ -242,7 +242,7 @@
     }
 
     // 娉ㄥ唽浜嬩欢-娣诲姞鎼滅储
-    MKEmitter.emit('addSearch', card.uuid, newcard)
+    MKEmitter.emit('addSearch', card.uuid, newcard, type)
   }
 
   move = (item, direction) => {
@@ -337,13 +337,22 @@
         }
   
         if (res.field && keys.includes(res.field.toLowerCase())) {
-          resolve({status: false, message: '鎼滅储瀛楁宸插瓨鍦紒'})
-          return
+          resolve({status: false})
+          const that = this
+          confirm({
+            title: '鎼滅储瀛楁宸插瓨鍦紒',
+            okText: '鐭ラ亾浜�',
+            cancelText: '鏇挎崲',
+            onOk() {},
+            onCancel() {
+              that.addSearch(res, 'replace')
+            }
+          })
+        } else {
+          resolve({status: true})
+  
+          this.addSearch(res)
         }
-
-        resolve({status: true})
-
-        this.addSearch(res)
       }
     }
   }
diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx
index 0ad4db4..3436279 100644
--- a/src/menu/components/chart/antv-bar/index.jsx
+++ b/src/menu/components/chart/antv-bar/index.jsx
@@ -1337,12 +1337,12 @@
 
   plusSearch = (uuid, search, type) => {
     const { card } = this.state
-    if (card.uuid !== uuid || type !== 'simple') return
+    if (card.uuid !== uuid || (type !== 'simple' && type !== 'replace')) return
 
     search.uuid = Utils.getuuid()
     search.focus = true
 
-    MKEmitter.emit('addSearch', card.uuid, search)
+    MKEmitter.emit('addSearch', card.uuid, search, type === 'replace' ? 'replace' : '')
   }
 
   addButton = () => {
diff --git a/src/menu/components/chart/antv-scatter/index.jsx b/src/menu/components/chart/antv-scatter/index.jsx
index 9a20837..41bf3bd 100644
--- a/src/menu/components/chart/antv-scatter/index.jsx
+++ b/src/menu/components/chart/antv-scatter/index.jsx
@@ -278,12 +278,12 @@
 
   plusSearch = (uuid, search, type) => {
     const { card } = this.state
-    if (card.uuid !== uuid || type !== 'simple') return
+    if (card.uuid !== uuid || (type !== 'simple' && type !== 'replace')) return
 
     search.uuid = Utils.getuuid()
     search.focus = true
 
-    MKEmitter.emit('addSearch', card.uuid, search)
+    MKEmitter.emit('addSearch', card.uuid, search, type === 'replace' ? 'replace' : '')
   }
 
   addButton = () => {
diff --git a/src/menu/components/search/main-search/index.jsx b/src/menu/components/search/main-search/index.jsx
index 33814cc..5bf777b 100644
--- a/src/menu/components/search/main-search/index.jsx
+++ b/src/menu/components/search/main-search/index.jsx
@@ -342,6 +342,17 @@
 
       this.updateComponent(_card)
       this.handleSearch(item)
+    } else if (type === 'replace') {
+      delete item.focus
+      _card.search = _card.search.map(cell => {
+        if (cell.field && cell.field.toLowerCase() === item.field.toLowerCase()) {
+          return item
+        }
+        return cell
+      })
+
+      this.updateComponent(_card)
+      this.handleSearch(item)
     } else if (type === 'multil') {
       _card.search.push(...item)
 
diff --git a/src/menu/components/share/pastecomponent/index.jsx b/src/menu/components/share/pastecomponent/index.jsx
index f0e89a1..90944e9 100644
--- a/src/menu/components/share/pastecomponent/index.jsx
+++ b/src/menu/components/share/pastecomponent/index.jsx
@@ -10,6 +10,7 @@
 import asyncComponent from '@/utils/asyncComponent'
 // import './index.scss'
 
+const { confirm } = Modal
 const PasteForm = asyncComponent(() => import('@/templates/zshare/pasteform'))
 
 class PasteController extends Component {
@@ -173,17 +174,20 @@
           }
         }
 
-        if (res.field && keys.includes(res.field.toLowerCase())) {
-          notification.warning({
-            top: 92,
-            message: '鎼滅储瀛楁宸插瓨鍦紒',
-            duration: 5
-          })
-          return
-        }
-
-        MKEmitter.emit('plusSearch', config.uuid, res, 'simple')
         this.setState({visible: false})
+        if (res.field && keys.includes(res.field.toLowerCase())) {
+          confirm({
+            title: '鎼滅储瀛楁宸插瓨鍦紒',
+            okText: '鐭ラ亾浜�',
+            cancelText: '鏇挎崲',
+            onOk() {},
+            onCancel() {
+              MKEmitter.emit('plusSearch', config.uuid, res, 'replace')
+            }
+          })
+        } else {
+          MKEmitter.emit('plusSearch', config.uuid, res, 'simple')
+        }
         return
       } else if (type === 'cardcell') {
         config.subcards.push(res)
diff --git a/src/menu/components/share/searchcomponent/index.jsx b/src/menu/components/share/searchcomponent/index.jsx
index 6eca698..27a0c1b 100644
--- a/src/menu/components/share/searchcomponent/index.jsx
+++ b/src/menu/components/share/searchcomponent/index.jsx
@@ -64,12 +64,24 @@
     MKEmitter.removeListener('addSearch', this.addSearch)
   }
 
-  addSearch = (cardId, element) => {
+  addSearch = (cardId, element, type) => {
     if (cardId !== this.props.config.uuid) return
 
     const { searchlist } = this.state
 
-    this.setState({searchlist: [...searchlist, element]})
+    if (type === 'replace') {
+      delete element.focus
+      this.setState({
+        searchlist: searchlist.map(cell => {
+          if (cell.field && cell.field.toLowerCase() === element.field.toLowerCase()) {
+            return element
+          }
+          return cell
+        }),
+      })
+    } else {
+      this.setState({searchlist: [...searchlist, element]})
+    }
     this.handleSearch(element)
   }
 
diff --git a/src/templates/sharecomponent/searchcomponent/index.jsx b/src/templates/sharecomponent/searchcomponent/index.jsx
index c861729..16dcefa 100644
--- a/src/templates/sharecomponent/searchcomponent/index.jsx
+++ b/src/templates/sharecomponent/searchcomponent/index.jsx
@@ -61,6 +61,18 @@
       }, () => {
         this.handleSearch(item)
       })
+    } else if (type === 'replace') {
+      delete item.focus
+      this.setState({
+        searchlist: searchlist.map(cell => {
+          if (cell.field && cell.field.toLowerCase() === item.field.toLowerCase()) {
+            return item
+          }
+          return cell
+        }),
+      }, () => {
+        this.handleSearch(item)
+      })
     } else if (type === 'multil') {
       let list = [...searchlist, ...item]
       list = list.filter(item => !item.origin) // 鍘婚櫎绯荤粺椤�
diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx
index b772b71..e6c8b75 100644
--- a/src/templates/zshare/verifycard/index.jsx
+++ b/src/templates/zshare/verifycard/index.jsx
@@ -2027,7 +2027,8 @@
       _lpline = `set @ModularDetailCode= right('${record.ModularDetailCode}',50)`
     }
 
-    let sql = `select @BillCode='', @${record.field}='', @ModularDetailCode=''
+    let sql = `Declare @BillCode nvarchar(50),@ModularDetailCode nvarchar(50)
+    select @BillCode='', @${record.field}='', @ModularDetailCode=''
     ${_lpline}
     exec s_get_BillCode
       @ModularDetailCode=@ModularDetailCode,

--
Gitblit v1.8.0