king
2021-09-01 31ec63f0419895876cbaba99637a884a32d33d0d
src/templates/sharecomponent/actioncomponent/actionform/index.jsx
@@ -14,7 +14,7 @@
  exec: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError'],
  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'],
  popview: ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose', 'display', 'ratio', 'placement'],
  tab: ['label', 'Ot', 'OpenType', 'tabTemplate', 'icon', 'class', 'position'],
  innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position'],
  funcbutton: ['label', 'OpenType', 'funcType', 'icon', 'class']
@@ -38,6 +38,7 @@
    position: null,  // 按钮位置
    procMode: null,  // 外部接口参数处理方式
    pageTemplate: null,
    Ot: null,
    requireOptions: [{
      value: 'notRequired',
      text: this.props.dict['header.form.notRequired']
@@ -97,18 +98,18 @@
    let _funcType = card.funcType || ''         // 功能按钮默认类型
    let _tabTemplate = card.tabTemplate         // 按钮为标签页时,标签类型:三级菜单或表单标签页
    let _pageTemplate = card.pageTemplate       // 新页面类型
    let _Ot = card.Ot || 'requiredSgl'
    if (_opentype === 'outerpage') {
      card.pageTemplate = 'custom'
      _opentype = 'innerpage'
    } else if (_opentype === 'blank') {
      _opentype = 'tab'
    }
    let _tabs = this.props.tabs.filter(tab => tab.type === 'SubTable')
    let _options = this.getOptions(_opentype, _intertype, _funcType, _pageTemplate, _tabTemplate, _procMode)
    let _options = this.getOptions(_opentype, _intertype, _funcType, _pageTemplate, _tabTemplate, _procMode, _Ot)
    
    this.setState({
      Ot: _Ot,
      openType: _opentype,
      pageTemplate: _pageTemplate,
      interType: _intertype,
@@ -130,7 +131,7 @@
            item.options = this.state.requireOptions.filter(op => ['requiredSgl'].includes(op.value))
          } else if (_opentype === 'innerpage' && _pageTemplate === 'billprint') {
            item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl', 'required'].includes(op.value))
          } else if (['innerpage', 'blank', 'tab', 'popview', 'excelIn'].includes(_opentype)) {
          } 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))
@@ -168,13 +169,13 @@
      try {
        let _form = document.getElementById('label')
        _form.select()
      } catch {
      } catch (e) {
        console.warn('表单focus失败!')
      }
    }
  }
  getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _tabTemplate, _procMode) => {
  getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _tabTemplate, _procMode, _Ot) => {
    let _options = fromJS(actionTypeOptions[_opentype]).toJS() // 选项列表
    
    if (_opentype === 'innerpage') {         // 新页面,可选模板(自定义时,可填入外部链接)
@@ -183,7 +184,7 @@
      } else if (_pageTemplate === 'billprint') {
        _options.push('printTemp')
      }
    } else if (_opentype === 'blank' || _opentype === 'tab') { // 新标签或当前页面替换
    } else if (_opentype === 'tab') {         // 标签页
      if (_tabTemplate === 'ThdMenu') {
        _options.push('linkmenu')
      }
@@ -201,16 +202,18 @@
      }
    } 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') {
        _options.push('procMode', 'interface', 'callbackType', 'cbTable', 'proInterface', 'method')
        _options.push('procMode', 'interface', 'callbackType', 'cbTable', 'proInterface', 'method', 'cross')
        if (_procMode === 'system') {
          _options.push('sql', 'sqlType')
        } else {
@@ -229,6 +232,10 @@
      _options.push('resetPageIndex')
    }
    if (_Ot !== 'notRequired' && _opentype !== 'excelOut' && _opentype !== 'funcbutton') {
      _options.push('controlField', 'controlVal')
    }
    return _options
  }
