From 176c6e1da22e96a1110fa91f8fc8eb8ad2881e08 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 08 八月 2022 18:13:37 +0800
Subject: [PATCH] 2022-08-08

---
 src/templates/sharecomponent/actioncomponent/actionform/index.jsx |  123 ++++++++++++++++++++++++++++++-----------
 1 files changed, 90 insertions(+), 33 deletions(-)

diff --git a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx
index d45b22d..0a94c8d 100644
--- a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { fromJS } from 'immutable'
-import { Form, Row, Col, Input, Select, Radio, notification, Tooltip, InputNumber, Cascader } from 'antd'
+import { Form, Row, Col, Input, Select, Radio, Tooltip, InputNumber, Cascader, Typography } from 'antd'
 import { QuestionCircleOutlined } from '@ant-design/icons'
 
 import { formRule } from '@/utils/option.js'
@@ -12,16 +12,17 @@
 const MkEditIcon = asyncComponent(() => import('@/components/mkIcon'))
 
 const { TextArea } = Input
+const { Paragraph } = Typography
 const actionTypeOptions = {
-  pop: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output', 'tipTitle'],
-  prompt: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output', 'tipTitle'],
-  exec: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output'],
-  excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'icon', 'class', 'sheet', 'execSuccess', 'execError'],
-  excelOut: ['label', 'OpenType', 'intertype', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'],
-  popview: ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose', 'display', 'ratio', 'clickouter'],
-  tab: ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'linkmenu'],
-  innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position'],
-  funcbutton: ['label', 'OpenType', 'funcType', 'icon', 'class']
+  pop: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output', 'tipTitle', 'hidden'],
+  prompt: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output', 'tipTitle', 'hidden'],
+  exec: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output', 'hidden'],
+  excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'icon', 'class', 'sheet', 'execSuccess', 'execError', 'hidden'],
+  excelOut: ['label', 'OpenType', 'intertype', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search', 'hidden'],
+  popview: ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose', 'display', 'ratio', 'clickouter', 'hidden'],
+  tab: ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'linkmenu', 'hidden'],
+  innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position', 'hidden'],
+  funcbutton: ['label', 'OpenType', 'funcType', 'icon', 'class', 'hidden']
 }
 
 class MainSearch extends Component {
@@ -30,7 +31,8 @@
     setting: PropTypes.object,   // 椤甸潰璁剧疆
     formlist: PropTypes.any,     // 琛ㄥ崟淇℃伅
     card: PropTypes.any,         // 鎸夐挳淇℃伅
-    inputSubmit: PropTypes.any   // 鍥炶溅鎻愪氦浜嬩欢
+    inputSubmit: PropTypes.func, // 鍥炶溅鎻愪氦浜嬩欢
+    updRecord: PropTypes.func
   }
 
   state = {
@@ -126,6 +128,8 @@
         console.warn('琛ㄥ崟focus澶辫触锛�')
       }
     }
