| | |
| | | }) |
| | | } |
| | | |
| | | selectChange = (val) => { |
| | | this.props.form.setFieldsValue({ |
| | | order: `${val} desc` |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { data, dict, tabId, usefulFields } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | |
| | | primaryKey = '' |
| | | } |
| | | } |
| | | if (!primaryKey && columns.length === 0) { |
| | | primaryKey = 'ID' |
| | | } |
| | | |
| | | let str = '^(' + usefulFields.join('|') + ')' |
| | | let _patten = new RegExp(str + '[0-9a-zA-Z_]*$', 'g') |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} className="ant-advanced-search-form commontable-setting-form" id="commontable-setting-form"> |
| | | <Form {...formItemLayout} className="ant-advanced-search-form subtable-setting-form" id="subtable-setting-form"> |
| | | <Row gutter={24}> |
| | | <Col span={12}> |
| | | <Form.Item label="表名"> |
| | |
| | | initialValue: data.tableType |
| | | })( |
| | | <Select |
| | | getPopupContainer={() => document.getElementById('commontable-setting-form')} |
| | | getPopupContainer={() => document.getElementById('subtable-setting-form')} |
| | | > |
| | | <Select.Option value="">不可选</Select.Option> |
| | | <Select.Option value="radio">单选</Select.Option> |
| | |
| | | <Col span={12}> |
| | | <Form.Item label="主键"> |
| | | {getFieldDecorator('primaryKey', { |
| | | initialValue: primaryKey ? primaryKey : (columns.length === 0 ? 'ID' : '') |
| | | initialValue: primaryKey |
| | | })( |
| | | <Select |
| | | getPopupContainer={() => document.getElementById('commontable-setting-form')} |
| | | getPopupContainer={() => document.getElementById('subtable-setting-form')} |
| | | onChange={this.selectChange} |
| | | > |
| | | <Select.Option key='unset' value="">不设置</Select.Option> |
| | | {columns.length === 0 ? |
| | |
| | | <Col span={12}> |
| | | <Form.Item label="默认排序"> |
| | | {getFieldDecorator('order', { |
| | | initialValue: data.order, |
| | | initialValue: data.order || (primaryKey ? primaryKey + ' desc' : ''), |
| | | rules: [ |
| | | { |
| | | required: true, |