From 437c69e4277c9ab81da46fe2ecd3857a7ccf3b14 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 24 二月 2025 21:52:57 +0800
Subject: [PATCH] 2025-02-24

---
 src/tabviews/zshare/actionList/normalbutton/index.jsx |  153 ++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 102 insertions(+), 51 deletions(-)

diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index 1128b97..c20b5df 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -425,6 +425,13 @@
         duration: 5
       })
       return false
+    } else if (btn.Ot !== 'notRequired' && data[0] && !data[0].$$uuid) {
+      notification.warning({
+        top: 92,
+        message: '鏈幏鍙栧埌ID鍊硷紒',
+        duration: 5
+      })
+      return false
     } else if (btn.Ot === 'requiredSgl' && data.length !== 1) {
       // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁
       notification.warning({
@@ -846,7 +853,7 @@
 
       let val = form.value
       if (form.type === 'number' || form.type === 'rate') {
-        if (isNaN(val)) {
+        if (isNaN(val) || val === '') {
           val = 0
         }
       } else if (['date', 'datemonth'].includes(form.type)) {
@@ -1120,23 +1127,25 @@
       } else {
         let works_flow_countersign = ''
         let works_flow_sign_values = ''
-        let works_flow_sign_field = ''
+        let works_flow_sign_field = 'statuscharone'
         let works_flow_sign_label = ''
         let works_begin_branch = ''
-        if (line.approvalMethod === 'countersign' && node.checkIds.length > 1) {
-          works_flow_countersign = 'Y'
-          let mark = line.mark || '宸插鏍�'
-          let fields = ['statuscharone', 'statuschartwo', 'statuscharthree', 'statuscharfour', 'statuscharfive']
-          node.checkUsers.forEach((user, index) => {
-            if (user.worker_id === userid) {
-              works_flow_sign_field = fields[index]
-              works_flow_sign_label = `${user.parentNames[2] || ''}${user.workername || ''}${mark}`
-            } else {
-              works_flow_sign_values += `${user.parentNames[2] || ''}${user.workername || ''}${mark}`
-            }
-          })
-        } else {
-          works_begin_branch = line.mknode === 'startEdge' ? 'Y' : ''
+        if (line) {
+          if (line.approvalMethod === 'countersign' && node.checkIds.length > 1) {
+            works_flow_countersign = 'Y'
+            let mark = line.mark || '宸插鏍�'
+            let fields = ['statuscharone', 'statuschartwo', 'statuscharthree', 'statuscharfour', 'statuscharfive']
+            node.checkUsers.forEach((user, index) => {
+              if (user.worker_id === userid) {
+                works_flow_sign_field = fields[index]
+                works_flow_sign_label = `${user.parentNames[2] || ''}${user.workername || ''}${mark}`
+              } else {
+                works_flow_sign_values += `${user.parentNames[2] || ''}${user.workername || ''}${mark}`
+              }
+            })
+          } else {
+            works_begin_branch = line.mknode === 'startEdge' ? 'Y' : ''
+          }
         }
 
         exps.push(
@@ -1302,7 +1311,6 @@
   getSysDeclareSql = (btn, formdata, data, columns, BID = '') => {
     const { submitType } = this.state
 
-    let datavars = {}                 // 澹版槑鐨勫彉閲忥紝琛ㄥ崟鍙婃樉绀哄垪
     // 闇�瑕佸0鏄庣殑鍙橀噺闆�
     let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'mk_deleted', 'bid', 'mk_submit_type']
   
@@ -1317,14 +1325,13 @@
     // 鑾峰彇瀛楁閿�煎
     formdata && formdata.forEach(form => {
       let _key = form.key.toLowerCase()
-      datavars[_key] = form.value
   
       if (!_initvars.includes(_key)) {
         _initvars.push(_key)
         let val = form.value
   
         if (form.type === 'number' || form.type === 'rate') {
-          if (isNaN(val)) {
+          if (isNaN(val) || val === '') {
             val = 0
           }
           _initFormfields.push(`@${_key}=${val}`)
@@ -1372,14 +1379,12 @@
   
     // 娣诲姞鏁版嵁涓瓧娈碉紝琛ㄥ崟鍊间紭鍏�(鎸夐挳涓嶉�夎鎴栧琛屾嫾鎺ユ椂璺宠繃)
     if (data && btn.Ot !== 'notRequired' && columns && columns.length > 0) {
-      datavars = {..._data, ...datavars}
-  
       const setField = (col) => {
         if (!col.field) return
         let _key = col.field.toLowerCase()
   
         if (!_initvars.includes(_key)) {
-          let _val = datavars.hasOwnProperty(_key) ? datavars[_key] : ''
+          let _val = _data.hasOwnProperty(_key) ? _data[_key] : ''
   
           if (col.datatype && /^date/ig.test(col.datatype) && !_val) {
             _val = '1949-10-01'
@@ -1588,7 +1593,7 @@
               }, 600)
             }
 
-            this.triggerNote(res, _param.ID) // 娑堟伅
+            this.triggerNote(res, _param) // 娑堟伅
             this.execSuccess(res)
           } else {
             this.execError(res)
@@ -1825,6 +1830,16 @@
       })
     }
 
+    if (/@.*@/.test(url)) {
+      Object.keys(param).forEach(key => {
+        let reg = new RegExp('@' + key + '@', 'ig')
+        if (reg.test(url)) {
+          url = url.replace(reg, param[key])
+          delete param[key]
+        }
+      })
+    }
+
     let _params = {
       url: url,
       method: btn.method || 'post'
@@ -1937,6 +1952,10 @@
         if (params.length === 0) {
           this.execSuccess(result)
           _resolve()
+        } else if (btn.execInterval) {
+          setTimeout(() => {
+            this.customLoopRequest(params, _resolve)
+          }, btn.execInterval)
         } else {
           this.customLoopRequest(params, _resolve)
         }
@@ -1974,6 +1993,10 @@
         if (params.length === 0) {
           this.execSuccess(result)
           _resolve()
+        } else if (btn.execInterval) {
+          setTimeout(() => {
+            this.customLoopRequest(params, _resolve)
+          }, btn.execInterval)
         } else {
           this.customLoopRequest(params, _resolve)
         }
@@ -1996,6 +2019,10 @@
         if (params.length === 0) {
           this.execSuccess(res)
           _resolve()
+        } else if (btn.execInterval) {
+          setTimeout(() => {
+            this.customLoopRequest(params, _resolve)
+          }, btn.execInterval)
         } else {
           this.customLoopRequest(params, _resolve)
         }
@@ -2343,6 +2370,10 @@
         if (params.length === 0) {
           this.execSuccess(res)
           _resolve()
+        } else if (btn.execInterval) {
+          setTimeout(() => {
+            this.innerLoopRequest(params, btn, _resolve)
+          }, btn.execInterval)
         } else {
           this.innerLoopRequest(params, btn, _resolve)
         }
@@ -2592,6 +2623,10 @@
         if (params.length === 0) {
           this.execSuccess(result)
           _resolve()
+        } else if (btn.execInterval) {
+          setTimeout(() => {
+            this.outerLoopRequest(params, _resolve)
+          }, btn.execInterval)
         } else {
           this.outerLoopRequest(params, _resolve)
         }
@@ -2636,6 +2671,10 @@
         if (params.length === 0) {
           this.execSuccess(result)
           _resolve()
+        } else if (btn.execInterval) {
+          setTimeout(() => {
+            this.outerLoopRequest(params, _resolve)
+          }, btn.execInterval)
         } else {
           this.outerLoopRequest(params, _resolve)
         }
@@ -2659,6 +2698,10 @@
         if (params.length === 0) {
           this.execSuccess(res)
           _resolve()
+        } else if (btn.execInterval) {
+          setTimeout(() => {
+            this.outerLoopRequest(params, _resolve)
+          }, btn.execInterval)
         } else {
           this.outerLoopRequest(params, _resolve)
         }
@@ -2875,7 +2918,7 @@
       res.message = res.message.replace(/\s*<<.*>>\s*/g, '')
       val = val ? val[0].replace(/<<|>>/g, '') : ''
 
-      if (/^http/.test(val)) {
+      if (/^(http|\/\/)/.test(val)) {
         let audio = document.createElement('audio')
         audio.src = val
         audio.play()
@@ -2951,6 +2994,7 @@
     }
 
     let tabId = ''
+    let menu = null
     if (btn.refreshTab && btn.refreshTab.length > 0) {
       tabId = btn.refreshTab[btn.refreshTab.length - 1]
     }
@@ -2959,8 +3003,26 @@
       this.clearBackSqlCache()
     }
 
+    if (btn.openmenu && Array.isArray(btn.openmenu) && btn.openmenu.length > 0 && sign !== '@no_target_menu@') {
+      let menuId = btn.openmenu.slice(-1)[0]
+      if (window.GLOB.mkThdMenus.has(menuId)) {
+        menu = {...window.GLOB.mkThdMenus.get(menuId), param: { $BID: id }}
+      } else if (btn.MenuID) {
+        menu = {
+          MenuID: btn.MenuID,
+          MenuName: btn.MenuName,
+          type: btn.tabType,
+          param: { $BID: id }
+        }
+      }
+    }
+
     if (tabId && btn.$MenuID === tabId) { // 鍒锋柊褰撳墠鑿滃崟鏃讹紝鍋滄鍏朵粬鎿嶄綔
-      MKEmitter.emit('reloadMenuView', tabId)
+      MKEmitter.emit('reloadMenuView', tabId, btn.urlPar === 'true')
+
+      if (menu) {
+        MKEmitter.emit('modifyTabs', menu, true)
+      }
       return
     }
 
@@ -3002,7 +3064,7 @@
     }
 
     if (tabId) {
-      MKEmitter.emit('reloadMenuView', tabId)
+      MKEmitter.emit('reloadMenuView', tabId, btn.urlPar === 'true')
     }
     
     if (btn.switchTab && btn.switchTab.length > 0) {
@@ -3016,24 +3078,8 @@
       node && node.scrollIntoView({behavior: 'smooth', block: 'center', inline: 'nearest'})
     }
 
-    if (btn.openmenu && Array.isArray(btn.openmenu) && btn.openmenu.length > 0 && sign !== '@no_target_menu@') {
-      let menuId = btn.openmenu.slice(-1)[0]
-      let menu = null
-
-      if (window.GLOB.mkThdMenus.has(menuId)) {
-        menu = {...window.GLOB.mkThdMenus.get(menuId), param: { $BID: id }}
-      } else if (btn.MenuID) {
-        menu = {
-          MenuID: btn.MenuID,
-          MenuName: btn.MenuName,
-          type: btn.tabType,
-          param: { $BID: id }
-        }
-      }
-
-      if (menu) {
-        MKEmitter.emit('modifyTabs', menu, true)
-      }
+    if (menu) {
+      MKEmitter.emit('modifyTabs', menu, true)
     }
 
     if (btn.execSuccess === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊
@@ -3638,7 +3684,7 @@
       res.message = res.message.replace(/\s*<<.*>>\s*/g, '')
       val = val ? val[0].replace(/<<|>>/g, '') : ''
 
-      if (/^http/.test(val)) {
+      if (/^(http|\/\/)/.test(val)) {
         let audio = document.createElement('audio')
         audio.src = val
         audio.play()
@@ -3722,7 +3768,7 @@
         tabId = btn.refreshTab[btn.refreshTab.length - 1]
       }
       if (tabId && btn.$MenuID === tabId) { // 鍒锋柊褰撳墠鑿滃崟鏃讹紝鍋滄鍏朵粬鎿嶄綔
-        MKEmitter.emit('reloadMenuView', tabId)
+        MKEmitter.emit('reloadMenuView', tabId, btn.urlPar === 'true')
         return
       }
 
@@ -3754,7 +3800,7 @@
       }
 
       if (tabId) {
-        MKEmitter.emit('reloadMenuView', tabId)
+        MKEmitter.emit('reloadMenuView', tabId, btn.urlPar === 'true')
       }
     }
 
@@ -3977,6 +4023,10 @@
       let key = item.field.toLowerCase()
       let _readin = item.readin !== 'false'
 
+      if (item.type === 'linkMain' && item.verifyVal === 'true') {
+        _item.$verify = true
+        _item.label = item.label
+      }
       if (_item.type === 'date') { // 鏃堕棿鍏煎
         _item.precision = item.precision || 'day'
       } else if (_item.type === 'datetime') {
@@ -4108,13 +4158,14 @@
    */
   getModels = () => {
     const { BID, btn, BData } = this.props
-    const { btnconfig, visible, dict, confirmLoading, submitType } = this.state
+    const { btnconfig, visible, dict, confirmLoading, submitType, loadingNumber, loadingTotal } = this.state
 
     if (!btnconfig || !btnconfig.setting) return null
 
     let title = btn.label
     let width = btnconfig.setting.width > 100 ? btnconfig.setting.width : btnconfig.setting.width + 'vw'
     let clickouter = btnconfig.setting.clickouter === 'close'
+    let num = loadingNumber && !loadingTotal ? `(${loadingNumber}) ` : ''
 
     if (btnconfig.setting.display === 'drawer') {
       let height = '100vh'
@@ -4183,9 +4234,9 @@
           onCancel={this.handleCancel}
           footer={[
             <Button key="cancel" onClick={this.handleCancel}>{dict['cancel'] || '鍙栨秷'}</Button>,
-            btn.extBtn === 'true' ? <Button key="extend" className={'extend-btn ' + (btn.extStyle || '')} disabled={confirmLoading && submitType !== btn.extValue} loading={confirmLoading && submitType === btn.extValue} onClick={() => this.handleOk(btn.extValue)}>{btn.extLabel}</Button> : null,
-            btn.extBtn === 'true' ? <Button key="confirm" className={'confirm-btn ' + (btn.confStyle || '')} disabled={confirmLoading && submitType !== ''} loading={confirmLoading && submitType === ''} onClick={() => this.handleOk()}>{btn.confLabel || dict['ok'] || '纭畾'}</Button> : null,
-            btn.extBtn !== 'true' ? <Button key="confirm" type="primary" loading={confirmLoading} onClick={() => this.handleOk()}>{dict['ok'] || '纭畾'}</Button> : null
+            btn.extBtn === 'true' ? <Button key="extend" className={'extend-btn ' + (btn.extStyle || '')} disabled={confirmLoading && submitType !== btn.extValue} loading={confirmLoading && submitType === btn.extValue} onClick={() => this.handleOk(btn.extValue)}>{submitType === btn.extValue ? num : ''}{btn.extLabel}</Button> : null,
+            btn.extBtn === 'true' ? <Button key="confirm" className={'confirm-btn ' + (btn.confStyle || '')} disabled={confirmLoading && submitType !== ''} loading={confirmLoading && submitType === ''} onClick={() => this.handleOk()}>{submitType === '' ? num : ''}{btn.confLabel || dict['ok'] || '纭畾'}</Button> : null,
+            btn.extBtn !== 'true' ? <Button key="confirm" type="primary" loading={confirmLoading} onClick={() => this.handleOk()}>{num}{dict['ok'] || '纭畾'}</Button> : null
           ]}
           destroyOnClose
         >

--
Gitblit v1.8.0