king
2023-07-16 1f5c6ac307a134dfa45b64c5723f2481ead9f213
src/templates/modalconfig/index.jsx
@@ -126,6 +126,7 @@
  }
  componentDidMount() {
    window.GLOB.formId = ''
    MKEmitter.addListener('submitStyle', this.getStyle)
    document.onkeydown = (event) => {
      let e = event || window.event
@@ -249,59 +250,51 @@
    let index = null
    uniq.set(card.field, true)
    let _inputIndex = 1
    let _tabIndex = 1
    let _linkIndex = 1
    config.fields.forEach((item, i) => {
      if (card.uuid === item.uuid) {
        index = i
      }
      let label = item.label || ''
      if (item.field && item.field.toLowerCase() !== label.toLowerCase()) {
        label = label + ' (' + item.field + ')'
      }
      if (!item.field) return
      if (['text', 'number', 'textarea', 'color'].includes(item.type) && card.field !== item.field) {
        _inputfields.push({
          field: item.field,
          label: _inputIndex + '、' + label
          label: item.label
        })
        _inputIndex++
      }
      if (card.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) {
        _tabfields.push({
          field: item.field,
          label: _tabIndex + '、' + label
          label: item.label
        })
        _tabIndex++
      }
      if (item.type === 'switch') {
      if (item.type === 'switch' || item.type === 'check') {
        _linksupFields.push({
          field: item.field,
          label: _linkIndex + '、' + label
          label: item.label
        })
      }
      if (!['select', 'link', 'radio', 'checkcard'].includes(item.type)) return
      if (item.type === 'checkcard' && item.multiple === 'true') return // 选项卡多选
      if (item.field && !uniq.has(item.field)) {
      if (!['select', 'link', 'radio', 'checkcard', 'multiselect'].includes(item.type)) return
      _linksupFields.push({
        field: item.field,
        label: item.label
      })
      if (item.type === 'multiselect' || (item.type === 'checkcard' && item.multiple === 'true')) return
      if (!uniq.has(item.field)) {
        uniq.set(item.field, true)
        _linkableFields.push({
          field: item.field,
          label: _linkIndex + '、' + item.label + ' (表单)'
          label: item.label + '-表单'
        })
        _linksupFields.push({
          field: item.field,
          label: _linkIndex + '、' + label
        })
        _linkIndex++
      }
    })
    _tabfields.unshift({field: '', label: '原表单'})
    if (index !== null) {
      if (index === 0) {
@@ -318,9 +311,8 @@
          _linkableFields.push({
            field: col.field,
            label: _linkIndex + '、' + col.label + ' (显示列)'
            label: col.label + '-显示列'
          })
          _linkIndex++
        }
      })
    } else if (tabConfig) {
@@ -330,9 +322,8 @@
          _linkableFields.push({
            field: col.field,
            label: _linkIndex + '、' + col.label + ' (显示列)'
            label: col.label + '-显示列'
          })
          _linkIndex++
        }
      })
    } else if (menu.LongParam) {
@@ -342,9 +333,8 @@
          _linkableFields.push({
            field: col.field,
            label: _linkIndex + '、' + col.label + ' (显示列)'
            label: col.label + '-显示列'
          })
          _linkIndex++
        }
      })
    }
@@ -357,6 +347,9 @@
    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({
@@ -404,6 +397,8 @@
      _config.fields = _config.fields.filter(item => !item.origin)
      window.GLOB.formId = res.uuid
      if (['select', 'multiselect', 'link', 'checkbox', 'radio', 'checkcard'].includes(res.type) && res.resourceType === '1' && /\s/.test(res.dataSource)) {
        this.setState({
          sqlVerifing: true
@@ -412,11 +407,13 @@
        let param = {
          func: 's_debug_sql',
          exec_type: 'y',
          LText: res.dataSource
          LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20)
            ${res.dataSource}`
        }
        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
        param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`)
        param.LText = param.LText.replace(/\n/g, ' ')
        
        param.LText = Utils.formatOptions(param.LText)
        param.secretkey = Utils.encrypt('', param.timestamp)
@@ -744,7 +741,6 @@
    })
  }
  render () {
    const { editAction } = this.props
    const { config, openEdition } = this.state
@@ -781,7 +777,7 @@
                <Button type="danger" onClick={this.clearConfig}>清空</Button>
                <Versions MenuId={editAction.uuid} open_edition={openEdition} updateConfig={this.refreshConfig}/>
                <ReplaceField type="form" config={config} updateConfig={this.updateconfig}/>
                <EditComponent options={['form']} config={this.state.config} plusFields={this.plusFields}/>
                <EditComponent options={['form']} type="formboard" config={this.state.config} plusFields={this.plusFields}/>
                <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>保存</Button>
                <Button onClick={this.cancelConfig}>返回</Button>
              </div>