king
2022-12-19 102be577a7f8df2ae30045d55a1a5fc584f90363
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')
@@ -245,7 +249,7 @@
      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') {
@@ -262,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')
@@ -294,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
@@ -302,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')
@@ -318,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')
@@ -380,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')
@@ -529,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'
  
@@ -568,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 = ''
@@ -701,7 +720,6 @@
  }
  getFields() {
    const { dict } = this.props
    const { getFieldDecorator } = this.props.form
    const fields = []
@@ -724,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') {
@@ -732,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') {
@@ -764,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) {
@@ -783,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>
            )}
@@ -797,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>
            )}
@@ -805,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)}}>
@@ -813,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>
@@ -822,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/>
@@ -836,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(
@@ -881,6 +912,7 @@
          values.uuid = card.uuid
          values.verify = card.verify || null
          values.modal = card.modal || null
          values.config = card.config || null
          if (values.OpenType === 'form') {
            if (values.formType !== 'scan') {