+
+    this.props.updRecord && this.props.updRecord(this.record)
   }
 
   getMutilOptions = () => {
@@ -145,18 +149,34 @@
       reOptions.intertype = this.state.interTypeOptions
 
       if (intertype === 'custom') {
-        shows.push('procMode', 'interface', 'callbackType', 'cbTable', 'proInterface', 'method', 'cross')
+        shows.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross')
         if (this.record.procMode === 'system') {
           shows.push('sql', 'sqlType')
-        } else {
+        } else if (this.record.procMode === 'inner') {
           reRequired.innerFunc = true
           shows.push('innerFunc')
+        }
+        if (this.record.callbackType === 'func') {
+          shows.push('callbackFunc')
+        } else if (this.record.callbackType !== 'none') {
+          shows.push('cbTable')
         }
         reReadonly.interface = false
         reRequired.interface = true
       } else if (intertype === 'outer') {
-        shows.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc', 'output')
-        reRequired.innerFunc = false
+        shows.push('procMode', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackType', 'output')
+        // reRequired.innerFunc = false
+        if (this.record.procMode === 'system') {
+          shows.push('sql', 'sqlType')
+        } else if (this.record.procMode === 'inner') {
+          reRequired.innerFunc = true
+          shows.push('innerFunc')
+        }
+        if (this.record.callbackType === 'func') {
+          shows.push('callbackFunc')
+        } else if (this.record.callbackType !== 'none') {
+          shows.push('cbTable')
+        }
 
         if (this.record.sysInterface === 'false') {
           reReadonly.interface = false
@@ -165,11 +185,15 @@
           reReadonly.interface = true
           reRequired.interface = false
         }
-      } else if (intertype === 'inner') {
+      } else if (intertype === 'inner') { // preFunc 鍓嶇疆鍑芥暟
         shows.push('innerFunc', 'output')
         reRequired.innerFunc = true
       } else {
         shows.push('sql', 'sqlType', 'output')
+      }
+
+      if (Ot === 'required') {
+        shows.push('progress')
       }
 
       if (this.record.sqlType === 'insert') {
@@ -190,6 +214,7 @@
       if (this.record.intertype === 'outer') {
         shows.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc')
         reRequired.innerFunc = false
+        reRequired.callbackFunc = false
 
         if (this.record.sysInterface === 'false') {
           reReadonly.interface = false
@@ -252,6 +277,7 @@
         if (this.record.intertype === 'outer') {
           shows.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc')
           reRequired.innerFunc = false
+          reRequired.callbackFunc = false
 
           if (this.record.sysInterface === 'false') {
             reReadonly.interface = false
@@ -266,6 +292,13 @@
         }
       } else if (_funcType === 'closetab') {
         shows.push('refreshTab')
+      } else if (_funcType === 'megvii') {
+        shows.push('subFunc', 'progress')
+      } else if (_funcType === 'filezip') {
+        reOptions.Ot = requireOptions
+        reRequired.innerFunc = false
+
+        shows.push('innerFunc', 'Ot', 'execSuccess', 'execError', 'urlkey')
       }
     }
 
@@ -327,7 +360,6 @@
       if (value === 'pop' || value === 'prompt' || value === 'exec') {
         _fieldval.intertype = 'system'
         _fieldval.sqlType = ''
-  
       } else if (value === 'excelIn') {
         _fieldval.intertype = 'system'
         _fieldval.Ot = 'notRequired'
@@ -337,15 +369,15 @@
         this.record.Ot = 'notRequired'
         this.record.label = this.props.dict['model.form.excelIn']
         this.record.class = 'dgreen'
-       
-  
       } else if (value === 'excelOut') {
         _fieldval.intertype = 'system'
         _fieldval.label = this.props.dict['model.form.excelOut']
         _fieldval.class = 'dgreen'
+        _fieldval.execSuccess = 'never'
         this.record.Ot = 'notRequired'
         this.record.label = this.props.dict['model.form.excelOut']
         this.record.class = 'dgreen'
+        this.record.execSuccess = 'never'
   
       } else if (value === 'popview') {
         _fieldval.display = 'modal'
@@ -383,6 +415,8 @@
       if (!['funcbutton', 'excelIn', 'excelOut'].includes(value)) {
         _fieldval.position = 'toolbar'
       }
+
+      this.props.updRecord && this.props.updRecord(this.record)
     } else if (key === 'position') {
       if (value === 'grid') {
         _fieldval.Ot = 'requiredSgl'
@@ -408,12 +442,14 @@
         _fieldval.class = 'purple'
       } else if (value === 'audit') {
         _fieldval.label = '瀹℃牳'
-        _fieldval.Ot = 'requiredSgl'
+        _fieldval.Ot = 'required'
         _fieldval.class = 'primary'
       } else if (value === 'LogicDelete' || value === 'delete') {
         _fieldval.label = '鍒犻櫎'
-        _fieldval.Ot = 'requiredSgl'
+        _fieldval.Ot = 'required'
         _fieldval.class = 'danger'
+      } else if (value === 'custom') {
+        _fieldval.Ot = 'required'
       }
 
       if (this.record.position === 'grid') {
@@ -437,6 +473,8 @@
       }
     } else if (key === 'intertype') {
       this.record.sysInterface = 'false'
+
+      this.props.updRecord && this.props.updRecord(this.record)
     } else if (key === 'sysInterface') {
       if (value === 'true') {
         _fieldval.interface = window.GLOB.mainSystemApi || ''
@@ -499,7 +537,7 @@
         ]
   
         if (item.key === 'innerFunc') {
-          let str = '^(' + item.fields.join('|') + ')'
+          let str = item.fields && item.fields.length ? '^(' + item.fields.join('|') + ')' : '^'
           let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g')
           rules.push(
             { pattern: _patten, message: formRule.func.innerMessage },
@@ -510,6 +548,24 @@
             { pattern: formRule.func.pattern, message: formRule.func.message },
             { max: formRule.func.max, message: formRule.func.maxMessage }
           )
+        } else if (item.key === 'output') {
+          if (this.record.intertype === 'system' || ((this.record.intertype === 'outer' || this.record.intertype === 'custom') && this.record.callbackType === 'script')) {
+            rules = [{
+              pattern: /^@[0-9a-zA-Z_]+@?$/,
+              message: '鍙橀噺浠绗﹀紑澶达紝鍙娇鐢ㄥ瓧姣嶃�佹暟瀛椾互鍙奯'
+            }, {
+              max: 100,
+              message: '鏈�澶�100涓瓧绗︺��'
+            }]
+          } else {
+            rules = [{
+              pattern: /^[0-9a-zA-Z_]*$/,
+              message: '瀛楁鍙娇鐢ㄥ瓧姣嶃�佹暟瀛椾互鍙奯'
+            }, {
+              max: 100,
+              message: '鏈�澶�100涓瓧绗︺��'
+            }]
+          }
         } else {
           rules.push({ max: formRule.input.max, message: formRule.input.message })
         }
@@ -520,7 +576,7 @@
           { required: item.required, message: dict['form.required.input'] + item.label + '!' }
         ]
 
-        content = <InputNumber min={item.min} max={item.max} precision={item.precision} />
+        content = <InputNumber min={item.min} max={item.max} precision={item.precision} onPressEnter={this.handleSubmit}/>
       } else if (item.type === 'select') {
         rules = [
           { required: item.required, message: dict['form.required.select'] + item.label + '!' }
@@ -586,11 +642,21 @@
         </Col>
       )
     })
+
+    if (window.debugger && this.props.card.uuid) {
+      fields.push(
+        <Col span={12} key="uuid">
+          <Form.Item label="鎸夐挳ID">
+            <Paragraph copyable>{this.props.card.uuid}</Paragraph>
+          </Form.Item>
+        </Col>
+      )
+    }
     return fields
   }
 
   handleConfirm = () => {
-    const { setting, card } = this.props
+    const { card } = this.props
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
     return new Promise((resolve, reject) => {
       this.props.form.validateFieldsAndScroll((err, values) => {
@@ -600,15 +666,6 @@
           values.position = values.position || 'toolbar'
 
           if (values.OpenType === 'excelOut') {
-            if (values.intertype === 'system' && setting.interType !== 'system') { // 瀵煎嚭excel闇�浣跨敤鏌ヨ鏁版嵁婧�
-              notification.warning({
-                top: 92,
-                message: '琛ㄦ牸鏁版嵁鏌ヨ鏈娇鐢ㄧ郴缁熷嚱鏁帮紝瀵煎嚭Excel涓嶅彲浣跨敤绯荤粺鍑芥暟锛�',
-                duration: 5
-              })
-              return
-            }
-            
             values.Ot = 'notRequired'
           } else if (values.OpenType === 'popview' && !values.linkTab) { // 娌℃湁鍏宠仈鏍囩锛堟柊寤烘椂锛夛紝鍒涘缓鏂版爣绛綢d
             values.linkTab = Utils.getuuid()

--
Gitblit v1.8.0