king
2022-03-29 b6cbfb08b51e87e6eac995be8e7751815715e6a1
src/menu/components/share/actioncomponent/actionform/index.jsx
@@ -11,15 +11,16 @@
const { TextArea } = Input
const MkEditIcon = asyncComponent(() => import('@/components/mkIcon'))
const acTyOptions = {
  pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'refreshTab', 'reload'],
  prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'refreshTab', 'reload'],
  exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'refreshTab', 'reload'],
  pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'refreshTab', 'position', 'tipTitle'],
  prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'refreshTab', 'position', 'tipTitle'],
  exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'refreshTab'],
  excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'color', 'sheet', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width'],
  excelOut: ['label', 'OpenType', 'intertype', 'show', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'resetPageIndex', 'pagination', 'search', 'width'],
  popview: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'color', 'popClose', 'resetPageIndex', 'width', 'display', 'ratio', 'syncComponent', 'clickouter'],
  tab: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'color', 'linkmenu', 'width'],
  innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'show', 'swipe', 'icon', 'class', 'color', 'width', 'open'],
  funcbutton: ['label', 'OpenType', 'funcType', 'show', 'swipe', 'icon', 'class', 'color', 'width']
  funcbutton: ['label', 'OpenType', 'funcType', 'show', 'swipe', 'icon', 'class', 'color', 'width'],
  form: ['label', 'OpenType', 'formType', 'intertype', 'Ot', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width', 'open', 'refreshTab', 'title']
}
class ActionForm extends Component {
@@ -38,13 +39,13 @@
    requireOptions: [],
    insertUpdateOptions: [{
      value: 'insert',
      text: this.props.dict['header.form.action.insert']
      text: '添加'
    }, {
      value: 'update',
      text: this.props.dict['header.form.action.update']
      text: '修改'
    }, {
      value: 'audit',
      text: this.props.dict['header.form.action.audit']
      text: '审核'
    }],
    deleteOptions: [{
      value: 'LogicDelete',
@@ -54,7 +55,7 @@
      text: '物理删除'
    }, {
      value: 'custom',
      text: this.props.dict['header.form.custom']
      text: '自定义'
    }],
    interTypeOptions: [{
      value: 'system',
@@ -197,6 +198,50 @@
      } else {
        reOptions.sqlType = this.state.insertUpdateOptions
      }
      // if (this.record.execSuccess === 'goback') {
        shows.push('reload')
      // }
    } else if (openType === 'form') {
      let intertype = this.record.intertype
      if (this.record.formType === 'switch') {
        shows.push('field', 'size', 'openVal', 'closeVal', 'openText', 'closeText')
      } else {
        shows.push('field', 'openVal', 'closeVal')
      }
      reOptions.intertype = this.state.interTypeOptions.filter(item => item.value !== 'custom')
      if (intertype === 'outer') {
        shows.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc')
        reRequired.innerFunc = false
        if (this.record.sysInterface === 'false') {
          reReadonly.interface = false
          reRequired.interface = true
        } else {
          reReadonly.interface = true
          reRequired.interface = false
        }
      } else if (intertype === 'inner') {
        shows.push('innerFunc')
        reRequired.innerFunc = true
      } else {
        shows.push('sql', 'sqlType')
      }
      if (this.record.execSuccess === 'goback') {
        shows.push('reload')
      }
      reOptions.Ot = requireOptions
      reOptions.sqlType = [{
        value: 'update',
        text: '修改'
      }, {
        value: 'custom',
        text: '自定义'
      }]
    } else if (openType === 'excelIn') {
      reOptions.intertype = this.state.interTypeOptions.filter(op => op.value !== 'custom')
      reOptions.Ot = requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
@@ -251,7 +296,11 @@
      if (this.record.pageTemplate === 'custom') {
        shows.push('url', 'joint')
      } else if (this.record.pageTemplate === 'linkpage') {
        shows.push('linkmenu', 'joint')
        shows.push('linkmenu')
        if (Ot === 'requiredSgl') {
          shows.push('joint')
        }
        reRequired.linkmenu = true
        reTooltip.linkmenu = ''
@@ -309,6 +358,9 @@
        if (this.record.control) {
          shows.push('controlField', 'controlVal')
        }
        if (this.record.control === 'disabled') {
          shows.push('reason')
        }
      }
    } else {
      if (Ot !== 'notRequired') {
@@ -332,6 +384,9 @@
      }
      if (this.record.control) {
        shows.push('controlField', 'controlVal')
      }
      if (this.record.control === 'disabled') {
        shows.push('reason')
      }
    }
@@ -375,6 +430,10 @@
        _fieldval.intertype = 'system'
        _fieldval.sqlType = ''
  
      } else if (value === 'form') {
        _fieldval.Ot = 'requiredSgl'
        this.record.Ot = 'requiredSgl'
      } else if (value === 'excelIn') {
        _fieldval.intertype = 'system'
        _fieldval.Ot = 'notRequired'
@@ -446,10 +505,12 @@
      } else if (value === 'update') {
        _fieldval.label = '修改'
        _fieldval.Ot = 'requiredSgl'
        if (hasclass) {
          _fieldval.class = 'purple'
        } else {
          _fieldval.color = 'primary'
        if (this.record.OpenType !== 'form') {
          if (hasclass) {
            _fieldval.class = 'purple'
          } else {
            _fieldval.color = 'primary'
          }
        }
      } else if (value === 'audit') {
        _fieldval.label = '审核'
@@ -469,10 +530,10 @@
        }
      }
      this.record.label = _fieldval.label
      this.record.Ot = _fieldval.Ot
      this.record.class = _fieldval.class || ''
      this.record.color = _fieldval.color || ''
      this.record.label = _fieldval.label || this.record.label || ''
      this.record.Ot = _fieldval.Ot || this.record.Ot || ''
      this.record.class = _fieldval.class || this.record.class || ''
      this.record.color = _fieldval.color || this.record.color || ''
      if (appType !== 'mob' && _fieldval.Ot === 'notRequired') {
        this.record.control = ''
@@ -549,6 +610,14 @@
      let content = null
      let initVal = item.initVal || ''
      if (item.type === 'splitLine') {
        fields.push(
          <Col span={24} key={index}>
            <p style={{borderBottom: '1px solid #e9e9e9', color: '#1890ff', textAlign: 'center'}}>{item.label}</p>
          </Col>
        )
        return
      }
      if (item.type === 'text') {
        rules = [
          { required: item.required, message: dict['form.required.input'] + item.label + '!' }
@@ -582,19 +651,36 @@
          { required: item.required, message: dict['form.required.select'] + item.label + '!' }
        ]
        content = <Select
          showSearch
          allowClear={item.allowClear === true}
          filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
          onChange={(value) => {this.optionChange(item.key, value)}}
          getPopupContainer={() => document.getElementById('winter')}
        >
          {item.options.map((option, index) =>
            <Select.Option key={index} value={(option.value || option.field)}>
              {(option.text || option.label)}
            </Select.Option>
          )}
        </Select>
        if (item.extendName) {
          content = <Select
            showSearch
            allowClear={item.allowClear === true}
            filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 ||
              option.props.extend.toLowerCase().indexOf(input.toLowerCase()) >= 0}
            onChange={(value) => {this.optionChange(item.key, value)}}
            getPopupContainer={() => document.getElementById('winter')}
          >
            {item.options.map((option, index) =>
              <Select.Option key={index} extend={option[item.extendName] || ''} value={(option.value || option.field)}>
                {(option.text || option.label)}
              </Select.Option>
            )}
          </Select>
        } else {
          content = <Select
            showSearch
            allowClear={item.allowClear === true}
            filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
            onChange={(value) => {this.optionChange(item.key, value)}}
            getPopupContainer={() => document.getElementById('winter')}
          >
            {item.options.map((option, index) =>
              <Select.Option key={index} value={(option.value || option.field)}>
                {(option.text || option.label)}
              </Select.Option>
            )}
          </Select>
        }
      } else if (item.type === 'radio') {
        rules = [
          { required: item.required, message: dict['form.required.select'] + item.label + '!' }
@@ -655,11 +741,16 @@
          values.verify = card.verify || null
          values.modal = card.modal || null
          if (values.OpenType === 'excelOut') {
          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
            }
          } else if (values.OpenType === 'excelOut') {
            if (values.intertype === 'system' && setting.interType !== 'system') {
              notification.warning({
                top: 92,
                message: '表格数据查询未使用数据源,导出Excel使用内部接口时,需自定义内部函数!',
                message: '表格数据查询未使用系统函数,导出Excel不可使用系统函数!',
                duration: 5
              })
              return