| | |
| | | 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' |
| | | |
| | |
| | | visible: false |
| | | } |
| | | |
| | | handleMenuClick = () => { |
| | | this.setState({visible: true}) |
| | | } |
| | | |
| | | resetconfig = (item, Tab, copyBtns, uuids = {}, floor) => { |
| | | item.tabId = Tab.uuid |
| | | item.parentId = Tab.parentId |
| | | |
| | | resetconfig = (item, appType) => { |
| | | if (item.type === 'tabs') { |
| | | uuids[item.uuid] = MenuUtils.getuuid() |
| | | item.uuid = uuids[item.uuid] |
| | | item.uuid = MenuUtils.getuuid() |
| | | item.setting.name = item.setting.name + MenuUtils.getSignName() |
| | | item.name = item.setting.name |
| | | |
| | | item.subtabs.forEach(tab => { |
| | | uuids[tab.uuid] = MenuUtils.getuuid() |
| | | tab.uuid = uuids[tab.uuid] |
| | | tab.parentId = item.uuid |
| | | |
| | | if (floor >= 3) { |
| | | tab.components = tab.components.filter(cell => cell.type !== 'tabs') |
| | | } |
| | | tab.uuid = MenuUtils.getuuid() |
| | | |
| | | tab.components = tab.components.map(cell => { |
| | | cell = this.resetconfig(cell, tab, copyBtns, uuids, floor + 1) |
| | | cell = this.resetconfig(cell, appType) |
| | | return cell |
| | | }) |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | uuids[item.uuid] = MenuUtils.getuuid() |
| | | item.uuid = uuids[item.uuid] |
| | | item.uuid = MenuUtils.getuuid() |
| | | item.setting.name = item.setting.name + MenuUtils.getSignName() |
| | | item.name = item.setting.name |
| | | |
| | | item.components = item.components.map(cell => { |
| | | cell.tabId = Tab.uuid |
| | | cell.parentId = Tab.parentId |
| | | |
| | | cell = MenuUtils.resetComponentConfig(cell, copyBtns, uuids) |
| | | cell = MenuUtils.resetComponentConfig(cell, appType) |
| | | |
| | | return cell |
| | | }) |
| | | } else { |
| | | item = MenuUtils.resetComponentConfig(item, copyBtns, uuids) |
| | | item = MenuUtils.resetComponentConfig(item, appType) |
| | | } |
| | | |
| | | return item |
| | |
| | | |
| | | pasteSubmit = () => { |
| | | const { Tab } = this.props |
| | | let options = ['tabs', 'group', 'datacard', 'propcard', 'timeline', 'balcony', 'normaltable', 'mainsearch', 'simpleform', 'stepform', 'tabform', 'tablecard', 'line', 'bar', 'pie', 'dashboard', 'scatter', 'chart'] |
| | | 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 => { |
| | |
| | | return |
| | | } |
| | | |
| | | let copyBtns = new Map() |
| | | let floor = MenuUtils.getFloor(Tab.parentId) |
| | | |
| | | res = this.resetconfig(res, Tab, copyBtns, {}, floor) |
| | | 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}) |
| | | |