king
2023-11-14 ef8acbf3859bd13e759fbb9b8ba726039c1fb2c5
2023-11-14
11个文件已修改
167 ■■■■■ 已修改文件
src/menu/components/form/formaction/actionform/index.jsx 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/form/formaction/formconfig.jsx 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/form/simple-form/index.jsx 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/normalbutton/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/index.jsx 83 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/mkInput/index.jsx 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/mkNumberInput/index.jsx 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/mkPopSelect/index.jsx 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/mkSelect/index.jsx 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/mkVercode/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/modalform/index.jsx 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/form/formaction/actionform/index.jsx
@@ -57,10 +57,12 @@
    } else if (this.record.type === 'close' || this.record.type === 'reset') {
      shows = ['typeName', 'label']
    } else {
      shows = ['typeName', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'output', 'reload', 'preButton', 'resetForm'] // 选项列表
      shows = ['typeName', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'output', 'reload', 'preButton'] // 选项列表
      if (this.record.execSuccess === 'never') {
        shows.push('resetForms')
      }
      if (this.record.intertype === 'custom') {
        shows.pop()
        shows.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross', 'stringify', 'ContentType', 'outerBlacklist')
        if (this.record.procMode === 'system') {
          shows.push('sql', 'sqlType')
@@ -282,6 +284,7 @@
              })(
                <Select
                  showSearch
                  mode={item.mode || ''}
                  filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                  onChange={(value) => {this.optionChange(item.key, value)}}
                  getPopupContainer={() => document.getElementById('winter')}
@@ -380,6 +383,9 @@
          if (values.outerBlacklist) {
            values.outerBlacklist = values.outerBlacklist.replace(/\s/ig, '')
          }
          if (values.resetForms && values.resetForms.length === 0) {
            values.resetForms = null
          }
          resolve(values)
        } else {
          reject(err)
src/menu/components/form/formaction/formconfig.jsx
@@ -125,18 +125,13 @@
  let resets = []
  fields.forEach(item => {
    if (item.hidden === 'true') return
    if (item.type !== 'text' && item.type !== 'number') return
    resets.push({
      value: item.uuid,
      value: item.field,
      text: item.label
    })
  })
  if (card.resetForm && resets.findIndex(item => item.value === card.resetForm) === -1) {
    card.resetForm = ''
  }
  return [
    {
@@ -492,12 +487,12 @@
    },
    {
      type: 'select',
      key: 'resetForm',
      key: 'resetForms',
      label: '重置表单',
      tooltip: '按钮执行成功后需要重置的表单,表单会恢复默认值并聚焦。',
      initVal: card.resetForm || '',
      initVal: card.resetForms || [],
      required: false,
      allowClear: true,
      mode: 'multiple',
      options: resets
    },
    {
src/tabviews/custom/components/form/simple-form/index.jsx
@@ -383,12 +383,12 @@
    }
  }
  mkFormSubmit = (btnId, callback) => {
  mkFormSubmit = (btnId, callback, formId) => {
    const { group } = this.state
    if (group.uuid !== btnId) return
    this.formRef.handleConfirm().then(res => {
    this.formRef.handleConfirm(formId).then(res => {
      MKEmitter.emit('triggerFormSubmit', {menuId: btnId, form: res})
    }, () => {
      callback && callback()
@@ -432,7 +432,7 @@
          data={data}
          action={group}
          unload={config.setting.supModule && !BID}
          inputSubmit={() => this.mkFormSubmit(group.uuid)}
          inputSubmit={(id) => this.mkFormSubmit(group.uuid, null, id)}
          wrappedComponentRef={(inst) => this.formRef = inst}
        /> : null}
        {data ? <div className={'mk-form-action ' + (group.$button || '')}>
src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -2176,8 +2176,8 @@
    const { btn } = this.props
    const { autoMatic } = this.state
    if (btn.resetForm) {
      MKEmitter.emit('mkFC', 'reset', btn.resetForm)
    if (btn.resetForms) {
      MKEmitter.emit('resetForms', btn.uuid)
    }
    if (this.preCallback) {
src/tabviews/zshare/mutilform/index.jsx
@@ -46,10 +46,12 @@
    ID: '',
    send_type: '',
    timestamp: '',
    n_id: ''
    n_id: '',
    focusId: ''
  }
  record = {}
  submitId = ''
  componentDidMount () {
    const { action, unload } = this.props
@@ -268,7 +270,7 @@
      }
      if (item.type === 'number') {
        if (isNaN(item.initval)) {
        if (isNaN(item.initval) || item.initval === '') {
          item.initval = 0
        }
      } else if (['select', 'link', 'radio', 'checkbox', 'checkcard', 'multiselect', 'cascader'].includes(item.type) && item.resourceType === '1') {
@@ -623,17 +625,19 @@
      }
      record[item.field] = item.initval
      item.orgval = item.initval
      if (linkFields[item.field]) {
        item.linkFields = linkFields[item.field]
      }
      
      if (item.enter === 'tab' || item.enter === 'sub') {
        if (fieldMap.has(item.tabField)) {
        item.tabUuid = ''
        if (item.tabField && fieldMap.has(item.tabField)) {
          item.tabUuid = fieldMap.get(item.tabField).uuid
        } else if (item.enter === 'tab') {
          item.enter = 'false'
        } else if (item.enter === 'sub') {
        } else if (item.enter === 'sub' && ['text', 'number'].includes(item.type)) {
          item.tabUuid = item.uuid
        }
      }
@@ -670,13 +674,16 @@
    this.record = record
    let ID = this.props.data ? this.props.data.$$uuid || '' : ''
    let focusItem = null
    this.setState({ formlist, ID }, () => {
    if (action.setting.focus && fieldMap.has(action.setting.focus)) {
      focusItem = fieldMap.get(action.setting.focus)
    }
    this.setState({ formlist, ID, focusId: focusItem ? focusItem.uuid : '' }, () => {
      if (unload) return
      
      if (action.setting && action.setting.focus && fieldMap.has(action.setting.focus)) {
        let focusItem = fieldMap.get(action.setting.focus)
      if (focusItem) {
        if (focusItem.type === 'text' || focusItem.type === 'number') {
          setTimeout(() => {
            MKEmitter.emit('mkFC', 'focus', focusItem.uuid)
@@ -702,6 +709,62 @@
        }
      }
    })
    if (action.subButton && action.subButton.resetForms) {
      MKEmitter.addListener('resetForms', this.resetForms)
    }
  }
  componentWillUnmount () {
    this.setState = () => {
      return
    }
    MKEmitter.removeListener('resetForms', this.resetForms)
  }
  resetForms = (id) => {
    const { action } = this.props
    const { focusId } = this.state
    if (id !== action.uuid) return
    let formlist = fromJS(this.state.formlist).toJS()
    let resetForms = action.subButton.resetForms || []
    formlist = formlist.map(item => {
      if (item.type !== 'text' && item.type !== 'number') return item
      if (resetForms.includes(item.field)) {
        item.initval = item.orgval
        this.record[item.field] = item.orgval
      }
      return item
    })
    let _list = fromJS(formlist).toJS().map(item => {
      if (item.type !== 'text' && item.type !== 'number') return item
      if (resetForms.includes(item.field) && !item.hidden) {
        item.hidden = true
      }
      return item
    })
    this.setState({
      formlist: _list
    }, () => {
      this.setState({
        formlist
      })
    })
    if (focusId || this.submitId) {
      setTimeout(() => {
        MKEmitter.emit('mkFC', 'focus', this.submitId || focusId)
      }, 50)
    }
  }
  getFormData = (deForms) => {
@@ -1218,7 +1281,7 @@
    return fields
  }
  handleConfirm = () => {
  handleConfirm = (formId) => {
    const { formlist, send_type, timestamp, n_id } = this.state
    // 表单提交时检查输入值是否正确
@@ -1316,6 +1379,8 @@
          forms.push(_item)
        })
        this.submitId = formId || ''
        resolve(forms)
      })
    })
src/tabviews/zshare/mutilform/mkInput/index.jsx
@@ -78,22 +78,6 @@
      } else {
        this.props.onChange(_val, true)
      }
    } else if (type === 'reset') {
      let _val = this.props.config.initval
      if (this.state.encryption === 'true' && _val) {
        try {
          _val = window.decodeURIComponent(window.atob(_val))
        } catch (e) {
          _val = this.props.config.initval
        }
      }
      this.setState({value: _val}, () => {
        this.inputRef.current.select()
      })
      this.props.onChange(this.props.config.initval)
    }
  }
@@ -139,7 +123,7 @@
      MKEmitter.emit('mkFC', 'focus', config.tabUuid)
    } else {
      MKEmitter.emit('mkFC', 'focus', config.tabUuid)
      this.props.onSubmit()
      this.props.onSubmit(config.tabUuid)
    }
  }
src/tabviews/zshare/mutilform/mkNumberInput/index.jsx
@@ -44,15 +44,6 @@
    } else if (type === 'input') {
      this.setState({value})
      this.props.onChange(value, true)
    } else if (type === 'reset') {
      let _val = this.props.config.initval
      this.setState({value: _val}, () => {
        let node = document.getElementById(this.props.config.uuid)
        node && node.select()
      })
      this.props.onChange(_val)
    }
  }
@@ -80,7 +71,7 @@
      MKEmitter.emit('mkFC', 'focus', config.tabUuid)
    } else {
      MKEmitter.emit('mkFC', 'focus', config.tabUuid)
      this.props.onSubmit()
      this.props.onSubmit(config.tabUuid)
    }
  }
src/tabviews/zshare/mutilform/mkPopSelect/index.jsx
@@ -265,12 +265,13 @@
      if (config.enter === 'tab') {
        MKEmitter.emit('mkFC', 'focus', config.tabUuid)
      } else if (config.enter === 'sub') {
        config.tabUuid && MKEmitter.emit('mkFC', 'focus', config.tabUuid)
        if (config.subFields) {
          setTimeout(() => {
            this.props.onSubmit()
            this.props.onSubmit(config.tabUuid)
          }, 1000)
        } else {
          this.props.onSubmit()
          this.props.onSubmit(config.tabUuid)
        }
      }
    })
