From bdfec44c9f3a37dbbe05bf14a252ffec04132a86 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 06 九月 2022 21:24:28 +0800
Subject: [PATCH] Merge branch 'develop'

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

diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index d58c19e..d6cceab 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -100,7 +100,6 @@
     if (btn.OpenType === 'formSubmit') {
       MKEmitter.addListener('triggerFormSubmit', this.actionSubmit)
     }
-    MKEmitter.addListener('returnModuleParam', this.resetModuleParam)
 
     if (btn.autoMatic) {
       MKEmitter.addListener('triggerBtnPopSubmit', this.triggerBtnPopSubmit)
@@ -156,7 +155,6 @@
     }
     MKEmitter.removeListener('triggerBtnId', this.actionTrigger)
     MKEmitter.removeListener('triggerFormSubmit', this.actionSubmit)
-    MKEmitter.removeListener('returnModuleParam', this.resetModuleParam)
     MKEmitter.removeListener('triggerBtnPopSubmit', this.triggerBtnPopSubmit)
   }
 
@@ -204,14 +202,6 @@
     this.execSubmit(data, () => {}, res.form)
   }
 
-  resetModuleParam = (menuId, btnId, param) => {
-    const { btn } = this.props
-    
-    if (btn.$menuId !== menuId || btn.uuid !== btnId || !param) return
-
-    this.moduleParams = param
-  }
-
   /**
    * @description 鎸夐挳鐘舵�佹敼鍙�
    */
@@ -248,7 +238,7 @@
 
     let _this = this
     let data = record || selectedData || []
-    
+
     if (btn.Ot !== 'notRequired' && data.length === 0) {
       // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹�
       notification.warning({
@@ -606,9 +596,13 @@
           param.LText = Utils.formatOptions(param.LText)
         } else if (btn.OpenType === 'pop') { // 琛ㄥ崟
           if (index !== 0) {
+            let _cell = {}
+            Object.keys(cell).forEach(key => {
+              _cell[key.toLowerCase()] = cell[key]
+            })
             formdata = formdata.map(_data => {
-              if (_data.readin && cell.hasOwnProperty(_data.key)) {
-                _data.value = cell[_data.key]
+              if (_data.readin && _cell.hasOwnProperty(_data.key.toLowerCase())) {
+                _data.value = _cell[_data.key.toLowerCase()]
               }
               return _data
             })
@@ -716,7 +710,7 @@
         })
       }
 
-      if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉
+      if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // special 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉
         param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
         param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp)
         param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
@@ -741,9 +735,13 @@
 
         if (btn.OpenType === 'pop') { // 琛ㄥ崟
           if (index !== 0) {
+            let _cell = {}
+            Object.keys(cell).forEach(key => {
+              _cell[key.toLowerCase()] = cell[key]
+            })
             formdata = formdata.map(_data => {
-              if (_data.readin && cell.hasOwnProperty(_data.key)) {
-                _data.value = cell[_data.key]
+              if (_data.readin && _cell.hasOwnProperty(_data.key.toLowerCase())) {
+                _data.value = _cell[_data.key.toLowerCase()]
               }
               return _data
             })
@@ -757,7 +755,7 @@
           param[setting.primaryKey] = primaryId
         }
 
-        if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉
+        if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // special 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉
           param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
           param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp)
           param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
@@ -903,7 +901,7 @@
       _declarefields = ',' + _declarefields
     }
     _sql = `/* 绯荤粺鐢熸垚 */
-        Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@bid nvarchar(50)${_declarefields}
+        Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@bid nvarchar(50)${_declarefields}
       `
   
     let userName = sessionStorage.getItem('User_Name') || ''
@@ -959,16 +957,10 @@
       btn.sqlType !== 'insert' && btn.Ot !== 'notRequired' && btn.verify && btn.verify.invalid === 'true' &&
       setting.dataresource
     ) {
-      MKEmitter.emit('queryModuleParam', btn.$menuId, btn.uuid)
-      setTimeout(() => {
-        if (this.moduleParams) {
-          this.execRealSubmit(data, _resolve, formdata)
-        } else {
-          setTimeout(() => {
-            this.execRealSubmit(data, _resolve, formdata)
-          }, 100)
-        }
-      }, 50)
+      MKEmitter.emit('queryModuleParam', btn.$menuId, (param) => {
+        this.moduleParams = param
+        this.execRealSubmit(data, _resolve, formdata)
+      })
     } else {
       this.execRealSubmit(data, _resolve, formdata)
     }
@@ -1227,8 +1219,24 @@
     const { btn } = this.props
 
     let param = null
+    let callback = result.mk_ex_invoke
 
