From 809987a63ced6f35a7d37623af33bdba31ca6c93 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 08 十月 2022 15:24:03 +0800 Subject: [PATCH] 2022-10-08 --- src/index.js | 10 --- src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx | 4 src/tabviews/custom/index.jsx | 28 ++++++--- src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx | 4 src/templates/sharecomponent/settingcomponent/settingform/index.jsx | 4 src/menu/components/card/prop-card/index.jsx | 3 + src/tabviews/commontable/index.jsx | 28 ++++++-- src/views/main/index.jsx | 15 +++++ src/templates/zshare/verifycard/customscript/index.jsx | 2 src/menu/datasource/verifycard/index.jsx | 4 src/utils/utils.js | 28 ++++---- 11 files changed, 80 insertions(+), 50 deletions(-) diff --git a/src/index.js b/src/index.js index d0ca76e..ee1ef18 100644 --- a/src/index.js +++ b/src/index.js @@ -282,16 +282,6 @@ writable: false, value: GLOB }) - Object.defineProperty(window, 'debug', { - set(value) { - if (value + '' === 'false') { - sessionStorage.removeItem('breakpoint') - } else { - sessionStorage.setItem('breakpoint', value) - } - console.info('璇峰埛鏂伴〉闈€��') - } - }) window.GLOB.CacheMap = new Map() // 缂撳瓨閰嶇疆淇℃伅 window.GLOB.UserCacheMap = new Map() // 缂撳瓨鐢ㄦ埛鑷畾涔夎缃� diff --git a/src/menu/components/card/prop-card/index.jsx b/src/menu/components/card/prop-card/index.jsx index e5afb70..2876dc8 100644 --- a/src/menu/components/card/prop-card/index.jsx +++ b/src/menu/components/card/prop-card/index.jsx @@ -488,7 +488,10 @@ } else { _card.setting.supModule = '' } + } else if (res.datatype === 'public') { + // let interfaces = window.GLOB.customMenu.interfaces || [] } + if (res.layout === 'flex') { _card.wrap.pagestyle = 'page' } diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx index 52a036f..64a38ce 100644 --- a/src/menu/datasource/verifycard/index.jsx +++ b/src/menu/datasource/verifycard/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Tabs, Popconfirm, notification, Modal, Typography, Spin, message, Button } from 'antd' +import { Form, Tabs, Popconfirm, notification, Modal, Typography, Spin, message, Button } from 'antd' import { StopOutlined, CheckCircleOutlined, EditOutlined, SwapOutlined, DeleteOutlined, CopyOutlined, BorderOutlined } from '@ant-design/icons' import moment from 'moment' @@ -851,4 +851,4 @@ } } -export default VerifyCard \ No newline at end of file +export default Form.create()(VerifyCard) \ No newline at end of file diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index e9d8ba6..940775d 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -69,7 +69,8 @@ absFields: [], // 缁濆鍊煎瓧娈� loadCustomApi: true, // 鍔犺浇澶栭儴璧勬簮 hasReqFields: false, - autoMatic: null + autoMatic: null, + visible: false } /** @@ -432,7 +433,7 @@ chartId, config, statFields, - shortcuts, + shortcuts: shortcuts.length > 0 ? shortcuts : null, setting: config.setting, searchlist: config.search, actions: _actions, @@ -463,11 +464,6 @@ setShortcut = () => { const { shortcuts } = this.state - if (!shortcuts || shortcuts.length === 0) { - document.onkeydown = () => {} - return - } - document.onkeydown = (event) => { let e = event || window.event let keyCode = e.keyCode || e.which || e.charCode @@ -484,6 +480,16 @@ if (!preKey || !keyCode) return let _shortcut = `${preKey}+${keyCode}` + + if (window.GLOB.breakpoint && _shortcut === 'ctrl+67') { + window.debugger = false + window.GLOB.breakpoint = false + sessionStorage.removeItem('breakpoint') + + MKEmitter.emit('debugChange') + } + + if (!shortcuts) return shortcuts.some(item => { if (item.$shortcut === _shortcut) { @@ -1090,6 +1096,10 @@ } } + debugChange = () => { + this.setState({visible: !this.state.visible}) + } + UNSAFE_componentWillMount () { // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁 this.loadconfig() @@ -1101,6 +1111,7 @@ componentDidMount () { MKEmitter.addListener('reloadData', this.reloadData) + MKEmitter.addListener('debugChange', this.debugChange) MKEmitter.addListener('reloadMenuView', this.reloadMenuView) MKEmitter.addListener('changeTableLine', this.changeTableLine) MKEmitter.addListener('resetActiveMenu', this.resetActiveMenu) @@ -1117,6 +1128,7 @@ } document.onkeydown = () => {} MKEmitter.removeListener('reloadData', this.reloadData) + MKEmitter.removeListener('debugChange', this.debugChange) MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) MKEmitter.removeListener('changeTableLine', this.changeTableLine) MKEmitter.removeListener('resetActiveMenu', this.resetActiveMenu) @@ -1276,7 +1288,7 @@ {setting && window.GLOB.breakpoint ? <DebugTable /> : null} {!window.GLOB.mkHS && autoMatic ? <AutoMatic autoMatic={autoMatic} config={config} /> : null} {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config} dict={this.state.dict} /> : null} - {!window.GLOB.mkHS && shortcuts ? <SettingComponent config={config} dict={this.state.dict} shortcuts={shortcuts}/> : null} + {!window.GLOB.mkHS && setting ? <SettingComponent config={config} dict={this.state.dict} shortcuts={shortcuts || []}/> : null} {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} </div> ) diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 669e36e..4e1324e 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -65,7 +65,6 @@ data: null, // 鍒楄〃鏁版嵁闆� loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� visible: false, // 鏍囩椤垫帶鍒� - treevisible: false, // 鑿滃崟缁撴瀯鏍戝脊妗嗘樉绀洪殣钘忔帶鍒� shortcuts: null // 蹇嵎閿� } @@ -210,7 +209,7 @@ this.setState({ BID: BID, - shortcuts, + shortcuts: shortcuts.length > 0 ? shortcuts : null, config, mainSearch }, () => { @@ -246,11 +245,6 @@ setShortcut = () => { const { shortcuts } = this.state - if (!shortcuts || shortcuts.length === 0) { - document.onkeydown = () => {} - return - } - document.onkeydown = (event) => { let e = event || window.event let keyCode = e.keyCode || e.which || e.charCode @@ -265,8 +259,18 @@ } if (!preKey || !keyCode) return - + let _shortcut = `${preKey}+${keyCode}` + + if (window.GLOB.breakpoint && _shortcut === 'ctrl+67') { + window.debugger = false + window.GLOB.breakpoint = false + sessionStorage.removeItem('breakpoint') + + MKEmitter.emit('debugChange') + } + + if (!shortcuts) return shortcuts.some(item => { if (item.$shortcut === _shortcut) { @@ -1151,6 +1155,7 @@ } componentDidMount () { + MKEmitter.addListener('debugChange', this.debugChange) MKEmitter.addListener('reloadMenuView', this.reloadMenuView) MKEmitter.addListener('resetActiveMenu', this.resetActiveMenu) } @@ -1162,11 +1167,16 @@ this.setState = () => { return } + MKEmitter.removeListener('debugChange', this.debugChange) MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) MKEmitter.removeListener('resetActiveMenu', this.resetActiveMenu) window.GLOB.CacheData.delete(this.props.MenuID) this.deleteCache(this.state.config.components) + } + + debugChange = () => { + this.setState({visible: !this.state.visible}) } deleteCache = (components) => { @@ -1368,7 +1378,7 @@ <Row className="component-wrap">{this.getComponents()}</Row> {config && window.GLOB.breakpoint ? <DebugTable /> : null} {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config} dict={this.state.dict} /> : null} - {!window.GLOB.mkHS && shortcuts ? <SettingComponent config={config} dict={this.state.dict} shortcuts={shortcuts}/> : null} + {!window.GLOB.mkHS && config ? <SettingComponent config={config} dict={this.state.dict} shortcuts={shortcuts || []}/> : null} {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} </div> ) diff --git a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx b/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx index 2414fc7..6ff6f95 100644 --- a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx +++ b/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Tabs, Table, Popconfirm, notification, Modal, Spin } from 'antd' +import { Form, Tabs, Table, Popconfirm, notification, Modal, Spin } from 'antd' import { EditOutlined, DeleteOutlined } from '@ant-design/icons' import moment from 'moment' @@ -442,4 +442,4 @@ } } -export default VerifyCard \ No newline at end of file +export default Form.create()(VerifyCard) \ No newline at end of file diff --git a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx index 7c5a9b8..3ae2a2c 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { notification, Modal, Spin, Tabs, Typography, Popconfirm, Button } from 'antd' +import { Form, notification, Modal, Spin, Tabs, Typography, Popconfirm, Button } from 'antd' import { CheckCircleOutlined, StopOutlined, SwapOutlined, DeleteOutlined, BorderOutlined } from '@ant-design/icons' import moment from 'moment' @@ -607,4 +607,4 @@ } } -export default SettingForm \ No newline at end of file +export default Form.create()(SettingForm) \ No newline at end of file diff --git a/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx b/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx index 5eab415..8f182b8 100644 --- a/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx +++ b/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { notification, Modal, Spin, Tabs } from 'antd' +import { Form, notification, Modal, Spin, Tabs } from 'antd' import moment from 'moment' import Api from '@/api' @@ -284,4 +284,4 @@ } } -export default SettingForm \ No newline at end of file +export default Form.create()(SettingForm) \ No newline at end of file diff --git a/src/templates/zshare/verifycard/customscript/index.jsx b/src/templates/zshare/verifycard/customscript/index.jsx index 979d472..e9df195 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$ -> */銆傛敞锛�1銆侀渶浣跨敤绯荤粺鎺ュ彛 2銆佽璁剧疆涓衡�滈�夋嫨澶氳鈥濇椂鏃犳晥銆傝皟璇曟浛鎹㈢ /*$breakpoint_begin_xxxx@ 銆丂breakpoint_end_xxxx$*/'}> + <Tooltip placement="topLeft" overlayStyle={{width: '320px', maxWidth: '320px'}} title={<><div>{'璋冭瘯鏇挎崲绗� /*$breakpoint_begin_xxxx@ 銆丂breakpoint_end_xxxx$*/锛屽湪鎺у埗鍙颁腑杈撳叆 window.debug = \'xxxx\' 浼氬惎鐢ㄥ搴旂殑璋冭瘯璇彞锛屽揩鎹烽敭 ctrl+c 鎴栧湪鎺у埗鍙颁腑杈撳叆 window.debug = false 鍏抽棴璋冭瘯銆�'}</div><div style={{height: '5px'}}></div><div>{'鏁版嵁妫�鏌ユ浛鎹㈢ $check@ -> \'\'銆� @check$ -> \'\'锛孍rrorCode绛変簬C鏃� $check@ -> /*銆� @check$ -> */銆傛敞锛�1銆侀渶浣跨敤绯荤粺鎺ュ彛 2銆佽璁剧疆涓衡�滈�夋嫨澶氳鈥濇椂鏃犳晥銆�'}</div></>}> <QuestionCircleOutlined className="mk-form-tip" /> sql </Tooltip> diff --git a/src/utils/utils.js b/src/utils/utils.js index 94ac0a2..2ac3152 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -2069,6 +2069,20 @@ _sql += _backCustomScript } + if (window.GLOB.breakpoint) { + let start = new RegExp('\\/\\*\\$breakpoint_begin_' + window.GLOB.breakpoint + '@', 'ig') + let end = new RegExp('@breakpoint_end_' + window.GLOB.breakpoint + '\\$\\*\\/', 'ig') + + if (window.GLOB.breakpoint === 'all') { + start = /\/\*\$breakpoint_begin_[0-9a-z_]+@/ig + end = /@breakpoint_end_[0-9a-z_]+\$\*\//ig + } + + _sql = _sql.replace(start, '').replace(end, '') + _sql += ` + z_debug_end: select @ErrorCode='E',@retmsg='debug_end' goto aaa` + } + if (retmsg) { _sql += ` aaa: if @ErrorCode!='' @@ -2087,20 +2101,6 @@ _sql = _sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) _sql = _sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) _sql = _sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) - - if (window.GLOB.breakpoint) { - let start = new RegExp('\\/\\*\\$breakpoint_begin_' + window.GLOB.breakpoint + '@', 'ig') - let end = new RegExp('@breakpoint_end_' + window.GLOB.breakpoint + '\\$\\*\\/', 'ig') - - if (window.GLOB.breakpoint === 'all') { - start = /\/\*\$breakpoint_begin_[0-9a-z_]+@/ig - end = /@breakpoint_end_[0-9a-z_]+\$\*\//ig - } - - _sql = _sql.replace(start, '').replace(end, '') - _sql += ` - z_debug_end: select @ErrorCode='E',@retmsg='debug_end' goto aaa` - } if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { // _sql = _sql.replace(/\n\s{8}/ig, '\n') diff --git a/src/views/main/index.jsx b/src/views/main/index.jsx index 257b4b8..d13a74c 100644 --- a/src/views/main/index.jsx +++ b/src/views/main/index.jsx @@ -23,6 +23,21 @@ componentDidMount () { MKEmitter.addListener('resetSelectLine', this.resetParentParam) + + Object.defineProperty(window, 'debug', { + set(value) { + if (value + '' === 'false') { + window.debugger = false + window.GLOB.breakpoint = false + sessionStorage.removeItem('breakpoint') + } else { + window.debugger = true + window.GLOB.breakpoint = value + '' + sessionStorage.setItem('breakpoint', value) + } + MKEmitter.emit('debugChange') + } + }) } componentWillUnmount () { -- Gitblit v1.8.0