src/tabviews/zshare/mutilform/mkSelect/index.jsx
@@ -149,12 +149,13 @@
      if (config.enter === 'tab') {
        MKEmitter.emit('mkFC', 'focus', config.tabUuid)
      } else if (config.enter === 'sub') {
        config.tabUuid && MKEmitter.emit('mkFC', 'focus', config.tabUuid)
        if (config.linkFields || config.subFields || config.controlFields) {
          setTimeout(() => {
            this.props.onSubmit()
            this.props.onSubmit(config.tabUuid)
          }, 1000)
        } else {
          this.props.onSubmit()
          this.props.onSubmit(config.tabUuid)
        }
      }
    })
src/tabviews/zshare/mutilform/mkVercode/index.jsx
@@ -55,8 +55,8 @@
    if (config.enter === 'tab') {
      MKEmitter.emit('mkFC', 'focus', config.tabUuid)
    } else {
      MKEmitter.emit('mkFC', 'focus', config.tabUuid)
      this.props.onSubmit()
      config.tabUuid && MKEmitter.emit('mkFC', 'focus', config.tabUuid)
      this.props.onSubmit(config.tabUuid)
    }
  }
src/templates/zshare/modalform/index.jsx
@@ -289,6 +289,10 @@
      if (this.record.interception === 'func') {
        shows.push('func')
      }
    } else if (type === 'popSelect') {
      if (this.record.enter === 'tab' || this.record.enter === 'sub') {
        shows.push('tabField')
      }
    }
    if (['multiselect', 'select', 'link', 'radio', 'checkbox', 'checkcard', 'cascader'].includes(type)) {
@@ -383,7 +387,7 @@
      if (value === 'text' || value === 'number') {
        this.record.enter = 'sub'
        _fieldval.enter = 'sub'
      } else if (value === 'select' || value === 'link') {
      } else if (['select', 'link', 'popSelect', 'vercode'].includes(value)) {
        _fieldval.enter = 'false'
      }