-    if (btn.callbackType === 'script' || btn.callbackType === 'default') {
+    delete result.mk_ex_invoke
+
+    if (callback === 'false' || callback === false) {
+      if (result.status) {
+        if (params.length === 0) {
+          this.execSuccess(result)
+          _resolve()
+        } else {
+          this.customLoopRequest(params, _resolve)
+        }
+      } else {
+        this.execError(result)
+        _resolve()
+      }
+      return
+    } else if (btn.callbackType === 'script' || btn.callbackType === 'default') {
       param = this.getCallBackSql(result, record)
     } else if (btn.callbackType === 'func') {
       param = {
@@ -1565,6 +1573,11 @@
             res.BID = this.props.BID
           }
 
+          if (res.mk_api_key) {
+            record.mk_api_key = res.mk_api_key
+          }
+          delete res.mk_api_key
+
           this.outerOuterRequest(params, res, record, _resolve)
         }
       } else {
@@ -1585,8 +1598,14 @@
       result.func = btn.outerFunc
     }
     if (window.GLOB.mkHS) {
-      if (btn.sysInterface === 'true' && options.cloudServiceApi) {
+      if (btn.outerFunc === 's_app_version_upt') { // special 鏇存柊鐗堟湰鍙锋椂璁块棶sso
+        if (window.GLOB.mainSystemApi) {
+          result.rduri = window.GLOB.mainSystemApi
+        }
+      } else if (btn.sysInterface === 'true' && options.cloudServiceApi) {
         result.rduri = options.cloudServiceApi
+        result.userid = sessionStorage.getItem('CloudUserID') || ''
+        result.LoginUID = sessionStorage.getItem('CloudLoginUID') || ''
       } else if (btn.sysInterface !== 'true') {
         if (window.GLOB.systemType === 'production' && btn.proInterface) {
           result.rduri = btn.proInterface
@@ -1595,7 +1614,7 @@
         }
       }
 
-      // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉
+      // special 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉
       if (result.func === 's_sDataDictb_TBBack' && result.LTextOut) {
         result.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
         result.secretkey = Utils.encrypt(result.LTextOut, result.timestamp)
@@ -1628,7 +1647,36 @@
 
     let param = null
 
-    if (btn.callbackType === 'script' || btn.callbackType === 'default') {
+    if (record.mk_api_key) {
+      result.mk_api_key = record.mk_api_key
+    }
+
+    let callback = result.mk_ex_invoke
+
+    delete result.mk_ex_invoke
+
+    if (callback === 'false' || callback === false) {
+      if (result.status) {
+        if (params.length === 0) {
+          this.execSuccess(result)
+          _resolve()
+        } else {
+          this.outerLoopRequest(params, _resolve)
+        }
+      } else {
+        this.execError(result)
+        _resolve()
+      }
+      return
+    } else if (window.GLOB.mkHS && btn.outerFunc === 's_get_sVersionDetail_Ltext' && btn.callbackFunc) { // special 鐗堟湰鍗囩骇鍥炶皟澶勭悊
+      if (result.status) {
+        this.verupRequest(params, result, outParam, _resolve)
+      } else {
+        this.execError(result)
+        _resolve()
+      }
+      return
+    } else if (btn.callbackType === 'script' || btn.callbackType === 'default') {
       param = this.getCallBackSql(result, record)
     } else if (btn.callbackType === 'func' || btn.callbackFunc) {
       delete result.message
@@ -1640,7 +1688,7 @@
         func: btn.callbackFunc
       }
 
-      // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉
+      // special 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉
       if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) {
         param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
         param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp)
@@ -1676,6 +1724,71 @@
         _resolve()
       }
     })
