| | |
| | | } |
| | | |
| | | pasteSubmit = () => { |
| | | const { options, config } = this.props |
| | | const { options, config, type } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | | |
| | | this.pasteFormRef.handleConfirm().then(res => { |
| | | if (res.copyType === 'action' && options.includes('action')) { |
| | | if (!options.includes(res.copyType)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '配置信息格式错误!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (res.copyType === 'action') { |
| | | res.uuid = Utils.getuuid() |
| | | MKEmitter.emit('pasteButton', config.uuid, res) |
| | | } else if (options.includes('search') && res.copyType === 'search') { |
| | | } else if (res.copyType === 'search' || (type === 'table' && res.copyType === 'form')) { |
| | | res.uuid = Utils.getuuid() |
| | | let keys = _config.search.map(item => item.field ? item.field.toLowerCase() : '') |
| | | |
| | | if (type === 'table') { |
| | | if (['number', 'switch', 'textarea', 'fileupload', 'hint', 'color', 'funcvar'].includes(res.type)) { |
| | | res.type = 'text' |
| | | } else if (res.type === 'radio') { |
| | | res.type = 'select' |
| | | } else if (res.type === 'checkbox') { |
| | | res.type = 'multiselect' |
| | | } else if (res.type === 'datetime') { |
| | | res.type = 'date' |
| | | } |
| | | } |
| | | |
| | | if (res.field && keys.includes(res.field.toLowerCase())) { |
| | | notification.warning({ |
| | |
| | | return |
| | | } |
| | | MKEmitter.emit('plusSearch', config.uuid, res, 'simple') |
| | | } else if (options.includes('columns') && res.copyType === 'columns') { |
| | | } else if (res.copyType === 'columns') { |
| | | let keys = _config.columns.map(item => item.field ? item.field.toLowerCase() : '') |
| | | let items = res.columns.filter(col => col.field && !keys.includes(col.field.toLowerCase())) |
| | | |
| | | MKEmitter.emit('plusColumns', config.uuid, items) |
| | | } else if (options.includes('form') && res.copyType === 'form') { |
| | | } else if (res.copyType === 'form') { |
| | | let keys = _config.fields.map(item => item.field ? item.field.toLowerCase() : '') |
| | | res.uuid = Utils.getuuid() |
| | | |