| | |
| | | changeColumns = (columns) => { |
| | | const { verify } = this.state |
| | | |
| | | let reset = false |
| | | columns = columns.map(col => { |
| | | col.type = col.type || 'Nvarchar(50)' |
| | | if (col.type === 'text' || col.type === 'image') { |
| | |
| | | col.type = 'Decimal(18,2)' |
| | | } |
| | | |
| | | if (col.import === 'init') { |
| | | col.required = 'false' |
| | | col.min = '' |
| | | col.max = '' |
| | | } |
| | | |
| | | if (/^Nvarchar/ig.test(col.type)) { |
| | | col.limit = col.type.match(/\d+/) ? col.type.match(/\d+/)[0] : '20000' |
| | | } else if (/^Decimal/ig.test(col.type)) { |
| | | col.limit = col.type.match(/\d+/ig)[1] |
| | | if (col.required === 'false') { |
| | | reset = true |
| | | } |
| | | col.required = 'true' |
| | | } else if (/^int/ig.test(col.type)) { |
| | | if (col.required === 'false') { |
| | | reset = true |
| | | } |
| | | col.required = 'true' |
| | | |
| | | } else { |
| | | col.limit = '' |
| | | } |
| | |
| | | |
| | | return col |
| | | }) |
| | | |
| | | if (reset) { |
| | | message.warning('数值类型均为必填。') |
| | | } |
| | | |
| | | this.setState({verify: {...verify, columns}}, () => { |
| | | this.resetUniqueColumns() |