+  }
+
+  verupRequest = (params, result, outParam, _resolve) => {
+    const { btn } = this.props
+
+    delete result.message
+    delete result.status
+
+    result.func = btn.callbackFunc
+
+    let ssoParam = null
+    let callParam = {...outParam, ...result}
+
+    if (callParam.LTextOut) {
+      callParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+      callParam.secretkey = Utils.encrypt(callParam.LTextOut, callParam.timestamp)
+      callParam.open_key = Utils.encryptOpenKey(callParam.secretkey, callParam.timestamp)
+    }
+
+    if (callParam.UpType === 'SSO' && window.GLOB.mainSystemApi) {
+      ssoParam = fromJS(callParam).toJS()
+
+      ssoParam.rduri = window.GLOB.mainSystemApi
+
+      delete ssoParam.UpType
+    } else {
+      delete callParam.UpType
+    }
+
+    if (ssoParam) {
+      Api.genericInterface(ssoParam).then(res => {
+        if (!res.status) {
+          this.execError(res)
+          _resolve()
+        } else {
+          Api.genericInterface(callParam).then(re => {
+            if (!re.status) {
+              this.execError(re)
+              _resolve()
+            } else {
+              if (params.length === 0) {
+                this.execSuccess(res)
+                _resolve()
+              } else {
+                this.outerLoopRequest(params, _resolve)
+              }
+            }
+          })
+        }
+      })
+    } else {
+      Api.genericInterface(callParam).then(re => {
+        if (!re.status) {
+          this.execError(re)
+          _resolve()
+        } else {
+          if (params.length === 0) {
+            this.execSuccess(re)
+            _resolve()
+          } else {
+            this.outerLoopRequest(params, _resolve)
+          }
+        }
+      })
+    }
   }
 
   /**
@@ -1847,11 +1960,8 @@
           _param.miniprogram.pagepath = `/pages/index/index?MenuId=${verify.wxNoteLinkMenuId}`
         }
       }
-
-      let keys = []
+      
       verify.wxNoteKeys.forEach(item => {
-        keys.push(item.key)
-
         _param.data[item.key] = {value: '', color: item.color}
       })
 
@@ -1867,9 +1977,9 @@
           m.client_msg_id = item.send_id
         }
 
-        keys.forEach(key => {
-          if (item[key] !== undefined) {
-            m.data[key].value = item[key]
+        verify.wxNoteKeys.forEach(note => {
+          if (item[note.value] !== undefined) {
+            m.data[note.key].value = item[note.value]
           }
         })
 
@@ -2008,7 +2118,7 @@
       _param.userid = 'bh0bapabtd45epsgra79segbch6c1ibk'
       _param.LoginUID = 'bh0bapabtd45epsgra79segbch6c1ibk'
 
-      Api.getLocalConfig(_param).then(result => {
+      Api.genericInterface(_param).then(result => {
         if (!result.status) {
           notification.warning({
             top: 92,
@@ -2060,10 +2170,13 @@
       })
       MKEmitter.emit('autoExecOver', btn.uuid, 'error')
       return
+    } else if (btn.OpenType !== 'pop' || !btnconfig || btnconfig.setting.finish !== 'unclose') {
+      this.setState({
+        loading: false
+      })
     }
     
     this.setState({
-      loading: false,
       loadingNumber: '',
       loadingTotal: '',
     })
@@ -2237,11 +2350,25 @@
   }
 
   modelconfirm = () => {
-    const { BData, btn } = this.props
+    const { btn, BID } = this.props
     const { btnconfig, selines } = this.state
     let _this = this
 
     let result = []
+    let _data = {}
+    let BData = {}
+
+    if (selines[0]) {
+      Object.keys(selines[0]).forEach(key => {
+        _data[key.toLowerCase()] = selines[0][key]
+      })
+    }
+    if (this.props.BData) {
+      Object.keys(this.props.BData).forEach(key => {
+        BData[key.toLowerCase()] = this.props.BData[key]
+      })
+    }
+
     btnconfig.fields.forEach(item => {
       if (!item.field) return
       let _readin = item.readin !== 'false'
@@ -2251,10 +2378,12 @@
         _readin = false
       }
 
-      if (item.type === 'linkMain' && BData && BData.hasOwnProperty(item.field)) {
-        _initval = BData[item.field]
-      } else if (_readin && selines[0] && selines[0].hasOwnProperty(item.field)) {
-        _initval = selines[0][item.field]
+      let key = item.field.toLowerCase()
+
+      if (item.type === 'linkMain' && BData.hasOwnProperty(key)) {
+        _initval = BData[key]
+      } else if (_readin && _data.hasOwnProperty(key)) {
+        _initval = _data[key]
       } else if (item.type === 'date' && _initval) {
         _initval = moment().subtract(_initval, 'days').format('YYYY-MM-DD')
       } else if (item.type === 'datemonth' && _initval) {
@@ -2263,15 +2392,17 @@
         _initval = moment().subtract(_initval, 'days').format('YYYY-MM-DD HH:mm:ss')
       }
 
+      if (_initval === undefined) {
+        _initval = ''
+      }
+
       let _fieldlen = item.fieldlength || 50
       if (item.type === 'textarea' || item.type === 'fileupload' || item.type === 'multiselect') {
         _fieldlen = item.fieldlength || 512
       } else if (item.type === 'number') {
         _fieldlen = item.decimal ? item.decimal : 0
-      }
-
-      if (_initval === undefined) {
-        _initval = ''
+      } else if (item.type === 'text' && /@appkey@|@SessionUid@|@bid@/ig.test(_initval)) { // 鐗规畩瀛楁鏇挎崲
+        _initval = _initval.replace(/^(\s*)@appkey@(\s*)$/ig, window.GLOB.appkey).replace(/^(\s*)@SessionUid@(\s*)$/ig, (localStorage.getItem('SessionUid') || '')).replace(/^(\s*)@bid@(\s*)$/ig, (BID || ''))
       }
 
       let _type = item.type

--
Gitblit v1.8.0