king
2023-06-14 08cce3334a2dc81d690b518136b0aaea64e48b0b
src/menu/components/share/actioncomponent/actionform/index.jsx
@@ -12,6 +12,7 @@
const { TextArea } = Input
const { Paragraph } = Typography
const MkEditIcon = asyncComponent(() => import('@/components/mkIcon'))
const MKTable = asyncComponent(() => import('@/components/normalform/modalform/mkTable'))
const acTyOptions = {
  pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden'],
  prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden'],
@@ -92,6 +93,8 @@
    let hasclass = true
    this.props.formlist.forEach(item => {
      if (!item.key) return
      this.record[item.key] = item.initVal
      if (item.key === 'class') {
@@ -206,6 +209,9 @@
        }
      } else if (intertype === 'inner') {
        shows.push('innerFunc', 'output')
        if (Ot === 'requiredOnce') { // 前置函数
          shows.push('preFunc')
        }
        reRequired.innerFunc = true
      } else {
        shows.push('sql', 'sqlType', 'output')
@@ -517,6 +523,10 @@
      }
    }
    if (shows.includes('syncComponent') && this.record.syncComponent[0] === 'multiComponent') {
      shows.push('syncComponents')
    }
    if (this.record.show === 'icon') {
      reRequired.icon = true
    } else {
@@ -552,7 +562,6 @@
      this.record.pageTemplate = ''
      this.record.funcType = ''
      this.record.sqlType = ''
      if (value === 'pop' || value === 'prompt' || value === 'exec') {
        _fieldval.intertype = 'system'
        _fieldval.sqlType = ''
@@ -565,10 +574,10 @@
        _fieldval.Ot = 'notRequired'
        _fieldval.execSuccess = 'grid'
        _fieldval.label = '导入Excel'
        _fieldval.class = 'dgreen'
        _fieldval.class = 'border-dgreen'
        this.record.Ot = 'notRequired'
        this.record.label = '导入Excel'
        this.record.class = 'dgreen'
        this.record.class = 'border-dgreen'
        this.record.execSuccess = 'grid'
      } else if (value === 'excelOut') {
        _fieldval.intertype = 'system'
@@ -576,11 +585,12 @@
        _fieldval.class = 'dgreen'
        _fieldval.execSuccess = 'never'
        _fieldval.Ot = 'requiredOnce'
        _fieldval.control = ''
        this.record.Ot = 'requiredOnce'
        this.record.label = '导出Excel'
        this.record.class = 'dgreen'
        this.record.execSuccess = 'never'
        this.record.control = ''
      } else if (value === 'popview') {
        _fieldval.display = 'modal'
        _fieldval.Ot = 'requiredSgl'
@@ -600,15 +610,6 @@
      } else if (value === 'funcbutton') {
        // _fieldval.funcType = ''
  
      }
      if (value === 'excelIn') {
        _fieldval.label = '导入Excel'
        _fieldval.class = 'dgreen'
      } else if (value === 'excelOut') {
        _fieldval.label = '导出Excel'
        _fieldval.class = 'dgreen'
        _fieldval.control = ''
        this.record.control = ''
      }
      if (appType !== 'mob' && _fieldval.Ot === 'notRequired') {
@@ -772,7 +773,7 @@
            { pattern: /^[a-zA-Z0-9@_]+$/, message: '表名只可使用字母、数字以及_' },
            { max: formRule.func.max, message: formRule.func.maxMessage }
          )
        } else if (item.key === 'outerFunc' || item.key === 'callbackFunc') {
        } else if (item.key === 'outerFunc' || item.key === 'callbackFunc' || item.key === 'preFunc') {
          rules.push(
            { pattern: formRule.func.pattern, message: formRule.func.message },
            { max: formRule.func.max, message: formRule.func.maxMessage }
@@ -864,7 +865,14 @@
          { required: item.required, message: '请选择' + item.label + '!' }
        ]
        content = <Cascader options={item.options || []} expandTrigger="hover" placeholder=""/>
        content = <Cascader onChange={(value) => {this.optionChange(item.key, value)}} options={item.options || []} expandTrigger="hover" placeholder=""/>
      } else if (item.type === 'table') {
        span = 24
        className = 'textarea'
        rules = [
          { required: item.required, message: '请添加' + item.label + '!' }
        ]
        content = (<MKTable tip={''} columns={item.columns || []} actions={[]}/>)
      } else if (item.type === 'icon') {
        rules = [
          { required: item.required, message: '请选择' + item.label + '!' }
@@ -930,6 +938,59 @@
          values.modal = card.modal || null
          values.config = card.config || null
          if (card.OpenType === 'excelOut' && values.OpenType === 'excelIn') {
            if (values.verify && values.verify.columns && values.verify.columns.length > 0) {
              values.verify.columns = values.verify.columns.map(col => {
                col.required = col.required || 'true'
                col.type = col.type || 'Nvarchar(50)'
                col.import = col.import || 'true'
                if (col.type === 'text' || col.type === 'image') {
                  col.type = 'Nvarchar(50)'
                } else if (col.type === 'number') {
                  col.type = 'Decimal(18,2)'
                }
                if (/^Nvarchar/ig.test(col.type)) {
                  col.limit = col.type.match(/\d+/)[0]
                } else if (/^Decimal/ig.test(col.type)) {
                  col.limit = col.type.match(/\d+/ig)[1]
                } else {
                  col.limit = ''
                }
                delete col.output
                delete col.abs
                delete col.Width
                return col
              })
              values.verify.sheet = values.verify.sheet || 'Sheet1'
            }
          } else if (card.OpenType === 'excelIn' && values.OpenType === 'excelOut') {
            if (values.verify && values.verify.columns && values.verify.columns.length > 0) {
              values.verify.columns = values.verify.columns.map(col => {
                col.type = col.type || 'text'
                col.output = col.output || 'true'
                col.required = col.required || 'false'
                col.Width = 20
                if (!['text', 'image', 'number'].includes(col.type)) {
                  if (/^Decimal/ig.test(col.type)) {
                    col.type = 'number'
                  } else {
                    col.type = 'text'
                  }
                }
                delete col.import
                return col
              })
            }
          }
          if (values.OpenType === 'form') {
            if (values.formType !== 'scan') {
              if (/^(0|[1-9]\d*)$/.test(values.openVal) && /^(0|[1-9]\d*)$/.test(values.closeVal)) {
@@ -953,7 +1014,7 @@
                values.verify.invalid = 'true'
              }
            }
          } else if (values.OpenType === 'tab' && values.linkmenu) {
          } else if (values.OpenType === 'tab' && values.linkmenu && Array.isArray(values.linkmenu)) {
            if (sessionStorage.getItem('thdMenuList')) {
              let list = null
              try {
@@ -994,7 +1055,7 @@
              }
            })
          }
          resolve(values)
        } else {
          reject(err)