From 891e8aaad3b2ce6980fd44d1cf49192dca1c3c66 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 23 十一月 2022 14:30:30 +0800 Subject: [PATCH] 2022-11-23 --- src/menu/pastecontroller/index.jsx | 82 ++++++++++++++--------------------------- 1 files changed, 28 insertions(+), 54 deletions(-) diff --git a/src/menu/pastecontroller/index.jsx b/src/menu/pastecontroller/index.jsx index 96179d1..800bec8 100644 --- a/src/menu/pastecontroller/index.jsx +++ b/src/menu/pastecontroller/index.jsx @@ -1,11 +1,11 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Modal, Button, 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')) @@ -18,69 +18,57 @@ visible: false } - handleMenuClick = () => { - this.setState({visible: true}) - } - - resetconfig = (item, copyBtns) => { + resetconfig = (item, uuids = {}) => { let appType = sessionStorage.getItem('appType') if (item.type === 'tabs') { - item.uuid = MenuUtils.getuuid() - item.setting.name = item.setting.name + MenuUtils.getdataName().toUpperCase().substr(-4) + uuids[item.uuid] = MenuUtils.getuuid() + item.uuid = uuids[item.uuid] + 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 + uuids[tab.uuid] = MenuUtils.getuuid() + tab.uuid = uuids[tab.uuid] if (appType !== 'mob') { tab.components = tab.components.filter(cell => cell.type !== 'menubar') } tab.components = tab.components.map(cell => { - cell.floor = tab.floor + 1 - cell.tabId = tab.uuid - cell.parentId = tab.parentId - - cell = this.resetconfig(cell, copyBtns) + cell = this.resetconfig(cell, uuids) return cell }) }) } else if (item.type === 'group') { - item.uuid = MenuUtils.getuuid() - item.setting.name = item.setting.name + MenuUtils.getdataName().toUpperCase().substr(-4) + uuids[item.uuid] = MenuUtils.getuuid() + item.uuid = uuids[item.uuid] + item.setting.name = item.setting.name + MenuUtils.getSignName() item.name = item.setting.name - if (appType !== 'mob') { - item.components = item.components.filter(cell => cell.type !== 'menubar') - } - item.components = item.components.map(cell => { - cell.floor = item.floor - cell.tabId = item.tabId || '' - cell.parentId = item.parentId || '' - cell = MenuUtils.resetComponentConfig(cell, copyBtns) + item.components = item.components.map(cell => { + cell = MenuUtils.resetComponentConfig(cell, uuids) return cell }) } else { - item = MenuUtils.resetComponentConfig(item, copyBtns) + item = MenuUtils.resetComponentConfig(item, uuids) } return item } pasteSubmit = () => { - let options = ['tabs', 'menubar', 'datacard', 'propcard', 'mainsearch', 'stepform', 'tabform', 'balcony', 'group', 'normaltable', 'tablecard', 'line', 'bar', 'pie', 'dashboard', 'scatter'] + let appType = sessionStorage.getItem('appType') + let options = ['tabs', 'timeline', 'datacard', 'propcard', 'mainsearch', 'simpleform', 'stepform', 'tabform', 'balcony', 'group', 'normaltable', 'tablecard', 'line', 'bar', 'pie', 'dashboard', 'scatter', 'iframe', 'sandbox'] + + if (appType === 'mob') { + options.push('menubar', 'topbar') + } else { + options.push('editable', 'antvG6') + } this.pasteFormRef.handleConfirm().then(res => { - if (res.copyType === 'menubar' && sessionStorage.getItem('appType') !== 'mob') { - notification.warning({ - top: 92, - message: '褰撳墠绯荤粺涓嶆敮鎸佽彍鍗曠粍浠讹紒', - duration: 5 - }) - return - } else if (!options.includes(res.copyType)) { + if (!options.includes(res.copyType)) { notification.warning({ top: 92, message: '閰嶇疆淇℃伅鏍煎紡閿欒锛�', @@ -89,27 +77,13 @@ return } - let copyBtns = new Map() + res = this.resetconfig(res) - res = this.resetconfig(res, copyBtns) - - delete res.copyType + // delete res.copyType this.props.insert(res) - copyBtns = [...copyBtns.values()] - - if (copyBtns.length > 0) { - MKEmitter.emit('copyButtons', copyBtns) - } - this.setState({visible: false}) - - notification.success({ - top: 92, - message: '绮樿创鎴愬姛锛�', - duration: 2 - }) }) } @@ -117,8 +91,8 @@ const { visible } = this.state return ( - <div style={{display: 'inline-block'}}> - <Button className="menu-config-paste" icon="snippets" onClick={() => {this.setState({visible: true})}}>绮樿创</Button> + <div className="mk-view-paste" style={{display: 'inline-block'}}> + <Button style={{borderColor: '#40a9ff', color: '#40a9ff'}} onClick={() => {this.setState({visible: true})}}><SnippetsOutlined />绮樿创</Button> <Modal title="绮樿创" visible={visible} -- Gitblit v1.8.0