From 2bccb9ec7bdefe23292a22bc153463cfa1479a49 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 21 六月 2024 16:25:42 +0800
Subject: [PATCH] 2024-06-21

---
 src/tabviews/zshare/actionList/excelInbutton/index.jsx |  103 ++++++++++++++++++++++++++++++---------------------
 1 files changed, 60 insertions(+), 43 deletions(-)

diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx
index 4d9919b..1be21b1 100644
--- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx
@@ -29,6 +29,7 @@
     disabled: false,
     hidden: false,
     primaryId: '',
+    dict: window.GLOB.dict
   }
 
   UNSAFE_componentWillMount () {
@@ -106,57 +107,45 @@
   /**
    * @description 瑙﹀彂鎸夐挳鎿嶄綔
    */
-  actionTrigger = (triggerId, record, type) => {
-    const { setting, BID, btn, selectedData } = this.props
-    const { loading, disabled } = this.state
+  actionTrigger = (triggerId, record, type, lid) => {
+    const { setting, BID, btn, selectedData, LID } = this.props
+    const { loading, disabled, dict } = this.state
 
     if (loading || disabled) return
     if (triggerId && btn.uuid !== triggerId) return
+    if (type === 'linkbtn' && !btn.$toolbtn && LID !== lid) return
+
+    let data = record || selectedData || []
 
     if (setting.supModule && !BID) {
       notification.warning({
         top: 92,
-        message: '闇�瑕佷笂绾т富閿�硷紒',
+        message: dict['sup_key_req'] || '闇�瑕佷笂绾т富閿�硷紒',
         duration: 5
       })
-      return
-    } else if (type === 'linkbtn' && !btn.$toolbtn && !is(fromJS(selectedData || []), fromJS(record))) {
-      return
-    }
-
-    let data = record || selectedData || []
-    
-    if (btn.Ot === 'requiredSgl' && data.length !== 1) {
+    } else if (btn.Ot === 'requiredSgl' && data.length !== 1) {
       // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁
       notification.warning({
         top: 92,
-        message: '璇烽�夋嫨鍗曡鏁版嵁锛�',
+        message: dict['select_single_row'] || '璇烽�夋嫨鍗曡鏁版嵁锛�',
         duration: 5
       })
-      return
-    } else if (!btn.verify || !btn.verify.sheet || !btn.verify.columns || btn.verify.columns.length === 0) {
-      notification.warning({
-        top: 92,
-        message: 'excel瀵煎叆楠岃瘉淇℃伅鏈缃紒',
-        duration: 5
+    } else {
+      let primaryId = '' // 瀵煎叆鏃惰Id
+      if (btn.Ot === 'requiredSgl' && setting.primaryKey) {
+        primaryId = data[0][setting.primaryKey] || ''
+      }
+  
+      this.setState({
+        selines: data,
+        primaryId: primaryId
+      }, () => {
+        this.refs.excelIn.exceltrigger()
       })
-      return
-    }
-
-    let primaryId = '' // 瀵煎叆鏃惰Id
-    if (btn.Ot === 'requiredSgl' && setting.primaryKey) {
-      primaryId = data[0][setting.primaryKey] || ''
-    }
-
-    this.setState({
-      selines: data,
-      primaryId: primaryId
-    }, () => {
-      this.refs.excelIn.exceltrigger()
-    })
-
-    if (window.GLOB.systemType === 'production') {
-      MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '瀵煎叆Excel'})
+  
+      if (window.GLOB.systemType === 'production') {
+        MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '瀵煎叆Excel'})
+      }
     }
   }
 
@@ -170,16 +159,18 @@
    */
   execSuccess = (res = {}) => {
     const { btn } = this.props
+    const { dict } = this.state
 
     if (res.ErrCode === 'S' || !res.ErrCode) { // 鎵ц鎴愬姛
       notification.success({
         top: 92,
-        message: res.message || '鎵ц鎴愬姛锛�',
+        message: res.message || dict['exc_success'] || '鎵ц鎴愬姛锛�',
         duration: btn.verify && btn.verify.stime ? btn.verify.stime : 2
       })
     } else if (res.ErrCode === 'Y') { // 鎵ц鎴愬姛
       Modal.success({
-        title: res.message || '鎵ц鎴愬姛锛�'
+        title: res.message || dict['exc_success'] || '鎵ц鎴愬姛锛�',
+        okText: dict['got_it'] || '鐭ラ亾浜�',
       })
     } else if (res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず
 
@@ -232,6 +223,7 @@
    */
   execError = (res = {}) => {
     const { btn } = this.props
+    const { dict } = this.state
 
     if (!['LoginError', 'C', '-2', 'E', 'N', 'F', 'NM'].includes(res.ErrCode)) {
       res.ErrCode = 'E'
@@ -239,23 +231,24 @@
 
     if (res.ErrCode === 'E') {
       Modal.error({
-        title: res.message || '鎵ц澶辫触锛�',
+        title: res.message || dict['exc_fail'] || '鎵ц澶辫触锛�',
+        okText: dict['got_it'] || '鐭ラ亾浜�'
       })
     } else if (res.ErrCode === 'N') {
       notification.error({
         top: 92,
-        message: res.message || '鎵ц澶辫触锛�',
+        message: res.message || dict['exc_fail'] || '鎵ц澶辫触锛�',
         duration: btn.verify && btn.verify.ntime ? btn.verify.ntime : 10
       })
     } else if (res.ErrCode === 'F') {
       notification.error({
         className: 'notification-custom-error',
         top: 92,
-        message: res.message || '鎵ц澶辫触锛�',
+        message: res.message || dict['exc_fail'] || '鎵ц澶辫触锛�',
         duration: btn.verify && btn.verify.ftime ? btn.verify.ftime : 10
       })
     } else if (res.ErrCode === 'NM') {
-      message.error(res.message || '鎵ц澶辫触锛�')
+      message.error(res.message || dict['exc_fail'] || '鎵ц澶辫触锛�')
     }
     
     this.setState({
@@ -266,6 +259,24 @@
       MKEmitter.emit('popclose')
     } else if (btn.execError !== 'never') {
       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 {
+          MKEmitter.emit('reloadData', btn.syncComponentId)
+        }
+      }
     }
 
     if (btn.execError === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊
@@ -342,6 +353,10 @@
         param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
       }
 
+      if (btn.database === 'sso' && window.GLOB.mainSystemApi) {
+        param.rduri = window.GLOB.mainSystemApi
+      }
+
       param.menuname = btn.logLabel
       
       if (window.GLOB.probation) {
@@ -364,8 +379,10 @@
           } else if (res.ErrCode === 'C') {
             const _this = this
             confirm({
-              title: '璇风‘璁�',
+              title: window.GLOB.dict['exec_sure'] || '璇风‘璁�',
               content: res.message,
+              okText: window.GLOB.dict['ok'] || '纭畾',
+              cancelText: window.GLOB.dict['cancel'] || '鍙栨秷',
               onOk() {
                 return new Promise(resolve => {
                   Api.genericInterface(unCheckParam).then(result => {

--
Gitblit v1.8.0