| | |
| | | state = { |
| | | interType: (this.props.config.setting && this.props.config.setting.interType) || 'inner', |
| | | columns: null, |
| | | currentTabs: null, |
| | | selectTabs: [], |
| | | interReadonly: false, |
| | | primaryKey: '' |
| | | } |
| | |
| | | UNSAFE_componentWillMount() { |
| | | const { config } = this.props |
| | | |
| | | let _tabs = [] |
| | | let _select = [] |
| | | let _tabMap = new Map() |
| | | let _columns = [] |
| | | let _setting = config.setting |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | config.tabgroups.forEach(groupname => { |
| | | config[groupname].forEach(tab => { |
| | | if (tab.origin) return |
| | | |
| | | _tabs.push(tab) |
| | | _tabMap.set(tab.uuid, true) |
| | | }) |
| | | }) |
| | | |
| | | _setting.subtabs && _setting.subtabs.forEach(tabId => { |
| | | if (_tabMap.has(tabId)) { |
| | | _select.push(tabId) |
| | | } |
| | | }) |
| | | |
| | | let primaryKey = _setting.primaryKey |
| | | if (primaryKey) { |
| | | let field = _columns.filter(column => column.field === primaryKey) |
| | |
| | | } |
| | | |
| | | this.setState({ |
| | | currentTabs: _tabs, |
| | | selectTabs: _select, |
| | | columns: _columns, |
| | | setting: _setting, |
| | | interType: _setting.interType || 'inner', |
| | |
| | | render() { |
| | | const { dict, usefulFields, menu } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { interType, columns, selectTabs, setting, datatype, primaryKey } = this.state |
| | | const { interType, columns, setting, datatype, primaryKey } = this.state |
| | | |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <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> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | | ) |