From dc5c6c0debd4d6b05f822545076fbf0a77008e0d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 10 八月 2022 13:35:53 +0800 Subject: [PATCH] 2022-08-10 --- src/views/popdesign/index.scss | 32 ++ src/menu/stylecombcontrolbutton/index.scss | 10 src/locales/zh-CN/mob.js | 1 src/pc/bgcontroller/index.jsx | 38 +++ src/views/pcdesign/index.jsx | 105 +------- src/views/popdesign/menuform/index.scss | 0 src/router/index.js | 2 src/templates/zshare/verifycard/customscript/index.jsx | 2 src/menu/components/card/data-card/index.jsx | 10 /dev/null | 9 src/views/popdesign/index.jsx | 251 ++++++++++++---------- src/views/popdesign/menuform/index.jsx | 14 src/pc/menushell/index.scss | 2 src/views/imdesign/index.jsx | 2 src/views/mobdesign/index.jsx | 28 -- src/views/menudesign/index.jsx | 147 ++++-------- src/locales/en-US/mob.js | 1 src/menu/menushell/index.scss | 3 18 files changed, 307 insertions(+), 350 deletions(-) diff --git a/src/locales/en-US/mob.js b/src/locales/en-US/mob.js index a284d0c..c5f7804 100644 --- a/src/locales/en-US/mob.js +++ b/src/locales/en-US/mob.js @@ -20,7 +20,6 @@ 'mob.component': '缁勪欢', 'mob.status.open': '鍚敤', 'mob.status.change': '鍒囨崲', - 'mob.basemsg': '鍩烘湰淇℃伅', 'mob.query.delete': '纭畾鍒犻櫎鍚楋紵', 'mob.logout.hint': '鎮ㄧ‘瀹氳閫�鍑哄悧?', 'mob.required.input': '璇疯緭鍏�', diff --git a/src/locales/zh-CN/mob.js b/src/locales/zh-CN/mob.js index b7f44ec..107ba2c 100644 --- a/src/locales/zh-CN/mob.js +++ b/src/locales/zh-CN/mob.js @@ -20,7 +20,6 @@ 'mob.component': '缁勪欢', 'mob.status.open': '鍚敤', 'mob.status.change': '鍒囨崲', - 'mob.basemsg': '鍩烘湰淇℃伅', 'mob.query.delete': '纭畾鍒犻櫎鍚楋紵', 'mob.logout.hint': '鎮ㄧ‘瀹氳閫�鍑哄悧?', 'mob.required.input': '璇疯緭鍏�', diff --git a/src/menu/bgcontroller/index.jsx b/src/menu/bgcontroller/index.jsx deleted file mode 100644 index ba87f28..0000000 --- a/src/menu/bgcontroller/index.jsx +++ /dev/null @@ -1,176 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { Form, Select, Input } from 'antd' - -import asyncComponent from '@/utils/asyncComponent' -import './index.scss' - -const ColorSketch = asyncComponent(() => import('@/mob/colorsketch')) -const SourceComponent = asyncComponent(() => import('@/menu/components/share/sourcecomponent')) -const { Option } = Select - -class MobController extends Component { - static propTpyes = { - config: PropTypes.any, - updateConfig: PropTypes.func, - } - - state = { - background: '', - backgroundColor: '', - backgroundImage: '', - backgroundSize: '', - backgroundRepeat: '', - } - - UNSAFE_componentWillMount () { - const { config } = this.props - - let bgImg = config.style.backgroundImage || '' - - if (bgImg && /^url/.test(bgImg)) { - bgImg = bgImg.replace('url(', '') - bgImg = bgImg.replace(')', '') - } - - this.setState({ - background: config.style.background || '', - backgroundColor: config.style.backgroundColor, - backgroundImage: bgImg, - backgroundSize: config.style.backgroundSize || '100%', - backgroundRepeat: config.style.backgroundRepeat || 'repeat', - }) - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.state), fromJS(nextState)) - } - - /** - * @description 淇敼鑳屾櫙棰滆壊 锛岄鑹叉帶浠� - */ - changeBackgroundColor = (val) => { - let config = fromJS(this.props.config).toJS() - - this.setState({ - backgroundColor: val - }) - - config.style.backgroundColor = val - this.props.updateConfig(config) - } - - imgChange = (val) => { - this.setState({ - backgroundImage: val - }) - - let config = fromJS(this.props.config).toJS() - - if (val) { - config.style.backgroundImage = `url(${val})` - } else { - delete config.style.backgroundImage - } - this.props.updateConfig(config) - } - - backgroundSizeChange = (val) => { - this.setState({ - backgroundSize: val - }) - - let config = fromJS(this.props.config).toJS() - config.style.backgroundSize = val - - this.props.updateConfig(config) - } - - backgroundRepeatChange = (val) => { - this.setState({ - backgroundRepeat: val - }) - - let config = fromJS(this.props.config).toJS() - config.style.backgroundRepeat = val - - this.props.updateConfig(config) - } - - changeBackground = (val) => { - this.setState({ - background: val, - }) - - if (!val || /(^linear-gradient|^radial-gradient)\(.*\)$/.test(val)) { - let config = fromJS(this.props.config).toJS() - config.style.background = val - - delete config.style.backgroundColor - delete config.style.backgroundImage - - if (!val) { - delete config.style.background - } - - this.setState({ - backgroundImage: '', - backgroundColor: '' - }) - - this.props.updateConfig(config) - } - } - - render () { - const { backgroundColor, backgroundImage, backgroundSize, backgroundRepeat, background } = this.state - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 4 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 20 } - } - } - - return ( - <div className="menu-background-controller"> - <Form {...formItemLayout}> - <Form.Item className="color-control" colon={false} label="棰滆壊"> - <ColorSketch value={backgroundColor} onChange={this.changeBackgroundColor} /> - </Form.Item> - {window.develop === true ? <Form.Item colon={false} label="棰滆壊"> - <Input value={background} onChange={(e) => this.changeBackground(e.target.value)} /> - </Form.Item> : null} - <Form.Item colon={false} label="鍥剧墖"> - <SourceComponent value={backgroundImage} type="" placement="right" onChange={this.imgChange}/> - </Form.Item> - <Form.Item colon={false} label="姣斾緥"> - <Select defaultValue={backgroundSize} onChange={this.backgroundSizeChange}> - <Option value="100%">100%</Option> - <Option value="100% 100%">100% 100%</Option> - <Option value="auto 100%">auto 100%</Option> - <Option value="100% auto">100% auto</Option> - <Option value="auto">auto</Option> - <Option value="contain">contain</Option> - <Option value="cover">cover</Option> - </Select> - </Form.Item> - <Form.Item colon={false} label="閲嶅"> - <Select defaultValue={backgroundRepeat} onChange={this.backgroundRepeatChange}> - <Option value="repeat">repeat</Option> - <Option value="no-repeat">no-repeat</Option> - <Option value="repeat-x">repeat-x</Option> - <Option value="repeat-y">repeat-y</Option> - </Select> - </Form.Item> - </Form> - </div> - ) - } -} - -export default MobController \ No newline at end of file diff --git a/src/menu/bgcontroller/index.scss b/src/menu/bgcontroller/index.scss deleted file mode 100644 index 0d6ed73..0000000 --- a/src/menu/bgcontroller/index.scss +++ /dev/null @@ -1,43 +0,0 @@ -.menu-background-controller { - width: 100%; - height: 100%; - overflow: hidden; - .color-control .ant-form-item-control { - padding-top: 10px; - line-height: 35px; - } - .mk-source-wrap { - height: 32px; - .mk-source-item-info { - top: 5px; - } - } -} - -.margin-popover { - padding-top: 0px; - .ant-popover-inner-content { - width: 90px; - padding: 0px 5px; - .ant-menu-root.ant-menu-vertical { - border: 0; - .ant-menu-item { - height: 30px; - cursor: pointer; - line-height: 30px; - } - .ant-menu-item:not(:last-child) { - margin-bottom: 0px; - } - .ant-menu-item:first-child { - margin-top: 10px; - } - .ant-menu-item:last-child { - margin-bottom: 10px; - } - } - } - .ant-popover-arrow { - display: none; - } -} \ No newline at end of file diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx index 67ca766..97971e6 100644 --- a/src/menu/components/card/data-card/index.jsx +++ b/src/menu/components/card/data-card/index.jsx @@ -237,6 +237,16 @@ }) } } + // $check@鏈夋晥鎬ф娴� + // if (['prompt', 'exec', 'pop'].includes(cell.OpenType) && cell.Ot === 'required' && cell.verify && cell.verify.scripts && cell.verify.scripts.length > 0) { + // cell.verify.scripts.some(s => { + // if (s.status !== 'false' && /\$check@|@check\$/ig.test(s.sql)) { + // card.errors.push({ level: 1, detail: `鍙�夋嫨澶氳鐨勬寜閽��${cell.label}鈥濅腑 $check@ 鎴� @check$ 灏嗕笉浼氱敓鏁堬紒`}) + // return true + // } + // return false + // }) + // } }) card.subcards.forEach((item, i) => { diff --git a/src/menu/menushell/index.scss b/src/menu/menushell/index.scss index 21f8a7d..ac770fb 100644 --- a/src/menu/menushell/index.scss +++ b/src/menu/menushell/index.scss @@ -1,6 +1,7 @@ .menu-shell-inner { min-height: calc(100vh - 100px); - width: 100%; + width: auto!important; + overflow-x: hidden; background-size: 100%; .anticon { diff --git a/src/menu/padcontroller/index.jsx b/src/menu/padcontroller/index.jsx deleted file mode 100644 index 3ade9f2..0000000 --- a/src/menu/padcontroller/index.jsx +++ /dev/null @@ -1,95 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { Form, Col } from 'antd' -import { ArrowUpOutlined, ArrowDownOutlined, ArrowLeftOutlined, ArrowRightOutlined } from '@ant-design/icons' - -import StyleInput from '../stylecontroller/styleInput' -import './index.scss' - -class MobController extends Component { - static propTpyes = { - config: PropTypes.any, - updateConfig: PropTypes.func, - } - - state = { - paddingTop: '', - paddingBottom: '', - paddingLeft: '', - paddingRight: '' - } - - UNSAFE_componentWillMount () { - - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.state), fromJS(nextState)) - } - - /** - * @description 淇敼鑳屾櫙棰滆壊 锛岄鑹叉帶浠� - */ - changePadding = (val, type) => { - let config = fromJS(this.props.config).toJS() - - config.style[type] = val - this.props.updateConfig(config) - } - - render () { - const { config } = this.props - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 4 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 20 } - } - } - - return ( - <div className="menu-padding-controller"> - <Form {...formItemLayout}> - <Col span={24}> - <Form.Item - colon={false} - label={<ArrowUpOutlined title="涓婅竟璺�"/>} - > - <StyleInput defaultValue={config.style.paddingTop || '0px'} options={['px', 'vh', 'vw']} onChange={(val) => this.changePadding(val, 'paddingTop')}/> - </Form.Item> - </Col> - <Col span={24}> - <Form.Item - colon={false} - label={<ArrowDownOutlined title="涓嬭竟璺�"/>} - > - <StyleInput defaultValue={config.style.paddingBottom || '0px'} options={['px', 'vh', 'vw']} onChange={(val) => this.changePadding(val, 'paddingBottom')}/> - </Form.Item> - </Col> - <Col span={24}> - <Form.Item - colon={false} - label={<ArrowLeftOutlined title="宸﹁竟璺�"/>} - > - <StyleInput defaultValue={config.style.paddingLeft || '0px'} options={['px', 'vh', 'vw']} onChange={(val) => this.changePadding(val, 'paddingLeft')}/> - </Form.Item> - </Col> - <Col span={24}> - <Form.Item - colon={false} - label={<ArrowRightOutlined title="鍙宠竟璺�"/>} - > - <StyleInput defaultValue={config.style.paddingRight || '0px'} options={['px', 'vh', 'vw']} onChange={(val) => this.changePadding(val, 'paddingRight')}/> - </Form.Item> - </Col> - </Form> - </div> - ) - } -} - -export default MobController \ No newline at end of file diff --git a/src/menu/padcontroller/index.scss b/src/menu/padcontroller/index.scss deleted file mode 100644 index 95c0abe..0000000 --- a/src/menu/padcontroller/index.scss +++ /dev/null @@ -1,9 +0,0 @@ -.menu-padding-controller { - width: 100%; - height: 100%; - overflow: hidden; - .ant-form-item label > .anticon { - font-size: 16px; - vertical-align: middle; - } -} diff --git a/src/menu/stylecombcontrolbutton/index.scss b/src/menu/stylecombcontrolbutton/index.scss index 3732704..003e577 100644 --- a/src/menu/stylecombcontrolbutton/index.scss +++ b/src/menu/stylecombcontrolbutton/index.scss @@ -17,6 +17,16 @@ z-index: 12; background:rgba(0, 0, 0, 0.2); } + .pc-poper-view::before { + content: ' '; + position: absolute; + left: 0; + top: 0; + bottom: 0; + right: 0; + z-index: 12; + background:rgba(0, 0, 0, 0.2); + } .menu-body .menu-view >.ant-card >.ant-card-body { position: relative; z-index: 13; diff --git a/src/pc/bgcontroller/index.jsx b/src/pc/bgcontroller/index.jsx index 88fdafa..23ee485 100644 --- a/src/pc/bgcontroller/index.jsx +++ b/src/pc/bgcontroller/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Form, Select } from 'antd' +import { Form, Select, Input } from 'antd' import { ArrowUpOutlined, ArrowDownOutlined, ArrowLeftOutlined, ArrowRightOutlined } from '@ant-design/icons' import asyncComponent from '@/utils/asyncComponent' @@ -19,6 +19,7 @@ } state = { + background: '', backgroundColor: '', backgroundImage: '', backgroundSize: '', @@ -38,6 +39,7 @@ } this.setState({ + background: config.style.background || '', backgroundColor: config.style.backgroundColor, backgroundImage: bgImg, backgroundSize: config.style.backgroundSize || '100%', @@ -123,9 +125,34 @@ this.props.updateConfig(config) } + changeBackground = (val) => { + this.setState({ + background: val, + }) + + if (!val || /(^linear-gradient|^radial-gradient)\(.*\)$/.test(val)) { + let config = fromJS(this.props.config).toJS() + config.style.background = val + + delete config.style.backgroundColor + delete config.style.backgroundImage + + if (!val) { + delete config.style.background + } + + this.setState({ + backgroundImage: '', + backgroundColor: '' + }) + + this.props.updateConfig(config) + } + } + render () { const { config } = this.props - const { backgroundColor, backgroundImage, backgroundSize, backgroundRepeat, backgroundPosition } = this.state + const { backgroundColor, backgroundImage, backgroundSize, backgroundRepeat, backgroundPosition, background } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -140,16 +167,19 @@ return ( <div className="pc-style-controller"> <Form {...formItemLayout}> - <Form.Item + {/* <Form.Item colon={false} label="瀹藉害" className="normal-view" > <StyleInput defaultValue={config.style.width || '100%'} options={['px', '%', 'vw']} onChange={(val) => this.changePadding(val, 'width')}/> - </Form.Item> + </Form.Item> */} <Form.Item className="color-control" colon={false} label="鑳屾櫙鑹�"> <ColorSketch value={backgroundColor} onChange={this.changeBackgroundColor} /> </Form.Item> + {window.develop === true ? <Form.Item colon={false} label="棰滆壊"> + <Input value={background} onChange={(e) => this.changeBackground(e.target.value)} /> + </Form.Item> : null} <Form.Item colon={false} label="鑳屾櫙鍥�"> <SourceComponent value={backgroundImage} type="" placement="right" onChange={this.imgChange}/> </Form.Item> diff --git a/src/pc/menushell/index.scss b/src/pc/menushell/index.scss index 21f8a7d..752a286 100644 --- a/src/pc/menushell/index.scss +++ b/src/pc/menushell/index.scss @@ -1,6 +1,6 @@ .menu-shell-inner { min-height: calc(100vh - 100px); - width: 100%; + width: auto!important; background-size: 100%; .anticon { diff --git a/src/router/index.js b/src/router/index.js index 434fcd4..2f4d669 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -16,6 +16,7 @@ const AppCheck = asyncLoadComponent(() => import('@/views/appcheck')) const PCDesign = asyncLoadComponent(() => import('@/views/pcdesign')) const MobDesign = asyncLoadComponent(() => import('@/views/mobdesign')) +const PopDesign = asyncLoadComponent(() => import('@/views/popdesign')) const ImDesign = asyncLoadComponent(() => import('@/views/imdesign')) const MenuDesign = asyncLoadComponent(() => import('@/views/menudesign')) const BaseDesign = asyncLoadComponent(() => import('@/views/basedesign')) @@ -39,6 +40,7 @@ {path: '/imdesign/:param', name: 'imdesign', component: ImDesign, auth: true}, {path: '/menudesign/:param', name: 'menudesign', component: MenuDesign, auth: true}, {path: '/basedesign/:param', name: 'basedesign', component: BaseDesign, auth: true}, + {path: '/popdesign/:param', name: 'popdesign', component: PopDesign, auth: true}, {path: '/billprint/:param', name: 'billprint', component: BillPrint, auth: true}, {path: '/docprint/:menuId', name: 'docprint', component: BillPrint, auth: false}, {path: '/docprint/:menuId/:id', name: 'docprint', component: BillPrint, auth: false}, diff --git a/src/templates/zshare/verifycard/customscript/index.jsx b/src/templates/zshare/verifycard/customscript/index.jsx index 9deb26b..2211b58 100644 --- a/src/templates/zshare/verifycard/customscript/index.jsx +++ b/src/templates/zshare/verifycard/customscript/index.jsx @@ -325,7 +325,7 @@ </Col> <Col span={24} className="sql"> <Form.Item label={ - <Tooltip placement="topLeft" title={'鏁版嵁妫�鏌ユ浛鎹㈢ $check@ -> \'\'銆� @check$ -> \'\'锛孍rrorCode绛変簬C鏃� $check@ -> /*銆� @check$ -> */'}> + <Tooltip placement="topLeft" title={'鏁版嵁妫�鏌ユ浛鎹㈢ $check@ -> \'\'銆� @check$ -> \'\'锛孍rrorCode绛変簬C鏃� $check@ -> /*銆� @check$ -> */銆傛敞锛�1銆侀渶浣跨敤绯荤粺鎺ュ彛 2銆佽璁剧疆涓衡�滈�夋嫨澶氳鈥濇椂鏃犳晥銆�'}> <QuestionCircleOutlined className="mk-form-tip" /> sql </Tooltip> diff --git a/src/views/imdesign/index.jsx b/src/views/imdesign/index.jsx index d0ee0c7..15ee914 100644 --- a/src/views/imdesign/index.jsx +++ b/src/views/imdesign/index.jsx @@ -485,7 +485,7 @@ <div className="pc-setting-tools"> <Collapse accordion defaultActiveKey="basedata" bordered={false}> {/* 鍩烘湰淇℃伅 */} - <Panel header={dict['mob.basemsg']} forceRender key="basedata"> + <Panel header="鍩烘湰淇℃伅" forceRender key="basedata"> {/* 鑿滃崟淇℃伅 */} {config ? <MenuForm dict={dict} diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index 0f24503..6bc56fd 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -1,5 +1,6 @@ import React, { Component } from 'react' import { DndProvider } from 'react-dnd' +import { withRouter } from 'react-router' import { is, fromJS } from 'immutable' import moment from 'moment' import HTML5Backend from 'react-dnd-html5-backend' @@ -12,7 +13,7 @@ import Utils, { setGLOBFuncs } from '@/utils/utils.js' import zhCN from '@/locales/zh-CN/mob.js' import enUS from '@/locales/en-US/mob.js' -import antdEnUS from 'antd/es/locale/en_US' +// import antdEnUS from 'antd/es/locale/en_US' import antdZhCN from 'antd/es/locale/zh_CN' import MKEmitter from '@/utils/events.js' import MenuUtils from '@/utils/utils-custom.js' @@ -23,7 +24,7 @@ const { Panel } = Collapse const { confirm } = Modal const { Paragraph } = Typography -const _locale = sessionStorage.getItem('lang') !== 'en-US' ? antdZhCN : antdEnUS +const _locale = antdZhCN const MenuForm = asyncComponent(() => import('./menuform')) const HomeForm = asyncComponent(() => import('./homeform')) @@ -31,10 +32,8 @@ const MenuShell = asyncComponent(() => import('@/menu/menushell')) const PrintMenuForm = asyncComponent(() => import('./printmenuform')) const SourceWrap = asyncComponent(() => import('@/menu/modulesource')) -const PopviewController = asyncComponent(() => import('@/menu/popview')) -const BgController = asyncComponent(() => import('@/menu/bgcontroller')) +const BgController = asyncComponent(() => import('@/pc/bgcontroller')) const PasteController = asyncComponent(() => import('@/menu/pastecontroller')) -const PaddingController = asyncComponent(() => import('@/menu/padcontroller')) const StyleController = asyncComponent(() => import('@/menu/stylecontroller')) const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) const Versions = asyncComponent(() => import('@/menu/versions')) @@ -47,13 +46,8 @@ const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) sessionStorage.setItem('isEditState', 'true') -sessionStorage.setItem('editMenuType', 'menu') // 缂栬緫鑿滃崟绫诲瀷 sessionStorage.setItem('appType', '') // 搴旂敤绫诲瀷 document.body.className = '' -window.GLOB.UserComponentMap = new Map() // 缂撳瓨鐢ㄦ埛鑷畾涔夌粍浠� -window.GLOB.TabsMap = new Map() // 缂撳瓨鐢ㄦ埛鎿嶄綔鐨勬爣绛鹃〉 -window.GLOB.urlFields = [] // url鍙橀噺 -window.GLOB.customMenu = null // 淇濆瓨鑿滃崟淇℃伅 class MenuDesign extends Component { state = { @@ -65,13 +59,10 @@ MenuNo: '', delButtons: [], copyButtons: [], - thawButtons: [], activeKey: 'basedata', menuloading: false, oriConfig: null, config: null, - popBtn: null, // 寮圭獥鏍囩椤� - visible: false, customComponents: [], comloading: false, settingshow: true, @@ -80,6 +71,13 @@ } UNSAFE_componentWillMount() { + sessionStorage.setItem('editMenuType', 'menu') // 缂栬緫鑿滃崟绫诲瀷 + + window.GLOB.UserComponentMap = new Map() // 缂撳瓨鐢ㄦ埛鑷畾涔夌粍浠� + window.GLOB.TabsMap = new Map() // 缂撳瓨鐢ㄦ埛鎿嶄綔鐨勬爣绛鹃〉 + window.GLOB.urlFields = [] // url鍙橀噺 + window.GLOB.customMenu = null // 淇濆瓨鑿滃崟淇℃伅 + try { let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) @@ -108,7 +106,7 @@ componentDidMount () { MKEmitter.addListener('delButtons', this.delButtons) MKEmitter.addListener('modalStatus', this.modalStatus) - MKEmitter.addListener('thawButtons', this.thawButtons) + // MKEmitter.addListener('thawButtons', this.thawButtons) MKEmitter.addListener('copyButtons', this.copyButtons) MKEmitter.addListener('changePopview', this.initPopview) MKEmitter.addListener('triggerMenuSave', this.triggerMenuSave) @@ -151,9 +149,6 @@ let node = document.getElementById('save-modal-config') if (!node) { - node = document.getElementById('save-pop-config') - } - if (!node) { node = document.getElementById('save-config') } @@ -174,7 +169,7 @@ } MKEmitter.removeListener('delButtons', this.delButtons) MKEmitter.removeListener('modalStatus', this.modalStatus) - MKEmitter.removeListener('thawButtons', this.thawButtons) + // MKEmitter.removeListener('thawButtons', this.thawButtons) MKEmitter.removeListener('copyButtons', this.copyButtons) MKEmitter.removeListener('changePopview', this.initPopview) MKEmitter.removeListener('triggerMenuSave', this.triggerMenuSave) @@ -187,8 +182,6 @@ } triggerMenuSave = () => { - if (this.state.visible) return - this.submitConfig() } @@ -343,9 +336,9 @@ this.setState({copyButtons: [...this.state.copyButtons, ...items]}) } - thawButtons = (item) => { - this.setState({thawButtons: [...this.state.thawButtons, item]}) - } + // thawButtons = (item) => { + // this.setState({thawButtons: [...this.state.thawButtons, item]}) + // } initPopview = (card, btn) => { const { oriConfig, config } = this.state @@ -359,20 +352,11 @@ return } - btn.config = fromJS(config).toJS() - btn.component = card + let _btn = fromJS(btn).toJS() + _btn.MenuName = config.MenuName + '-' + card.name + '-' + btn.label + _btn.ParentMenuID = config.uuid - sessionStorage.setItem('editMenuType', 'popview') // 缂栬緫寮圭獥鏍囩 - - this.setState({popBtn: btn, visible: true}) - } - - handleBack = () => { - this.setState({popBtn: null, delButtons: [], copyButtons: []}, () => { - sessionStorage.setItem('editMenuType', 'menu') - window.GLOB.customMenu = this.state.config - this.setState({visible: false}) - }) + this.props.history.push('/popdesign/' + window.btoa(window.encodeURIComponent((JSON.stringify(_btn))))) } closeView = () => { @@ -498,7 +482,6 @@ delButtons.push(btn.uuid) return } - this.checkBtn(btn) buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`) _sort++ }) @@ -509,7 +492,6 @@ delButtons.push(cell.uuid) return } - this.checkBtn(cell) buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`) _sort++ }) @@ -519,7 +501,6 @@ delButtons.push(cell.uuid) return } - this.checkBtn(cell) buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`) _sort++ }) @@ -532,7 +513,6 @@ delButtons.push(cell.uuid) return } - this.checkBtn(cell) buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`) _sort++ }) @@ -544,7 +524,6 @@ delButtons.push(cell.uuid) return } - this.checkBtn(cell) buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`) _sort++ }) @@ -554,7 +533,6 @@ delButtons.push(btn.uuid) return } - this.checkBtn(btn) buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`) _sort++ }) @@ -564,7 +542,6 @@ delButtons.push(btn.uuid) return } - this.checkBtn(btn) buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`) _sort++ }) @@ -575,7 +552,6 @@ delButtons.push(btn.uuid) return } - this.checkBtn(btn) buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`) _sort++ }) @@ -589,28 +565,8 @@ return buttons } - checkBtn = (btn) => { - if (['prompt', 'exec', 'pop'].includes(btn.OpenType) && btn.Ot === 'required' && btn.verify && btn.verify.scripts && btn.verify.scripts.length > 0) { - let hascheck = false - btn.verify.scripts.forEach(item => { - if (item.status === 'false') return - - if (/\$check@|@check\$/ig.test(item.sql)) { - hascheck = true - } - }) - if (hascheck) { - notification.warning({ - top: 92, - message: `鍙�夋嫨澶氳鐨勬寜閽��${btn.label}銆嬩腑 $check@ 鎴� @check$ 灏嗕笉浼氱敓鏁堬紒`, - duration: 5 - }) - } - } - } - submitConfig = () => { - const { MenuType, copyButtons, thawButtons } = this.state + const { MenuType, copyButtons } = this.state let config = fromJS(this.state.config).toJS() if (MenuType === 'billPrint' && config.printPage === 'page' && !config.everyPCount) { @@ -752,28 +708,28 @@ } return Api.getSystemConfig(_param) } - }).then(res => { // 鎸夐挳瑙i櫎鍐荤粨 - if (!res) return - if (!res.status) { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - return false - } + // }).then(res => { // 鎸夐挳瑙i櫎鍐荤粨 + // if (!res) return + // if (!res.status) { + // notification.warning({ + // top: 92, + // message: res.message, + // duration: 5 + // }) + // return false + // } - let ids = thawButtons.filter(item => btnIds.indexOf(item) !== -1) - if (ids.length === 0) { - return { - status: true - } - } else { - return Api.getSystemConfig({ - func: 'sPC_MainMenu_ReDel', - MenuID: ids.join(',') - }) - } + // let ids = thawButtons.filter(item => btnIds.indexOf(item) !== -1) + // if (ids.length === 0) { + // return { + // status: true + // } + // } else { + // return Api.getSystemConfig({ + // func: 'sPC_MainMenu_ReDel', + // MenuID: ids.join(',') + // }) + // } }).then(res => { // 椤甸潰淇濆瓨 if (!res) return @@ -917,7 +873,6 @@ this.setState({ delButtons: [], copyButtons: [], - thawButtons: [], menuloading: false }) notification.success({ @@ -1095,13 +1050,13 @@ } render () { - const { activeKey, comloading, MenuType, popBtn, visible, dict, MenuId, config, settingshow, ParentId, menuloading, customComponents, eyeopen } = this.state + const { activeKey, comloading, MenuType, dict, MenuId, config, settingshow, ParentId, menuloading, customComponents, eyeopen } = this.state return ( <ConfigProvider locale={_locale}> <div className={'pc-menu-view ' + (MenuType || '')} id="mk-menu-design-view"> <Header /> - {!popBtn && !visible ? <DndProvider backend={HTML5Backend}> + <DndProvider backend={HTML5Backend}> <div className="menu-body"> <div className={'menu-setting ' + (!settingshow ? 'hidden' : '')}> <div className="draw"> @@ -1109,7 +1064,7 @@ </div> <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> {/* 鍩烘湰淇℃伅 */} - <Panel header={dict['mob.basemsg']} key="basedata"> + <Panel header="鍩烘湰淇℃伅" key="basedata"> {/* 鑿滃崟淇℃伅 */} {config && MenuType === 'custom' ? <MenuForm dict={dict} @@ -1139,17 +1094,14 @@ {config ? <Paragraph style={{padding: '15px 0px 0px 18px'}} copyable={{ text: MenuId }}>鑿滃崟ID</Paragraph> : null} </Panel> {/* 缁勪欢娣诲姞 */} - <Panel header={dict['mob.component']} key="component"> + <Panel header="缁勪欢" key="component"> <SourceWrap MenuType={MenuType} /> </Panel> {customComponents && customComponents.length ? <Panel header="鑷畾涔夌粍浠�" key="cuscomponent"> <SourceWrap components={customComponents} MenuType={MenuType} /> </Panel> : null} - <Panel header={'椤甸潰鑳屾櫙'} key="background"> + <Panel header="椤甸潰鏍峰紡" key="background"> {config ? <BgController config={config} updateConfig={this.updateConfig} /> : null} - </Panel> - <Panel header={'椤甸潰鍐呰竟璺�'} key="padding"> - {config ? <PaddingController config={config} updateConfig={this.updateConfig} /> : null} </Panel> </Collapse> </div> @@ -1174,8 +1126,7 @@ </Card> </div> </div> - </DndProvider> : null} - {popBtn && visible ? <PopviewController btn={popBtn} handleBack={this.handleBack}/> : null} + </DndProvider> <StyleController /> <StyleCombController /> <ModalController /> @@ -1185,4 +1136,4 @@ } } -export default MenuDesign \ No newline at end of file +export default withRouter(MenuDesign) \ No newline at end of file diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index a519595..89ecb4a 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -959,7 +959,6 @@ item.action && item.action.forEach(btn => { if (btn.hidden === 'true') return - this.checkBtn(btn) m.children.push({ key: btn.uuid, title: btn.label, @@ -970,7 +969,6 @@ if (cell.eleType !== 'button') return if (cell.hidden === 'true') return - this.checkBtn(cell) m.children.push({ key: cell.uuid, title: cell.label, @@ -983,7 +981,6 @@ if (cell.eleType !== 'button') return if (cell.hidden === 'true') return - this.checkBtn(cell) m.children.push({ key: cell.uuid, title: cell.label, @@ -995,7 +992,6 @@ if (cell.eleType !== 'button') return if (cell.hidden === 'true') return - this.checkBtn(cell) m.children.push({ key: cell.uuid, title: cell.label, @@ -1025,7 +1021,6 @@ item.action && item.action.forEach(btn => { if (btn.hidden === 'true') return - this.checkBtn(btn) m.children.push({ key: btn.uuid, title: btn.label, @@ -1036,7 +1031,6 @@ col.elements.forEach(btn => { if (btn.hidden === 'true') return - this.checkBtn(btn) m.children.push({ key: btn.uuid, title: btn.label, @@ -1197,26 +1191,6 @@ }) return menus - } - - checkBtn = (btn) => { - if (['prompt', 'exec', 'pop'].includes(btn.OpenType) && btn.Ot === 'required' && btn.verify && btn.verify.scripts && btn.verify.scripts.length > 0) { - let hascheck = false - btn.verify.scripts.forEach(item => { - if (item.status === 'false') return - - if (/\$check@|@check\$/ig.test(item.sql)) { - hascheck = true - } - }) - if (hascheck) { - notification.warning({ - top: 92, - message: `鍙�夋嫨澶氳鐨勬寜閽��${btn.label}銆嬩腑 $check@ 鎴� @check$ 灏嗕笉浼氱敓鏁堬紒`, - duration: 5 - }) - } - } } getMiniStyle = (config) => { @@ -1944,7 +1918,7 @@ <div className="pc-setting-tools"> <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> {/* 鍩烘湰淇℃伅 */} - <Panel header={dict['mob.basemsg']} forceRender className="basedata" key="basedata"> + <Panel header="鍩烘湰淇℃伅" forceRender className="basedata" key="basedata"> {/* 鑿滃崟淇℃伅 */} {config ? <MenuForm dict={dict} diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index cc33747..4eef974 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -25,7 +25,6 @@ const MenuForm = asyncComponent(() => import('./menuform')) const Transfer = asyncComponent(() => import('@/pc/transfer')) -const PopviewController = asyncComponent(() => import('@/menu/popview')) const Versions = asyncComponent(() => import('@/menu/versions')) const MenuShell = asyncComponent(() => import('@/pc/menushell')) const ViewNodes = asyncComponent(() => import('@/menu/viewnodes')) @@ -45,15 +44,10 @@ const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) sessionStorage.setItem('isEditState', 'true') -sessionStorage.setItem('editMenuType', 'menu') // 缂栬緫鑿滃崟绫诲瀷 + sessionStorage.setItem('appType', 'pc') // 搴旂敤绫诲瀷 sessionStorage.setItem('typename', 'pc') document.body.className = '' -window.GLOB.UserComponentMap = new Map() // 缂撳瓨鐢ㄦ埛鑷畾涔夌粍浠� -window.GLOB.TabsMap = new Map() // 缂撳瓨鐢ㄦ埛鎿嶄綔鐨勬爣绛鹃〉 -window.GLOB.CacheIndependent = new Map() -window.GLOB.urlFields = [] // url鍙橀噺 -window.GLOB.customMenu = null // 淇濆瓨鑿滃崟淇℃伅 const memberLevel = Utils.getMemberLevel() @@ -67,13 +61,10 @@ MenuNo: '', delButtons: [], copyButtons: [], - thawButtons: [], activeKey: 'basedata', menuloading: false, oriConfig: null, config: null, - popBtn: null, // 寮圭獥鏍囩椤� - visible: false, customComponents: [], settingshow: sessionStorage.getItem('settingshow') !== 'false', controlshow: sessionStorage.getItem('controlshow') !== 'false', @@ -84,6 +75,15 @@ UNSAFE_componentWillMount() { if (memberLevel < 30) return + + sessionStorage.setItem('editMenuType', 'menu') // 缂栬緫鑿滃崟绫诲瀷 + + window.GLOB.UserComponentMap = new Map() // 缂撳瓨鐢ㄦ埛鑷畾涔夌粍浠� + window.GLOB.TabsMap = new Map() // 缂撳瓨鐢ㄦ埛鎿嶄綔鐨勬爣绛鹃〉 + window.GLOB.CacheIndependent = new Map() + window.GLOB.urlFields = [] // url鍙橀噺 + window.GLOB.customMenu = null // 淇濆瓨鑿滃崟淇℃伅 + try { let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) @@ -133,7 +133,6 @@ } MKEmitter.addListener('delButtons', this.delButtons) MKEmitter.addListener('modalStatus', this.modalStatus) - MKEmitter.addListener('thawButtons', this.thawButtons) MKEmitter.addListener('copyButtons', this.copyButtons) MKEmitter.addListener('changePopview', this.initPopview) MKEmitter.addListener('changeEditMenu', this.changeEditMenu) @@ -200,7 +199,6 @@ } MKEmitter.removeListener('delButtons', this.delButtons) MKEmitter.removeListener('modalStatus', this.modalStatus) - MKEmitter.removeListener('thawButtons', this.thawButtons) MKEmitter.removeListener('copyButtons', this.copyButtons) MKEmitter.removeListener('changePopview', this.initPopview) MKEmitter.removeListener('changeEditMenu', this.changeEditMenu) @@ -214,8 +212,6 @@ } triggerMenuSave = () => { - if (this.state.visible) return - this.submitConfig() } @@ -499,14 +495,6 @@ }) } - handleBack = () => { - this.setState({popBtn: null, delButtons: [], copyButtons: [], thawButtons: []}, () => { - sessionStorage.setItem('editMenuType', 'menu') - window.GLOB.customMenu = this.state.config - this.setState({visible: false}) - }) - } - updateComponentStyle = (parentId, keys, style) => { const { config } = this.state @@ -536,10 +524,6 @@ copyButtons = (items) => { this.setState({copyButtons: [...this.state.copyButtons, ...items]}) } - - thawButtons = (item) => { - this.setState({thawButtons: [...this.state.thawButtons, item]}) - } initPopview = (card, btn) => { const { oriConfig, config } = this.state @@ -553,12 +537,11 @@ return } - btn.config = fromJS(config).toJS() - btn.component = card + let _btn = fromJS(btn).toJS() + _btn.MenuName = config.MenuName + '-' + card.name + '-' + btn.label + _btn.ParentMenuID = config.uuid - sessionStorage.setItem('editMenuType', 'popview') // 缂栬緫寮圭獥鏍囩 - - this.setState({popBtn: btn, visible: true}) + this.props.history.push('/popdesign/' + window.btoa(window.encodeURIComponent((JSON.stringify(_btn))))) } closeView = () => { @@ -933,7 +916,6 @@ item.action && item.action.forEach(btn => { if (btn.hidden === 'true') return - this.checkBtn(btn) m.children.push({ key: btn.uuid, title: btn.label, @@ -947,7 +929,6 @@ if (cell.eleType !== 'button') return if (cell.hidden === 'true') return - this.checkBtn(cell) m.children.push({ key: cell.uuid, title: cell.label, @@ -960,7 +941,6 @@ if (cell.eleType !== 'button') return if (cell.hidden === 'true') return - this.checkBtn(cell) m.children.push({ key: cell.uuid, title: cell.label, @@ -976,7 +956,6 @@ if (cell.eleType !== 'button') return if (cell.hidden === 'true') return - this.checkBtn(cell) m.children.push({ key: cell.uuid, title: cell.label, @@ -991,7 +970,6 @@ if (cell.eleType !== 'button') return if (cell.hidden === 'true') return - this.checkBtn(cell) m.children.push({ key: cell.uuid, title: cell.label, @@ -1024,7 +1002,6 @@ item.action && item.action.forEach(btn => { if (btn.hidden === 'true') return - this.checkBtn(btn) m.children.push({ key: btn.uuid, title: btn.label, @@ -1038,7 +1015,6 @@ col.elements.forEach(btn => { if (btn.hidden === 'true') return - this.checkBtn(btn) m.children.push({ key: btn.uuid, title: btn.label, @@ -1071,26 +1047,6 @@ } return nodes - } - - checkBtn = (btn) => { - if (['prompt', 'exec', 'pop'].includes(btn.OpenType) && btn.Ot === 'required' && btn.verify && btn.verify.scripts && btn.verify.scripts.length > 0) { - let hascheck = false - btn.verify.scripts.forEach(item => { - if (item.status === 'false') return - - if (/\$check@|@check\$/ig.test(item.sql)) { - hascheck = true - } - }) - if (hascheck) { - notification.warning({ - top: 92, - message: `鍙�夋嫨澶氳鐨勬寜閽��${btn.label}銆嬩腑 $check@ 鎴� @check$ 灏嗕笉浼氱敓鏁堬紒`, - duration: 5 - }) - } - } } getSubMenus = () => { @@ -1209,7 +1165,7 @@ } submitConfig = () => { - const { delButtons, copyButtons, thawButtons } = this.state + const { delButtons, copyButtons } = this.state let config = fromJS(this.state.config).toJS() if (!config.MenuName || !config.MenuNo || (config.cacheUseful === 'true' && !config.cacheTime)) { @@ -1445,27 +1401,6 @@ } return Api.getSystemConfig(_param) } - }).then(res => { // 鎸夐挳瑙i櫎鍐荤粨 - if (!res) return - if (!res.status) { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - return false - } else if (!res.nonexec) { // 鎵ц鍒犻櫎鍚庡埛鏂拌彍鍗曞垪琛� - this.getAppMenus() - } - - if (thawButtons.length === 0) { - return { status: true } - } else { - return Api.getSystemConfig({ - func: 'sPC_MainMenu_ReDel', - MenuID: thawButtons.join(',') - }) - } }).then(res => { // 椤甸潰淇濆瓨 if (!res) return @@ -1604,7 +1539,6 @@ this.setState({ delButtons: [], copyButtons: [], - thawButtons: [], menuloading: false }) notification.success({ @@ -1883,13 +1817,13 @@ } render () { - const { localedict, loading, visible, popBtn, comloading, activeKey, settingshow, controlshow, dict, MenuId, config, menuloading, customComponents, eyeopen } = this.state + const { localedict, loading, comloading, activeKey, settingshow, controlshow, dict, MenuId, config, menuloading, customComponents, eyeopen } = this.state return ( <ConfigProvider locale={localedict}> <div className={'mk-pc-view '} id="mk-pc-design-view"> {loading ? <Spin className="view-spin" size="large" /> : null} - {!popBtn && !visible ? <DndProvider backend={HTML5Backend}> + <DndProvider backend={HTML5Backend}> <div className={'menu-setting ' + (!settingshow ? 'hidden' : '')}> <div className="draw"> {settingshow ? <DoubleLeftOutlined onClick={() => {sessionStorage.setItem('settingshow', 'false'); this.setState({settingshow: false})}}/> : null} @@ -1898,7 +1832,7 @@ <div className="pc-setting-tools"> <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> {/* 鍩烘湰淇℃伅 */} - <Panel header={dict['mob.basemsg']} key="basedata"> + <Panel header="鍩烘湰淇℃伅" key="basedata"> {/* 鑿滃崟淇℃伅 */} {config ? <MenuForm dict={dict} @@ -1953,8 +1887,7 @@ <div className={'menu-body menu-view' + (menuloading ? ' saving' : '') + (eyeopen ? ' eye-open' : '')}> {config && !comloading ? <MenuShell menu={config} handleList={this.updateConfig} /> : null} </div> - </DndProvider> : null} - {popBtn && visible ? <PopviewController btn={popBtn} handleBack={this.handleBack}/> : null} + </DndProvider> <StyleController /> <StyleCombController /> <ModalController /> diff --git a/src/menu/popview/index.jsx b/src/views/popdesign/index.jsx similarity index 73% rename from src/menu/popview/index.jsx rename to src/views/popdesign/index.jsx index 8b4293f..fd7d701 100644 --- a/src/menu/popview/index.jsx +++ b/src/views/popdesign/index.jsx @@ -1,21 +1,21 @@ import React, { Component } from 'react' -import PropTypes from 'prop-types' import { DndProvider } from 'react-dnd' import { is, fromJS } from 'immutable' import moment from 'moment' import HTML5Backend from 'react-dnd-html5-backend' -import { notification, Modal, Collapse, Card, Switch, Button } from 'antd' +import { ConfigProvider, notification, Modal, Collapse, Card, Switch, Button } from 'antd' import { EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons' import Api from '@/api' -import Utils from '@/utils/utils.js' -import zhCN from '@/locales/zh-CN/mob.js' -import enUS from '@/locales/en-US/mob.js' +import Utils, { setGLOBFuncs } from '@/utils/utils.js' import MKEmitter from '@/utils/events.js' import asyncComponent from '@/utils/asyncComponent' +// import antdEnUS from 'antd/es/locale/en_US' +import antdZhCN from 'antd/es/locale/zh_CN' import './index.scss' +const _locale = antdZhCN const { Panel } = Collapse const { confirm } = Modal @@ -25,22 +25,22 @@ const SourceWrap = asyncComponent(() => import('@/menu/modulesource')) const MenuShell = asyncComponent(() => import('@/menu/menushell')) const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) -const BgController = asyncComponent(() => import('@/menu/bgcontroller')) +const BgController = asyncComponent(() => import('@/pc/bgcontroller')) const PasteController = asyncComponent(() => import('@/menu/pastecontroller')) -const PaddingController = asyncComponent(() => import('@/menu/padcontroller')) const StyleCombControlButton = asyncComponent(() => import('@/menu/stylecombcontrolbutton')) const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) +const StyleController = asyncComponent(() => import('@/menu/stylecontroller')) +const ModalController = asyncComponent(() => import('@/menu/modalconfig/controller')) +const StyleCombController = asyncComponent(() => import('@/menu/stylecombcontroller')) + sessionStorage.setItem('isEditState', 'true') -class MenuDesign extends Component { - static propTpyes = { - btn: PropTypes.object, - handleBack: PropTypes.func - } +document.body.className = '' +class PopViewDesign extends Component { state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + btn: null, MenuId: '', delButtons: [], activeKey: 'basedata', @@ -53,13 +53,29 @@ } UNSAFE_componentWillMount() { - const { btn } = this.props + sessionStorage.setItem('editMenuType', 'popview') - this.setState({ - MenuId: btn.uuid, - }, () => { - this.getMenuParam() - }) + window.GLOB.UserComponentMap = new Map() // 缂撳瓨鐢ㄦ埛鑷畾涔夌粍浠� + window.GLOB.TabsMap = new Map() // 缂撳瓨鐢ㄦ埛鎿嶄綔鐨勬爣绛鹃〉 + window.GLOB.urlFields = [] // url鍙橀噺 + window.GLOB.customMenu = null // 淇濆瓨鑿滃崟淇℃伅 + + try { + let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) + + this.setState({ + btn: param, + MenuId: param.uuid, + }, () => { + this.getMenuParam() + }) + } catch (e) { + notification.warning({ + top: 92, + message: '鑿滃崟淇℃伅瑙f瀽閿欒锛�', + duration: 5 + }) + } } componentDidMount () { @@ -67,7 +83,50 @@ MKEmitter.addListener('triggerMenuSave', this.submitConfig) MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent) - this.updateCustomComponent() + setTimeout(() => { + this.updateCustomComponent() + setGLOBFuncs() + }, 1000) + + document.onkeydown = (event) => { + let e = event || window.event + let keyCode = e.keyCode || e.which || e.charCode + let preKey = '' + + if (e.ctrlKey) { + preKey = 'ctrl' + } + if (e.shiftKey) { + preKey = 'shift' + } else if (e.altKey) { + preKey = 'alt' + } + + if (!preKey || !keyCode) return + + let _shortcut = `${preKey}+${keyCode}` + + if (_shortcut === 'ctrl+83') { + if (this.state.modalStatus) { + notification.warning({ + top: 92, + message: '璇蜂繚瀛�' + this.state.modalStatus, + duration: 5 + }) + return false + } + + let node = document.getElementById('save-modal-config') + if (!node) { + node = document.getElementById('save-pop-config') + } + + if (node) { + node.click() + } + return false + } + } } shouldComponentUpdate (nextProps, nextState) { @@ -153,29 +212,26 @@ const { oriConfig, config } = this.state if (!config) { - this.props.handleBack() + window.history.back() return } - - const _this = this if (!is(fromJS(oriConfig), fromJS(config))) { confirm({ title: '閰嶇疆宸蹭慨鏀癸紝鏀惧純淇濆瓨鍚楋紵', content: '', onOk() { - _this.props.handleBack() + window.history.back() }, onCancel() {} }) } else { - this.props.handleBack() + window.history.back() } } getMenuParam = () => { - const { btn } = this.props - const { MenuId } = this.state + const { MenuId, btn } = this.state let param = { func: 'sPC_Get_LongParam', @@ -205,7 +261,7 @@ MenuID: MenuId, Template: 'CustomPage', enabled: false, - MenuName: btn.config.MenuName + '-' + btn.label, + MenuName: btn.MenuName, MenuNo: '', tables: [], components: [], @@ -258,7 +314,6 @@ delButtons.push(btn.uuid) return } - this.checkBtn(btn) buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`) _sort++ }) @@ -269,7 +324,6 @@ delButtons.push(cell.uuid) return } - this.checkBtn(cell) buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`) _sort++ }) @@ -279,7 +333,6 @@ delButtons.push(cell.uuid) return } - this.checkBtn(cell) buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`) _sort++ }) @@ -292,7 +345,6 @@ delButtons.push(cell.uuid) return } - this.checkBtn(cell) buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`) _sort++ }) @@ -304,7 +356,6 @@ delButtons.push(cell.uuid) return } - this.checkBtn(cell) buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`) _sort++ }) @@ -314,7 +365,6 @@ delButtons.push(btn.uuid) return } - this.checkBtn(btn) buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`) _sort++ }) @@ -324,7 +374,6 @@ delButtons.push(btn.uuid) return } - this.checkBtn(btn) buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`) _sort++ }) @@ -335,7 +384,6 @@ delButtons.push(btn.uuid) return } - this.checkBtn(btn) buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`) _sort++ }) @@ -347,26 +395,6 @@ traversal(config.components) return buttons - } - - checkBtn = (btn) => { - if (['prompt', 'exec', 'pop'].includes(btn.OpenType) && btn.Ot === 'required' && btn.verify && btn.verify.scripts && btn.verify.scripts.length > 0) { - let hascheck = false - btn.verify.scripts.forEach(item => { - if (item.status === 'false') return - - if (/\$check@|@check\$/ig.test(item.sql)) { - hascheck = true - } - }) - if (hascheck) { - notification.warning({ - top: 92, - message: `鍙�夋嫨澶氳鐨勬寜閽��${btn.label}銆嬩腑 $check@ 鎴� @check$ 灏嗕笉浼氱敓鏁堬紒`, - duration: 5 - }) - } - } } filterConfig = (components) => { @@ -387,7 +415,7 @@ } submitConfig = () => { - const { btn } = this.props + const { btn } = this.state let config = fromJS(this.state.config).toJS() if ((config.cacheUseful === 'true' && !config.cacheTime) || !config.MenuNo || !config.MenuName) { @@ -410,15 +438,13 @@ config.enabled = false } - let _name = (btn.component.name ? btn.component.name + '-' : '') + btn.label - let param = { func: 'sPC_ButtonParam_AddUpt', - ParentID: btn.config.uuid, + ParentID: btn.ParentMenuID, MenuID: config.uuid, MenuNo: config.MenuNo || '', Template: 'CustomPage', - MenuName: _name, + MenuName: config.MenuName, PageParam: JSON.stringify({Template: 'CustomPage'}), LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config))), open_edition: config.open_edition @@ -643,61 +669,62 @@ } render () { - const { btn } = this.props - const { activeKey, comloading, dict, config, menuloading, customComponents, MenuId, eyeopen } = this.state + const { activeKey, comloading, config, menuloading, customComponents, MenuId, eyeopen } = this.state return ( - <div className="pc-poper-view"> - <Header /> - <DndProvider backend={HTML5Backend}> - <div className="menu-body"> - <div className="menu-setting"> - <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> - {/* 鍩烘湰淇℃伅 */} - <Panel header={dict['mob.basemsg']} key="basedata"> - {/* 鑿滃崟淇℃伅 */} - {config ? <MenuForm dict={dict} config={config} btn={btn} updateConfig={this.updateConfig}/> : null} - {/* 琛ㄥ悕娣诲姞 */} - {config ? <TableComponent config={config} updatetable={this.updatetable}/> : null} - </Panel> - {/* 缁勪欢娣诲姞 */} - <Panel header={dict['mob.component']} key="component"> - <SourceWrap MenuType="" /> - </Panel> - {customComponents && customComponents.length ? <Panel header="鑷畾涔夌粍浠�" key="cuscomponent"> - <SourceWrap components={customComponents} MenuType="" /> - </Panel> : null} - <Panel header={'椤甸潰鑳屾櫙'} key="background"> - {config ? <BgController config={config} updateConfig={this.updateConfig} /> : null} - </Panel> - <Panel header={'椤甸潰鍐呰竟璺�'} key="padding"> - {config ? <PaddingController config={config} updateConfig={this.updateConfig} /> : null} - </Panel> - </Collapse> + <ConfigProvider locale={_locale}> + <div className="pc-poper-view"> + <Header /> + <DndProvider backend={HTML5Backend}> + <div className="menu-body"> + <div className="menu-setting"> + <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> + {/* 鍩烘湰淇℃伅 */} + <Panel header="鍩烘湰淇℃伅" key="basedata"> + {/* 鑿滃崟淇℃伅 */} + {config ? <MenuForm config={config} updateConfig={this.updateConfig}/> : null} + {/* 琛ㄥ悕娣诲姞 */} + {config ? <TableComponent config={config} updatetable={this.updatetable}/> : null} + </Panel> + {/* 缁勪欢娣诲姞 */} + <Panel header="缁勪欢" key="component"> + <SourceWrap MenuType="" /> + </Panel> + {customComponents && customComponents.length ? <Panel header="鑷畾涔夌粍浠�" key="cuscomponent"> + <SourceWrap components={customComponents} MenuType="" /> + </Panel> : null} + <Panel header="椤甸潰鏍峰紡" key="background"> + {config ? <BgController config={config} updateConfig={this.updateConfig} /> : null} + </Panel> + </Collapse> + </div> + <div className={'menu-view' + (menuloading ? ' saving' : '') + (eyeopen ? ' eye-open' : '')}> + <Card title={ + <div> {config && config.MenuName} </div> + } bordered={false} extra={ + <div> + <Button className="mk-border-purple" onClick={() => this.setState({eyeopen: !eyeopen})}>{!eyeopen ? <EyeOutlined /> : <EyeInvisibleOutlined />} 缁勪欢鍚�</Button> + <Versions MenuId={MenuId} open_edition={config ? config.open_edition : ''} updateConfig={this.refreshConfig}/> + <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> + <StyleCombControlButton menu={config} /> + <PasteController insert={this.insert} /> + {config ? <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> : null} + <Button type="primary" id="save-pop-config" onClick={this.submitConfig} loading={menuloading}>淇濆瓨</Button> + <Button type="default" onClick={this.closeView}>杩斿洖</Button> + </div> + } style={{ width: '100%' }}> + {config && !comloading ? <MenuShell menu={config} handleList={this.updateConfig} /> : null} + </Card> + </div> </div> - <div className={'menu-view' + (menuloading ? ' saving' : '') + (eyeopen ? ' eye-open' : '')}> - <Card title={ - <div> {config && config.MenuName} </div> - } bordered={false} extra={ - <div> - <Button className="mk-border-purple" onClick={() => this.setState({eyeopen: !eyeopen})}>{!eyeopen ? <EyeOutlined /> : <EyeInvisibleOutlined />} 缁勪欢鍚�</Button> - <Versions MenuId={MenuId} open_edition={config ? config.open_edition : ''} updateConfig={this.refreshConfig}/> - <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> - <StyleCombControlButton menu={config} /> - <PasteController insert={this.insert} /> - {config ? <Switch className="big" checkedChildren={dict['mob.enable']} unCheckedChildren={dict['mob.disable']} checked={config.enabled} onChange={this.onEnabledChange} /> : null} - <Button type="primary" id="save-pop-config" onClick={this.submitConfig} loading={menuloading}>{dict['mob.save']}</Button> - <Button type="default" onClick={this.closeView}>{dict['mob.return']}</Button> - </div> - } style={{ width: '100%' }}> - {config && !comloading ? <MenuShell menu={config} handleList={this.updateConfig} /> : null} - </Card> - </div> - </div> - </DndProvider> - </div> + </DndProvider> + <StyleController /> + <StyleCombController /> + <ModalController /> + </div> + </ConfigProvider> ) } } -export default MenuDesign \ No newline at end of file +export default PopViewDesign \ No newline at end of file diff --git a/src/menu/popview/index.scss b/src/views/popdesign/index.scss similarity index 87% rename from src/menu/popview/index.scss rename to src/views/popdesign/index.scss index 7194ad4..416bbb5 100644 --- a/src/menu/popview/index.scss +++ b/src/views/popdesign/index.scss @@ -10,6 +10,38 @@ display: none; } } + + .component-name { + position: absolute; + z-index: 9; + display: none; + left: 0; + right: 0; + top: 0; + bottom: 0; + background: rgba(255, 255, 255, 0.9); + border: 1px solid #1890ff; + .center { + position: absolute; + font-size: 16px; + left: 50%; + top: 50%; + color: #1890ff; + transform: translate(-50%, -50%); + max-width: 70%; + .title { + text-align: center; + } + } + .error { + text-align: center; + color: red; + display: block; + } + .waring { + color: orange; + } + } >.menu-body { width: 100vw; diff --git a/src/menu/popview/menuform/index.jsx b/src/views/popdesign/menuform/index.jsx similarity index 88% rename from src/menu/popview/menuform/index.jsx rename to src/views/popdesign/menuform/index.jsx index 4de1e6f..6906e4d 100644 --- a/src/menu/popview/menuform/index.jsx +++ b/src/views/popdesign/menuform/index.jsx @@ -7,8 +7,6 @@ class CustomMenuForm extends Component { static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� - btn: PropTypes.object, config: PropTypes.object, updateConfig: PropTypes.func } @@ -41,7 +39,7 @@ } render() { - const { dict, config } = this.props + const { config } = this.props const { getFieldDecorator } = this.props.form const formItemLayout = { labelCol: { @@ -58,26 +56,26 @@ <Form {...formItemLayout}> <Row> <Col span={24}> - <Form.Item label={dict['mob.menu'] + dict['mob.name']}> + <Form.Item label="鑿滃崟鍚嶇О"> {getFieldDecorator('MenuName', { initialValue: config.MenuName, rules: [ { required: true, - message: dict['mob.required.input'] + dict['mob.menu'] + dict['mob.name'] + '!' + message: '璇疯緭鍏ヨ彍鍗曞悕绉�!' } ] })(<Input placeholder="" autoComplete="off" onChange={this.changeName}/>)} </Form.Item> </Col> <Col span={24}> - <Form.Item label={dict['mob.menu'] + dict['mob.param']}> + <Form.Item label="鑿滃崟鍙傛暟"> {getFieldDecorator('MenuNo', { initialValue: config.MenuNo, rules: [ { required: true, - message: dict['mob.required.input'] + dict['mob.menu'] + dict['mob.param'] + '!' + message: '璇疯緭鍏ヨ彍鍗曞弬鏁�!' } ] })(<Input placeholder="" autoComplete="off" onChange={this.changeNo}/>)} @@ -119,7 +117,7 @@ rules: [ { required: true, - message: dict['mob.required.input'] + '鏃堕暱!' + message: '璇疯緭鍏ユ椂闀�!' } ] })( diff --git a/src/menu/popview/menuform/index.scss b/src/views/popdesign/menuform/index.scss similarity index 100% rename from src/menu/popview/menuform/index.scss rename to src/views/popdesign/menuform/index.scss -- Gitblit v1.8.0