From 8e3b4c6dede34e8be6ba47a20ecd9a70576675cf Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 13 一月 2025 18:02:33 +0800 Subject: [PATCH] 2025-01-13 --- src/views/tabledesign/index.jsx | 135 ++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 126 insertions(+), 9 deletions(-) diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx index ad2c7a6..be78503 100644 --- a/src/views/tabledesign/index.jsx +++ b/src/views/tabledesign/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 } from 'antd' -import { DoubleLeftOutlined, DoubleRightOutlined } from '@ant-design/icons' +import { notification, Modal, Collapse, Card, Switch, Button, Typography, message } from 'antd' +import { DoubleLeftOutlined, DoubleRightOutlined, CopyOutlined } from '@ant-design/icons' import md5 from 'md5' import Api from '@/api' @@ -896,6 +896,129 @@ return is(fromJS(oriConfig), fromJS(config)) } + copyMenu = () => { + const { config } = this.state + + if (!config.enabled) { + notification.warning({ + top: 92, + message: '鑿滃崟鏈惎鐢紝涓嶅彲澶嶅埗銆�', + duration: 5 + }) + } else { + let msg = { copyType: 'components', type: 'admin', interfaces: [] } + + msg.components = fromJS(config.components).toJS() + msg.components.forEach((item, i) => { + if (item.type === 'tabs') { + item.name = '鏍囩缁�' + i + item.width = 24 + item.subtype = 'tabs' + item.setting = {autoSwitch: 'false', blacklist: [], name: item.name, position: 'top', supModule: [], tabStyle: 'line', width: 24} + + item.subtabs.forEach(tab => { + tab.components[0].subtype = 'normaltable' + tab.components[0].width = 24 + tab.components[0].wrap.width = 24 + tab.components[0].wrap.name = tab.components[0].name + + tab.components[0].action.forEach(btn => { + if (btn.OpenType === 'popview' && btn.config) { + btn.config.Template = 'CustomPage' + if (btn.config.components[0]) { + btn.config.components[0].subtype = 'normaltable' + } + } + }) + tab.components[0].cols = tab.components[0].cols.filter(col => !(col.field && col.Hide === 'true')) + tab.components[0].cols.forEach(col => { + if (col.type !== 'custom') return + col.elements.forEach(btn => { + if (btn.OpenType === 'popview' && btn.config) { + btn.config.Template = 'CustomPage' + if (btn.config.components[0]) { + btn.config.components[0].subtype = 'normaltable' + } + } + }) + }) + }) + } else { + item.subtype = 'normaltable' + item.width = 24 + item.wrap.width = 24 + item.wrap.name = item.name + item.action.forEach(btn => { + if (btn.OpenType === 'popview' && btn.config) { + btn.config.Template = 'CustomPage' + if (btn.config.components[0]) { + btn.config.components[0].subtype = 'normaltable' + } + } + }) + item.cols = item.cols.filter(col => !(col.field && col.Hide === 'true')) + item.cols.forEach(col => { + if (col.type !== 'custom') return + col.elements.forEach(btn => { + if (btn.OpenType === 'popview' && btn.config) { + btn.config.Template = 'CustomPage' + if (btn.config.components[0]) { + btn.config.components[0].subtype = 'normaltable' + } + } + }) + }) + } + }) + + if (msg.components[0].search && msg.components[0].search.length > 0) { + let cell = { + uuid: Utils.getuuid(), + type: 'search', + width: 24, + subtype: 'mainsearch', + name: '鎼滅储', + search: msg.components[0].search, + style: {borderBottomColor: '#f0f0f0', borderBottomWidth: '1px'}, + wrap: {float: 'left', blacklist: [], name: '鎼滅储', width: 24} + } + + cell.wrap.advanceType = msg.components[0].wrap.advanceType || 'modal' + cell.wrap.advanceWidth = msg.components[0].wrap.advanceWidth || 1000 + cell.wrap.searchLwidth = msg.components[0].wrap.searchLwidth || 33.3 + cell.wrap.searchRatio = msg.components[0].wrap.searchRatio || 6 + cell.wrap.resetContrl = msg.components[0].wrap.resetContrl || 'init' + cell.wrap.show = msg.components[0].wrap.show || 'true' + + if (cell.wrap.advanceType === 'drawer') { + cell.wrap.drawerPlacement = msg.components[0].wrap.drawerPlacement || 'left' + } + + msg.components[0].search = [] + msg.components[0].setting.useMSearch = 'true' + + msg.components.unshift(cell) + msg.components[0].$tables = getTables(msg.components[0]) + msg.components[1].$tables = getTables(msg.components[1]) + } + + 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) => { config.fstMenuId = this.state.config.fstMenuId || config.fstMenuId || '' config.parentId = this.state.config.parentId || config.parentId || '' @@ -944,6 +1067,7 @@ {/* 琛ㄥ悕娣诲姞 */} <TableComponent config={config} updatetable={this.updateConfig}/> <Paragraph style={{padding: '15px 0px 0px 18px'}} copyable={{ text: MenuId }}>鑿滃崟ID</Paragraph> + <Paragraph style={{padding: '0px 0px 0px 5px'}}>鑿滃崟缁勪欢 <CopyOutlined onClick={this.copyMenu} style={{marginLeft: '3px', cursor: 'pointer', color: '#1890ff'}} /></Paragraph> </> : null} </Panel> <Panel header="鎼滅储" key="search"> @@ -966,13 +1090,6 @@ <div className={'menu-view' + (menuloading ? ' saving' : '')}> <Card bordered={false} extra={ <div className="mk-opeartion-list"> - {/* <Dropdown overlay={ - <div className="mk-button-dropdown-wrap"> - <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> - </div> - } trigger={['click']} placement="bottomCenter"> - <Button className="mk-button-more">鏇村<DownOutlined/></Button> - </Dropdown> */} {config ? <Debug config={config}/> : null} {config ? <Transfer config={config}/> : null} {config ? <Unattended config={config} updateConfig={this.updateConfig}/> : null} -- Gitblit v1.8.0