| | |
| | | columns.reverse() |
| | | subColumns.reverse() |
| | | |
| | | columns.forEach(col => { |
| | | if (!col.datatype) return |
| | | if (/^nvarchar/.test(col.datatype)) { |
| | | col.datatype = col.datatype.replace(/^nvarchar/, 'Nvarchar') |
| | | } else if (/^decimal/.test(col.datatype)) { |
| | | col.datatype = col.datatype.replace(/^decimal/, 'Decimal') |
| | | } else if (/^int/.test(col.datatype)) { |
| | | col.datatype = col.datatype.replace(/^int/, 'Int') |
| | | } |
| | | }) |
| | | subColumns.forEach(col => { |
| | | if (!col.datatype) return |
| | | if (/^nvarchar/.test(col.datatype)) { |
| | | col.datatype = col.datatype.replace(/^nvarchar/, 'Nvarchar') |
| | | } else if (/^decimal/.test(col.datatype)) { |
| | | col.datatype = col.datatype.replace(/^decimal/, 'Decimal') |
| | | } else if (/^int/.test(col.datatype)) { |
| | | col.datatype = col.datatype.replace(/^int/, 'Int') |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | scripts, |
| | | columns: columns, |
| | |
| | | const { columns } = this.state |
| | | let m = [] |
| | | let n = [] |
| | | let s = [] |
| | | |
| | | columns.forEach(col => { |
| | | m.push(`${col.field} ${col.datatype}`) |
| | | n.push(col.field) |
| | | m.unshift(`${col.field} ${col.datatype}`) |
| | | n.unshift(col.field) |
| | | if (/decimal|int/ig.test(col.datatype)) { |
| | | s.unshift(`${Math.round(Math.random() * 10)} as ${col.field}`) |
| | | } else if (/datetime/.test(col.datatype)) { |
| | | s.unshift(`'${moment().format('YYYY-MM-DD HH:mm:ss')}' as ${col.field}`) |
| | | } else if (/date/.test(col.datatype)) { |
| | | s.unshift(`'${moment().format('YYYY-MM-DD')}' as ${col.field}`) |
| | | } else { |
| | | s.unshift(`'${col.label}' as ${col.field}`) |
| | | } |
| | | }) |
| | | |
| | | if (window.debugger) { |
| | | console.info('select ' + s.join(', ')) |
| | | } |
| | | |
| | | let oInput = document.createElement('input') |
| | | oInput.value = `/*${m.join(',')}*/ |
| | |
| | | updatefield={this.updatefields} |
| | | /> |
| | | <EditTable actions={['edit', 'move', 'copy', 'del', 'clear']} searchKey={searchKey} type="datasourcefield" wrappedComponentRef={(inst) => this.datasource = inst} data={columns} columns={colColumns} onChange={(columns) => this.setState({columns})}/> |
| | | </TabPane> : null} |
| | | </TabPane> : <TabPane tab={ |
| | | <span> |
| | | 字段集 |
| | | {columns.length ? <span className="count-tip">{columns.length}</span> : null} |
| | | </span> |
| | | } key="columns"> |
| | | <div className="base-table-columns"></div> |
| | | <EditTable actions={[]} searchKey={searchKey} type="datasourcefield" data={columns} columns={colColumns}/> |
| | | </TabPane>} |
| | | {config.subtype === 'dualdatacard' ? <TabPane tab={ |
| | | <span> |
| | | 子表字段集 |