From f07c42a322f41e14ef5b1bf8f2fd66fc5d338cdd Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 28 六月 2023 18:17:09 +0800 Subject: [PATCH] 2023-06-28 --- src/menu/components/tabs/paste/index.jsx | 54 ++++++++++++++++-------------------------------------- 1 files changed, 16 insertions(+), 38 deletions(-) diff --git a/src/menu/components/tabs/paste/index.jsx b/src/menu/components/tabs/paste/index.jsx index c51ac9f..be4a281 100644 --- a/src/menu/components/tabs/paste/index.jsx +++ b/src/menu/components/tabs/paste/index.jsx @@ -1,11 +1,11 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Icon, Modal, notification } from 'antd' +import { Modal, notification } from 'antd' +import { SnippetsOutlined } from '@ant-design/icons' import MenuUtils from '@/utils/utils-custom.js' -import MKEmitter from '@/utils/events.js' import asyncComponent from '@/utils/asyncComponent' -import './index.scss' +// import './index.scss' const PasteForm = asyncComponent(() => import('@/templates/zshare/pasteform')) @@ -19,49 +19,32 @@ visible: false } - handleMenuClick = () => { - this.setState({visible: true}) - } - - resetconfig = (item, Tab, copyBtns) => { - item.floor = Tab.floor + 1 - item.tabId = Tab.uuid - item.parentId = Tab.parentId - + resetconfig = (item, appType) => { if (item.type === 'tabs') { item.uuid = MenuUtils.getuuid() - item.setting.name = item.setting.name + MenuUtils.getdataName().toUpperCase().substr(-4) + item.setting.name = item.setting.name + MenuUtils.getSignName() item.name = item.setting.name item.subtabs.forEach(tab => { tab.uuid = MenuUtils.getuuid() - tab.parentId = item.uuid - - if (item.floor >= 3) { - tab.components = tab.components.filter(cell => cell.type !== 'tabs') - } tab.components = tab.components.map(cell => { - cell = this.resetconfig(cell, tab, copyBtns) + cell = this.resetconfig(cell, appType) return cell }) }) } else if (item.type === 'group') { item.uuid = MenuUtils.getuuid() - item.setting.name = item.setting.name + MenuUtils.getdataName().toUpperCase().substr(-4) + item.setting.name = item.setting.name + MenuUtils.getSignName() item.name = item.setting.name item.components = item.components.map(cell => { - cell.floor = Tab.floor + 1 - cell.tabId = Tab.uuid - cell.parentId = Tab.parentId - - cell = MenuUtils.resetComponentConfig(cell, copyBtns) + cell = MenuUtils.resetComponentConfig(cell, appType) return cell }) } else { - item = MenuUtils.resetComponentConfig(item, copyBtns) + item = MenuUtils.resetComponentConfig(item, appType) } return item @@ -69,15 +52,18 @@ pasteSubmit = () => { const { Tab } = this.props - let options = ['tabs', 'group', 'datacard', 'propcard', 'balcony', 'normaltable', 'mainsearch', 'stepform', 'tabform', 'tablecard', 'line', 'bar', 'pie', 'dashboard', 'scatter'] + let appType = sessionStorage.getItem('appType') + let options = ['tabs', 'group', 'datacard', 'propcard', 'timeline', 'balcony', 'normaltable', 'mainsearch', 'simpleform', 'stepform', 'tabform', 'editor', 'tablecard', 'line', 'bar', 'pie', 'scatter', 'sandbox'] let types = { login: '鐧诲綍', navbar: '瀵艰埅鏍�', topbar: '瀵艰埅鏍�' } - if (sessionStorage.getItem('appType') === 'mob') { + if (appType === 'mob') { options.push('menubar') + } else { + options.push('editable', 'antvG6', 'antvX6', 'tree', 'dashboard', 'chart') } this.pasteFormRef.handleConfirm().then(res => { @@ -97,19 +83,11 @@ return } - let copyBtns = new Map() - - res = this.resetconfig(res, Tab, copyBtns) + res = this.resetconfig(res, appType) delete res.copyType this.props.insert(res, Tab) - - copyBtns = [...copyBtns.values()] - - if (copyBtns.length > 0) { - MKEmitter.emit('copyButtons', copyBtns) - } this.setState({visible: false}) @@ -126,7 +104,7 @@ return ( <div style={{display: 'inline-block'}}> - <Icon type="snippets" style={{color: 'purple'}} onClick={() => {this.setState({visible: true})}} /> + <SnippetsOutlined style={{color: 'purple'}} onClick={() => {this.setState({visible: true})}} /> <Modal title="绮樿创" visible={visible} -- Gitblit v1.8.0