| | |
| | | let data = fromJS(this.state.data).toJS() |
| | | |
| | | this.pasteFormRef.handleConfirm().then(res => { |
| | | if (res.key !== type) { |
| | | if (res.copyType === 'columns' && type === 'datasourcefield') { |
| | | res.type = 'array' |
| | | res.data = [] |
| | | res.columns.forEach(col => { |
| | | if (!col.field) return |
| | | if (col.type === 'number') { |
| | | let datatype = 'Int' |
| | | if (col.decimal) { |
| | | datatype = `Decimal(18,${col.decimal})` |
| | | } |
| | | |
| | | res.data.push({ |
| | | $index: res.data.length + 1, |
| | | datatype: datatype, |
| | | field: col.field, |
| | | decimal: col.decimal, |
| | | label: col.label, |
| | | type: 'number', |
| | | uuid: Utils.getuuid() |
| | | }) |
| | | } else { |
| | | let datatype = 'Nvarchar(50)' |
| | | let fieldlength = 50 |
| | | if (col.fieldlength && [10, 20, 50, 100, 256, 512, 1024, 2048].includes(col.fieldlength)) { |
| | | fieldlength = col.fieldlength |
| | | datatype = `Nvarchar(${fieldlength})` |
| | | } |
| | | |
| | | res.data.push({ |
| | | $index: res.data.length + 1, |
| | | datatype: datatype, |
| | | field: col.field, |
| | | fieldlength: fieldlength, |
| | | label: col.label, |
| | | type: 'text', |
| | | uuid: Utils.getuuid() |
| | | }) |
| | | } |
| | | |
| | | }) |
| | | } else if (res.key !== type) { |
| | | message.warning('配置信息格式错误!') |
| | | return |
| | | } |