| | |
| | | btnTabConfig: null, // 打开新标签按钮配置 |
| | | handleMVisible: false, // 添加或修改菜单模态框(角色权限分配等) |
| | | sysMenu: false, // 添加或编辑菜单(角色权限分配等) |
| | | fstMenuId: null, // 一级菜单Id |
| | | fstMenuList: null // 一级菜单列表 |
| | | } |
| | | |
| | | /** |
| | |
| | | }) |
| | | } else if (menu.type === 'close') { |
| | | confirm({ |
| | | title: this.state.dict['model.menu.close'].replace('@M', menu.card.text), |
| | | title: this.state.dict['model.menu.close'].replace('@M', menu.card.MenuName), |
| | | content: '', |
| | | onOk() { |
| | | let param = { |
| | |
| | | } else if (menu.type === 'edit') { |
| | | let _menu = fromJS(menu.card).toJS() |
| | | |
| | | delete _menu.id |
| | | delete _menu.src |
| | | delete _menu.text |
| | | |
| | | 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.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, |
| | |
| | | } |
| | | |
| | | _menu.LongParam = _LongParam |
| | | _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 || '' |
| | | |
| | | // 检测模板是否存在 |
| | |
| | | }, () => { |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | }) |
| | | } else if (_menu.fstMenuId) { |
| | | } else { |
| | | this.setState({ |
| | | type: 'edit', |
| | | editMenu: _menu, |
| | |
| | | tabview: _menu.PageParam.Template |
| | | }, () => { |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | }) |
| | | } else { |
| | | _menu.loadingFstMenuId = true |
| | | this.setState({ |
| | | type: 'edit', |
| | | editMenu: _menu |
| | | }) |
| | | } |
| | | } else { |
| | |
| | | return |
| | | } |
| | | |
| | | if (!this.state.fstMenuId) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单加载中,请稍后重试!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | | tabview: 'template', |
| | | editMenu: { |
| | |
| | | isSubtable: '', // 是否为主子表 |
| | | 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 // 新建菜单设置排序 |
| | | } |
| | | }, () => { |
| | |
| | | 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() |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | useTemplate = (template, useType) => { |
| | | let editMenu = fromJS(this.state.editMenu).toJS() |
| | | |
| | | if (!this.state.fstMenuId) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单加载中,请稍后重试!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (!editMenu.fstMenuId) { |
| | | editMenu.fstMenuId = this.state.fstMenuId |
| | | editMenu.fstMenuList = this.state.fstMenuList |
| | | } |
| | | editMenu.fstMenuId = this.props.mainMenu.MenuID |
| | | editMenu.fstMenuList = this.props.menuTree |
| | | |
| | | if (useType === 'sys' && (template.type === 'RolePermission' || template.type === 'NewPage')) { // 独立页面 |
| | | let _menu = { |
| | |
| | | }) |
| | | } |
| | | |
| | | 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 = this.state.editMenu ? fromJS(this.state.editMenu).toJS() : null |
| | | |
| | | if (!_menu || !_menu.loadingFstMenuId) { |
| | | return |
| | | } |
| | | |
| | | delete _menu.loadingFstMenuId |
| | | _menu.fstMenuId = this.state.fstMenuId |
| | | _menu.fstMenuList = this.state.fstMenuList |
| | | |
| | | this.setState({ |
| | | type: 'edit', |
| | | editMenu: _menu, |
| | | loading: false, |
| | | tabview: _menu.PageParam.Template |
| | | }, () => { |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | }) |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (!is(fromJS(this.props.menulist), fromJS(nextProps.menulist))) { |
| | | this.setState({ |
| | |
| | | } |
| | | <div className="cus-submenu-title"> |
| | | <Icon type={this.props.supMenu.PageParam.Icon} /> |
| | | <span>{this.props.supMenu.text}</span> |
| | | <span>{this.props.supMenu.MenuName}</span> |
| | | </div> |
| | | <DndProvider backend={HTML5Backend}> |
| | | <DragElement |
| | |
| | | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | mainMenu: state.mainMenu, |
| | | menuTree: state.menuTree, |
| | | memberLevel: state.memberLevel |
| | | } |
| | | } |