From bd1dfc9e6c9b9f8076ca2783ce598e0936b4c664 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 22 十二月 2021 14:36:03 +0800 Subject: [PATCH] 2021-12-22 --- src/templates/menuconfig/editthdmenu/index.jsx | 452 ++++++++++++++++++++++++++++++------------------------- 1 files changed, 246 insertions(+), 206 deletions(-) diff --git a/src/templates/menuconfig/editthdmenu/index.jsx b/src/templates/menuconfig/editthdmenu/index.jsx index 8d088a2..1c9c99f 100644 --- a/src/templates/menuconfig/editthdmenu/index.jsx +++ b/src/templates/menuconfig/editthdmenu/index.jsx @@ -1,22 +1,28 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' +import { connect } from 'react-redux' import { DndProvider } from 'react-dnd' +import { withRouter } from 'react-router-dom' import HTML5Backend from 'react-dnd-html5-backend' -import { notification, Modal, Button, Spin, Icon, Col, Card, Tabs, Row, Input } from 'antd' +import { notification, Modal, Button, Spin, Col, Card, Tabs, Row, Input } from 'antd' +import { PlusOutlined } from '@ant-design/icons' import moment from 'moment' import Api from '@/api' import { sysTemps } from '@/utils/option.js' -import zhCN from '@/locales/zh-CN/header.js' -import enUS from '@/locales/en-US/header.js' +import zhCN from '@/locales/zh-CN/model.js' +import enUS from '@/locales/en-US/model.js' import mainsubtable from '@/assets/img/mainsubtable.jpg' import treepage from '@/assets/img/treepage.jpg' - +import calendar from '@/assets/img/calendar.jpg' +import customImg from '@/assets/img/custom.jpg' +import MkIcon from '@/components/mk-icon' import Preview from './preview' import MenuForm from './menuform' import TransferForm from '@/templates/zshare/basetransferform' import Utils from '@/utils/utils.js' +import MenuUtils from '@/utils/utils-custom.js' import DragElement from '../menuelement' import asyncLoadComponent from '@/utils/asyncLoadComponent' import './index.scss' @@ -29,6 +35,7 @@ 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')) @@ -36,11 +43,6 @@ const { confirm } = Modal const { TabPane } = Tabs const { Search } = Input - -const illust = { // 妯℃澘鍥剧墖锛岀敤浜庡凡浣跨敤妯℃澘 - CommonTable: mainsubtable, - TreePage: treepage -} class EditMenu extends Component { static propTpyes = { @@ -52,7 +54,7 @@ } state = { - dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, thawmenulist: null, // 宸插喕缁撶殑浜岀骇鑿滃崟 type: '', // 鎿嶄綔绫诲瀷锛屾柊寤烘垨缂栬緫鑿滃崟 thawMvisible: false, // 瑙i櫎鍐荤粨妯℃�佹 @@ -78,9 +80,16 @@ btnTabConfig: null, // 鎵撳紑鏂版爣绛炬寜閽厤缃� handleMVisible: false, // 娣诲姞鎴栦慨鏀硅彍鍗曟ā鎬佹锛堣鑹叉潈闄愬垎閰嶇瓑锛� sysMenu: false, // 娣诲姞鎴栫紪杈戣彍鍗曪紙瑙掕壊鏉冮檺鍒嗛厤绛夛級 - optionLibs: [], // 鑷畾涔変笅鎷夐�夐」搴� - fstMenuId: null, // 涓�绾ц彍鍗旾d - fstMenuList: null // 涓�绾ц彍鍗曞垪琛� + targetKeys: [] // 瑙e喕鑿滃崟鍒楄〃 + } + + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 + */ + componentWillUnmount () { + this.setState = () => { + return + } } /** @@ -104,15 +113,13 @@ if (!is(fromJS(this.props.menulist), fromJS(this.state.menulist))) { notification.warning({ top: 92, - message: this.state.dict['header.menu.presave'], + message: this.state.dict['model.menu.presave'], duration: 5 }) } else if (menu.type === 'close') { confirm({ - title: this.state.dict['header.menu.close'].replace('@M', menu.card.text), + title: this.state.dict['model.menu.close'].replace('@M', menu.card.MenuName), content: '', - okText: this.state.dict['header.confirm'], - cancelText: this.state.dict['header.cancel'], onOk() { let param = { func: 'sPC_MainMenu_Del', @@ -133,28 +140,15 @@ onCancel() {} }) } else if (menu.type === 'edit') { - let _menu = JSON.parse(JSON.stringify(menu.card)) + let _menu = fromJS(menu.card).toJS() - delete _menu.id - delete _menu.src - delete _menu.text - - if (_menu.PageParam && _menu.PageParam.Template === 'RolePermission') { // 鍗曢〉闈慨鏀� + if (_menu.PageParam && (_menu.PageParam.Template === 'RolePermission' || _menu.PageParam.Template === 'NewPage')) { // 鍗曢〉闈慨鏀� _menu.Template = _menu.PageParam.Template + _menu.url = _menu.PageParam.url - if (!this.state.fstMenuId) { - notification.warning({ - top: 92, - message: '鑿滃崟鍔犺浇涓紝璇风◢鍚庨噸璇曪紒', - duration: 5 - }) - return - } - - _menu.ParentID = this.props.supMenu.MenuID + _menu.fstMenuId = _menu.FstId _menu.supMenuList = this.props.supMenuList - _menu.fstMenuId = this.state.fstMenuId || '' - _menu.fstMenuList = this.state.fstMenuList || [] + _menu.fstMenuList = this.props.menuTree this.setState({ handleMVisible: true, @@ -187,10 +181,9 @@ } _menu.LongParam = _LongParam - _menu.ParentID = this.props.supMenu.MenuID + _menu.fstMenuId = _menu.FstId _menu.supMenuList = this.props.supMenuList - _menu.fstMenuId = this.state.fstMenuId || '' - _menu.fstMenuList = this.state.fstMenuList || [] + _menu.fstMenuList = this.props.menuTree _menu.open_edition = res.open_edition || '' // 妫�娴嬫ā鏉挎槸鍚﹀瓨鍦� @@ -200,7 +193,7 @@ if (_Template.length === 0) { notification.warning({ top: 92, - message: this.state.dict['header.menu.template.empty'], + message: '鑿滃崟妯℃澘涓㈠け锛岃閲嶆柊閫夋嫨妯℃澘锛�', duration: 5 }) @@ -212,22 +205,14 @@ }, () => { document.getElementById('root').style.overflowY = 'hidden' }) - } else if (_menu.fstMenuId) { + } else { this.setState({ type: 'edit', editMenu: _menu, loading: false, - optionLibs: new Map(), // 缂栬緫鏃讹紝鍒濆鍖栦负绌� tabview: _menu.PageParam.Template }, () => { document.getElementById('root').style.overflowY = 'hidden' - }) - } else { - _menu.loadingFstMenuId = true - this.setState({ - type: 'edit', - editMenu: _menu, - optionLibs: new Map() }) } } else { @@ -250,16 +235,7 @@ if (!is(fromJS(this.props.menulist), fromJS(this.state.menulist))) { notification.warning({ top: 92, - message: this.state.dict['header.menu.presave'], - duration: 5 - }) - return - } - - if (!this.state.fstMenuId) { - notification.warning({ - top: 92, - message: '鑿滃崟鍔犺浇涓紝璇风◢鍚庨噸璇曪紒', + message: this.state.dict['model.menu.presave'], duration: 5 }) return @@ -275,10 +251,10 @@ PageParam: '', LongParam: '', isSubtable: '', // 鏄惁涓轰富瀛愯〃 - ParentID: this.props.supMenu.MenuID, + ParentId: this.props.supMenu.MenuID, supMenuList: this.props.supMenuList, - fstMenuId: this.state.fstMenuId, - fstMenuList: this.state.fstMenuList, + fstMenuId: this.props.mainMenu.MenuID, + fstMenuList: this.props.menuTree, menuSort: (this.props.menulist.length + 1) * 10 // 鏂板缓鑿滃崟璁剧疆鎺掑簭 } }, () => { @@ -288,13 +264,14 @@ if (!is(fromJS(this.props.menulist), fromJS(this.state.menulist))) { notification.warning({ top: 92, - message: this.state.dict['header.menu.presave'], + message: this.state.dict['model.menu.presave'], duration: 5 }) return } this.setState({ - thawMvisible: true + thawMvisible: true, + targetKeys: [] }) Api.getSystemConfig({ func: 'sPC_Get_FrozenMenu', @@ -330,14 +307,12 @@ param.LText = param.LText.join(' union ') // sql鎷兼帴 param.LText = Utils.formatOptions(param.LText) // 鍏抽敭瀛楃鏇挎崲锛宐ase64鍔犲瘑 - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' // 鏃堕棿鎴� + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') // 鏃堕棿鎴� param.secretkey = Utils.encrypt(param.LText, param.timestamp) // md5瀵嗛挜 confirm({ - title: this.state.dict['header.menu.resetorder'], + title: this.state.dict['model.menu.resetorder'], content: '', - okText: this.state.dict['header.confirm'], - cancelText: this.state.dict['header.cancel'], onOk() { return Api.getSystemConfig(param).then(res => { if (res.status) { @@ -357,23 +332,37 @@ this.props.exitEdit() } } else if (type === 'close') { - this.props.exitEdit() + if (!is(fromJS(this.props.menulist), fromJS(this.state.menulist))) { + let _this = this + + confirm({ + title: '鑿滃崟椤哄簭宸茶皟鏁达紝鏀惧純淇濆瓨鍚楋紵', + content: '', + onOk() { + _this.props.exitEdit() + }, + onCancel() {} + }) + } else { + this.props.exitEdit() + } } } thawMemuSubmit = () => { + const { targetKeys } = this.state // 涓夌骇鑿滃崟瑙i櫎鍐荤粨 - if (this.refs.trawmenu.state.targetKeys.length === 0) { + if (targetKeys.length === 0) { notification.warning({ top: 92, - message: this.state.dict['header.menu.thawmenu.select'], + message: this.state.dict['form.required.select'] + this.state.dict['model.menu'], duration: 5 }) } else { this.setState({ confirmLoading: true }) - let defers = this.refs.trawmenu.state.targetKeys.map(item => { + let defers = targetKeys.map(item => { return new Promise((resolve) => { Api.getSystemConfig({ func: 'sPC_MainMenu_ReDel', @@ -399,6 +388,7 @@ this.setState({ confirmLoading: false, thawMvisible: false, + targetKeys: [], thawmenulist: null }) this.props.reload() @@ -411,7 +401,8 @@ // 瑙i櫎鍐荤粨-鍙栨秷 this.setState({ thawMvisible: false, - thawmenulist: null + thawmenulist: null, + targetKeys: [] }) } @@ -436,29 +427,37 @@ * 2銆佷娇鐢ㄥ凡鏈夎彍鍗曟ā鏉挎椂锛岃幏鍙栬彍鍗曢厤缃俊鎭紝鏍囪涓簎ser锛堝鍒惰彍鍗曟寜閽級 */ useTemplate = (template, useType) => { - let editMenu = JSON.parse(JSON.stringify(this.state.editMenu)) + let editMenu = fromJS(this.state.editMenu).toJS() - if (!this.state.fstMenuId) { - notification.warning({ - top: 92, - message: '鑿滃崟鍔犺浇涓紝璇风◢鍚庨噸璇曪紒', - duration: 5 - }) - return - } + editMenu.fstMenuId = this.props.mainMenu.MenuID + editMenu.fstMenuList = this.props.menuTree - if (!editMenu.fstMenuId) { - editMenu.fstMenuId = this.state.fstMenuId - editMenu.fstMenuList = this.state.fstMenuList - } - - if (useType === 'sys' && template.type === 'RolePermission') { // 鐙珛椤甸潰 + if (useType === 'sys' && (template.type === 'RolePermission' || template.type === 'NewPage')) { // 鐙珛椤甸潰 let _menu = { ...editMenu, MenuID: Utils.getuuid(), MenuName: template.title, Template: template.type, - ParentID: this.props.supMenu.MenuID, + ParentId: this.props.supMenu.MenuID, + menuSort: (this.props.menulist.length + 1) * 10, + isSystem: true + } + + this.setState({ + handleMVisible: true, + sysMenu: _menu + }) + return + } else if (template.type === 'CustomPage') { + let _menu = { + ...editMenu, + MenuID: Utils.getuuid(), + MenuName: template.title, + Template: template.type, + ParentId: this.props.supMenu.MenuID, + OriginMenuId: template.uuid || '', + menuSort: (this.props.menulist.length + 1) * 10, + isSystem: true } this.setState({ @@ -531,7 +530,6 @@ this.setState({ loading: false, tabview: template.type, - optionLibs: new Map(), // 鏂板缓鏃讹紝鍒濆鍖栦笅鎷夐�夐」搴� editMenu: { ...editMenu, type: template.type, @@ -540,23 +538,35 @@ isSubtable: template.isSubtable } }) + document.getElementById('root').style.overflowY = 'hidden' }) } getUsedTemplate = () => { + const { memberLevel } = this.props let { sysTemplates } = this.state + const illust = { // 妯℃澘鍥剧墖锛岀敤浜庡凡浣跨敤妯℃澘 + CommonTable: mainsubtable, + TreePage: treepage, + CalendarPage: calendar, + CustomPage: customImg + } Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'menu'}).then(res => { let _templates = [] let hasRolePermission = false res.UserTemp.forEach(temp => { - if (temp.Template === 'RolePermission') { + if (temp.Template === 'NewPage') { + return + } else if (temp.Template === 'RolePermission') { hasRolePermission = true return + } else if (temp.Template === 'CustomPage' && memberLevel < 20) { + return } - + _templates.push({ uuid: temp.MenuID, title: temp.MenuName, @@ -565,15 +575,15 @@ }) }) - if (!hasRolePermission) { - sysTemplates = sysTemplates.map(temp => { - if (temp.type === 'RolePermission') { - temp.hidden = false - } + sysTemplates = sysTemplates.map(temp => { + if (temp.type === 'RolePermission' && !hasRolePermission) { + temp.hidden = false + } else if (temp.type === 'CustomPage' && memberLevel < 20) { + temp.hidden = true + } - return temp - }) - } + return temp + }) this.setState({ usedTemplates: _templates, @@ -605,9 +615,10 @@ */ memuSubmit = () => { const { sysMenu } = this.state - let sysTemplates = JSON.parse(JSON.stringify(this.state.sysTemplates)) + let sysTemplates = fromJS(this.state.sysTemplates).toJS() - if (sysMenu.isSystem) { + // 瑙掕壊鏉冮檺鍒嗛厤妯℃澘锛屽彧鍙互娣诲姞涓�娆� + if (sysMenu.isSystem && (sysMenu.Template === 'RolePermission')) { sysTemplates = sysTemplates.map(temp => { if (temp.type === sysMenu.type) { temp.hidden = true @@ -618,6 +629,15 @@ } this.menuFormRef.handleConfirm().then(res => { + let PageParam = { + Template: sysMenu.Template, + OpenType: 'newtab' + } + + if (sysMenu.Template === 'NewPage') { + PageParam.OpenType = 'NewPage' + PageParam.url = res.url + } let param = { func: 'sPC_TrdMenu_AddUpt', @@ -628,107 +648,106 @@ MenuNo: res.MenuNo, Template: sysMenu.Template, MenuName: res.MenuName, - PageParam: JSON.stringify({Template: sysMenu.Template, OpenType: 'newtab'}), + PageParam: JSON.stringify(PageParam), LongParam: '', LText: '', LTexttb: '' } - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + if (sysMenu.menuSort) { // 鑿滃崟鏂板缓鏃惰缃帓搴� + param.Sort = sysMenu.menuSort + } + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) this.setState({ confirmLoading: true }) - Api.getSystemConfig(param).then(response => { - if (response.status) { - this.setState({ - sysTemplates: sysTemplates, - confirmLoading: false, - handleMVisible: false, - sysMenu: '', - tabview: '' - }) - - this.props.reload() - } else { - this.setState({ - confirmLoading: false - }) - notification.warning({ - top: 92, - message: response.message, - duration: 5 - }) - } - }) - }) - } - - - UNSAFE_componentWillMount () { - this.getUsedTemplate() - - this.setState({ - menulist: this.props.menulist - }) - } - - componentDidMount () { - let _param = { - func: 's_Get_FSMenusForOpen', - SndMenuID: this.props.supMenu.MenuID, - TYPE: 20, - TypeCharOne: 'PC' - } - this.setState({ - loading: true - }) - - Api.getSystemConfig(_param).then(result => { - if (result.status) { - this.setState({ - loading: false, - fstMenuId: result.FstIDSeleted, - fstMenuList: result.data.map(smenu => { - let _smenu = { - MenuID: smenu.FstID, - text: smenu.FstName, - options: smenu.SndData.map(menu => { - return { - MenuID: menu.SndID, - text: menu.SndName, - } - }) - } - - return _smenu - }) - }, () => { - let _menu = JSON.parse(JSON.stringify(this.state.editMenu)) + if (sysMenu.Template === 'CustomPage' && sysMenu.OriginMenuId) { + this.copyMenu(param, sysMenu.OriginMenuId) + } else { + Api.getSystemConfig(param).then(response => { + if (response.status) { + this.setState({ + sysTemplates: sysTemplates, + confirmLoading: false, + handleMVisible: false, + sysMenu: '', + tabview: '' + }) - if (!_menu || !_menu.loadingFstMenuId) { - return + this.props.reload() + document.getElementById('root').style.overflowY = 'unset' + } else { + this.setState({ + confirmLoading: false + }) + notification.warning({ + top: 92, + message: response.message, + duration: 5 + }) } + }) + } + }) + } + + copyMenu = (param, MenuId) => { + Api.getSystemConfig({ + func: 'sPC_Get_LongParam', + MenuID: MenuId + }).then(result => { + if (result.status) { + let config = null - delete _menu.loadingFstMenuId - _menu.fstMenuId = this.state.fstMenuId - _menu.fstMenuList = this.state.fstMenuList + try { + config = result.LongParam ? JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) : null + } catch (e) { + console.warn('Parse Failure') + config = null + } - this.setState({ - type: 'edit', - editMenu: _menu, - loading: false, - optionLibs: new Map(), // 缂栬緫鏃讹紝鍒濆鍖栦负绌� - tabview: _menu.PageParam.Template - }, () => { - document.getElementById('root').style.overflowY = 'hidden' - }) + 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({ + confirmLoading: false, + handleMVisible: false, + sysMenu: '', + tabview: '' + }) + + this.props.reload() + document.getElementById('root').style.overflowY = 'unset' + } else { + this.setState({ + confirmLoading: false + }) + notification.warning({ + top: 92, + message: response.message, + duration: 5 + }) + } }) } else { this.setState({ - loading: false + confirmLoading: false }) notification.warning({ top: 92, @@ -736,6 +755,14 @@ duration: 5 }) } + }) + } + + UNSAFE_componentWillMount () { + this.getUsedTemplate() + + this.setState({ + menulist: this.props.menulist }) } @@ -748,6 +775,7 @@ } render () { + const { dict } = this.state return ( <div className="third-edit-box"> {!this.state.tabview ? @@ -767,14 +795,14 @@ <div className="tipcard card5" style={{backgroundImage: 'url(' + card5 + ')'}}> <p>缂栬緫鐘舵�佷腑锛岃彍鍗曚箣澶栧尯鍩熶細閿佸畾锛屾煡鐪嬬郴缁熸暟鎹鐐瑰嚮銆�</p> <div> - <a target="blank" href="#/main" >鏂伴〉闈�</a> + <span className="new-view" onClick={() => {window.open('#/main')}} >鏂伴〉闈�</span> </div> </div> </div> : null } <div className="cus-submenu-title"> - <Icon type={this.props.supMenu.PageParam.Icon} /> - <span>{this.props.supMenu.text}</span> + <MkIcon type={this.props.supMenu.PageParam.Icon} /> + <span>{this.props.supMenu.MenuName}</span> </div> <DndProvider backend={HTML5Backend}> <DragElement @@ -784,17 +812,17 @@ /> </DndProvider> <div className="menu-add" onClick={() => {this.handleSubBtn('add')}}> - <Icon type="plus" /> + <PlusOutlined /> </div> <div className="menu-btn"> - <Button type="primary" onClick={() => {this.handleSubBtn('thaw')}}>{this.state.dict['header.thawmenu']}</Button> - <Button type="primary" onClick={() => {this.handleSubBtn('confirm')}}>{this.state.dict['header.confirm']}</Button> - <Button onClick={() => {this.handleSubBtn('close')}}>{this.state.dict['header.close']}</Button> + <Button type="primary" onClick={() => {this.handleSubBtn('thaw')}}>{dict['model.thaw'] + dict['model.menu']}</Button> + <Button type="primary" onClick={() => {this.handleSubBtn('confirm')}}>{dict['model.confirm']}</Button> + <Button onClick={() => {this.handleSubBtn('close')}}>{dict['model.close']}</Button> </div> {this.state.tabview === 'template' ? <div className="editboard"> <div className="workplace"> - <Button className="top-btn mk-yellow" onClick={this.exittabview}>{this.state.dict['header.cancel']}</Button> + <Button className="top-btn mk-yellow" onClick={this.exittabview}>{dict['model.cancel']}</Button> {this.state.tabview === 'template' && <Tabs defaultActiveKey="1"> <TabPane tab="绯荤粺妯℃澘" key="1"> <Row> @@ -848,7 +876,13 @@ {this.state.tabview === 'TreePage' ? <TreePageConfig menu={this.state.editMenu} - optionLibs={this.state.optionLibs} + reloadmenu={() => {this.props.reload()}} + handleView={this.handleView} + /> : null + } + {this.state.tabview === 'CalendarPage' ? + <CalendarPageConfig + menu={this.state.editMenu} reloadmenu={() => {this.props.reload()}} handleView={this.handleView} /> : null @@ -856,7 +890,6 @@ {this.state.tabview === 'CommonTable' ? <ComTableConfig menu={this.state.editMenu} - optionLibs={this.state.optionLibs} reloadmenu={() => {this.props.reload()}} handleView={this.handleView} /> : null @@ -864,7 +897,6 @@ {this.state.tabview === 'Modal' ? <ModalConfig menu={this.state.editMenu} - optionLibs={this.state.optionLibs} editTab={this.state.editTab} tabConfig={this.state.tabConfig} editSubTab={this.state.editSubTab} @@ -879,7 +911,6 @@ {this.state.tabview === 'SubTable' ? <SubTable menu={this.state.editMenu} - optionLibs={this.state.optionLibs} editTab={this.state.editTab} editSubTab={this.state.editSubTab} tabConfig={this.state.tabConfig} @@ -892,7 +923,6 @@ {this.state.tabview === 'FormTab' ? <FormTabConfig menu={this.state.editMenu} - optionLibs={this.state.optionLibs} btnTab={this.state.btnTab} config={this.state.subConfig} handleView={this.handleView} @@ -902,9 +932,8 @@ <Preview cancel={this.cancelPrePicture} preview={this.state.preview} template={this.state.pretemplate} confirm={this.useTemplate}/> {/* 瑙e喕鑿滃崟妯℃�佹 */} <Modal - title={this.state.dict['header.thawmenu']} - okText={this.state.dict['header.confirm']} - cancelText={this.state.dict['header.cancel']} + title={dict['model.thaw'] + dict['model.menu']} + width={600} visible={this.state.thawMvisible} onOk={this.thawMemuSubmit} confirmLoading={this.state.confirmLoading} @@ -912,13 +941,11 @@ destroyOnClose > {!this.state.thawmenulist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} - {this.state.thawmenulist && <TransferForm ref="trawmenu" menulist={this.state.thawmenulist}/>} + {this.state.thawmenulist && <TransferForm onChange={(vals) => this.setState({targetKeys: vals})} menulist={this.state.thawmenulist}/>} </Modal> {/* 娣诲姞绯荤粺鑿滃崟 */} <Modal - title={this.state.sysMenu && this.state.sysMenu.isSystem ? this.state.dict['header.menu.tadd'] : this.state.dict['header.menu.tupdate']} - okText={this.state.dict['header.confirm']} - cancelText={this.state.dict['header.cancel']} + title={this.state.sysMenu && this.state.sysMenu.isSystem ? dict['model.add'] + dict['model.menu'] : dict['model.update'] + dict['model.menu']} visible={this.state.handleMVisible} onOk={this.memuSubmit} confirmLoading={this.state.confirmLoading} @@ -927,7 +954,8 @@ > <MenuForm menu={this.state.sysMenu} - dict={this.state.dict} + dict={dict} + inputSubmit={this.memuSubmit} wrappedComponentRef={(inst) => this.menuFormRef = inst} /> </Modal> @@ -937,4 +965,16 @@ } } -export default EditMenu \ No newline at end of file +const mapStateToProps = (state) => { + return { + mainMenu: state.mainMenu, + menuTree: state.menuTree, + memberLevel: state.memberLevel + } +} + +const mapDispatchToProps = () => { + return {} +} + +export default withRouter(connect(mapStateToProps, mapDispatchToProps)(EditMenu)) \ No newline at end of file -- Gitblit v1.8.0