From 6def3330d1d1cf4036916ed04c8bbc4128e1e5d0 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 03 五月 2020 19:42:17 +0800
Subject: [PATCH] 2020-05-03

---
 src/templates/zshare/createinterface/index.jsx |   51 +++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 45 insertions(+), 6 deletions(-)

diff --git a/src/templates/zshare/createinterface/index.jsx b/src/templates/zshare/createinterface/index.jsx
index 83fc27c..d48bd8b 100644
--- a/src/templates/zshare/createinterface/index.jsx
+++ b/src/templates/zshare/createinterface/index.jsx
@@ -23,11 +23,17 @@
     btn: null
   }
 
+  /**
+   * @description 瑙﹀彂鍒涘缓璇绘暟鎹帴鍙�
+   * @param { object } menu    鑿滃崟绫诲瀷锛堜笁绾ц彍鍗曟垨鏍囩椤碉級銆佽彍鍗旾D銆佽彍鍗曞弬鏁般�佽彍鍗曞悕绉�
+   * @param { object } config  鑿滃崟閰嶇疆淇℃伅
+   */
   triggerOutInterface = (menu, config) => {
     let _search = []
     let _index = 1
 
     if (menu.type !== 'main') {
+      // 瀛愯〃椤甸潰澧炲姞BID瀛楁锛屾暟鎹簮涓娇鐢ㄤ簡@BID@鏃讹紝BID绫诲瀷涓哄繀浼�
       if (config.setting.dataresource && /@BID@/ig.test(config.setting.dataresource)) {
         _search.push(`select 'BID' as searchfield,'BID' as label,'0' as Sort,'' as defaultvalue,'required' as DefaultType`)
       } else {
@@ -113,11 +119,14 @@
       Ltextsearchparam: _search.join(' union all '),
       AppendWhere: config.setting.queryType === 'query' ? searchText.join(' AND ') : '',
       WhereType: config.setting.queryType === 'statistics' ? 'Statistics' : 'query',
+      custom_script: config.setting.customScript || '',
+      // default_sql: config.setting.default || 'true',
       OrderCol: config.setting.order
     }
 
     param.Ltextsearchparam = Utils.formatOptions(param.Ltextsearchparam)
     param.AppendWhere = Utils.formatOptions(param.AppendWhere)
+    param.custom_script = Utils.formatOptions(param.custom_script)
 
     this.setState({
       type: 'out',
@@ -238,7 +247,7 @@
           notification.warning({
             top: 92,
             message: result.message,
-            duration: 10
+            duration: 5
           })
           resolve(false)
         } else {
@@ -261,7 +270,7 @@
         notification.warning({
           top: 92,
           message: result.message,
-          duration: 10
+          duration: 5
         })
         return false
       } else {
@@ -283,7 +292,26 @@
     })
   }
 
+  /**
+   * @description 瑙﹀彂鍒涘缓鍐欏叆鎺ュ彛锛堟寜閽級
+   */
   triggerInInterface = (btn, config, menu) => {
+    if (!['pop', 'exec', 'prompt'].includes(btn.OpenType) || btn.funcType || btn.intertype !== 'inner' || btn.innerFunc ) {
+      notification.warning({
+        top: 92,
+        message: '鎵撳紑鏂瑰紡涓� 寮圭獥锛堣〃鍗曪級銆佹彁绀烘鎴栫洿鎺ユ墽琛岋紝涓斾娇鐢ㄧ郴缁熷嚱鏁版椂锛屾墠鍙互鍒涘缓鎺ュ彛锛�',
+        duration: 5
+      })
+      return
+    } else if (btn.Ot === 'requiredOnce') {
+      notification.warning({
+        top: 92,
+        message: '澶氳鎷兼帴鏃讹紝涓嶆敮鎸佸垱寤烘帴鍙o紒',
+        duration: 5
+      })
+      return
+    }
+
     let param = {
       func: 's_get_para_for_in',
       Menuid: btn.uuid,
@@ -343,6 +371,9 @@
     })
   }
 
+  /**
+   * @description 鎵ц鎺ュ彛鍒涘缓
+   */
   createBtnInterfaceExec = (param, config, btn) => {
     let formlist = []
     let receipt = param.Return === 'Y'
@@ -424,14 +455,14 @@
             notification.warning({
               top: 92,
               message: result.message,
-              duration: 10
+              duration: 5
             })
             resolve(false)
           } else {
             notification.warning({
               top: 92,
               message: '璇峰畬鍠勮〃鍗曚俊鎭紒',
-              duration: 10
+              duration: 5
             })
             resolve(false)
           }
@@ -448,7 +479,12 @@
       })
 
       if (param.menuType !== 'main' && !_keys.includes('bid')) {
+        _keys.push('bid')
         param.Ltexttableparam.unshift(`select 'BID' as searchfield,'BID' as label,'0' as Sort,'nvarchar(50)' as fieldtype,'required' as requiredtype,'' as defaultvalue`)
+      }
+
+      if (btn.Ot !== 'notRequired' && !_keys.includes(config.setting.primaryKey.toLowerCase())) {
+        param.Ltexttableparam.unshift(`select '${config.setting.primaryKey}' as searchfield,'${config.setting.primaryKey}' as label,'1' as Sort,'nvarchar(50)' as fieldtype,'required' as requiredtype,'' as defaultvalue`)
       }
 
       param.Ltexttableparam = param.Ltexttableparam.join(' union all ')
@@ -509,7 +545,7 @@
         notification.warning({
           top: 92,
           message: res.message,
-          duration: 10
+          duration: 5
         })
         return false
       } else {
@@ -531,7 +567,7 @@
         notification.warning({
           top: 92,
           message: res.message,
-          duration: 10
+          duration: 5
         })
         return false
       } else {
@@ -805,6 +841,9 @@
           @VoucherTypeOne ='${_voucher.VoucherTypeOne}',
           @VoucherTypeTwo ='${_voucher.VoucherTypeTwo}',
           @Type =${_voucher.Type},
+          @UserID=@UserID@,
+          @Username=@Username,
+          @FullName=@FullName,
           @BVoucher =@BVoucher OUTPUT ,
           @FIBVoucherDate =@FIBVoucherDate OUTPUT ,
           @FiYear =@FiYear OUTPUT ,

--
Gitblit v1.8.0