| | |
| | | dict: PropTypes.object, // 字典项 |
| | | menu: PropTypes.object, |
| | | data: PropTypes.object, |
| | | config: PropTypes.object, |
| | | columns: PropTypes.array, |
| | | usefulFields: PropTypes.array |
| | | } |
| | | |
| | | state = { |
| | | interType: this.props.data.interType || 'inner', |
| | | columns: this.props.columns.filter(item => item.field && item.type !== 'colspan') |
| | | columns: this.props.columns.filter(item => item.field && item.type !== 'colspan'), |
| | | currentTabs: null, |
| | | selectTabs: [] |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { config, data } = 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) |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | currentTabs: _tabs, |
| | | selectTabs: _select |
| | | }) |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | |
| | | render() { |
| | | const { data, dict, menu, usefulFields } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { interType, columns } = this.state |
| | | const { interType, columns, selectTabs } = this.state |
| | | |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label="标签"> |
| | | {getFieldDecorator('tabshow', { |
| | | initialValue: data.tabshow || 'horizontal' |
| | | })( |
| | | <Select> |
| | | <Select.Option value="horizontal">横向显示</Select.Option> |
| | | <Select.Option value="vertical">纵向显示</Select.Option> |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label="初始化"> |
| | | {getFieldDecorator('onload', { |
| | | initialValue: data.onload || 'true' |
| | |
| | | )} |
| | | </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> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | | ) |