king
2020-04-02 4614a540b53edbd83a0a9a483414cfdec0f5d321
src/templates/formtabconfig/index.jsx
@@ -15,6 +15,7 @@
import { queryTableSql } from '@/utils/option.js'
import ModalForm from '@/templates/zshare/modalform'
import PasteForm from '@/templates/zshare/pasteform'
import ActionForm from './actionform'
import SettingForm from './settingform'
import DragElement from './dragelement'
@@ -67,7 +68,8 @@
    editgroup: null,         // 当前编辑组
    groupVisible: false,     // 编辑组模态框
    optionLibs: null,        // 自定义下拉选项库
    activeKey: '0'           // 默认展开基本信息
    activeKey: '0',          // 默认展开基本信息
    pasteVisible: false      // 粘贴模态框
  }
  /**
@@ -1864,6 +1866,56 @@
    })
  }
  pasteSubmit = () => {
    let _config = JSON.parse(JSON.stringify(this.state.config))
    this.pasteFormRef.handleConfirm().then(res => {
      if (res.copyType === 'form') {
        let repeat = false
        _config.groups.forEach(group => {
          let item = group.sublist.filter(cell => cell.field === res.field)[0]
          if (item) {
            repeat = true
          }
          if (group.isDefault) {
            group.sublist.push(res)
          }
        })
        if (res.type === 'linkMain') {
          notification.warning({
            top: 92,
            message: '不支持此表单类型!',
            duration: 10
          })
          return
        } else if (repeat) {
          notification.warning({
            top: 92,
            message: '此表单字段已存在!',
            duration: 10
          })
          return
        }
        this.setState({
          config: _config,
          pasteVisible: null
        }, () => {
          this.handleSearch(res)
        })
      } else {
        notification.warning({
          top: 92,
          message: '配置信息格式错误!',
          duration: 10
        })
      }
    })
  }
  render () {
    const { config, modaltype, activeKey } = this.state
    let _length = config.groups.length
@@ -1986,6 +2038,7 @@
              </div>
            } style={{ width: '100%' }}>
              <Icon type="setting" onClick={this.changeSetting} />
              <Icon type="snippets" title={this.state.dict['header.form.paste']} onClick={() => {this.setState({pasteVisible: true})}} />
              <Tooltip placement="bottomLeft" overlayClassName="middle" title="在左侧工具栏《搜索》中,选择对应搜索框拖至此处添加;或点击按钮《添加搜索条件》批量添加,选择批量添加时,需提前选择使用表。">
                <Icon type="question-circle" />
              </Tooltip>
@@ -2232,6 +2285,21 @@
            wrappedComponentRef={(inst) => this.groupRef = inst}
          />
        </Modal>
        {/* 按钮配置信息粘贴复制 */}
        <Modal
          title={this.state.dict['header.form.paste']}
          visible={this.state.pasteVisible}
          width={600}
          maskClosable={false}
          onOk={this.pasteSubmit}
          onCancel={() => {this.setState({pasteVisible: null})}}
          destroyOnClose
        >
          <PasteForm
            dict={this.state.dict}
            wrappedComponentRef={(inst) => this.pasteFormRef = inst}
          />
        </Modal>
        {this.state.loading && <Spin size="large" />}
      </div>
    )