From fe1b8fd12f0cd2bd9530dbab1deb6b49611284a5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 28 十一月 2023 15:01:36 +0800
Subject: [PATCH] 2023-11-28

---
 src/tabviews/custom/components/form/tab-form/index.jsx    |    4 
 src/tabviews/custom/popview/index.jsx                     |   37 +++--------
 src/tabviews/basetable/index.jsx                          |   10 +++
 src/tabviews/custom/components/form/step-form/index.jsx   |    4 
 src/tabviews/custom/index.jsx                             |   45 ++++-----------
 src/tabviews/custom/components/form/simple-form/index.jsx |    2 
 src/templates/zshare/verifycard/baseform/index.jsx        |   23 +++++++
 src/templates/zshare/verifycard/index.jsx                 |    1 
 src/templates/zshare/codemirror/index.jsx                 |    2 
 9 files changed, 63 insertions(+), 65 deletions(-)

diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx
index 8665c82..d5c7dc8 100644
--- a/src/tabviews/basetable/index.jsx
+++ b/src/tabviews/basetable/index.jsx
@@ -496,6 +496,16 @@
       }
     }
 
+    if (cell.verify && cell.verify.preHandle === 'true') {
+      try {
+        // eslint-disable-next-line
+        let func = new Function('btn', 'systemType', cell.verify.pre_func)
+        func(cell, window.GLOB.systemType)
+      } catch (e) {
+        console.warn(e)
+      }
+    }
+
     if (cell.syncComponentId) {
       if (cell.syncComponentId === item.setting.supModule) {
         cell.syncComponentId = ''
diff --git a/src/tabviews/custom/components/form/simple-form/index.jsx b/src/tabviews/custom/components/form/simple-form/index.jsx
index 6b082d1..2968377 100644
--- a/src/tabviews/custom/components/form/simple-form/index.jsx
+++ b/src/tabviews/custom/components/form/simple-form/index.jsx
@@ -220,7 +220,7 @@
   refreshByButtonResult = (menuId, position, btn, id) => {
     const { config, group, BID } = this.state
 
-    if (group.uuid !== menuId) return
+    if (config.uuid !== menuId) return
 
     if (position === 'grid' && config.wrap.refocus) {
       let _group = fromJS(group).toJS()
diff --git a/src/tabviews/custom/components/form/step-form/index.jsx b/src/tabviews/custom/components/form/step-form/index.jsx
index 2b7de64..03ab2b7 100644
--- a/src/tabviews/custom/components/form/step-form/index.jsx
+++ b/src/tabviews/custom/components/form/step-form/index.jsx
@@ -239,9 +239,9 @@
    * @param {*} btn        // 鎵ц鐨勬寜閽�
    */
   refreshByButtonResult = (menuId, position, btn, id) => {
-    const { config, group, BID } = this.state
+    const { config, BID } = this.state
 
-    if (group.uuid !== menuId) return
+    if (config.uuid !== menuId) return
 
     if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) {
       MKEmitter.emit('reloadData', config.setting.supModule, BID)
diff --git a/src/tabviews/custom/components/form/tab-form/index.jsx b/src/tabviews/custom/components/form/tab-form/index.jsx
index 7dd140a..ba5f788 100644
--- a/src/tabviews/custom/components/form/tab-form/index.jsx
+++ b/src/tabviews/custom/components/form/tab-form/index.jsx
@@ -205,9 +205,9 @@
    * @param {*} btn        // 鎵ц鐨勬寜閽�
    */
   refreshByButtonResult = (menuId, position, btn, id) => {
-    const { config, group, BID } = this.state
+    const { config, BID } = this.state
 
-    if (group.uuid !== menuId) return
+    if (config.uuid !== menuId) return
 
     if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) {
       MKEmitter.emit('reloadData', config.setting.supModule, BID)
diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index 89b981b..eee9fa8 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -772,48 +772,17 @@
       } else if (item.type === 'form') {
         item.subcards = item.subcards.map(group => {
           group.subButton.uuid = group.uuid
-          group.subButton.$menuId = group.uuid
-          group.subButton.$MenuID = this.props.MenuID
-          // group.subButton.$forbid = true // 涓嶅0鏄庢暟鎹簮鍙橀噺
           group.subButton.OpenType = 'formSubmit'
           group.subButton.execError = 'never'
-          group.subButton.logLabel = item.$menuname + '-' + group.subButton.label
-
           if (!group.subButton.Ot) {
             group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl'
           }
 
-          if (item.$process) {
-            group.subButton.$process = true
-            group.subButton.$flowId = 'flow' + this.props.MenuID
-          }
+          group.subButton = this.resetButton(item, group.subButton)
 
-          if (item.$cache && item.$time) {
+          if (item.$cache && item.$time) { // 琛ㄥ崟缂撳瓨
             group.$cache = item.$cache
             group.$time = item.$time
-          }
-
-          group.subButton.syncComponentId = group.subButton.syncComponent ? (group.subButton.syncComponent.pop() || '') : ''
-
-          if (group.subButton.syncComponentId && group.subButton.syncComponentId === item.setting.supModule) {
-            group.subButton.syncComponentId = ''
-            if (group.subButton.execSuccess === 'grid') {
-              group.subButton.execSuccess = 'mainline'
-            }
-          }
-
-          if (group.subButton.verify && group.subButton.verify.invalid === 'true') {
-            if (item.wrap.datatype === 'static' || item.wrap.datatype === 'public') {
-              group.subButton.verify.invalid = 'false'
-            } else if (item.setting && item.setting.maxScript && item.setting.maxScript >= 300) {
-              group.subButton.verify.invalid = 'false'
-            } else if (group.subButton.sqlType === 'insert') {
-              group.subButton.verify.invalid = 'false'
-            } else if (group.subButton.Ot === 'notRequired') {
-              group.subButton.verify.invalid = 'false'
-            } else if (group.subButton.intertype !== 'system' && group.subButton.procMode !== 'system') {
-              group.subButton.verify.invalid = 'false'
-            }
           }
 
           group.fields = group.fields.map(cell => {
@@ -945,6 +914,16 @@
       }
     }
 
+    if (cell.verify && cell.verify.preHandle === 'true') {
+      try {
+        // eslint-disable-next-line
+        let func = new Function('btn', 'systemType', cell.verify.pre_func)
+        func(cell, window.GLOB.systemType)
+      } catch (e) {
+        console.warn(e)
+      }
+    }
+
     if (cell.syncComponentId) {
       if (cell.syncComponentId === item.setting.supModule) {
         cell.syncComponentId = ''
diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx
index 0dd6bfd..5e0431c 100644
--- a/src/tabviews/custom/popview/index.jsx
+++ b/src/tabviews/custom/popview/index.jsx
@@ -504,39 +504,14 @@
       } else if (item.type === 'form') {
         item.subcards = item.subcards.map(group => {
           group.subButton.uuid = group.uuid
-          group.subButton.$menuId = group.uuid
-          group.subButton.$MenuID = Tab.$MenuID
           group.subButton.OpenType = 'formSubmit'
           group.subButton.execError = 'never'
-          group.subButton.logLabel = item.$menuname + '-' + group.subButton.label
-          group.subButton.$tabId = Tab.uuid
 
           if (!group.subButton.Ot) {
             group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl'
           }
 
-          group.subButton.syncComponentId = group.subButton.syncComponent ? (group.subButton.syncComponent.pop() || '') : ''
-
-          if (group.subButton.syncComponentId && group.subButton.syncComponentId === item.setting.supModule) {
-            group.subButton.syncComponentId = ''
-            if (group.subButton.execSuccess === 'grid') {
-              group.subButton.execSuccess = 'mainline'
-            }
-          }
-
-          if (group.subButton.verify && group.subButton.verify.invalid === 'true') {
-            if (item.wrap.datatype === 'static') {
-              group.subButton.verify.invalid = 'false'
-            } else if (item.setting && item.setting.maxScript && item.setting.maxScript >= 300) {
-              group.subButton.verify.invalid = 'false'
-            } else if (group.subButton.intertype !== 'system' && group.subButton.procMode !== 'system') {
-              group.subButton.verify.invalid = 'false'
-            } else if (group.subButton.sqlType === 'insert') {
-              group.subButton.verify.invalid = 'false'
-            } else if (group.subButton.Ot === 'notRequired') {
-              group.subButton.verify.invalid = 'false'
-            }
-          }
+          group.subButton = this.resetButton(item, group.subButton, Tab)
 
           group.fields = group.fields.map(cell => {
             // 鏁版嵁婧恠ql璇彞锛岄澶勭悊锛屾潈闄愰粦鍚嶅崟瀛楁璁剧疆涓洪殣钘忚〃鍗�
@@ -656,6 +631,16 @@
       }
     }
 
+    if (cell.verify && cell.verify.preHandle === 'true') {
+      try {
+        // eslint-disable-next-line
+        let func = new Function('btn', 'systemType', cell.verify.pre_func)
+        func(cell, window.GLOB.systemType)
+      } catch (e) {
+        console.warn(e)
+      }
+    }
+
     if (cell.syncComponentId) {
       if (cell.syncComponentId === item.setting.supModule) {
         cell.syncComponentId = ''
diff --git a/src/templates/zshare/codemirror/index.jsx b/src/templates/zshare/codemirror/index.jsx
index 729bb1a..db428e7 100644
--- a/src/templates/zshare/codemirror/index.jsx
+++ b/src/templates/zshare/codemirror/index.jsx
@@ -240,7 +240,7 @@
           {fullScreen || func ? <Dropdown overlayClassName="mk-mirror-font" overlay={menu} placement="bottomRight">
             <FontSizeOutlined />
           </Dropdown> : null}
-          <SwapOutlined title="瀛楃鏇挎崲" onClick={() => this.setState({visible: true})}/>
+          {!mode ? <SwapOutlined title="瀛楃鏇挎崲" onClick={() => this.setState({visible: true})}/> : null}
           {display ? <CodeMirror
             className="code-mirror-area"
             value={defaultVal}
diff --git a/src/templates/zshare/verifycard/baseform/index.jsx b/src/templates/zshare/verifycard/baseform/index.jsx
index 533f446..705262e 100644
--- a/src/templates/zshare/verifycard/baseform/index.jsx
+++ b/src/templates/zshare/verifycard/baseform/index.jsx
@@ -6,6 +6,7 @@
 
 import Api from '@/api'
 import MkPrintTemps from '@/menu/components/share/actioncomponent/actionform/mkPrintTemps'
+import CodeMirror from '@/templates/zshare/codemirror'
 import './index.scss'
 
 const sysTempsIds = ['8IFltwzyKcu15iA8fqSyb6m-pMa88a3ZTu0No3vDHgo', 'LOB-bbt9jVncGh7IOAUdESh1Sgzcbt62UwOqSqcK9ok']
@@ -132,6 +133,8 @@
       error = '浣跨敤鍗曟嵁鎵撳嵃鏃讹紝闇�瑕侀�夋嫨鎵撳嵃妯℃澘锛�'
     } else if (verify.accountdate === 'true' && !verify.accountfield) {
       error = '寮�鍚处鏈熸椂锛岄渶瑕侀�夋嫨楠岃瘉鍏徃锛�'
+    } else if (verify.preHandle === 'true' && !verify.pre_func) {
+      error = '寮�鍚寜閽澶勭悊鏃讹紝闇�瑕佸~鍐欏鐞嗗嚱鏁帮紒'
     } else if (verify.wxNote === 'true') {
       if (!verify.wxTemplateId) {
         error = '寮�鍚叕浼楀彿娑堟伅鎺ㄩ�佹椂锛岄渶瑕侀�夋嫨娑堟伅妯℃澘锛�'
@@ -159,6 +162,9 @@
     if (_verify.accountdate !== 'true') {
       _verify.accountfield = ''
       _verify.voucherdate = ''
+    }
+    if (_verify.preHandle !== 'true') {
+      _verify.pre_func = ''
     }
     if (_verify.wxNote !== 'true') {
       _verify.wxTemplateId = ''
@@ -616,6 +622,23 @@
               </div>
             </div>
           </Col> : null}
+          <Col span={24}></Col>
+          <Col span={8}>
+            <Form.Item label={
+              <Tooltip placement="topRight" title="杩愯鏃朵慨鏀规寜閽弬鏁帮紝鍏ュ弬涓猴紙btn, systemType锛夈�傛敞锛歴ystemType涓虹郴缁熺被鍨嬶紝姝e紡绯荤粺涓簆roduction">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                鎸夐挳棰勫鐞�
+              </Tooltip>
+            }>
+              <Radio.Group value={verify.preHandle || 'false'} onChange={(e) => {this.onOptionChange(e.target.value, 'preHandle')}}>
+                <Radio value="true">寮�鍚�</Radio>
+                <Radio value="false">涓嶅紑鍚�</Radio>
+              </Radio.Group>
+            </Form.Item>
+          </Col>
+          {verify.preHandle === 'true' ? <Col span={24} style={{paddingLeft: '50px'}}>
+            <CodeMirror mode="text/javascript" theme="cobalt" value={verify.pre_func || ''} onChange={(val) => {this.onOptionChange(val, 'pre_func')}} />
+          </Col> : null}
         </Row>
       </Form>
     )
diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx
index 2dcdd58..26ce4cd 100644
--- a/src/templates/zshare/verifycard/index.jsx
+++ b/src/templates/zshare/verifycard/index.jsx
@@ -574,6 +574,7 @@
     _verify.printEnable = _verify.printEnable || 'false' // 鍗曟嵁鎵撳嵃鏄惁寮�鍚�
     _verify.noteType = _verify.noteType || 'N'           // 鐭俊鍙戦�佹ā寮忥細Y锛堝疄鏃讹級銆丯锛堝畾鏃讹級
     _verify.noteTemp = _verify.noteTemp || 'Y'           // 鐭俊鍙戦�佹ā鏉匡細Y锛堢浉鍚岋級銆丯锛堜笉鍚岋級
+    _verify.preHandle = _verify.preHandle || 'false'     // 鎸夐挳棰勫鐞嗘槸鍚﹀紑鍚�
     _verify.invalid = _invalid
     _verify.uniques = _verify.uniques || []
     _verify.contrasts = _verify.contrasts || []

--
Gitblit v1.8.0