From fce4de633059cb57ab89ede8f6d63c77afa19cda Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 28 七月 2022 10:55:15 +0800 Subject: [PATCH] 2022-07-28 --- src/views/basedesign/index.scss | 7 src/locales/zh-CN/model.js | 1 src/views/basedesign/index.jsx | 279 +++++++++++++++++++++++ src/views/basedesign/menuform/index.jsx | 175 ++++++++++++++ src/locales/en-US/model.js | 1 src/views/design/sidemenu/index.jsx | 23 + src/views/basedesign/menuform/index.scss | 0 src/views/design/sidemenu/editthdmenu/index.jsx | 181 +------------- src/router/index.js | 2 9 files changed, 496 insertions(+), 173 deletions(-) diff --git a/src/locales/en-US/model.js b/src/locales/en-US/model.js index e8c73bb..14aaded 100644 --- a/src/locales/en-US/model.js +++ b/src/locales/en-US/model.js @@ -47,7 +47,6 @@ 'header.menu.config.placeholder': 'Configuration has been modified, do you want to save configuration information ?', 'header.menu.config.notsave': 'The menu has not been saved, please save the menu configuration first锛�', 'header.menu.config.update': 'Menu configuration has been modified, please save锛�', - 'model.menu.presave': 'Menu order has been adjusted, Please save!', 'header.menu.form': 'The form', 'header.menu.group.add': 'Add a group', 'header.menu.search': 'Search', diff --git a/src/locales/zh-CN/model.js b/src/locales/zh-CN/model.js index 57af105..bdb362a 100644 --- a/src/locales/zh-CN/model.js +++ b/src/locales/zh-CN/model.js @@ -47,7 +47,6 @@ 'header.menu.config.placeholder': '閰嶇疆宸蹭慨鏀癸紝鏄惁淇濆瓨閰嶇疆淇℃伅锛�', 'header.menu.config.notsave': '鑿滃崟灏氭湭淇濆瓨锛岃鍏堜繚瀛樿彍鍗曢厤缃紒', 'header.menu.config.update': '鑿滃崟閰嶇疆宸蹭慨鏀癸紝璇蜂繚瀛橈紒', - 'model.menu.presave': '鑿滃崟椤哄簭宸茶皟鏁达紝璇蜂繚瀛橈紒', 'header.menu.form': '琛ㄥ崟', 'header.menu.group.add': '娣诲姞鍒嗙粍', 'header.menu.search': '鎼滅储', diff --git a/src/router/index.js b/src/router/index.js index 74b94b7..434fcd4 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -18,6 +18,7 @@ const MobDesign = asyncLoadComponent(() => import('@/views/mobdesign')) const ImDesign = asyncLoadComponent(() => import('@/views/imdesign')) const MenuDesign = asyncLoadComponent(() => import('@/views/menudesign')) +const BaseDesign = asyncLoadComponent(() => import('@/views/basedesign')) const BillPrint = asyncLoadComponent(() => import('@/views/billprint')) const PrintT = asyncLoadComponent(() => import('@/views/printTemplate')) const Interface = asyncLoadComponent(() => import('@/views/interface')) @@ -37,6 +38,7 @@ {path: '/mobdesign/:param', name: 'mobdesign', component: MobDesign, auth: true}, {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: '/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/views/basedesign/index.jsx b/src/views/basedesign/index.jsx new file mode 100644 index 0000000..ddbea7f --- /dev/null +++ b/src/views/basedesign/index.jsx @@ -0,0 +1,279 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +// import { is, fromJS } from 'immutable' +import { connect } from 'react-redux' +import { withRouter } from 'react-router-dom' +import { notification, Spin } from 'antd' +// import moment from 'moment' + +import Api from '@/api' +import MKEmitter from '@/utils/events.js' +import zhCN from '@/locales/zh-CN/model.js' +import enUS from '@/locales/en-US/model.js' +// import Utils from '@/utils/utils.js' +import MenuUtils from '@/utils/utils-custom.js' +import asyncComponent from '@/utils/asyncComponent' +import asyncLoadComponent from '@/utils/asyncLoadComponent' +import './index.scss' + +const Header = asyncComponent(() => import('@/menu/header')) +const ComTableConfig = asyncLoadComponent(() => import('@/templates/comtableconfig')) +const TreePageConfig = asyncLoadComponent(() => import('@/templates/treepageconfig')) +const CalendarPageConfig = asyncLoadComponent(() => import('@/templates/calendarconfig')) +const FormTabConfig = asyncLoadComponent(() => import('@/templates/formtabconfig')) +const ModalConfig = asyncLoadComponent(() => import('@/templates/modalconfig')) +const SubTable = asyncLoadComponent(() => import('@/templates/subtableconfig')) + +class BaseDesign extends Component { + static propTpyes = { + menulist: PropTypes.any, // 涓夌骇鑿滃崟鍒楄〃 + exitEdit: PropTypes.func, // 閫�鍑虹紪杈戠姸鎬� + supMenu: PropTypes.object, // 瀵瑰簲鐨勪笂绾ц彍鍗� + supMenuList: PropTypes.array // 涓婄骇鑿滃崟鍒楄〃锛岀敤浜庝笁绾ц彍鍗曞垏鎹笂绾ц彍鍗� + } + + state = { + dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + loading: false, // 缂栬緫鑿滃崟鎴栦娇鐢ㄥ凡浣跨敤妯℃澘鏃讹紝鑾峰彇閰嶇疆淇℃伅 + btnParam: null, // 缂栬緫鎸夐挳鐨勯厤缃俊鎭� + menulist: null, // 缂栬緫涓殑鑿滃崟 + tabview: '', // 閫夋嫨妯℃澘绐楀彛锛坱emplate锛夈�佸熀纭�琛ㄦ牸閰嶇疆锛圕ommonTable锛夈�佽〃鍗曪紙Modal锛夈�佸瓙琛紙SubTable锛� + editMenu: null, // 缂栬緫鑿滃崟 + editAction: null, // 缂栬緫鎸夐挳 + editTab: null, // 缂栬緫鏍囩 + tabConfig: null, // 鏍囩閰嶇疆淇℃伅 + editSubTab: null, // 缂栬緫瀛愭爣绛撅紙鏍囩涓殑鏍囩锛� + subTabConfig: null, // 瀛愭爣绛鹃厤缃俊鎭� + subConfig: null, // 瀛愰厤缃俊鎭� + btnTab: null, // 鎵撳紑鏂版爣绛炬垨褰撳墠椤甸潰鍒锋柊鐨勬寜閽� + btnTabConfig: null, // 鎵撳紑鏂版爣绛炬寜閽厤缃� + handleMVisible: false, // 娣诲姞鎴栦慨鏀硅彍鍗曟ā鎬佹锛堣鑹叉潈闄愬垎閰嶇瓑锛� + sysMenu: null, // 娣诲姞鎴栫紪杈戣彍鍗曪紙瑙掕壊鏉冮檺鍒嗛厤绛夛級 + change: false + } + + UNSAFE_componentWillMount() { + try { + let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) + + this.getMenuParam(param) + } catch (e) { + notification.warning({ + top: 92, + message: '鑿滃崟淇℃伅瑙f瀽閿欒锛�', + duration: 5 + }) + } + } + + getMenuParam = (editMenu) => { + editMenu.fstMenuId = editMenu.FstId + editMenu.supMenuList = [] + editMenu.fstMenuList = [] + + let tree = sessionStorage.getItem('menuTree') + if (tree) { + tree = JSON.parse(tree) + editMenu.fstMenuList = tree + + tree.forEach(item => { + if (item.MenuID === editMenu.FstId) { + editMenu.supMenuList = item.children + } + }) + } + + let param = { + func: 'sPC_Get_LongParam', + MenuID: editMenu.MenuID + } + + this.setState({ + loading: true + }) + + Api.getSystemConfig(param).then(res => { + if (res.status) { + let _LongParam = '' + if (res.LongParam) { + try { + _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) + } catch (e) { + console.warn('Parse Failure') + _LongParam = '' + } + } + + editMenu.LongParam = _LongParam + editMenu.open_edition = res.open_edition || '' + + this.setState({ + editMenu: editMenu, + loading: false, + tabview: editMenu.type + }) + } else { + this.setState({ + loading: false + }) + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } + }) + } + + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 + */ + componentWillUnmount () { + this.setState = () => { + return + } + } + + handleView = (param) => { + this.setState({ + tabview: '' + }, () => { + if (param) { + this.setState(param) + } + }) + } + + copyMenu = (param, MenuId) => { + Api.getSystemConfig({ + func: 'sPC_Get_LongParam', + MenuID: MenuId + }).then(result => { + if (result.status) { + let config = null + + try { + config = result.LongParam ? JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) : null + } catch (e) { + console.warn('Parse Failure') + config = null + } + + if (config) { + config.uuid = param.MenuID + config.MenuID = param.MenuID + config.parentId = param.ParentID + config.MenuName = param.MenuName + config.MenuNo = param.MenuNo + config.easyCode = '' + config.components = MenuUtils.resetConfig(config.components) + config.enabled = false + + param.LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(config))) + } + + Api.getSystemConfig(param).then(response => { + if (response.status) { + this.setState({ + handleMVisible: false, + sysMenu: null + }) + + MKEmitter.emit('mkUpdateMenuList') + } else { + notification.warning({ + top: 92, + message: response.message, + duration: 5 + }) + } + }) + } else { + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + } + }) + } + + render () { + const { loading } = this.state + + return ( + <div className="mk-base-design-wrap"> + <Header/> + {this.state.tabview === 'TreePage' ? + <TreePageConfig + menu={this.state.editMenu} + reloadmenu={() => {localStorage.setItem('menuUpdate', new Date().getTime())}} + handleView={this.handleView} + /> : null + } + {this.state.tabview === 'CalendarPage' ? + <CalendarPageConfig + menu={this.state.editMenu} + reloadmenu={() => {localStorage.setItem('menuUpdate', new Date().getTime())}} + handleView={this.handleView} + /> : null + } + {this.state.tabview === 'CommonTable' ? + <ComTableConfig + menu={this.state.editMenu} + reloadmenu={() => {localStorage.setItem('menuUpdate', new Date().getTime())}} + handleView={this.handleView} + /> : null + } + {this.state.tabview === 'Modal' ? + <ModalConfig + menu={this.state.editMenu} + editTab={this.state.editTab} + tabConfig={this.state.tabConfig} + editSubTab={this.state.editSubTab} + subTabConfig={this.state.subTabConfig} + btnTab={this.state.btnTab} + btnTabConfig={this.state.btnTabConfig} + editAction={this.state.editAction} + subConfig={this.state.subConfig} + handleView={this.handleView} + /> : null + } + {this.state.tabview === 'SubTable' ? + <SubTable + menu={this.state.editMenu} + editTab={this.state.editTab} + editSubTab={this.state.editSubTab} + tabConfig={this.state.tabConfig} + btnTab={this.state.btnTab} + btnTabConfig={this.state.btnTabConfig} + config={this.state.subConfig} + handleView={this.handleView} + /> : null + } + {this.state.tabview === 'FormTab' ? + <FormTabConfig + menu={this.state.editMenu} + btnTab={this.state.btnTab} + config={this.state.subConfig} + handleView={this.handleView} + /> : null + } + {loading ? <Spin className="loading-view" /> : null} + </div> + ) + } +} + +const mapStateToProps = (state) => { + return { + mainMenu: state.mainMenu, + menuTree: state.menuTree + } +} + +const mapDispatchToProps = () => { + return {} +} + +export default withRouter(connect(mapStateToProps, mapDispatchToProps)(BaseDesign)) \ No newline at end of file diff --git a/src/views/basedesign/index.scss b/src/views/basedesign/index.scss new file mode 100644 index 0000000..064a360 --- /dev/null +++ b/src/views/basedesign/index.scss @@ -0,0 +1,7 @@ +.mk-base-design-wrap { + .loading-view { + position: absolute; + left: calc(50vw - 22px); + top: calc(50vh - 22px); + } +} diff --git a/src/views/basedesign/menuform/index.jsx b/src/views/basedesign/menuform/index.jsx new file mode 100644 index 0000000..5e09244 --- /dev/null +++ b/src/views/basedesign/menuform/index.jsx @@ -0,0 +1,175 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { Form, Row, Col, Input, Select } from 'antd' +import './index.scss' + +const { TextArea } = Input + +class MainSearch extends Component { + static propTpyes = { + menu: PropTypes.object, // 鑿滃崟淇℃伅 + inputSubmit: PropTypes.func // 鍥炶溅鎻愪氦 + } + + state = { + supMenuList: [] + } + + UNSAFE_componentWillMount () { + this.setState({ + supMenuList: this.props.menu.supMenuList + }) + } + + changeMenu = (val) => { + const { menu } = this.state + + let submenu = menu.fstMenuList.filter(item => item.MenuID === val)[0] + + if (submenu) { + this.setState({ + supMenuList: submenu.children + }, () => { + this.props.form.setFieldsValue({ParentID: submenu.children[0] ? submenu.children[0].MenuID : ''}) + }) + } else { + this.setState({ + supMenuList: [] + }, () => { + this.props.form.setFieldsValue({ParentID: ''}) + }) + } + } + + handleConfirm = () => { + // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� + return new Promise((resolve, reject) => { + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + resolve(values) + } else { + reject(err) + } + }) + }) + } + + onEnterSubmit = (e) => { + // 琛ㄥ崟鍥炶溅鎻愪氦 + if (e.key !== 'Enter') return + + this.props.inputSubmit && this.props.inputSubmit() + } + + render() { + const { getFieldDecorator } = this.props.form + const { menu } = this.state + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 8 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + } + } + + return ( + <Form {...formItemLayout} style={{paddingRight: '20px'}} onKeyDown={this.onEnterSubmit}> + <Row gutter={24}> + <Col span={22}> + <Form.Item label={'涓�绾ц彍鍗�'}> + {getFieldDecorator('fstMenuId', { + initialValue: menu.fstMenuId, + rules: [ + { + required: true, + message: '璇烽�夋嫨涓婄骇鑿滃崟!' + } + ] + })( + <Select + showSearch + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + onChange={this.changeMenu} + > + {menu.fstMenuList.map(option => + <Select.Option key={option.MenuID} value={option.MenuID}>{option.text || option.MenuName}</Select.Option> + )} + </Select> + )} + </Form.Item> + </Col> + <Col span={22}> + <Form.Item label={'浜岀骇鑿滃崟'}> + {getFieldDecorator('ParentID', { + initialValue: menu.ParentId, + rules: [ + { + required: true, + message: '璇烽�夋嫨涓婄骇鑿滃崟!' + } + ] + })( + <Select + showSearch + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + > + {menu.supMenuList.map(option => + <Select.Option key={option.MenuID} value={option.MenuID}>{option.text || option.MenuName}</Select.Option> + )} + </Select> + )} + </Form.Item> + </Col> + <Col span={22}> + <Form.Item label={'鑿滃崟鍚嶇О'}> + {getFieldDecorator('MenuName', { + initialValue: menu.MenuName || '', + rules: [ + { + required: true, + message: '璇疯緭鍏ヨ彍鍗曞悕绉�!' + } + ] + })(<Input placeholder="" autoFocus autoComplete="off" />)} + </Form.Item> + </Col> + <Col span={22}> + <Form.Item label={'鑿滃崟鍙傛暟'}> + {getFieldDecorator('MenuNo', { + initialValue: menu.MenuNo || '', + rules: [ + { + required: true, + message: '璇疯緭鍏ヨ彍鍗曞弬鏁�!' + } + ] + })(<Input placeholder="" autoComplete="off" />)} + </Form.Item> + </Col> + {menu.Template === 'NewPage' ? <Col span={22}> + <Form.Item label={'閾炬帴鍦板潃'}> + {getFieldDecorator('url', { + initialValue: menu.url || '', + rules: [ + { + required: true, + message: '璇疯緭鍏ラ〉闈㈠湴鍧�!' + }, + { + max: 1024, + message: '鍦板潃鏈�闀夸负1024涓瓧绗�!' + } + ] + })(<TextArea rows={2} />)} + </Form.Item> + </Col> : null} + </Row> + </Form> + ) + } +} + +export default Form.create()(MainSearch) \ No newline at end of file diff --git a/src/views/basedesign/menuform/index.scss b/src/views/basedesign/menuform/index.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/views/basedesign/menuform/index.scss diff --git a/src/views/design/sidemenu/editthdmenu/index.jsx b/src/views/design/sidemenu/editthdmenu/index.jsx index 5a6d731..3680e40 100644 --- a/src/views/design/sidemenu/editthdmenu/index.jsx +++ b/src/views/design/sidemenu/editthdmenu/index.jsx @@ -10,8 +10,6 @@ import Api from '@/api' import MKEmitter from '@/utils/events.js' -import zhCN from '@/locales/zh-CN/model.js' -import enUS from '@/locales/en-US/model.js' import MkIcon from '@/components/mk-icon' import Utils from '@/utils/utils.js' import MenuUtils from '@/utils/utils-custom.js' @@ -20,12 +18,6 @@ import './index.scss' const MenuForm = asyncLoadComponent(() => import('../thdmenuform')) -const ComTableConfig = asyncLoadComponent(() => import('@/templates/comtableconfig')) -const TreePageConfig = asyncLoadComponent(() => import('@/templates/treepageconfig')) -const CalendarPageConfig = asyncLoadComponent(() => import('@/templates/calendarconfig')) -const FormTabConfig = asyncLoadComponent(() => import('@/templates/formtabconfig')) -const ModalConfig = asyncLoadComponent(() => import('@/templates/modalconfig')) -const SubTable = asyncLoadComponent(() => import('@/templates/subtableconfig')) const { confirm } = Modal @@ -38,21 +30,9 @@ } state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, confirmLoading: false, // 鎻愪氦涓�傘�傘�� loading: false, // 缂栬緫鑿滃崟鎴栦娇鐢ㄥ凡浣跨敤妯℃澘鏃讹紝鑾峰彇閰嶇疆淇℃伅 - btnParam: null, // 缂栬緫鎸夐挳鐨勯厤缃俊鎭� menulist: null, // 缂栬緫涓殑鑿滃崟 - tabview: '', // 閫夋嫨妯℃澘绐楀彛锛坱emplate锛夈�佸熀纭�琛ㄦ牸閰嶇疆锛圕ommonTable锛夈�佽〃鍗曪紙Modal锛夈�佸瓙琛紙SubTable锛� - editMenu: null, // 缂栬緫鑿滃崟 - editAction: null, // 缂栬緫鎸夐挳 - editTab: null, // 缂栬緫鏍囩 - tabConfig: null, // 鏍囩閰嶇疆淇℃伅 - editSubTab: null, // 缂栬緫瀛愭爣绛撅紙鏍囩涓殑鏍囩锛� - subTabConfig: null, // 瀛愭爣绛鹃厤缃俊鎭� - subConfig: null, // 瀛愰厤缃俊鎭� - btnTab: null, // 鎵撳紑鏂版爣绛炬垨褰撳墠椤甸潰鍒锋柊鐨勬寜閽� - btnTabConfig: null, // 鎵撳紑鏂版爣绛炬寜閽厤缃� handleMVisible: false, // 娣诲姞鎴栦慨鏀硅彍鍗曟ā鎬佹锛堣鑹叉潈闄愬垎閰嶇瓑锛� sysMenu: null, // 娣诲姞鎴栫紪杈戣彍鍗曪紙瑙掕壊鏉冮檺鍒嗛厤绛夛級 change: false @@ -87,7 +67,7 @@ if (this.state.change) { notification.warning({ top: 92, - message: this.state.dict['model.menu.presave'], + message: '鑿滃崟椤哄簭宸茶皟鏁达紝璇蜂繚瀛橈紒', duration: 5 }) return @@ -131,69 +111,24 @@ handleMVisible: true, sysMenu: _menu }) + } else if (['CommonTable', 'TreePage', 'CalendarPage'].includes(_menu.PageParam.Template)) { + sessionStorage.setItem('menuTree', JSON.stringify(this.props.menuTree)) + let _param = window.btoa(window.encodeURIComponent(JSON.stringify(_menu))) - return + window.open(`#/basedesign/${_param}`) + } else if (_menu.PageParam.Template === 'CustomPage') { + let _param = { + MenuType: 'custom', + MenuId: _menu.MenuID, + ParentId: _menu.ParentId, + MenuName: _menu.MenuName, + MenuNo: _menu.MenuNo + } + + _param = window.btoa(window.encodeURIComponent(JSON.stringify(_param))) + + window.open(`#/menudesign/${_param}`) } - - // let _param = '' - // if (card.type === 'CustomPage') { - // _param = { - // MenuType: 'custom', - // MenuId: card.MenuID, - // ParentId: card.ParentId, - // MenuName: card.MenuName, - // MenuNo: card.MenuNo - // } - // _param = window.btoa(window.encodeURIComponent(JSON.stringify(_param))) - // } - // window.open(`#/menudesign/${_param}`)} - - // let param = { - // func: 'sPC_Get_LongParam', - // MenuID: _menu.MenuID - // } - - // this.setState({ - // loading: true - // }) - - // Api.getSystemConfig(param).then(res => { - // if (res.status) { - // let _LongParam = '' - // if (res.LongParam) { - // try { - // _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) - // } catch (e) { - // console.warn('Parse Failure') - // _LongParam = '' - // } - // } - - // _menu.LongParam = _LongParam - // _menu.fstMenuId = _menu.FstId - // _menu.supMenuList = this.props.supMenuList - // _menu.fstMenuList = this.props.menuTree - // _menu.open_edition = res.open_edition || '' - - - // this.setState({ - // editMenu: _menu, - // loading: false, - // tabview: _menu.PageParam.Template - // }, () => { - // document.getElementById('root').style.overflowY = 'hidden' - // }) - // } else { - // this.setState({ - // loading: false - // }) - // notification.warning({ - // top: 92, - // message: res.message, - // duration: 5 - // }) - // } - // }) } } @@ -248,30 +183,11 @@ } } - exittabview = () => { - this.setState({tabview: ''}) - document.getElementById('root').style.overflowY = 'unset' - } - - handleView = (param) => { - this.setState({ - tabview: '' - }, () => { - if (param) { - this.setState(param) - document.getElementById('root').style.overflowY = 'hidden' - } else { - document.getElementById('root').style.overflowY = 'unset' - } - }) - } - /** * @description 涓夌骇鑿滃崟娣诲姞鎴栦慨鏀� */ memuSubmit = () => { const { sysMenu } = this.state - let sysTemplates = fromJS(this.state.sysTemplates).toJS() this.menuFormRef.handleConfirm().then(res => { let PageParam = { @@ -309,11 +225,9 @@ Api.getSystemConfig(param).then(response => { if (response.status) { this.setState({ - sysTemplates: sysTemplates, confirmLoading: false, handleMVisible: false, - sysMenu: '', - tabview: '' + sysMenu: null }) MKEmitter.emit('mkUpdateMenuList') @@ -365,8 +279,7 @@ this.setState({ confirmLoading: false, handleMVisible: false, - sysMenu: '', - tabview: '' + sysMenu: null }) MKEmitter.emit('mkUpdateMenuList') @@ -430,62 +343,6 @@ <Button type="primary" className="mk-save-menu" disabled={!change} onClick={() => {this.handleSubBtn('confirm')}}>淇濆瓨</Button> <Button onClick={() => {this.handleSubBtn('close')}}>鍏抽棴</Button> </div> - - {this.state.tabview === 'TreePage' ? - <TreePageConfig - menu={this.state.editMenu} - reloadmenu={() => {MKEmitter.emit('mkUpdateMenuList')}} - handleView={this.handleView} - /> : null - } - {this.state.tabview === 'CalendarPage' ? - <CalendarPageConfig - menu={this.state.editMenu} - reloadmenu={() => {MKEmitter.emit('mkUpdateMenuList')}} - handleView={this.handleView} - /> : null - } - {this.state.tabview === 'CommonTable' ? - <ComTableConfig - menu={this.state.editMenu} - reloadmenu={() => {MKEmitter.emit('mkUpdateMenuList')}} - handleView={this.handleView} - /> : null - } - {this.state.tabview === 'Modal' ? - <ModalConfig - menu={this.state.editMenu} - editTab={this.state.editTab} - tabConfig={this.state.tabConfig} - editSubTab={this.state.editSubTab} - subTabConfig={this.state.subTabConfig} - btnTab={this.state.btnTab} - btnTabConfig={this.state.btnTabConfig} - editAction={this.state.editAction} - subConfig={this.state.subConfig} - handleView={this.handleView} - /> : null - } - {this.state.tabview === 'SubTable' ? - <SubTable - menu={this.state.editMenu} - editTab={this.state.editTab} - editSubTab={this.state.editSubTab} - tabConfig={this.state.tabConfig} - btnTab={this.state.btnTab} - btnTabConfig={this.state.btnTabConfig} - config={this.state.subConfig} - handleView={this.handleView} - /> : null - } - {this.state.tabview === 'FormTab' ? - <FormTabConfig - menu={this.state.editMenu} - btnTab={this.state.btnTab} - config={this.state.subConfig} - handleView={this.handleView} - /> : null - } {/* 娣诲姞绯荤粺鑿滃崟 */} <Modal title="淇敼鑿滃崟" diff --git a/src/views/design/sidemenu/index.jsx b/src/views/design/sidemenu/index.jsx index e41d70d..d007ba1 100644 --- a/src/views/design/sidemenu/index.jsx +++ b/src/views/design/sidemenu/index.jsx @@ -63,7 +63,6 @@ UNSAFE_componentWillReceiveProps (nextProps) { if (!is(fromJS(this.props.mainMenu), fromJS(nextProps.mainMenu))) { - // 涓昏彍鍗曞垏鎹紝璇锋眰2銆�3绾ц彍鍗曟暟鎹� this.loadsubmenu(nextProps.mainMenu) } } @@ -113,18 +112,24 @@ } _param = window.btoa(window.encodeURIComponent(JSON.stringify(_param))) window.open(`#/menudesign/${_param}`) - } else if (['RolePermission', 'NewPage'].includes(cell.type)) { - cell.Template = cell.PageParam.Template - cell.url = cell.PageParam.url || '' + } else if (['CommonTable', 'TreePage', 'CalendarPage'].includes(cell.type)) { + sessionStorage.setItem('menuTree', JSON.stringify(this.props.menuTree)) + let _param = window.btoa(window.encodeURIComponent(JSON.stringify(cell))) - cell.fstMenuId = cell.FstId - cell.supMenuList = this.props.mainMenu.children - cell.fstMenuList = this.props.menuTree + window.open(`#/basedesign/${_param}`) + } else if (['RolePermission', 'NewPage'].includes(cell.type)) { + let _cell = fromJS(cell).toJS() + _cell.Template = _cell.PageParam.Template + _cell.url = _cell.PageParam.url || '' + + _cell.fstMenuId = _cell.FstId + _cell.supMenuList = this.props.mainMenu.children + _cell.fstMenuList = this.props.menuTree this.setState({ thdVisible: true, loading: false, - sysMenu: cell + sysMenu: _cell }) } } @@ -303,7 +308,7 @@ {item.children.map(cell => { return ( <Menu.Item key={cell.MenuID}> - <span className="editable-menu-item" onDoubleClick={(e) => {e.stopPropagation();this.editmenu(cell)}}>{cell.MenuName}</span> + <span className="editable-menu-item" onDoubleClick={() => this.editmenu(cell)}>{cell.MenuName}</span> </Menu.Item> ) })} -- Gitblit v1.8.0