king
2020-02-18 29c5821ce140e89a8b35e53f41672dd86da56982
src/templates/comtableconfig/settingform/index.jsx
@@ -11,7 +11,6 @@
    dict: PropTypes.object, // 字典项
    menu: PropTypes.object,
    data: PropTypes.object,
    config: PropTypes.object,
    columns: PropTypes.array,
    usefulFields: PropTypes.array
  }
@@ -19,32 +18,12 @@
  state = {
    interType: this.props.data.interType || 'inner',
    columns: this.props.columns.filter(item => item.field && item.type !== 'colspan'),
    currentTabs: null,
    selectTabs: [],
    interReadonly: false,
    primaryKey: ''
  }
  UNSAFE_componentWillMount() {
    const { config, data, columns } = this.props
    let _tabs = []
    let _select = []
    let _tabMap = new Map()
    config.tabgroups.forEach(groupname => {
      config[groupname].forEach(tab => {
        if (tab.origin) return
        _tabs.push(tab)
        _tabMap.set(tab.uuid, true)
      })
    })
    data.subtabs && data.subtabs.forEach(tabId => {
      if (_tabMap.has(tabId)) {
        _select.push(tabId)
      }
    })
    const { data, columns } = this.props
    let primaryKey = data.primaryKey
    if (primaryKey) {
@@ -62,8 +41,6 @@
    }
    this.setState({
      currentTabs: _tabs,
      selectTabs: _select,
      interReadonly: data.sysInterface === 'true',
      primaryKey: primaryKey
    })
@@ -139,7 +116,7 @@
  render() {
    const { data, dict, menu, usefulFields } = this.props
    const { getFieldDecorator } = this.props.form
    const { interType, columns, selectTabs, primaryKey } = this.state
    const { interType, columns, primaryKey } = this.state
    const formItemLayout = {
      labelCol: {
@@ -364,28 +341,6 @@
                <Select>
                  <Select.Option value="true">加载数据</Select.Option>
                  <Select.Option value="false">不加载数据</Select.Option>
                </Select>
              )}
            </Form.Item>
          </Col>
          <Col span={12}>
            <Form.Item label={
              <Tooltip placement="topLeft" title="主表可选取关联标签,标签关联后,主表数据切换时,下级标签会跟随主表主键值变化。">
                <Icon type="question-circle" />
                {'下级标签'}
              </Tooltip>
            }>
              {getFieldDecorator('subtabs', {
                initialValue: selectTabs
              })(
                <Select
                  mode="multiple"
                  style={{ width: '100%' }}
                  placeholder="Please select"
                >
                  {this.state.currentTabs.map((option, index) =>
                    <Select.Option id={option.uuid} title={option.label} key={index} value={option.uuid}>{option.label}</Select.Option>
                  )}
                </Select>
              )}
            </Form.Item>