king
2024-05-22 3ecc98d6ba3fe31b9694bad348cbbb08c1b0dd81
2024-05-22
9个文件已修改
211 ■■■■ 已修改文件
src/menu/components/form/simple-form/index.jsx 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/form/step-form/index.jsx 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/form/tab-form/index.jsx 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/modalconfig/index.jsx 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/mob/modalconfig/index.jsx 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/index.jsx 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/mkSelect/index.jsx 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/index.jsx 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/modalform/index.jsx 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/form/simple-form/index.jsx
@@ -41,8 +41,7 @@
    visible: false,
    editform: null,
    formlist: null,
    sqlVerifing: false,
    standardform: null
    sqlVerifing: false
  }
  UNSAFE_componentWillMount () {
@@ -346,23 +345,17 @@
   * @description 表单编辑
   */
  handleForm = (_item) => {
    const { card, appType } = this.state
    const { card } = this.state
    let _form = fromJS(_item).toJS()
    let _inputfields = []
    let _tabfields = []
    let _linkableFields = []
    let _linksupFields = []
    let standardform = null
    let index = null
    card.subcards[0].fields.forEach((item, i) => {
      if (_form.uuid === item.uuid) {
        index = i
      }
      if (!item.field || _form.field === item.field) return
      if (['text', 'number', 'textarea', 'color'].includes(item.type)) {
      if (['text', 'number', 'textarea', 'select'].includes(item.type)) {
        _inputfields.push({
          field: item.field,
          label: item.label
@@ -397,14 +390,6 @@
      })
    })
    if (index !== null) {
      if (index === 0) {
        standardform = card.subcards[0].fields[index + 1] || null
      } else {
        standardform = card.subcards[0].fields[index - 1] || null
      }
    }
    let _fields = _linkableFields.map(cell => cell.field)
    card.columns.forEach(col => {
      if (col.field && !_fields.includes(col.field)) {
@@ -420,13 +405,7 @@
      _form.linkSubField = _form.linkSubField.filter(item => fields.includes(item))
    }
    if (appType !== 'mob' && !_form.span && standardform && standardform.span) {
      _form.span = standardform.span
      _form.labelwidth = standardform.labelwidth
    }
    this.setState({
      standardform,
      visible: true,
      editform: _form,
      formlist: getModalForm(_form, _inputfields, _tabfields, _linkableFields, _linksupFields, card.columns)
@@ -442,7 +421,7 @@
  handleSubmit = () => {
    let _config = fromJS(this.state.card).toJS()
    this.formRef.handleConfirm(_config.subcards[0].fields).then(res => {
    this.formRef.handleConfirm().then(res => {
      _config.subcards[0].fields = _config.subcards[0].fields.map(item => {
        delete item.focus
@@ -687,7 +666,7 @@
            card={this.state.editform}
            formlist={this.state.formlist}
            inputSubmit={this.handleSubmit}
            standardform={this.state.standardform}
            fields={card.subcards[0].fields}
            wrappedComponentRef={(inst) => this.formRef = inst}
          />
        </Modal>
src/menu/components/form/step-form/index.jsx
@@ -42,8 +42,7 @@
    visible: false,
    editform: null,
    formlist: null,
    sqlVerifing: false,
    standardform: null
    sqlVerifing: false
  }
  UNSAFE_componentWillMount () {
@@ -447,23 +446,17 @@
   * @description 表单编辑
   */
  handleForm = (_item) => {
    const { card, group, appType } = this.state
    const { card, group } = this.state
    let _form = fromJS(_item).toJS()
    let _inputfields = []
    let _tabfields = []
    let _linkableFields = []
    let _linksupFields = []
    let standardform = null
    let index = null
    group.fields.forEach((item, i) => {
      if (_form.uuid === item.uuid) {
        index = i
      }
      if (!item.field || _form.field === item.field) return
      if (['text', 'number', 'textarea', 'color'].includes(item.type)) {
      if (['text', 'number', 'textarea', 'select'].includes(item.type)) {
        _inputfields.push({
          field: item.field,
          label: item.label
@@ -499,14 +492,6 @@
      })
    })
    if (index !== null) {
      if (index === 0) {
        standardform = group.fields[index + 1] || null
      } else {
        standardform = group.fields[index - 1] || null
      }
    }
    let _fields = _linkableFields.map(cell => cell.field)
    card.columns.forEach(col => {
      if (col.field && !_fields.includes(col.field)) {
@@ -522,13 +507,7 @@
      _form.linkSubField = _form.linkSubField.filter(item => fields.includes(item))
    }
    if (appType !== 'mob' && !_form.span && standardform && standardform.span) {
      _form.span = standardform.span
      _form.labelwidth = standardform.labelwidth
    }
    this.setState({
      standardform,
      visible: true,
      editform: _form,
      formlist: getModalForm(_form, _inputfields, _tabfields, _linkableFields, _linksupFields, card.columns)
@@ -544,7 +523,7 @@
  handleSubmit = () => {
    let _config = fromJS(this.state.group).toJS()
    this.formRef.handleConfirm(_config.fields).then(res => {
    this.formRef.handleConfirm().then(res => {
      _config.fields = _config.fields.map(item => {
        delete item.focus
@@ -803,7 +782,7 @@
            card={this.state.editform}
            formlist={this.state.formlist}
            inputSubmit={this.handleSubmit}
            standardform={this.state.standardform}
            fields={group.fields}
            wrappedComponentRef={(inst) => this.formRef = inst}
          />
        </Modal>
src/menu/components/form/tab-form/index.jsx
@@ -42,8 +42,7 @@
    visible: false,
    editform: null,
    formlist: null,
    sqlVerifing: false,
    standardform: null
    sqlVerifing: false
  }
  UNSAFE_componentWillMount () {
@@ -453,23 +452,17 @@
   * @description 表单编辑
   */
  handleForm = (_item) => {
    const { card, group, appType } = this.state
    const { card, group } = this.state
    let _form = fromJS(_item).toJS()
    let _inputfields = []
    let _tabfields = []
    let _linkableFields = []
    let _linksupFields = []
    let standardform = null
    let index = null
    group.fields.forEach((item, i) => {
      if (_form.uuid === item.uuid) {
        index = i
      }
      if (!item.field || _form.field === item.field) return
      if (['text', 'number', 'textarea', 'color'].includes(item.type)) {
      if (['text', 'number', 'textarea', 'select'].includes(item.type)) {
        _inputfields.push({
          field: item.field,
          label: item.label
@@ -504,14 +497,6 @@
      })
    })
    if (index !== null) {
      if (index === 0) {
        standardform = group.fields[index + 1] || null
      } else {
        standardform = group.fields[index - 1] || null
      }
    }
    let _fields = _linkableFields.map(cell => cell.field)
    card.columns.forEach(col => {
      if (col.field && !_fields.includes(col.field)) {
@@ -527,13 +512,7 @@
      _form.linkSubField = _form.linkSubField.filter(item => fields.includes(item))
    }
    if (appType !== 'mob' && !_form.span && standardform && standardform.span) {
      _form.span = standardform.span
      _form.labelwidth = standardform.labelwidth
    }
    this.setState({
      standardform,
      visible: true,
      editform: _form,
      formlist: getModalForm(_form, _inputfields, _tabfields, _linkableFields, _linksupFields, card.columns)
@@ -549,7 +528,7 @@
  handleSubmit = () => {
    let _config = fromJS(this.state.group).toJS()
    this.formRef.handleConfirm(_config.fields).then(res => {
    this.formRef.handleConfirm().then(res => {
      _config.fields = _config.fields.map(item => {
        delete item.focus
@@ -805,7 +784,7 @@
            card={this.state.editform}
            formlist={this.state.formlist}
            inputSubmit={this.handleSubmit}
            standardform={this.state.standardform}
            fields={group.fields}
            wrappedComponentRef={(inst) => this.formRef = inst}
          />
        </Modal>
src/menu/modalconfig/index.jsx
@@ -40,7 +40,6 @@
    originConfig: null,    // 原始菜单
    sqlVerifing: false,    // sql验证
    showField: false,      // 显示表单字段值
    standardform: null,
    saving: false
  }
@@ -110,17 +109,11 @@
    let _tabfields = []
    let _linkableFields = []
    let _linksupFields = []
    let standardform = null
    let index = null
    config.fields.forEach((item, i) => {
      if (card.uuid === item.uuid) {
        index = i
      }
      if (!item.field || card.field === item.field) return
      if (['text', 'number', 'textarea', 'color'].includes(item.type)) {
      if (['text', 'number', 'textarea', 'select'].includes(item.type)) {
        _inputfields.push({
          field: item.field,
          label: item.label
@@ -154,13 +147,6 @@
        label: item.label + '-表单'
      })
    })
    if (index !== null) {
      if (index === 0) {
        standardform = config.fields[index + 1] || null
      } else {
        standardform = config.fields[index - 1] || null
      }
    }
    let columns = componentConfig.columns
    if (btn.$sub) {
@@ -182,16 +168,7 @@
      card.linkSubField = card.linkSubField.filter(item => fields.includes(item))
    }
    if (!card.span && standardform && standardform.span) {
      card.span = standardform.span
      card.labelwidth = standardform.labelwidth
    } else if (!card.span) {
      card.span = 12
      card.labelwidth = 33.3
    }
    this.setState({
      standardform,
      visible: true,
      card: card,
      formlist: getModalForm(card, _inputfields, _tabfields, _linkableFields, _linksupFields, columns)
@@ -533,7 +510,7 @@
            card={card}
            formlist={this.state.formlist}
            inputSubmit={this.handleSubmit}
            standardform={this.state.standardform}
            fields={config.fields}
            wrappedComponentRef={(inst) => this.formRef = inst}
          />
        </Modal>
src/mob/modalconfig/index.jsx
@@ -38,7 +38,6 @@
    originConfig: null,    // 原始菜单
    sqlVerifing: false,    // sql验证
    showField: false,      // 显示表单字段值
    standardform: null,
    saving: false
  }
@@ -112,17 +111,11 @@
    let _tabfields = []
    let _linkableFields = []
    let _linksupFields = []
    let standardform = null
    let index = null
    config.fields.forEach((item, i) => {
      if (card.uuid === item.uuid) {
        index = i
      }
      if (!item.field || card.field === item.field) return
      if (['text', 'number', 'textarea', 'color'].includes(item.type)) {
      if (['text', 'number', 'textarea', 'select'].includes(item.type)) {
        _inputfields.push({
          field: item.field,
          label: item.label
@@ -157,14 +150,6 @@
      })
    })
    if (index !== null) {
      if (index === 0) {
        standardform = config.fields[index + 1] || null
      } else {
        standardform = config.fields[index - 1] || null
      }
    }
    let columns = componentConfig.columns
    if (btn.$sub) {
      columns = componentConfig.subColumns || []
@@ -186,7 +171,6 @@
    }
    this.setState({
      standardform,
      visible: true,
      card: card,
      formlist: getModalForm(card, _inputfields, _tabfields, _linkableFields, _linksupFields, columns)
@@ -468,7 +452,7 @@
            card={card}
            formlist={this.state.formlist}
            inputSubmit={this.handleSubmit}
            standardform={this.state.standardform}
            fields={config.fields}
            wrappedComponentRef={(inst) => this.formRef = inst}
          />
        </Modal>
src/tabviews/zshare/mutilform/index.jsx
@@ -547,7 +547,7 @@
          item.subFields = []
          item.linkSubField.forEach(m => {
            let n = fieldMap.get(m)
            if (n && ['text', 'number', 'textarea'].includes(n.type)) {
            if (n && ['text', 'number', 'textarea', 'select'].includes(n.type)) {
              item.subFields.push({
                uuid: n.uuid,
                field: m
@@ -570,7 +570,7 @@
          item.subFields = []
          item.linkSubField.forEach(m => {
            let n = fieldMap.get(m)
            if (n && ['text', 'number', 'textarea'].includes(n.type)) {
            if (n && ['text', 'number', 'textarea', 'select'].includes(n.type)) {
              item.subFields.push({
                uuid: n.uuid,
                field: m
@@ -590,7 +590,7 @@
          item.subFields = []
          item.linkSubField.forEach(m => {
            let n = fieldMap.get(m)
            if (n && ['text', 'number', 'textarea'].includes(n.type)) {
            if (n && ['text', 'number', 'textarea', 'select'].includes(n.type)) {
              item.subFields.push({
                uuid: n.uuid,
                field: m
@@ -602,7 +602,7 @@
          item.subFields = []
          item.linkSubField.forEach(m => {
            let n = fieldMap.get(m)
            if (n && ['text', 'number', 'textarea'].includes(n.type)) {
            if (n && ['text', 'number', 'textarea', 'select'].includes(n.type)) {
              item.subFields.push({
                uuid: n.uuid,
                field: m
src/tabviews/zshare/mutilform/mkSelect/index.jsx
@@ -79,12 +79,15 @@
    MKEmitter.removeListener('mkFC', this.mkFormFocus)
  }
  mkFormFocus = (type, uuid) => {
  mkFormFocus = (type, uuid, val, level) => {
    if (uuid !== this.props.config.uuid) return
    if (type !== 'focus') return
    if (type === 'focus') {
    let _div = document.getElementById(uuid)
    _div && _div.click && _div.click()
    } else if (type === 'input' && (!level || level < 10)) {
      let _level = level || 1
      this.selectChange(val, _level++)
    }
  }
  mkFormHandle = (uuid, parentId, level) => {
@@ -123,7 +126,7 @@
    }
  }
  selectChange = (val) => {
  selectChange = (val, level) => {
    const { config } = this.state
    let other = {}
@@ -132,7 +135,7 @@
      option && config.subFields.forEach((n, i) => {
        other[n.field] = option[n.field]
        setTimeout(() => {
          MKEmitter.emit('mkFC', 'input', n.uuid, option[n.field])
          MKEmitter.emit('mkFC', 'input', n.uuid, option[n.field], level)
        }, i * 5)
      })
    }
@@ -177,7 +180,7 @@
          value={value}
          dropdownMatchSelectWidth={config.dropdown !== 'false'}
          filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
          onSelect={this.selectChange}
          onSelect={(val) => this.selectChange(val)}
          onChange={(val) => val === undefined && this.selectChange('')}
          disabled={config.readonly}
        >
src/templates/modalconfig/index.jsx
@@ -221,17 +221,11 @@
    let _tabfields = []
    let _linkableFields = []
    let _linksupFields = []
    let standardform = null
    let index = null
    config.fields.forEach((item, i) => {
      if (card.uuid === item.uuid) {
        index = i
      }
      if (!item.field || card.field === item.field) return
      if (['text', 'number', 'textarea', 'color'].includes(item.type)) {
      if (['text', 'number', 'textarea', 'select'].includes(item.type)) {
        _inputfields.push({
          field: item.field,
          label: item.label
@@ -265,14 +259,6 @@
        label: item.label + '-表单'
      })
    })
    if (index !== null) {
      if (index === 0) {
        standardform = config.fields[index + 1] || null
      } else {
        standardform = config.fields[index - 1] || null
      }
    }
    let _fields = _linkableFields.map(cell => cell.field)
    if (subTabConfig) {
@@ -309,16 +295,7 @@
      card.linkSubField = card.linkSubField.filter(item => fields.includes(item))
    }
    if (!card.span && standardform && standardform.span) {
      card.span = standardform.span
      card.labelwidth = standardform.labelwidth
    } else if (!card.span) {
      card.span = 12
      card.labelwidth = 33.3
    }
    this.setState({
      standardform,
      visible: true,
      card: card,
      formlist: getModalForm(card, _inputfields, _tabfields, _linkableFields, _linksupFields)
@@ -752,7 +729,7 @@
            card={this.state.card}
            formlist={this.state.formlist}
            inputSubmit={this.handleSubmit}
            standardform={this.state.standardform}
            fields={config.fields}
            wrappedComponentRef={(inst) => this.formRef = inst}
          />
        </Modal>
src/templates/zshare/modalform/index.jsx
@@ -51,7 +51,7 @@
class MainSearch extends Component {
  static propTpyes = {
    formlist: PropTypes.any,
    standardform: PropTypes.any,
    fields: PropTypes.array,
    card: PropTypes.object,
    inputSubmit: PropTypes.any
  }
@@ -537,18 +537,21 @@
  changeVal = (val, type) => {
    if (type !== 'span' || ![24, 12, 8, 6].includes(val)) return
    const { standardform } = this.props
    const { card, fields } = this.props
    if (!standardform || ![24, 12, 8, 6].includes(standardform.span) || !standardform.labelwidth) return
    let index = fields.findIndex(item => card.uuid === item.uuid)
    let stform = fields[index - 1]
    if (!stform || ![24, 12, 8, 6].includes(stform.span) || !stform.labelwidth) return
    let labelwidth = null
    if (standardform.span === val) {
      labelwidth = standardform.labelwidth
    } else if (standardform.span > val) {
    if (stform.span === val) {
      labelwidth = stform.labelwidth
    } else if (stform.span > val) {
      labelwidth = 33.3
    } else {
      switch(standardform.span) {
      switch(stform.span) {
        case 12:
          labelwidth = 16.2
          break;
@@ -930,8 +933,8 @@
    }
  }
  handleConfirm = (fields) => {
    const { card } = this.props
  handleConfirm = () => {
    const { card, fields } = this.props
    // 表单提交时检查输入值是否正确
    return new Promise((resolve, reject) => {
      this.props.form.validateFieldsAndScroll((err, values) => {