king
2021-10-21 1da6506bf58270bacc2a4345002c6b082835580e
src/templates/sharecomponent/actioncomponent/actionform/index.jsx
@@ -9,9 +9,9 @@
const { TextArea } = Input
const actionTypeOptions = {
  pop: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError'],
  prompt: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError'],
  exec: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError'],
  pop: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output'],
  prompt: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output'],
  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', 'placement'],
@@ -134,7 +134,7 @@
          } else if (['innerpage', 'tab', 'popview', 'excelIn'].includes(_opentype)) {
            item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
          } else if (card.sqlType === 'insert') {
            item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl', 'required'].includes(op.value))
            item.options = this.state.requireOptions.filter(op => ['notRequired'].includes(op.value))
          } else {
            item.options = this.state.requireOptions
          }
@@ -169,7 +169,7 @@
      try {
        let _form = document.getElementById('label')
        _form.select()
      } catch {
      } catch (e) {
        console.warn('表单focus失败!')
      }
    }
@@ -202,12 +202,14 @@
      }
    } else if (_opentype === 'funcbutton') {
      if (_funcType === 'print') {
        _options.push('execMode', 'intertype', 'Ot', 'execSuccess', 'execError')
        _options.push('execMode', 'intertype', 'Ot', 'execSuccess', 'execError', 'controlField', 'controlVal')
        if (_intertype === 'outer') {
          _options.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc')
        } else if (_intertype === 'inner') {
          _options.push('innerFunc')
        }
      } else if (_funcType === 'closetab') {
        _options.push('refreshTab')
      }
    } else if (_opentype !== 'popview') { // 打开方式不是弹窗页面时
      if (_intertype === 'custom') {
@@ -220,7 +222,7 @@
      } else if (_intertype === 'outer') {
        _options.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc')
      } else if (_intertype === 'inner') {
        _options.push('innerFunc')
        _options.push('innerFunc', 'preFunc')
      } else {
        _options.push('sql', 'sqlType')
      }
@@ -230,7 +232,7 @@
      _options.push('resetPageIndex')
    }
    if (_Ot !== 'notRequired' && _opentype !== 'excelOut') {
    if (_Ot !== 'notRequired' && _opentype !== 'excelOut' && _opentype !== 'funcbutton') {
      _options.push('controlField', 'controlVal')
    }
@@ -329,29 +331,15 @@
      }, () => {
        this.props.form.setFieldsValue(_fieldval)
      })
    // } else if (key === 'tabType') {
    //   let _tabs = this.props.tabs.filter(tab => tab.type === value)
    //   let _fieldval = {}
    //   this.setState({
    //     formlist: this.state.formlist.map(item => {
    //       if (item.key === 'linkTab') {
    //         item.options = [
    //           {
    //             value: '',
    //             text: '新建'
    //           },
    //           ..._tabs
    //         ]
    //       }
    //       return item
    //     })
    //   }, () => {
    //     this.props.form.setFieldsValue(_fieldval)
    //   })
    } else if (key === 'funcType') {
      let _options = this.getOptions('funcbutton', this.state.interType, value, card.pageTemplate, card.tabTemplate, procMode, Ot)
      let _fieldval = {}
      if (value === 'print') {
        _fieldval.label = '打印'
      } else if (value === 'closetab') {
        _fieldval.label = '关闭'
      }
      this.setState({
        funcType: value,
@@ -376,7 +364,7 @@
      this.setState({
        formlist: this.state.formlist.map(item => {
          if (item.key === 'Ot' && value === 'insert') {
            item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl', 'required'].includes(op.value))
            item.options = this.state.requireOptions.filter(op => ['notRequired'].includes(op.value))
          } else if (item.key === 'Ot') {
            item.options = this.state.requireOptions
          }
@@ -525,7 +513,7 @@
      if (item.type === 'text') { // 文本搜索
        let _rules = []
        if (item.key === 'innerFunc') {
        if (item.key === 'innerFunc' || item.key === 'preFunc') {
          let str = '^(' + item.fields.join('|') + ')'
          let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g')
          _rules = [{
@@ -587,7 +575,7 @@
                    message: this.props.dict['form.required.input'] + item.label + '!'
                  }
                ]
              })(<InputNumber min={0} max={10000} precision={0} />)}
              })(<InputNumber min={0} max={10000} precision={0} onPressEnter={this.handleSubmit}/>)}
            </Form.Item>
          </Col>
        )
@@ -613,6 +601,7 @@
                  showSearch
                  filterOption={(input, option) => option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0}
                  onChange={(value) => {this.optionChange(item.key, value)}}
                  allowClear={item.key === 'icon'}
                  getPopupContainer={() => document.getElementById('winter')}
                >
                  {item.options.map((option, index) =>
@@ -675,7 +664,12 @@
      } else if (item.type === 'cascader') { // 多选
        fields.push(
          <Col span={12} key={index}>
            <Form.Item label={item.label}>
            <Form.Item label={item.tooltip ?
              <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
                <Icon type="question-circle" />
                {item.label}
              </Tooltip> : item.label
            }>
              {getFieldDecorator(item.key, {
                initialValue: item.initVal || [],
                rules: [
@@ -733,6 +727,45 @@
                values.verify.invalid = 'true'
              }
            }
          } else if (values.OpenType === 'tab' && values.linkmenu) {
            if (sessionStorage.getItem('thdMenuList')) {
              let list = null
              try {
                list = JSON.parse(sessionStorage.getItem('thdMenuList')) || []
              } catch (e) {
                list = []
              }
              let id = values.linkmenu[values.linkmenu.length - 1]
              list.forEach(item => {
                if (item.MenuID === id) {
                  values.MenuID = id
                  values.MenuName = item.MenuName
                  values.MenuNo = item.MenuNo
                  values.tabType = item.type
                }
              })
            }
          }
          if (values.openmenu && Array.isArray(values.openmenu) && values.openmenu.length > 0) {
            let list = null
            try {
              list = JSON.parse(sessionStorage.getItem('thdMenuList')) || []
            } catch (e) {
              list = []
            }
            let id = values.openmenu[values.openmenu.length - 1]
            list.forEach(item => {
              if (item.MenuID === id) {
                values.MenuID = id
                values.MenuName = item.MenuName
                values.MenuNo = item.MenuNo
                values.tabType = item.type
              }
            })
          }
          resolve(values)