@@ -236,11 +243,11 @@
   * @description 切换
   */
  optionChange = (key, value) => {
    const { openType, funcType, procMode } = this.state
    const { openType, funcType, procMode, Ot } = this.state
    const { card } = this.props
    if (key === 'OpenType') {
      let _options = this.getOptions(value, 'system', '', this.state.pageTemplate, card.tabTemplate, 'system')
      let _options = this.getOptions(value, 'system', '', this.state.pageTemplate, card.tabTemplate, 'system', Ot)
      let _fieldval = {}
      let _formlist = this.state.formlist.map(item => {
        item.hidden = !_options.includes(item.key)
@@ -261,7 +268,7 @@
          } else if (value === 'innerpage' && this.state.pageTemplate === 'billprint') {
            item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl', 'required'].includes(op.value))
            _fieldval.Ot = 'requiredSgl'
          } else if (['innerpage', 'blank', 'tab', 'popview'].includes(value)) {
          } else if (['innerpage', 'tab', 'popview'].includes(value)) {
            item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
            _fieldval.Ot = 'requiredSgl'
          } else if (value === 'excelIn') {
@@ -312,7 +319,7 @@
            } else if (openType === 'innerpage' && this.state.pageTemplate === 'billprint') {
              item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl', 'required'].includes(op.value))
              _fieldval.Ot = 'requiredSgl'
            } else if (['innerpage', 'blank', 'tab', 'popview'].includes(openType)) {
            } else if (['innerpage', 'tab', 'popview'].includes(openType)) {
              item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
              _fieldval.Ot = 'requiredSgl'
            } else {
@@ -345,7 +352,7 @@
    //     this.props.form.setFieldsValue(_fieldval)
    //   })
    } else if (key === 'funcType') {
      let _options = this.getOptions('funcbutton', this.state.interType, value, card.pageTemplate, card.tabTemplate, procMode)
      let _options = this.getOptions('funcbutton', this.state.interType, value, card.pageTemplate, card.tabTemplate, procMode, Ot)
      let _fieldval = {}
      this.setState({
@@ -399,7 +406,7 @@
        this.props.form.setFieldsValue(_fieldval)
      })
    } else if (key === 'pageTemplate') {
      let _options = this.getOptions('innerpage', this.state.interType, this.state.funcType, value, card.tabTemplate, procMode)
      let _options = this.getOptions('innerpage', this.state.interType, this.state.funcType, value, card.tabTemplate, procMode, Ot)
      let _fieldval = {}
      this.setState({
@@ -440,7 +447,7 @@
        })
      })
    } else if (key === 'intertype') {
      let _options = this.getOptions(openType, value, funcType, '', '', procMode)
      let _options = this.getOptions(openType, value, funcType, '', '', procMode, Ot)
      this.setState({
        interType: value,
@@ -460,7 +467,7 @@
        })
      })
    } else if (key === 'procMode') {
      let _options = this.getOptions(openType, this.state.interType, funcType, '', '', value)
      let _options = this.getOptions(openType, this.state.interType, funcType, '', '', value, Ot)
      this.setState({
        procMode: value,
@@ -470,6 +477,16 @@
          if (item.key === 'innerFunc') {
            item.required = true
          }
          return item
        })
      })
    } else if (key === 'Ot') {
      let _options = this.getOptions(openType, this.state.interType, funcType, this.state.pageTemplate, card.tabTemplate, procMode, value)
      this.setState({
        Ot: value,
        formlist: this.state.formlist.map(item => {
          item.hidden = !_options.includes(item.key)
          return item
        })
      })
@@ -598,11 +615,12 @@
                  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) =>
                    <Select.Option id={`${index}`} title={option.text} key={`${index}`} value={option.value}>
                      {item.key === 'icon' && option.value && <Icon type={option.value} />} {option.text}
                    <Select.Option id={`${index}`} title={option.text} key={`${index}`} value={option.value || option.field}>
                      {item.key === 'icon' && option.value ? <Icon type={option.value} /> : null} {option.text || option.label}
                    </Select.Option>
                  )}
                </Select>
@@ -613,7 +631,12 @@
      } else if (item.type === 'radio') {
        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: [
@@ -700,7 +723,6 @@
            values.Ot = 'notRequired'
          } else if (values.OpenType === 'popview' && !values.linkTab) { // 没有关联标签(新建时),创建新标签Id
            values.linkTab = Utils.getuuid()
            values.createTab = true // 用于标记按钮复制时,是否复制原有标签
          } else if (values.OpenType === 'funcbutton') { // 转换打印时打开方式
            values.position = 'toolbar'
          } else if (['pop', 'prompt', 'exec'].includes(values.OpenType) && values.verify) {