|
|
@@ -13,10 +13,11 @@ const {Content} = Layout;
|
|
|
class Table extends Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
+ console.log('Table props',props);
|
|
|
this.state = {
|
|
|
- currentTable: props.currentTable,
|
|
|
- remark: props.remark,
|
|
|
- columns: props.columns,
|
|
|
+ currentTable: props.currentTable || ' ',
|
|
|
+ remark: props.remark || '',
|
|
|
+ columns: props.columns || [],
|
|
|
newColName: '',
|
|
|
newColType: 'type',
|
|
|
types: ['ID', 'String', 'Int', 'Float', 'Boolean', 'DateTime'],
|
|
|
@@ -95,14 +96,17 @@ class Table extends Component {
|
|
|
componentWillReceiveProps(next) {
|
|
|
this.setState({
|
|
|
currentTable: next.currentTable,
|
|
|
- columns: next.columns,
|
|
|
+ columns: next.columns || [],
|
|
|
remark: next.remark
|
|
|
});
|
|
|
};
|
|
|
|
|
|
render() {
|
|
|
// console.log('columns',this.state.columns);
|
|
|
- let {schemaId:schemaID,schemaName} = this.props.history.location.state;
|
|
|
+ console.log('this.props',this.props);
|
|
|
+ let schemaID = this.props.schemaID || this.props.history.location.state.schemaID;
|
|
|
+ let schemaName = this.props.schemaName || this.props.history.location.state.schemaName;
|
|
|
+ console.log('schemaID',schemaID,'schemaName',schemaName);
|
|
|
let userID = this.props.userID || getCookie('user_id');
|
|
|
// console.log('schemaID',schemaID,'userID',userID);
|
|
|
|
|
|
@@ -114,7 +118,6 @@ class Table extends Component {
|
|
|
|
|
|
<Layout style={{padding: '24px', zIndex: '0'}}>
|
|
|
<Content style={{padding: '24px', minHeight: 280, background: '#fff', marginTop: '48px'}}>
|
|
|
-
|
|
|
<div className="column-content">
|
|
|
<span className='table-title'> Table name</span>
|
|
|
<Input
|
|
|
@@ -204,16 +207,16 @@ class Table extends Component {
|
|
|
schemaID={schemaID}
|
|
|
userID={userID}
|
|
|
/>
|
|
|
- {
|
|
|
- // undefined的时候 上层未传进来 currentTable === 'add',为的是输入框内不默认显示 add
|
|
|
- this.state.currentTable === '' ? '' : this.state.currentTable === undefined ? '' :
|
|
|
- <DeleteTableButton
|
|
|
- currentTable={this.state.currentTable}
|
|
|
- currentTableIndex={this.props.currentTableIndex}
|
|
|
- schemaID={schemaID}
|
|
|
- userID={userID}
|
|
|
- />
|
|
|
- }
|
|
|
+ {/*{*/}
|
|
|
+ {/*// undefined的时候 上层未传进来 currentTable === 'add',为的是输入框内不默认显示 add*/}
|
|
|
+ {/*this.state.currentTable === '' ? '' : this.state.currentTable === undefined ? '' :*/}
|
|
|
+ {/*<DeleteTableButton*/}
|
|
|
+ {/*currentTable={this.state.currentTable}*/}
|
|
|
+ {/*currentTableIndex={this.props.currentTableIndex}*/}
|
|
|
+ {/*schemaID={schemaID}*/}
|
|
|
+ {/*userID={userID}*/}
|
|
|
+ {/*/>*/}
|
|
|
+ {/*}*/}
|
|
|
</div>
|
|
|
</Content>
|
|
|
</Layout>
|