From 325aa13d3b61d1c066f8fcab107003ef36713df3 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 16 一月 2025 10:20:09 +0800 Subject: [PATCH] 2025-01-16 --- src/views/menudesign/index.jsx | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 53 insertions(+), 5 deletions(-) diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index 41ba0b2..29eb9eb 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -4,8 +4,8 @@ import { is, fromJS } from 'immutable' import moment from 'moment' import HTML5Backend from 'react-dnd-html5-backend' -import { notification, Modal, Collapse, Card, Switch, Button, Typography, Spin } from 'antd' -import { DoubleLeftOutlined, DoubleRightOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons' +import { notification, Modal, Collapse, Card, Switch, Button, Typography, Spin, message } from 'antd' +import { DoubleLeftOutlined, DoubleRightOutlined, EyeOutlined, EyeInvisibleOutlined, CopyOutlined } from '@ant-design/icons' import html2canvas from 'html2canvas' import md5 from 'md5' @@ -1230,7 +1230,16 @@ insert = (item) => { let config = fromJS(this.state.config).toJS() - config.components.push(item) + if (item.copyType === 'components') { + config.components.push(...item.components) + if (!config.interfaces) { + config.interfaces = item.interfaces + } else { + config.interfaces.push(...item.interfaces) + } + } else { + config.components.push(item) + } this.setState({config}) window.GLOB.customMenu = config @@ -1249,6 +1258,44 @@ const { oriConfig, config } = this.state return is(fromJS(oriConfig), fromJS(config)) + } + + copyMenu = () => { + const { config } = this.state + + if (!config.enabled) { + notification.warning({ + top: 92, + message: '鑿滃崟鏈惎鐢紝涓嶅彲澶嶅埗銆�', + duration: 5 + }) + } else if (config.components.length === 0) { + notification.warning({ + top: 92, + message: '鏈坊鍔犵粍浠讹紝涓嶅彲澶嶅埗銆�', + duration: 5 + }) + } else { + let msg = { copyType: 'components', type: 'admin' } + + msg.components = config.components || [] + msg.interfaces = config.interfaces || [] + + try { + msg = window.btoa(window.encodeURIComponent(JSON.stringify(msg))) + } catch (e) { + console.warn('Stringify Failure') + msg = '' + } + + let oInput = document.createElement('input') + oInput.value = msg + document.body.appendChild(oInput) + oInput.select() + document.execCommand('Copy') + document.body.removeChild(oInput) + message.success('澶嶅埗鎴愬姛銆�') + } } updateLogConfig = (config) => { @@ -1306,7 +1353,8 @@ /> {/* 琛ㄥ悕娣诲姞 */} <TableComponent config={config} updatetable={this.updateConfig}/> - <Paragraph style={{padding: '15px 0px 0px 18px'}} copyable={{ text: MenuId }}>鑿滃崟ID</Paragraph> + <Paragraph style={{padding: '15px 0px 0px 37px'}} copyable={{ text: MenuId }}>鑿滃崟ID</Paragraph> + <Paragraph style={{padding: '0px 0px 0px 18px'}}>鑿滃崟缁勪欢锛�<CopyOutlined onClick={this.copyMenu} style={{cursor: 'pointer', color: '#1890ff'}} /></Paragraph> <NormalCss config={config} updateConfig={this.updateConfig}/> </> : null} </Panel> @@ -1333,7 +1381,7 @@ <SysInterface config={config} updateConfig={this.updateConfig}/> <PictureController/> <StyleCombControlButton menu={config} /> - <PasteController insert={this.insert} /> + <PasteController vType="admin" insert={this.insert} /> {config ? <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> : null} <Button type="primary" id="save-config" disabled={!config} className={needUpdate ? 'update-tip' : ''} onClick={this.submitConfig} loading={menuloading}>淇濆瓨</Button> <Button type="default" disabled={menuloading} onClick={this.closeView}>鍏抽棴</Button> -- Gitblit v1.8.0