| | |
| | | changeColumns = (columns) => { |
| | | const { verify } = this.state |
| | | |
| | | if (columns[0] && !['image', 'text', 'number'].includes(columns[0].type)) { |
| | | columns = columns.map(col => { |
| | | let _cell = { |
| | | uuid: Utils.getuuid(), |
| | | Column: col.Column, |
| | | Text: col.Text, |
| | | Width: 20, |
| | | abs: 'false', |
| | | output: col.output || 'true', |
| | | required: col.required || 'false', |
| | | type: 'text', |
| | | } |
| | | columns = columns.map(col => { |
| | | col.type = col.type || 'text' |
| | | col.output = col.output || 'true' |
| | | col.required = col.required || 'false' |
| | | |
| | | return _cell |
| | | }) |
| | | } |
| | | if (!['text', 'image', 'number'].includes(col.type)) { |
| | | if (/^Decimal/ig.test(col.type)) { |
| | | col.type = 'number' |
| | | } else { |
| | | col.type = 'text' |
| | | } |
| | | } |
| | | |
| | | return col |
| | | }) |
| | | // if (columns[0] && !['image', 'text', 'number'].includes(columns[0].type)) { |
| | | // columns = columns.map(col => { |
| | | // let _cell = { |
| | | // uuid: Utils.getuuid(), |
| | | // Column: col.Column, |
| | | // Text: col.Text, |
| | | // Width: 20, |
| | | // abs: 'false', |
| | | // output: col.output || 'true', |
| | | // required: col.required || 'false', |
| | | // type: 'text', |
| | | // } |
| | | |
| | | // return _cell |
| | | // }) |
| | | // } |
| | | |
| | | this.setState({verify: {...verify, columns}}) |
| | | } |