From 04c038af25f79ac7fc80e93054856a614f22b63b Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 12 六月 2024 16:43:39 +0800
Subject: [PATCH] 2024-06-12

---
 src/tabviews/zshare/actionList/normalbutton/index.jsx |  166 +++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 124 insertions(+), 42 deletions(-)

diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index 1f42b73..c9547e1 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -204,8 +204,8 @@
   /**
    * @description 瑙﹀彂鎸夐挳鎿嶄綔
    */
-  actionTrigger = (triggerId, record, type, callback) => {
-    const { btn, selectedData } = this.props
+  actionTrigger = (triggerId, record, type, lid, callback) => {
+    const { btn, selectedData, LID } = this.props
     const { loading, disabled } = this.state
 
     if (type === 'preButton') {
@@ -219,7 +219,7 @@
 
     if (loading || disabled) return
     if (triggerId && btn.uuid !== triggerId) return
-    if (type === 'linkbtn' && !btn.$toolbtn && !is(fromJS(selectedData || []), fromJS(record))) return
+    if (type === 'linkbtn' && !btn.$toolbtn && LID !== lid) return
     if (btn.OpenType === 'form' && btn.formType === 'count_line') return
 
     this.setState({autoMatic: type === 'autoMatic'})
@@ -756,6 +756,9 @@
         param.username = sessionStorage.getItem('User_Name') || ''
         param.fullname = sessionStorage.getItem('Full_Name') || ''
       }
+      if (btn.dataM === 'true') {
+        param.dataM = sessionStorage.getItem('dataM') === 'true' ? 'Y' : ''
+      }
       
       let primaryId = ''
 
@@ -797,6 +800,9 @@
         if (btn.recordUser === 'true') {
           param.username = sessionStorage.getItem('User_Name') || ''
           param.fullname = sessionStorage.getItem('Full_Name') || ''
+        }
+        if (btn.dataM === 'true') {
+          param.dataM = sessionStorage.getItem('dataM') === 'true' ? 'Y' : ''
         }
 
         let primaryId = setting.primaryKey ? cell[setting.primaryKey] || '' : ''
@@ -1087,7 +1093,7 @@
     let node = document.getElementById('button' + btnId)
 
     if (node) {
-      MKEmitter.emit('triggerBtnId', btnId, null, 'preButton', (res) => {
+      MKEmitter.emit('triggerBtnId', btnId, null, 'preButton', null, (res) => {
         if (!res) {
           this.setState({loading: false})
           resolve()
@@ -1130,6 +1136,14 @@
             item.script_type = 'Y'
             return item
           })
+        }
+        if (btn.database === 'sso') {
+          if ((window.GLOB.mkHS || window.GLOB.systemType === 'production') && window.GLOB.mainSystemApi) {
+            params = params.map(item => {
+              item.rduri = window.GLOB.mainSystemApi
+              return item
+            })
+          }
         }
       } else {
         params = this.getInnerParam(data, formdata)
@@ -1632,11 +1646,12 @@
       })
 
       keys = keys.join(',')
+      vals = vals.join(',')
 
       lines.push({
         table: md5(tb + keys),
-        insert: `Insert into ${tbName} (${keys},[mk_level],[mk_id],[mk_bid])`,
-        select: `Select ${vals.join(',')},'${level}','${id}','${bid}'`
+        insert: `Insert into ${tbName} (${keys ? keys + ',' : ''}[mk_level],[mk_id],[mk_bid])`,
+        select: `Select ${keys ? vals + ',' : ''}'${level}','${id}','${bid}'`
       })
 
       subObjs.forEach(item => {
@@ -1719,6 +1734,7 @@
       sql = sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`)
       sql = sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`)
       sql = sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`)
+      sql = sql.replace(/@lang@/ig, `'${sessionStorage.getItem('lang')}'`)
       sql = sql.replace(/@typename@/ig, `'admin'`)
 
       if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺
@@ -2265,6 +2281,17 @@
     }
 
     let sign = ''
+    let focusField = ''
+
+    if (/@focus:[a-z0-9_]+@/i.test(res.message)) {
+      let val = res.message.match(/@focus:[a-z0-9_]+@/i)
+      res.message = res.message.replace(/@focus:[a-z0-9_]+@/i, '')
+      focusField = val ? val[0].replace(/@focus:|@/ig, '') : ''
+
+      if (!res.message) {
+        res.ErrCode = '-1'
+      }
+    }
     if (/^@speak@/i.test(res.message)) {
       res.message = res.message.replace(/^@speak@/i, '')
       let val = res.message.match(/<<.*>>/)
@@ -2280,7 +2307,8 @@
       if (!res.message) {
         res.ErrCode = '-1'
       }
-    } else if (/@close_tab@|@close_popup@|@goback@|@no_target_menu@/i.test(res.message)) {
+    }
+    if (/@close_tab@|@close_popup@|@goback@|@no_target_menu@/i.test(res.message)) {
       sign = res.message.match(/@close_tab@|@close_popup@|@goback@|@no_target_menu@/i)[0].toLowerCase()
       res.message = res.message.replace(/@close_tab@|@close_popup@|@goback@|@no_target_menu@/i, '')
     }
@@ -2313,7 +2341,7 @@
       Modal.success({
         title: msg,
         onOk: () => {
-          this.successContinue(sign, id)
+          this.successContinue(sign, id, res, focusField)
         }
       })
       return
@@ -2321,12 +2349,16 @@
 
     }
 
-    this.successContinue(sign, id)
+    this.successContinue(sign, id, res, focusField)
   }
 
-  successContinue = (sign, id) => {
+  successContinue = (sign, id, res, focusField) => {
     const { btn } = this.props
     const { btnconfig } = this.state
+
+    if (focusField) {
+      MKEmitter.emit('resetFocus', btn.uuid, focusField)
+    }
 
     this.setState({
       loadingNumber: '',
@@ -2345,9 +2377,9 @@
       tabId = btn.refreshTab[btn.refreshTab.length - 1]
     }
 
-    if (btn.formCache === 'clear') { // 娓呴櫎琛ㄥ崟缂撳瓨
-      window.GLOB.CacheMap = new Map()
-    }
+    // if (btn.formCache === 'clear') { // 娓呴櫎琛ㄥ崟缂撳瓨
+    //   window.GLOB.CacheMap = new Map()
+    // }
 
     if (tabId && btn.$MenuID === tabId) { // 鍒锋柊褰撳墠鑿滃崟鏃讹紝鍋滄鍏朵粬鎿嶄綔
       MKEmitter.emit('reloadMenuView', tabId, 'table')
@@ -2428,6 +2460,34 @@
 
     if (btn.execSuccess === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊
       MKEmitter.emit('refreshPopButton', btn.$tabId)
+    }
+
+    if (btn.verify && btn.verify.linkEnable === 'true') {
+      let url = ''
+      if (window.GLOB.systemType === 'production') {
+        url = btn.verify.linkProUrl
+        if (!url) {
+          notification.warning({
+            top: 92,
+            message: '灏氭湭娣诲姞姝e紡绯荤粺閾炬帴鍦板潃锛�',
+            duration: 5
+          })
+          return
+        }
+      } else {
+        url = btn.verify.linkUrl
+      }
+
+      if (/@/.test(url)) {
+        Object.keys(res).forEach(key => {
+          url = url.replace(new RegExp('@' + key + '@', 'ig'), res[key])
+        })
+      }
+      if (!/^http/.test(url)) {
+        url = window.location.origin + url
+      }
+
+      window.open(url)
     }
   }
 
@@ -2561,9 +2621,9 @@
 
       if (verify.wxNoteLink === 'url' && verify.wxNoteLinkUrl) {
         _param.url = verify.wxNoteLinkUrl
-      } else if (verify.wxNoteLink === 'miniProgram' && window.GLOB.WXminiAppID) {
+      } else if (verify.wxNoteLink === 'miniProgram' && (window.GLOB.WXminiAppID || verify.wxNoteMiniId)) {
         _param.miniprogram = {
-          appid: window.GLOB.WXminiAppID,
+          appid: verify.wxNoteMiniId || window.GLOB.WXminiAppID,
           pagepath: '/pages/index/index'
         }
 
@@ -3043,8 +3103,47 @@
     } else if (btn.execError === 'closepoptab' || sign === '@close_popup@') {
       MKEmitter.emit('popclose')
     } else if (btn.execError !== 'never') {
+      let tabId = ''
+      if (btn.refreshTab && btn.refreshTab.length > 0) {
+        tabId = btn.refreshTab[btn.refreshTab.length - 1]
+      }
+      if (tabId && btn.$MenuID === tabId) { // 鍒锋柊褰撳墠鑿滃崟鏃讹紝鍋滄鍏朵粬鎿嶄綔
+        MKEmitter.emit('reloadMenuView', tabId, 'table')
+        return
+      }
+
       MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn, '', this.state.selines)
+
+      if (btn.syncComponentId) {
+        if (btn.syncComponentId === 'multiComponent') {
+          btn.syncComponentIds.forEach((id, i) => {
+            setTimeout(() => {
+              if (/\$focus/.test(id)) {
+                MKEmitter.emit('reloadData', id.split('$')[0], id.split('$')[1])
+              } else {
+                MKEmitter.emit('reloadData', id)
+              }
+            }, 20 * i)
+          })
+        } else if (/\$focus/.test(btn.syncComponentId)) {
+          MKEmitter.emit('reloadData', btn.syncComponentId.split('$')[0], btn.syncComponentId.split('$')[1])
+        } else {
+          if (btn.syncDelay) {
+            this.delayTimer && clearTimeout(this.delayTimer)
+            this.delayTimer = setTimeout(() => {
+              MKEmitter.emit('reloadData', btn.syncComponentId)
+            }, btn.syncDelay)
+          } else {
+            MKEmitter.emit('reloadData', btn.syncComponentId)
+          }
+        }
+      }
+
+      if (tabId) {
+        MKEmitter.emit('reloadMenuView', tabId, 'table')
+      }
     }
+
     if (btn.OpenType === 'form') {
       let data = this.props.selectedData && this.props.selectedData[0] ? this.props.selectedData[0] : null
 
@@ -3199,7 +3298,7 @@
   }
 
   modelconfirm = () => {
-    const { btn, BID } = this.props
+    const { BID } = this.props
     const { btnconfig, selines } = this.state
     let _this = this
 
@@ -3344,7 +3443,7 @@
       this.execSubmit(selines, () => {}, result)
     } else {
       confirm({
-        title: btn.tipTitle || '纭畾瑕佹墽琛屽悧?',
+        title: btnconfig.setting.tipTitle || '纭畾瑕佹墽琛屽悧?',
         onOk() {
           return new Promise(resolve => {
             _this.execSubmit(selines, resolve, result)
@@ -3543,42 +3642,25 @@
     }
 
     let label = ''
-    let icon = ''
-    let type = 'link'
-    let className = ''
 
-    if (btn.show === 'button') {
-      label = name || btn.label
-      icon = btn.icon || ''
-    } else if (btn.show === 'link') {
-      label = <span>{name || btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span>
-      icon = ''
+    if (btn.show === 'link') {
+      label = <span>{name || btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon} /> : ''}</span>
     } else if (btn.show === 'icon') {
-      icon = btn.icon || ''
-    } else if (!btn.$toolbtn) {
-      icon = btn.icon || ''
-      label = btn.label
-      className = 'mk-btn mk-' + (btn.class || 'unset')
+      label = !loading ? <MkIcon type={btn.icon} /> : null
+    } else if (btn.$toolbtn) {
+      label = <span>{!loading && btn.icon ? <MkIcon style={{marginRight: '8px'}} type={btn.icon} /> : ''}{loadingNumber && !loadingTotal ? `(${loadingNumber})` : ''}{btn.label}</span>
     } else {
-      type = ''
-      icon = btn.icon || ''
-      label = btn.label
-      className = 'mk-btn mk-' + (btn.class || 'unset')
-    }
-
-    if (loadingNumber && btn.progress !== 'progressbar' && btn.$toolbtn && (!btn.show || btn.show === 'button')) {
-      label = (loadingNumber ? `(${loadingNumber})` : '') + btn.label
+      label = <span>{!loading && btn.icon ? <MkIcon style={{marginRight: '8px'}} type={btn.icon} /> : ''}{name || btn.label}</span>
     }
 
     let BTN = <Button
-      type={type}
-      icon={icon}
+      type="link"
       id={'button' + btn.uuid}
       title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')}
       loading={loading}
       disabled={disabled}
       style={btn.style}
-      className={className}
+      className={btn.hover || ''}
       onClick={(e) => {e.stopPropagation(); this.actionTrigger()}}
     >{label}</Button>
 

--
Gitblit v1.8.0