From 461e4fff4b51d067671244eec63b097cd9012b6e Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 30 三月 2020 09:25:41 +0800
Subject: [PATCH] 2020-03-30

---
 src/tabviews/zshare/actionList/index.jsx |  148 ++++++++++++++++++++++++++++---------------------
 1 files changed, 85 insertions(+), 63 deletions(-)

diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx
index db47fb5..70767bc 100644
--- a/src/tabviews/zshare/actionList/index.jsx
+++ b/src/tabviews/zshare/actionList/index.jsx
@@ -78,7 +78,7 @@
       notification.warning({
         top: 92,
         message: '闇�瑕佷笂绾т富閿�硷紒',
-        duration: 10
+        duration: 5
       })
       return
     }
@@ -95,7 +95,7 @@
       notification.warning({
         top: 92,
         message: this.props.dict['main.action.confirm.selectline'],
-        duration: 10
+        duration: 5
       })
       return
     } else if (item.Ot === 'requiredSgl' && data.length !== 1) {
@@ -103,7 +103,7 @@
       notification.warning({
         top: 92,
         message: this.props.dict['main.action.confirm.selectSingleLine'],
-        duration: 10
+        duration: 5
       })
       return
     } else if (item.Ot !== 'notRequired' && !setting.primaryKey) {
@@ -111,7 +111,7 @@
       notification.warning({
         top: 92,
         message: '鏈缃富閿紒',
-        duration: 10
+        duration: 5
       })
       return
     }
@@ -154,7 +154,7 @@
         notification.warning({
           top: 92,
           message: '瀵煎嚭鎸夐挳閰嶇疆閿欒锛�',
-          duration: 10
+          duration: 5
         })
         return
       }
@@ -173,7 +173,7 @@
         notification.warning({
           top: 92,
           message: 'excel瀵煎叆楠岃瘉淇℃伅鏈缃紒',
-          duration: 10
+          duration: 5
         })
       }
     } else if (item.OpenType === 'popview' && this.props.type !== 'subtab') {
@@ -182,7 +182,7 @@
       notification.warning({
         top: 92,
         message: '寮圭獥椤甸潰涓嶆敮鎸佹璁剧疆锛�',
-        duration: 10
+        duration: 5
       })
     } else if (item.OpenType === 'innerpage') {
       let Id = data[0][setting.primaryKey]
@@ -196,7 +196,7 @@
         notification.warning({
           top: 92,
           message: '椤甸潰绫诲瀷璁剧疆閿欒锛�',
-          duration: 10
+          duration: 5
         })
       }
     } else if (item.OpenType === 'outerpage') {
@@ -245,7 +245,7 @@
       notification.warning({
         top: 92,
         message: '瀹屽杽涓�傘�傘��',
-        duration: 10
+        duration: 5
       })
     }
   }
@@ -267,7 +267,7 @@
       notification.warning({
         top: 92,
         message: '璇峰畬鍠勬墦鍗伴獙璇佷俊鎭紒',
-        duration: 15
+        duration: 5
       })
       return
     }
@@ -393,6 +393,12 @@
 
   execCustomPrint = (item, printlist, formdata) => {
     this.setState({loadingUuid: ''})
+    this.execSuccess(item, {
+      ErrCode: '-1',
+      message: '',
+      ErrMesg: '',
+      status: true
+    })
 
     try {
       // eslint-disable-next-line
@@ -400,11 +406,19 @@
       func(printlist, formdata, item.verify, notification)
     } catch (e) {
       console.warn(e)
-      notification.warning({
-        top: 92,
-        message: '鑷畾涔夊嚱鏁版墽琛岄敊璇紒',
-        duration: 10
-      })
+
+      try {
+        // eslint-disable-next-line
+        let evalfunc = eval('(true && function (data, form, printer, notification) {' + item.verify.printFunc + '})')
+        evalfunc(printlist, formdata, item.verify, notification)
+      } catch (error) {
+        console.warn(error)
+        notification.warning({
+          top: 92,
+          message: '鑷畾涔夊嚱鏁版墽琛岄敊璇紒',
+          duration: 5
+        })
+      }
     }
   }
 
@@ -583,7 +597,6 @@
     }).then(response => {
       if (!response) return
 
-      response = {"status":true,"message":"","ErrCode":"","ErrMesg":"","CpCode":"YTO","InsideBill":"202003261727348572C0D0C2C0E444FD0B42A","PrintData":"{\"data\":{\"CpCode\":\"YTO\",\"WayBillCode\":\"YT2045589280491\",\"InsideBill\":\"19042003260002\",\"RecvInfo\":\"寮犲厛鐢�  137147852  \\r\\n娌冲寳鐪佷繚瀹氬競绔炵鍖�001\",\"SendInfo\":\"瀹濇椂寰楃鎶�锛堜腑鍥斤級鏈夐檺鍏徃  0512-65152888-5147  \\r\\n瀹濇椂寰楃鎶�锛堜腑鍥斤級鏈夐檺鍏徃锛圔鍖猴級鑻忓窞宸ヤ笟鍥尯涓滄椇璺�18鍙穃",\"BigShot\":\"176淇濆畾\",\"GatherCenterCode\":\"311911\",\"GatherCenterName\":\"\",\"CustomData\":\"wu800*2\\\\r\\\\n\",\"Pin\":\"\"},\"templateURL\":\"http://css.positecgroup.com/template/yto.srt\",\"ectype\":\"jdpop\"}","CustomData":""}
       if (response.status) {
         _list.push(response)
 
@@ -844,12 +857,13 @@
     })
 
     if (list.length === 0) {
-      notification.warning({
-        top: 92,
-        message: '鏈幏鍙栧埌鎵撳嵃淇℃伅锛�',
-        duration: 10
-      })
       this.setState({loadingUuid: ''})
+      this.execError({
+        ErrCode: 'N',
+        message: '鏈幏鍙栧埌鎵撳嵃淇℃伅锛�',
+        ErrMesg: '',
+        status: false
+      }, item)
       return
     } else if (_errors.length > 0) {
       let lackerror = []
@@ -873,12 +887,13 @@
         msg.push(emptyerror.join(' ; '))
       }
 
-      notification.warning({
-        top: 92,
-        message: msg.join(' ; ') + ' !',
-        duration: 10
-      })
       this.setState({loadingUuid: ''})
+      this.execError({
+        ErrCode: 'N',
+        message: msg.join(' ; ') + ' !',
+        ErrMesg: '',
+        status: false
+      }, item)
       return
     }
 
