From a02fc6a77fa1b35c6516b2d37108d80e260c6c85 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 07 十一月 2024 22:05:08 +0800 Subject: [PATCH] 2024-11-07 --- src/menu/components/share/copycomponent/index.jsx | 61 ++++++++++++++++++++++++++---- 1 files changed, 53 insertions(+), 8 deletions(-) diff --git a/src/menu/components/share/copycomponent/index.jsx b/src/menu/components/share/copycomponent/index.jsx index 8c34118..3cebc71 100644 --- a/src/menu/components/share/copycomponent/index.jsx +++ b/src/menu/components/share/copycomponent/index.jsx @@ -1,25 +1,70 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Icon, message } from 'antd' +import { message } from 'antd' +import { CopyOutlined } from '@ant-design/icons' import './index.scss' class CopyComponent extends Component { static propTpyes = { - btnlog: PropTypes.array, - handlelog: PropTypes.func + type: PropTypes.string, + card: PropTypes.object + } + + transConfig = (config, type) => { + if (type === 'menucell') { + config.setting.type = 'linkmenu' + config.setting.linkMenuId = '' + config.setting.copyMenuId = '' + } else if (type === 'mobnavbar') { + delete config.open_edition + delete config.dataName + + config.menus.forEach(item => { + item.property = 'menu' + item.open = 'self' + + delete item.copyMenuId + delete item.clearMenu + delete item.linkMenuId + }) + } else if (config.type === 'menubar' && config.subtype === 'menubar') { + let cell = config.subMenus[0] + config.subMenus = [] + + if (cell) { + cell.setting.type = 'menu' + cell.setting.linkMenuId = '' + cell.setting.copyMenuId = '' + + config.subMenus.push(cell) + } + } else if (['normaltable', 'editable', 'basetable'].includes(type)) { + config.action = config.action.filter(item => !item.origin) + config.cols = config.cols.filter(item => !item.origin) + config.search = config.search.filter(item => !item.origin) + delete config.isNew + } } trigger = () => { const { card, type } = this.props - let copycard = fromJS(card).toJS() - copycard.copyType = type + let _val = fromJS(card).toJS() + _val.copyType = type - let _val = '' + this.transConfig(_val, type) try { - _val = window.btoa(window.encodeURIComponent(JSON.stringify(copycard))) + delete _val.$srcId + + let srcid = localStorage.getItem(window.GLOB.sysSign + 'srcId') + if (srcid) { + _val.$srcId = srcid + } + + _val = window.btoa(window.encodeURIComponent(JSON.stringify(_val))) } catch (e) { + console.warn(e) message.warning('澶嶅埗澶辫触锛岃閲嶈瘯锛�') _val = '' } @@ -38,7 +83,7 @@ render () { return ( - <Icon type="copy" title="澶嶅埗" style={{color: '#26C281'}} onClick={this.trigger} /> + <CopyOutlined title="澶嶅埗" style={{color: '#26C281'}} onClick={this.trigger} /> ) } } -- Gitblit v1.8.0