king
2021-11-08 0225695d43c773d16f4d0743ad205590eed58cec
src/menu/components/share/actioncomponent/actionform/index.jsx
@@ -10,11 +10,11 @@
const { TextArea } = Input
const MkIcon = asyncComponent(() => import('@/components/mkIcon'))
const actionTypeOptions = {
  pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width', 'openmenu', 'open', 'output'],
  prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width', 'openmenu', 'open', 'output'],
  exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width', 'openmenu', 'open', 'output'],
  excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'sheet', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width'],
  excelOut: ['label', 'OpenType', 'intertype', 'show', 'icon', 'class', 'execSuccess', 'execError', 'syncComponent', 'resetPageIndex', 'pagination', 'search', 'width'],
  pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'output', 'refreshTab', 'reload'],
  prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'output', 'refreshTab', 'reload'],
  exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'output', 'refreshTab', 'reload'],
  excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'sheet', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width'],
  excelOut: ['label', 'OpenType', 'intertype', 'show', 'icon', 'class', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'resetPageIndex', 'pagination', 'search', 'width'],
  popview: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'popClose', 'resetPageIndex', 'width', 'display', 'ratio', 'placement'],
  tab: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'linkmenu', 'width'],
  innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'show', 'icon', 'class', 'width', 'open'],
@@ -113,18 +113,30 @@
          item.options = btnCustomClasses
        } else if (item.key === 'innerFunc' && _procMode === 'inner') {
          item.required = true
        } else if (item.key === 'linkmenu') {
          if (_opentype === 'funcbutton' && _funcType === 'scan') {
            item.required = false
            item.tooltip = '使用扫码登录功能或菜单跳转功能时,需选择跳转的菜单。'
          } else {
            item.tooltip = ''
            item.required = true
          }
        } else if (item.key === 'intertype') {
          let iscustom = ['pop', 'prompt', 'exec'].includes(_opentype)
          item.options = this.state.interTypeOptions.filter(op => (iscustom || op.value !== 'custom'))
        } else if (item.key === 'Ot') {
          if (type === 'card') {
            item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
            if (card.sqlType === 'insert') {
              item.options = this.state.requireOptions.filter(op => ['notRequired'].includes(op.value))
            } else {
              item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
            }
          } else if (_pageTemplate === 'pay') { // 行级按钮、支付按钮,只能选单行
            item.options = this.state.requireOptions.filter(op => ['requiredSgl'].includes(op.value))
          } 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
          }
@@ -146,7 +158,7 @@
  getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot) => {
    let _options = actionTypeOptions[_opentype] ? fromJS(actionTypeOptions[_opentype]).toJS() : [] // 选项列表
    if (_opentype === 'innerpage') {         // 新页面,可选模板(自定义时,可填入外部链接)
      if (_pageTemplate === 'custom') {
        _options.push('url', 'joint')
@@ -179,6 +191,10 @@
        _options.push('execSuccess', 'execError')
      } else if (_funcType === 'closetab') {
        _options.push('refreshTab')
      } else if (_funcType === 'scan') {
        _options.push('linkmenu')
      } else if (_funcType === 'goBack') {
        _options.push('reload')
      }
    } else if (_opentype !== 'popview' && _opentype !== 'tab') {
      if (_intertype === 'custom') {
@@ -268,6 +284,14 @@
          _fieldval.sqlType = ''
        } else if (item.key === 'pageTemplate') {
          item.initVal = ''
        } else if (item.key === 'linkmenu') {
          if (value === 'funcbutton' && this.state.funcType === 'scan') {
            item.required = false
            item.tooltip = '使用扫码登录功能或菜单跳转功能时,需选择跳转的菜单。'
          } else {
            item.tooltip = ''
            item.required = true
          }
        }
        return item
@@ -294,7 +318,14 @@
      let _options = this.getOptions(openType, this.state.interType, value, pageTemplate, procMode, Ot)
      let _fieldval = {}
      if (value === 'print') {
        _fieldval.label = '打印'
      } else if (value === 'closetab') {
        _fieldval.label = '关闭'
      }
      this.setState({
        funcType: value,
        formlist: this.state.formlist.map(item => {
          item.hidden = !_options.includes(item.key)
@@ -308,6 +339,14 @@
            } else {
              item.options = this.state.requireOptions
            }
          } else if (item.key === 'linkmenu') {
            if (value === 'scan') {
              item.required = false
              item.tooltip = '使用扫码登录功能或菜单跳转功能时,需选择跳转的菜单。'
            } else {
              item.tooltip = ''
              item.required = true
            }
          }
          return item
@@ -320,9 +359,13 @@
      this.setState({
        formlist: this.state.formlist.map(item => {
          if (item.key === 'Ot' && type === 'card') {
            item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
            if (value === 'insert') {
              item.options = this.state.requireOptions.filter(op => ['notRequired'].includes(op.value))
            } else {
              item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
            }
          } else 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
          }
@@ -339,7 +382,7 @@
          _fieldval.Ot = 'requiredSgl'
        } else if (value === 'audit') {
          _fieldval.label = '审核'
          _fieldval.class = 'purple'
          _fieldval.class = 'primary'
          _fieldval.Ot = 'requiredSgl'
        } else if (value === 'LogicDelete' || value === 'delete') {
          _fieldval.label = '删除'
@@ -617,10 +660,15 @@
            </Form.Item>
          </Col>
        )
      } else if (item.type === 'cascader') { // 多选
      } 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: [
@@ -630,7 +678,7 @@
                  }
                ]
              })(
                <Cascader options={item.options || []} placeholder=""/>
                <Cascader options={item.options || []} expandTrigger="hover" placeholder=""/>
              )}
            </Form.Item>
          </Col>
@@ -649,18 +697,6 @@
                ]
              })(
                <MkIcon allowClear/>
              )}
            </Form.Item>
          </Col>
        )
      } else if (item.type === 'mcascader') {
        fields.push(
          <Col span={12} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.key, {
                initialValue: item.initVal
              })(
                <Cascader options={item.options} expandTrigger="hover" placeholder="" />
              )}
            </Form.Item>
          </Col>
@@ -709,6 +745,46 @@
                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)