| | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | // import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | const PasteForm = asyncComponent(() => import('@/templates/zshare/pasteform')) |
| | | |
| | | class PasteController extends Component { |
| | |
| | | return item |
| | | } |
| | | |
| | | extra = (res) => { |
| | | let config = fromJS(this.props.config).toJS() |
| | | |
| | | if (res.copyType === 'mk_actions') { |
| | | config.action = res.action |
| | | this.props.updateConfig(config) |
| | | |
| | | setTimeout(() => { |
| | | MKEmitter.emit('revertBtn', config.uuid) |
| | | }, 30) |
| | | } else if (res.copyType === 'mk_searches') { |
| | | config.search = res.search |
| | | this.props.updateConfig(config) |
| | | |
| | | setTimeout(() => { |
| | | MKEmitter.emit('revert', config.uuid, 'search') |
| | | }, 30) |
| | | } else if (res.copyType === 'mk_fields') { |
| | | config.columns = res.columns |
| | | this.props.updateConfig(config) |
| | | } else if (res.copyType === 'mk_cols') { |
| | | config.cols = res.cols |
| | | this.props.updateConfig(config) |
| | | } else if (res.copyType === 'mk_setting') { |
| | | config.setting = res.setting |
| | | this.props.updateConfig(config) |
| | | } |
| | | console.log(config) |
| | | this.setState({visible: false}) |
| | | } |
| | | |
| | | pasteSubmit = () => { |
| | | const { options } = this.props |
| | | this.pasteFormRef.handleConfirm().then(res => { |
| | | if (/^mk_/.test(res.copyType)) { // dms-trans |
| | | this.extra(res) |
| | | return |
| | | } |
| | | if (!options.includes(res.copyType)) { |
| | | notification.warning({ top: 92, message: '配置信息格式错误!', duration: 5 }) |
| | | return |
| | |
| | | } |
| | | } |
| | | |
| | | if (res.field && keys.includes(res.field.toLowerCase())) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '搜索字段已存在!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | MKEmitter.emit('plusSearch', config.uuid, res, 'simple') |
| | | this.setState({visible: false}) |
| | | if (res.field && keys.includes(res.field.toLowerCase())) { |
| | | confirm({ |
| | | title: '搜索字段已存在!', |
| | | okText: '知道了', |
| | | cancelText: '替换', |
| | | onOk() {}, |
| | | onCancel() { |
| | | MKEmitter.emit('plusSearch', config.uuid, res, 'replace') |
| | | } |
| | | }) |
| | | } else { |
| | | MKEmitter.emit('plusSearch', config.uuid, res, 'simple') |
| | | } |
| | | return |
| | | } else if (type === 'cardcell') { |
| | | config.subcards.push(res) |