From e47f5f999cb20283ad99c00c5e771d44501cf3c9 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 26 十二月 2019 17:47:26 +0800
Subject: [PATCH] 2019-12-26

---
 src/tabviews/tableshare/actionList/index.jsx |  113 ++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 72 insertions(+), 41 deletions(-)

diff --git a/src/tabviews/tableshare/actionList/index.jsx b/src/tabviews/tableshare/actionList/index.jsx
index f5ef28f..ab371ec 100644
--- a/src/tabviews/tableshare/actionList/index.jsx
+++ b/src/tabviews/tableshare/actionList/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import moment from 'moment'
-import { Button, Affix, Modal, notification, Spin } from 'antd'
+import { Button, Affix, Modal, notification, Spin, message } from 'antd'
 import MutilForm from '@/tabviews/tableshare/mutilform'
 import Utils from '@/utils/utils.js'
 import Api from '@/api'
@@ -30,14 +30,13 @@
     configMap: {}
   }
 
-  UNSAFE_componentWillMount() {
-    console.log(this.props.type)
-  }
-  
   refreshdata = (item, type) => {
     this.props.refreshdata(item, type)
   }
   
+  /**
+   * @description 瑙﹀彂鎸夐挳鎿嶄綔
+   */
   actionTrigger = (item, record) => {
     const { setting } = this.props
 
@@ -181,7 +180,7 @@
 
         Api.genericInterface(param).then((res) => {
           if (res.status) {
-            this.execSuccess(btn)
+            this.execSuccess(btn, res)
           } else {
             this.execError(res, btn)
           }
@@ -236,21 +235,16 @@
           let errorMsg = ''
           result.forEach(res => {
             if (res.status) {
-              
+              errorMsg = res
             } else {
               iserror = true
-              errorMsg = res.message
+              errorMsg = res
             }
           })
           if (!iserror) {
-            this.execSuccess(btn)
+            this.execSuccess(btn, errorMsg)
           } else {
-            notification.error({
-              top: 92,
-              message: errorMsg,
-              duration: 15
-            })
-            this.refreshdata(btn, 'error')
+            this.execError(errorMsg, btn)
           }
           _resolve()
         })
@@ -333,7 +327,7 @@
               response.func = btn.callbackFunc
               return Api.genericInterface(response)
             } else {
-              this.execSuccess(btn)
+              this.execSuccess(btn, response)
               _resolve()
             }
           } else {
@@ -344,7 +338,7 @@
           if (!res) return
   
           if (res.status) {
-            this.execSuccess(btn)
+            this.execSuccess(btn, res)
           } else {
             this.execError(res, btn)
           }
@@ -429,16 +423,13 @@
           result.forEach(res => {
             if (!res.status) {
               iserror = true
-              errorMsg = res.message
+              errorMsg = res
+            } else {
+              errorMsg = res
             }
           })
           if (iserror) {
-            notification.error({
-              top: 92,
-              message: errorMsg,
-              duration: 15
-            })
-            this.refreshdata(btn, 'error')
+            this.execError(errorMsg, btn)
             _resolve()
             return
           }
@@ -461,7 +452,7 @@
             return Promise.all(deffers)
           } else {
             _resolve()
-            this.execSuccess(btn)
+            this.execSuccess(btn, errorMsg)
           }
         }).then(result => {
           if (!result) return
@@ -471,19 +462,16 @@
           result.forEach(res => {
             if (!res.status) {
               iserror = true
-              errorMsg = res.message
+              errorMsg = res
+            } else {
+              errorMsg = res
             }
           })
           if (iserror) {
-            notification.error({
-              top: 92,
-              message: errorMsg,
-              duration: 15
-            })
-            this.refreshdata(btn, 'error')
+            this.execError(errorMsg, btn)
             return
           } else {
-            this.execSuccess(btn)
+            this.execSuccess(btn, errorMsg)
           }
           _resolve()
         })
@@ -501,17 +489,27 @@
     }
   }
 
