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/tabviews/custom/components/editor/braft-editor/index.scss | 9 + src/views/tabledesign/index.jsx | 135 ++++++++++++++- src/menu/components/editor/braft-editor/options.jsx | 1 src/views/pcdesign/index.jsx | 65 ++++++ src/templates/zshare/verifycard/index.jsx | 2 src/utils/utils-custom.js | 52 ++--- src/views/mobdesign/index.jsx | 75 +++++++ src/views/menudesign/index.jsx | 58 +++++ src/menu/pastecontroller/index.jsx | 51 +++++ src/templates/zshare/verifycard/voucherform/index.jsx | 50 +++++ 10 files changed, 438 insertions(+), 60 deletions(-) diff --git a/src/menu/components/editor/braft-editor/options.jsx b/src/menu/components/editor/braft-editor/options.jsx index 70910be..72d9018 100644 --- a/src/menu/components/editor/braft-editor/options.jsx +++ b/src/menu/components/editor/braft-editor/options.jsx @@ -150,6 +150,7 @@ {value: 'no-border', label: '鏃犺竟妗�'}, {value: 'bold-border', label: '杈规鍔犵矖'}, {value: 'deep-border', label: '杈规棰滆壊鍔犳繁'}, + {value: 'word-break', label: '寮哄埗鎹㈣'}, ], span: 24 }, diff --git a/src/menu/pastecontroller/index.jsx b/src/menu/pastecontroller/index.jsx index a570034..51b273d 100644 --- a/src/menu/pastecontroller/index.jsx +++ b/src/menu/pastecontroller/index.jsx @@ -5,6 +5,7 @@ import { SnippetsOutlined } from '@ant-design/icons' import md5 from 'md5' +import Utils from '@/utils/utils.js' import MenuUtils from '@/utils/utils-custom.js' import asyncComponent from '@/utils/asyncComponent' // import './index.scss' @@ -291,7 +292,7 @@ } this.pasteFormRef.handleConfirm().then(res => { - if (!res.copyType) { + if (!res.copyType || (res.copyType === 'components' && this.props.vType !== res.type)) { notification.warning({ top: 92, message: '閰嶇疆淇℃伅鏍煎紡閿欒锛�', @@ -307,6 +308,54 @@ let menu = fromJS(window.GLOB.customMenu).toJS() + if (res.copyType === 'components') { + let commonId = Utils.getuuid() + + res.interfaces = res.interfaces.map(inter => { + inter.uuid = md5(commonId + inter.uuid) + return inter + }) + + res.components = MenuUtils.resetConfig(res.components, commonId, true) + + if (menu.components.length) { + if ( + menu.components.findIndex(m => m.type === 'search' || (m.type === 'topbar' && m.wrap.type !== 'navbar')) > -1 && + res.components.findIndex(m => m.type === 'search' || (m.type === 'topbar' && m.wrap.type !== 'navbar')) > -1 + ) { + notification.warning({ + top: 92, + message: '鎼滅储鏉′欢涓嶅彲閲嶅娣诲姞锛�', + duration: 5 + }) + return + } + if ( + menu.components.findIndex(m => m.type === 'topbar') > -1 && + res.components.findIndex(m => m.type === 'topbar') > -1 + ) { + notification.warning({ + top: 92, + message: '瀵艰埅鏍忎笉鍙噸澶嶆坊鍔狅紒', + duration: 5 + }) + return + } + } + + this.setState({visible: false}) + + this.props.insert(res) + + notification.success({ + top: 92, + message: '绮樿创鎴愬姛锛�', + duration: 2 + }) + + return + } + if (!options.includes(res.copyType)) { if (type && types[res.copyType]) { notification.warning({ diff --git a/src/tabviews/custom/components/editor/braft-editor/index.scss b/src/tabviews/custom/components/editor/braft-editor/index.scss index ea58f85..e81c223 100644 --- a/src/tabviews/custom/components/editor/braft-editor/index.scss +++ b/src/tabviews/custom/components/editor/braft-editor/index.scss @@ -67,6 +67,15 @@ } } } +.custom-braft-editor-box.word-break { + .braft-content { + table { + td, th { + word-break: break-all!important; + } + } + } +} .custom-braft-editor-box.tb-flex { .braft-content { table { diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 69876c0..e6fdc87 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -2686,7 +2686,7 @@ 鍒涘缓鍑瘉 {verify.voucher && verify.voucher.enabled ? <span className="count-tip">1</span> : null} </span> - } key="voucher"> + } key="voucher" disabled={card.Ot === 'requiredOnce'}> <VoucherForm voucher={voucher} columns={columns} diff --git a/src/templates/zshare/verifycard/voucherform/index.jsx b/src/templates/zshare/verifycard/voucherform/index.jsx index c3c4b5a..f66fd0b 100644 --- a/src/templates/zshare/verifycard/voucherform/index.jsx +++ b/src/templates/zshare/verifycard/voucherform/index.jsx @@ -1,7 +1,8 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Form, Row, Col, Select, Switch, notification } from 'antd' +import { Form, Row, Col, Select, Switch, notification, Modal } from 'antd' +import { ConsoleSqlOutlined } from '@ant-design/icons' // import './index.scss' class UniqueForm extends Component { @@ -141,6 +142,50 @@ }) } + voucherSql = () => { + let BVoucherType = this.props.form.getFieldValue('BVoucherType') + let VoucherTypeOne = this.props.form.getFieldValue('VoucherTypeOne') + let linkField = this.props.form.getFieldValue('linkField') + + let _detail = this.state.voucherDetail.filter(item => item.ModularDetailCode === VoucherTypeOne)[0] + + if (!_detail) { + notification.warning({ + top: 92, + message: '鍑瘉绫诲瀷鎴栧嚟璇佹爣璇嗕笉瀛樺湪锛�', + duration: 5 + }) + return + } + + let _sql = `/* 鍒涘缓鍑瘉 */ + exec s_BVoucher_Create + @Bill = @${linkField || ''}, + @BVoucherType ='${BVoucherType}', + @VoucherTypeOne ='${VoucherTypeOne}', + @VoucherTypeTwo ='${_detail.VoucherTypeTwo}', + @Type =${_detail.IDefine1}, + @UserID=@UserID@, + @Username=@Username, + @FullName=@FullName, + @BVoucher =@BVoucher OUTPUT , + @FIBVoucherDate =@FIBVoucherDate OUTPUT , + @FiYear =@FiYear OUTPUT , + @ErrorCode =@ErrorCode OUTPUT, + @retmsg=@retmsg OUTPUT + if @ErrorCode!='' + GOTO aaa + ` + + Modal.info({ + title: '', + width: 500, + className: 'sql-example', + icon: null, + content: _sql.split(/\n\s{6}/ig).map((n, index) => <div key={index} dangerouslySetInnerHTML={{ __html: n.replace(/\s/ig, ' ') }} style={{whiteSpace: 'nowrap'}}></div>) + }) + } + render() { const { getFieldDecorator } = this.props.form const { voucherobj } = this.props @@ -255,8 +300,9 @@ </Form.Item> </Col> <Col span={11}> - <Form.Item label={'鏄惁鍚敤'}> + <Form.Item label="鏄惁鍚敤"> <Switch checkedChildren="鍚�" unCheckedChildren="鍋�" checked={voucherobj.enabled} onChange={this.onEnabledChange} /> + {voucherobj.enabled ? <ConsoleSqlOutlined style={{marginLeft: '20px', fontSize: '18px', color: '#1890ff', verticalAlign: 'middle'}} onClick={this.voucherSql}/> : null} </Form.Item> </Col> </Row> diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js index 12e86d5..021894d 100644 --- a/src/utils/utils-custom.js +++ b/src/utils/utils-custom.js @@ -451,11 +451,7 @@ card.elements = card.elements.map(cell => { if (cell.eleType === 'button') { cell.uuid = md5(commonId + cell.uuid) - if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) { - cell.pageTemplate = '' - cell.linkmenu = '' - } - this.resetBtn(cell, commonId) + this.resetBtn(cell, commonId, clear) } else { cell.uuid = this.getuuid() } @@ -467,11 +463,7 @@ card.backElements = card.backElements.map(cell => { if (cell.eleType === 'button') { cell.uuid = md5(commonId + cell.uuid) - if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) { - cell.pageTemplate = '' - cell.linkmenu = '' - } - this.resetBtn(cell, commonId) + this.resetBtn(cell, commonId, clear) } else { cell.uuid = this.getuuid() } @@ -491,11 +483,7 @@ item.elements = item.elements.map(cell => { if (cell.eleType === 'button') { cell.uuid = md5(commonId + cell.uuid) - if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) { - cell.pageTemplate = '' - cell.linkmenu = '' - } - this.resetBtn(cell, commonId) + this.resetBtn(cell, commonId, clear) } else { cell.uuid = this.getuuid() } @@ -528,12 +516,7 @@ cell.uuid = md5(commonId + cell.uuid) if (cell.eleType === 'button') { - if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) { - cell.pageTemplate = '' - cell.linkmenu = '' - } - - this.resetBtn(cell, commonId) + this.resetBtn(cell, commonId, clear) } return cell @@ -572,11 +555,15 @@ }) if (cell.subButton) { - this.resetBtn(cell.subButton, commonId) + this.resetBtn(cell.subButton, commonId, clear) } return cell }) + } else if (item.type === 'login') { + if (clear) { + item.wrap.linkmenu = '' + } } if (item.btnlog) { @@ -587,12 +574,7 @@ item.action = item.action.map(cell => { cell.uuid = md5(commonId + cell.uuid) - if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) { - cell.pageTemplate = '' - cell.linkmenu = '' - } - - this.resetBtn(cell, commonId) + this.resetBtn(cell, commonId, clear) return cell }) @@ -650,7 +632,7 @@ /** * @description 鎸夐挳閲嶇疆 */ - static resetBtn (btn, commonId) { + static resetBtn (btn, commonId, clear = false) { if (btn.OpenType === 'pop' || (btn.OpenType === 'funcbutton' && btn.execMode === 'pop')) { if (btn.modal && btn.modal.fields && btn.modal.fields.length > 0) { btn.modal.fields = btn.modal.fields.map(m => { @@ -659,6 +641,16 @@ }) } } + + if (clear) { + if (btn.pageTemplate === 'linkpage') { + btn.pageTemplate = '' + } + delete btn.linkmenu + delete btn.openmenu + delete btn.refreshTab + } + if (btn.switchTab && btn.switchTab.length > 0) { btn.switchTab = btn.switchTab.map(m => md5(commonId + m)) } @@ -3891,7 +3883,7 @@ _sql += ` /* 鍒涘缓鍑瘉 */ exec s_BVoucher_Create - @Bill ='0', + @Bill = @${_voucher.linkField}, @BVoucherType ='${_voucher.BVoucherType}', @VoucherTypeOne ='${_voucher.VoucherTypeOne}', @VoucherTypeTwo ='${_voucher.VoucherTypeTwo}', 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> diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index b15aa97..2fcc5eb 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -4,7 +4,7 @@ import { is, fromJS } from 'immutable' import HTML5Backend from 'react-dnd-html5-backend' import { notification, Modal, Collapse, Switch, Button, message, Spin, Typography } from 'antd' -import { DoubleLeftOutlined, DoubleRightOutlined, HomeOutlined, LoginOutlined, ArrowLeftOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons' +import { DoubleLeftOutlined, DoubleRightOutlined, HomeOutlined, LoginOutlined, ArrowLeftOutlined, EyeOutlined, EyeInvisibleOutlined, CopyOutlined } from '@ant-design/icons' import moment from 'moment' import md5 from 'md5' @@ -1988,11 +1988,22 @@ insert = (item) => { let config = fromJS(this.state.config).toJS() - if (item.type === 'topbar' && !config.style.paddingTop) { - config.style.paddingTop = '50px' + if (item.copyType === 'components') { + if (item.components.findIndex(m => m.type === 'topbar') > -1 && !config.style.paddingTop) { + config.style.paddingTop = '50px' + } + config.components.push(...item.components) + if (!config.interfaces) { + config.interfaces = item.interfaces + } else { + config.interfaces.push(...item.interfaces) + } + } else { + if (item.type === 'topbar' && !config.style.paddingTop) { + config.style.paddingTop = '50px' + } + config.components.push(item) } - - config.components.push(item) this.setState({config}) window.GLOB.customMenu = config @@ -2170,6 +2181,53 @@ 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: 'mob' } + + msg.components = [] + msg.interfaces = config.interfaces || [] + + config.components.forEach(item => { + if (item.type === 'navbar') return + + msg.components.push(item) + }) + + if (msg.components.length === 0) { + notification.warning({ + top: 92, + message: '鏈坊鍔犵粍浠讹紝涓嶅彲澶嶅埗銆�', + duration: 5 + }) + return + } + + 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.open_edition = this.state.config.open_edition || '' @@ -2217,8 +2275,9 @@ <UrlFieldComponent config={config} updateConfig={this.updateConfig}/> {/* 琛ㄥ悕娣诲姞 */} <TableComponent config={config} updatetable={this.updateConfig}/> - <Paragraph style={{padding: '15px 0px 0px 18px'}} copyable={{ text: MenuId }}>鑿滃崟ID</Paragraph> - <Paragraph style={{padding: '10px 0px 0px 18px'}} copyable={{ text: `${window.GLOB.baseurl}mob/index.html#/index/${sessionStorage.getItem('kei_no')}/${sessionStorage.getItem('typename')}/${sessionStorage.getItem('lang')}/${MenuId}/@BID@` }}>鑿滃崟閾炬帴</Paragraph> + <Paragraph style={{padding: '15px 0px 0px 37px'}} copyable={{ text: MenuId }}>鑿滃崟ID</Paragraph> + <Paragraph style={{padding: '0px 0px 0px 23px'}} copyable={{ text: `${window.GLOB.baseurl}mob/index.html#/index/${sessionStorage.getItem('kei_no')}/${sessionStorage.getItem('typename')}/${sessionStorage.getItem('lang')}/${MenuId}/@BID@` }}>鑿滃崟閾炬帴</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> @@ -2247,7 +2306,7 @@ {config ? <Debug config={config}/> : null} <Button className="mk-border-purple" onClick={() => this.setState({eyeopen: !eyeopen})}>{!eyeopen ? <EyeOutlined /> : <EyeInvisibleOutlined />} 缁勪欢鍚�</Button> <CreateView resetmenu={this.getAppMenus} /> - <PasteController insert={this.insert} /> + <PasteController vType="mob" insert={this.insert} /> <TableNodes config={config} /> <ViewNodes config={config} MenuId={MenuId}/> <SysInterface config={config} updateConfig={this.updateConfig}/> diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index f4dd5f0..d9585dd 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -4,7 +4,7 @@ import { is, fromJS } from 'immutable' import HTML5Backend from 'react-dnd-html5-backend' import { notification, Modal, Collapse, Switch, Button, message, Spin, Typography } from 'antd' -import { DoubleLeftOutlined, DoubleRightOutlined, HomeOutlined, LoginOutlined, ArrowLeftOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons' +import { DoubleLeftOutlined, DoubleRightOutlined, HomeOutlined, LoginOutlined, ArrowLeftOutlined, EyeOutlined, EyeInvisibleOutlined, CopyOutlined } from '@ant-design/icons' import moment from 'moment' import md5 from 'md5' @@ -1662,7 +1662,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 @@ -1805,6 +1814,53 @@ 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: 'pc' } + + msg.components = [] + msg.interfaces = config.interfaces || [] + + config.components.forEach(item => { + if (item.type === 'navbar') return + + msg.components.push(item) + }) + + if (msg.components.length === 0) { + notification.warning({ + top: 92, + message: '鏈坊鍔犵粍浠讹紝涓嶅彲澶嶅埗銆�', + duration: 5 + }) + return + } + + 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.open_edition = this.state.config.open_edition || '' @@ -1845,7 +1901,8 @@ <UrlFieldComponent config={config} updateConfig={this.updateConfig}/> {/* 琛ㄥ悕娣诲姞 */} <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> @@ -1874,7 +1931,7 @@ {config ? <Debug config={config}/> : null} <Button className="mk-border-purple" onClick={() => this.setState({eyeopen: !eyeopen})}>{!eyeopen ? <EyeOutlined /> : <EyeInvisibleOutlined />} 缁勪欢鍚�</Button> <CreateView resetmenu={this.getAppMenus} /> - <PasteController insert={this.insert} /> + <PasteController vType="pc" insert={this.insert} /> <TableNodes config={config} /> <ViewNodes config={config} MenuId={MenuId}/> <SysInterface config={config} updateConfig={this.updateConfig}/> 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