From 102be577a7f8df2ae30045d55a1a5fc584f90363 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 19 十二月 2022 18:31:38 +0800
Subject: [PATCH] 2022-12-19

---
 src/menu/components/share/actioncomponent/actionform/index.jsx |  134 +++++++++++++++++++++++++++++---------------
 1 files changed, 88 insertions(+), 46 deletions(-)

diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx
index a6125a5..8cbf7ca 100644
--- a/src/menu/components/share/actioncomponent/actionform/index.jsx
+++ b/src/menu/components/share/actioncomponent/actionform/index.jsx
@@ -6,6 +6,7 @@
 import { formRule } from '@/utils/option.js'
 
 import asyncComponent from '@/utils/asyncComponent'
+import KeyInterface from '@/components/keyInterface'
 import './index.scss'
 
 const { TextArea } = Input
@@ -26,7 +27,6 @@
 
 class ActionForm extends Component {
   static propTpyes = {
-    dict: PropTypes.object,      // 瀛楀吀椤�
     type: PropTypes.any,         // type涓�"card"鏃讹紝鍙彲閫夊崟琛屾垨涓嶉�夎
     setting: PropTypes.object,   // 椤甸潰璁剧疆
     formlist: PropTypes.any,     // 琛ㄥ崟淇℃伅
@@ -77,13 +77,13 @@
   record = {}
   
   UNSAFE_componentWillMount () {
-    const { type, dict } = this.props
+    const { type } = this.props
 
     let requireOptions = [
-      { value: 'notRequired', text: dict['header.form.notRequired'] },
-      { value: 'requiredSgl', text: dict['header.form.requiredSgl'] },
-      { value: 'required', text: dict['header.form.required'] },
-      { value: 'requiredOnce', text: dict['header.form.requiredOnce'] }
+      { value: 'notRequired', text: '涓嶉�夋嫨琛�' },
+      { value: 'requiredSgl', text: '閫夋嫨鍗曡' },
+      { value: 'required', text: '閫夋嫨澶氳' },
+      { value: 'requiredOnce', text: '澶氳鎷兼帴' }
     ]
 
     if (type === 'card') {
@@ -178,7 +178,7 @@
         reReadonly.interface = false
         reRequired.interface = true
       } else if (intertype === 'outer') {
-        shows.push('procMode', 'sysInterface', 'interface', 'outerFunc', 'callbackType', 'output')
+        shows.push('procMode', 'sysInterface', 'outerFunc', 'callbackType', 'output')
         if (this.record.procMode === 'system') {
           shows.push('sql', 'sqlType')
         } else if (this.record.procMode === 'inner') {
@@ -195,10 +195,14 @@
           reReadonly.interface = false
           reRequired.interface = true
 
-          shows.push('proInterface')
-        } else {
+          shows.push('interface', 'proInterface')
+        } else if (this.record.sysInterface === 'true') {
           reReadonly.interface = true
           reRequired.interface = false
+
+          shows.push('interface')
+        } else if (this.record.sysInterface === 'external') {
+          shows.push('exInterface', 'exProInterface')
         }
       } else if (intertype === 'inner') {
         shows.push('innerFunc', 'output')
@@ -236,14 +240,16 @@
 
       if (this.record.formType === 'switch') {
         shows.push('field', 'size', 'openVal', 'closeVal', 'openText', 'closeText')
-      } else {
+      } else if (this.record.formType === 'radio') {
         shows.push('field', 'openVal', 'closeVal')
+      } else {
+        shows.push('field')
       }
 
       reOptions.intertype = this.state.interTypeOptions.filter(item => item.value !== 'custom')
 
       if (intertype === 'outer') {
-        shows.push('procMode', 'sysInterface', 'interface', 'outerFunc', 'callbackType')
+        shows.push('procMode', 'sysInterface', 'outerFunc', 'callbackType')
         if (this.record.procMode === 'system') {
           shows.push('sql', 'sqlType')
         } else if (this.record.procMode === 'inner') {
@@ -260,10 +266,14 @@
           reReadonly.interface = false
           reRequired.interface = true
 
-          shows.push('proInterface')
-        } else {
+          shows.push('interface', 'proInterface')
+        } else if (this.record.sysInterface === 'true') {
           reReadonly.interface = true
           reRequired.interface = false
+
+          shows.push('interface')
+        } else if (this.record.sysInterface === 'external') {
+          shows.push('exInterface', 'exProInterface')
         }
       } else if (intertype === 'inner') {
         shows.push('innerFunc')
@@ -292,7 +302,7 @@
       reOptions.Ot = requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
 
       if (this.record.intertype === 'outer') {
-        shows.push('innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc')
+        shows.push('innerFunc', 'sysInterface', 'outerFunc', 'callbackFunc')
         reRequired.innerFunc = false
         reRequired.callbackFunc = false
 
@@ -300,10 +310,14 @@
           reReadonly.interface = false
           reRequired.interface = true
 
-          shows.push('proInterface')
-        } else {
+          shows.push('interface', 'proInterface')
+        } else if (this.record.sysInterface === 'true') {
           reReadonly.interface = true
           reRequired.interface = false
+
+          shows.push('interface')
+        } else if (this.record.sysInterface === 'external') {
+          shows.push('exInterface', 'exProInterface')
         }
       } else if (this.record.intertype === 'inner') {
         shows.push('innerFunc')
@@ -316,17 +330,21 @@
       reOptions.intertype = this.state.interTypeOptions.filter(op => op.value !== 'custom')
 
       if (this.record.intertype === 'outer') {
-        shows.push('innerFunc', 'sysInterface', 'interface', 'outerFunc')
+        shows.push('innerFunc', 'sysInterface', 'outerFunc')
         reRequired.innerFunc = false
 
         if (this.record.sysInterface === 'false') {
           reReadonly.interface = false
           reRequired.interface = true
 
-          shows.push('proInterface')
-        } else {
+          shows.push('interface', 'proInterface')
+        } else if (this.record.sysInterface === 'true') {
           reReadonly.interface = true
           reRequired.interface = false
+
+          shows.push('interface')
+        } else if (this.record.sysInterface === 'external') {
+          shows.push('exInterface', 'exProInterface')
         }
       } else if (this.record.intertype === 'inner') {
         shows.push('innerFunc')
@@ -378,18 +396,22 @@
       if (_funcType === 'print') {
         shows.push('execMode', 'intertype', 'Ot', 'execSuccess', 'execError')
         if (this.record.intertype === 'outer') {
-          shows.push('innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc')
+          shows.push('innerFunc', 'sysInterface', 'outerFunc', 'callbackFunc')
           reRequired.innerFunc = false
           reRequired.callbackFunc = false
 
           if (this.record.sysInterface === 'false') {
             reReadonly.interface = false
             reRequired.interface = true
-
-            shows.push('proInterface')
-          } else {
+  
+            shows.push('interface', 'proInterface')
+          } else if (this.record.sysInterface === 'true') {
             reReadonly.interface = true
             reRequired.interface = false
+  
+            shows.push('interface')
+          } else if (this.record.sysInterface === 'external') {
+            shows.push('exInterface', 'exProInterface')
           }
         } else if (this.record.intertype === 'inner') {
           shows.push('innerFunc')
@@ -428,6 +450,9 @@
         shows.push('innerFunc', 'Ot', 'execSuccess', 'execError', 'urlkey')
       } else if (_funcType === 'pay') {
         shows.push('payType', 'Ot', 'execSuccess', 'execError', 'syncComponent', 'openmenu')
+        if (this.record.openmenu && this.record.openmenu !== 'goback') {
+          shows.push('open')
+        }
         reOptions.Ot = requireOptions.filter(op => ['requiredSgl'].includes(op.value))
       } else if (_funcType === 'refund') {
         shows.push('Ot', 'execSuccess', 'execError', 'syncComponent', 'openmenu')
@@ -524,21 +549,20 @@
       } else if (value === 'excelIn') {
         _fieldval.intertype = 'system'
         _fieldval.Ot = 'notRequired'
-        
-        _fieldval.label = this.props.dict['model.form.excelIn']
+        _fieldval.execSuccess = 'grid'
+        _fieldval.label = '瀵煎叆Excel'
         _fieldval.class = 'dgreen'
         this.record.Ot = 'notRequired'
-        this.record.label = this.props.dict['model.form.excelIn']
+        this.record.label = '瀵煎叆Excel'
         this.record.class = 'dgreen'
-       
-  
+        this.record.execSuccess = 'grid'
       } else if (value === 'excelOut') {
         _fieldval.intertype = 'system'
-        _fieldval.label = this.props.dict['model.form.excelOut']
+        _fieldval.label = '瀵煎嚭Excel'
         _fieldval.class = 'dgreen'
         _fieldval.execSuccess = 'never'
         this.record.Ot = 'notRequired'
-        this.record.label = this.props.dict['model.form.excelOut']
+        this.record.label = '瀵煎嚭Excel'
         this.record.class = 'dgreen'
         this.record.execSuccess = 'never'
   
@@ -563,10 +587,10 @@
   
       }
       if (value === 'excelIn') {
-        _fieldval.label = this.props.dict['model.form.excelIn']
+        _fieldval.label = '瀵煎叆Excel'
         _fieldval.class = 'dgreen'
       } else if (value === 'excelOut') {
-        _fieldval.label = this.props.dict['model.form.excelOut']
+        _fieldval.label = '瀵煎嚭Excel'
         _fieldval.class = 'dgreen'
         _fieldval.control = ''
         this.record.control = ''
@@ -696,7 +720,6 @@
   }
 
   getFields() {
-    const { dict } = this.props
     const { getFieldDecorator } = this.props.form
     const fields = []
 
@@ -719,7 +742,7 @@
       }
       if (item.type === 'text') {
         rules = [
-          { required: item.required, message: dict['form.required.input'] + item.label + '!' }
+          { required: item.required, message: '璇疯緭鍏�' + item.label + '!' }
         ]
   
         if (item.key === 'innerFunc') {
@@ -727,6 +750,11 @@
           let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g')
           rules.push(
             { pattern: _patten, message: formRule.func.innerMessage },
+            { max: formRule.func.max, message: formRule.func.maxMessage }
+          )
+        } else if (item.key === 'sql' || item.key === 'sheet') {
+          rules.push(
+            { pattern: /^[a-zA-Z0-9@_]+$/, message: '琛ㄥ悕鍙彲浣跨敤瀛楁瘝銆佹暟瀛椾互鍙奯' },
             { max: formRule.func.max, message: formRule.func.maxMessage }
           )
         } else if (item.key === 'outerFunc' || item.key === 'callbackFunc') {
@@ -759,13 +787,13 @@
         content = <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />
       } else if (item.type === 'number') {
         rules = [
-          { required: item.required, message: dict['form.required.input'] + item.label + '!' }
+          { required: item.required, message: '璇疯緭鍏�' + item.label + '!' }
         ]
 
         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 + '!' }
+          { required: item.required, message: '璇烽�夋嫨' + item.label + '!' }
         ]
 
         if (item.extendName) {
@@ -778,7 +806,7 @@
             getPopupContainer={() => document.getElementById('winter')}
           >
             {item.options.map((option, index) =>
-              <Select.Option key={index} extend={option[item.extendName] || ''} value={(option.value || option.field)}>
+              <Select.Option key={index} title={option.text || option.label} extend={option[item.extendName] || ''} value={(option.value || option.field)}>
                 {(option.text || option.label)}
               </Select.Option>
             )}
@@ -792,7 +820,7 @@
             getPopupContainer={() => document.getElementById('winter')}
           >
             {item.options.map((option, index) =>
-              <Select.Option key={index} value={(option.value || option.field)}>
+              <Select.Option key={index} title={option.text || option.label} value={(option.value || option.field)}>
                 {(option.text || option.label)}
               </Select.Option>
             )}
@@ -800,7 +828,7 @@
         }
       } else if (item.type === 'radio') {
         rules = [
-          { required: item.required, message: dict['form.required.select'] + item.label + '!' }
+          { required: item.required, message: '璇烽�夋嫨' + item.label + '!' }
         ]
 
         content = <Radio.Group onChange={(e) => {this.optionChange(item.key, e.target.value)}}>
@@ -808,7 +836,7 @@
         </Radio.Group>
       } else if (item.type === 'checkbox') {
         rules = [
-          { required: item.required, message: dict['form.required.select'] + item.label + '!' }
+          { required: item.required, message: '璇烽�夋嫨' + item.label + '!' }
         ]
 
         content = <Checkbox.Group>
@@ -817,13 +845,13 @@
       } else if (item.type === 'cascader') {
         initVal = item.initVal || []
         rules = [
-          { required: item.required, message: dict['form.required.select'] + item.label + '!' }
+          { required: item.required, message: '璇烽�夋嫨' + item.label + '!' }
         ]
 
         content = <Cascader options={item.options || []} expandTrigger="hover" placeholder=""/>
       } else if (item.type === 'icon') {
         rules = [
-          { required: item.required, message: dict['form.required.select'] + item.label + '!' }
+          { required: item.required, message: '璇烽�夋嫨' + item.label + '!' }
         ]
 
         content = <MkEditIcon options={['edit', 'hint', 'direction', 'normal', 'data']} allowClear/>
@@ -831,10 +859,18 @@
         span = 24
         className = 'textarea'
         rules = [
-          { required: item.readonly ? false : item.required, message: dict['form.required.input'] + item.label + '!' }
+          { required: item.readonly ? false : item.required, message: '璇疯緭鍏�' + item.label + '!' }
         ]
 
         content = <TextArea rows={2} readOnly={item.readonly}/>
+      } else if (item.type === 'keyinterface') {
+        span = 24
+        className = 'textarea'
+        rules = [
+          { required: item.required, message: '璇疯緭鍏�' + item.label + '!' }
+        ]
+
+        content = <KeyInterface type={item.key === 'exInterface' ? 'develop' : 'product'}/>
       }
 
       fields.push(
@@ -876,11 +912,17 @@
           values.uuid = card.uuid
           values.verify = card.verify || null
           values.modal = card.modal || null
+          values.config = card.config || null
 
           if (values.OpenType === 'form') {
-            if (/^(0|[1-9]\d*)$/.test(values.openVal) && /^(0|[1-9]\d*)$/.test(values.closeVal)) {
-              values.openVal = +values.openVal
-              values.closeVal = +values.closeVal
+            if (values.formType !== 'scan') {
+              if (/^(0|[1-9]\d*)$/.test(values.openVal) && /^(0|[1-9]\d*)$/.test(values.closeVal)) {
+                values.openVal = +values.openVal
+                values.closeVal = +values.closeVal
+              }
+            } else {
+              values.show = 'icon'
+              values.icon = 'scan'
             }
           } else if (values.OpenType === 'excelOut') {
             values.Ot = 'notRequired'

--
Gitblit v1.8.0