-  execSuccess = (btn) => {
+  /**
+   * @description 鎿嶄綔鎴愬姛鍚庡鐞�
+   * 1銆乪xcel瀵煎嚭锛屾垚鍔熷悗鍙栨秷瀵煎嚭鎸夐挳鍔犺浇涓姸鎬�
+   * 2銆佺姸鎬佺爜涓� S 鏃讹紝鏄剧ず鎴愬姛淇℃伅鍚庣郴缁熼粯璁や俊鎭�
+   * 3銆佺姸鎬佺爜涓� -1 鏃讹紝涓嶆樉绀轰换浣曚俊鎭�
+   * 4銆佹ā鎬佹鎵ц鎴愬姛鍚庢槸鍚﹀叧闂�
+   * 5銆侀�氱煡涓诲垪琛ㄥ埛鏂�
+   */
+  execSuccess = (btn, res) => {
     if (btn.OpenType === 'excelOut') {
       this.setState({
         loadingUuid: ''
       })
-    } else {
+    } else if (res && res.ErrCode === 'S') {
       notification.success({
         top: 92,
-        message: this.props.dict['main.action.confirm.success'],
+        message: res.ErrMesg || this.props.dict['main.action.confirm.success'],
         duration: 2
       })
+    } else if (res && res.ErrCode === '-1') {
+
     }
     
     if (btn.OpenType === 'pop' && btn.setting && btn.setting.finish !== 'unclose') {
@@ -522,17 +520,32 @@
     this.refreshdata(btn, 'success')
   }
 
+  /**
+   * @description 鎿嶄綔澶辫触鍚庡鐞�
+   * 1銆佺姸鎬佺爜涓� E銆丯銆丗銆丯M 鏃讹紝鏄剧ず鐩稿簲鎻愮ず淇℃伅
+   * 2銆乪xcel瀵煎嚭锛屽け璐ュ悗鍙栨秷瀵煎嚭鎸夐挳鍔犺浇涓姸鎬�
+   * 3銆侀�氱煡涓诲垪琛ㄥ埛鏂�
+   */
   execError = (res, btn) => {
-    if (!res.ErrCode || res.ErrCode === 'E') {
+    if (res.ErrCode === 'E') {
+      Modal.error({
+        title: res.message || res.ErrMesg,
+      })
+    } else if (res.ErrCode === 'N') {
       notification.error({
         top: 92,
         message: res.message || res.ErrMesg,
-        duration: 15
+        duration: btn.errorTime || 15
       })
-    } else if (res.ErrCode === 'E') {
-      Modal.error({
-        title: res.message || res.ErrMesg
+    } else if (res.ErrCode === 'F') {
+      notification.error({
+        className: 'notification-custom-error',
+        top: 92,
+        message: res.message || res.ErrMesg,
+        duration: btn.errorTime || 15
       })
+    } else if (res.ErrCode === 'NM') {
+      message.error(res.message || res.ErrMesg)
     }
     
     if (btn.OpenType === 'excelOut') {
@@ -544,6 +557,9 @@
     this.refreshdata(btn, 'error')
   }
 
+  /**
+   * @description 鎸夐挳閰嶇疆淇℃伅閿欒鎻愮ず
+   */
   actionSettingError = () => {
     notification.warning({
       top: 92,
@@ -552,6 +568,9 @@
     })
   }
 
+  /**
+   * @description 鑾峰彇鎸夐挳閰嶇疆淇℃伅
+   */
   improveAction = (action) => {
     const { configMap, execAction } = this.state
 
@@ -613,6 +632,9 @@
     }
   }
 
+  /**
+   * @description 鑾峰彇涓嬫媺琛ㄥ崟閫夐」淇℃伅
+   */
   improveActionForm = () => {
     const { configMap, execAction } = this.state
     let subfields = []
@@ -710,6 +732,9 @@
     })
   }
 
+  /**
+   * @description 妯℃�佹锛堣〃鍗曪級锛岀‘璁�
+   */
   handleOk = () => {
     this.formRef.handleConfirm().then(res => {
       this.setState({
@@ -723,12 +748,18 @@
     }, () => {})
   }
 
+  /**
+   * @description 妯℃�佹锛堣〃鍗曪級锛屽彇娑�
+   */
   handleCancel = () => {
     this.setState({
       visible: false
     })
   }
 
+  /**
+   * @description 鏄剧ず妯℃�佹
+   */
   getModels = () => {
     const { execAction } = this.state
 

--
Gitblit v1.8.0