@@ -900,10 +915,11 @@
         })
 
         this.setState({loadingUuid: ''})
-        notification.success({
-          top: 92,
-          message: '鎵撳嵃璇锋眰宸插彂鍑恒��',
-          duration: 2
+        this.execSuccess(item, {
+          ErrCode: 'S',
+          message: '',
+          ErrMesg: '鎵撳嵃璇锋眰宸插彂鍑恒��',
+          status: true
         })
       }
     }
@@ -922,10 +938,11 @@
         })
 
         this.setState({loadingUuid: ''})
-        notification.success({
-          top: 92,
-          message: '鎵撳嵃璇锋眰宸插彂鍑恒��',
-          duration: 2
+        this.execSuccess(item, {
+          ErrCode: 'S',
+          message: '',
+          ErrMesg: '鎵撳嵃璇锋眰宸插彂鍑恒��',
+          status: true
         })
       }
     }
@@ -937,12 +954,14 @@
         try {
           data = JSON.parse(event.data)
         } catch {
-          notification.warning({
-            top: 92,
-            message: event.data,
-            duration: 10
-          })
           this.setState({loadingUuid: ''})
+          this.execError({
+            ErrCode: 'N',
+            message: event.data,
+            ErrMesg: '',
+            status: false
+          }, item)
+
           data = ''
         }
       }
@@ -956,28 +975,31 @@
         })
 
         this.setState({loadingUuid: ''})
-        notification.success({
-          top: 92,
-          message: '鎵撳嵃璇锋眰宸插彂鍑恒��',
-          duration: 2
+        this.execSuccess(item, {
+          ErrCode: 'S',
+          message: '',
+          ErrMesg: '鎵撳嵃璇锋眰宸插彂鍑恒��',
+          status: true
         })
       } else if (data && data.message && !data.status) {
-        notification.warning({
-          top: 92,
-          message: data.message,
-          duration: 10
-        })
         this.setState({loadingUuid: ''})
+        this.execError({
+          ErrCode: 'N',
+          message: data.message,
+          ErrMesg: '',
+          status: false
+        }, item)
       }
     }
 
     socket.onerror = () => {
-      notification.warning({
-        top: 92,
-        message: '鏃犳硶杩炴帴鍒�:' + item.verify.linkUrl,
-        duration: 10
-      })
       this.setState({loadingUuid: ''})
+      this.execError({
+        ErrCode: 'N',
+        message: '鏃犳硶杩炴帴鍒�:' + item.verify.linkUrl,
+        ErrMesg: '',
+        status: false
+      }, item)
     }
   }
 
@@ -1068,7 +1090,7 @@
           notification.warning({
             top: 92,
             message: '浣跨敤鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒',
-            duration: 10
+            duration: 5
           })
           return
         }
@@ -1534,7 +1556,7 @@
     notification.warning({
       top: 92,
       message: this.props.dict['main.action.settingerror'],
-      duration: 10
+      duration: 5
     })
   }
 
@@ -1572,7 +1594,7 @@
           notification.warning({
             top: 92,
             message: res.message,
-            duration: 10
+            duration: 5
           })
           this.setState({
             execAction: null,
@@ -1583,7 +1605,7 @@
           notification.warning({
             top: 92,
             message: '鏈幏鍙栧埌鎸夐挳閰嶇疆淇℃伅锛�',
-            duration: 10
+            duration: 5
           })
           this.setState({
             execAction: null,
@@ -1733,7 +1755,7 @@
         notification.warning({
           top: 92,
           message: error.message,
-          duration: 10
+          duration: 5
         })
       }
 
@@ -1757,19 +1779,19 @@
         notification.warning({
           top: 92,
           message: '宸ヤ綔琛ㄣ��' + btn.verify.sheet + '銆嬩笉瀛樺湪锛�',
-          duration: 10
+          duration: 5
         })
       } else if (errors === 'empty') {
         notification.warning({
           top: 92,
           message: '宸ヤ綔琛ㄣ��' + btn.verify.sheet + '銆嬩负绌猴紒',
-          duration: 10
+          duration: 5
         })
       } else if (errors === 'headerError') {
         notification.warning({
           top: 92,
           message: '宸ヤ綔琛ㄣ��' + btn.verify.sheet + '銆嬭〃澶磋缃敊璇紒',
-          duration: 10
+          duration: 5
         })
       }
       
@@ -1780,7 +1802,7 @@
       notification.warning({
         top: 92,
         message: '鏈幏鍙栧埌宸ヤ綔琛ㄣ��' + btn.verify.sheet + '銆嬫暟鎹紒',
-        duration: 10
+        duration: 5
       })
       return
     }
@@ -1790,7 +1812,7 @@
       notification.warning({
         top: 92,
         message: result.errors,
-        duration: 10
+        duration: 5
       })
       return
     }

--
Gitblit v1.8.0