| | |
| | | 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'), |
| | | 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) { |
| | |
| | | } |
| | | |
| | | this.setState({ |
| | | currentTabs: _tabs, |
| | | selectTabs: _select, |
| | | interReadonly: data.sysInterface === 'true', |
| | | primaryKey: primaryKey |
| | | }) |
| | |
| | | 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: { |
| | |
| | | <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> |