| | |
| | | sysMenu: false, // 添加或编辑菜单(角色权限分配等) |
| | | optionLibs: [], // 自定义下拉选项库 |
| | | fstMenuId: null, // 一级菜单Id |
| | | fstMenuList: null // 一级菜单列表 |
| | | fstMenuList: null, // 一级菜单列表 |
| | | roleList: null // 角色列表,建立黑名单 |
| | | } |
| | | |
| | | /** |
| | |
| | | delete _menu.src |
| | | delete _menu.text |
| | | |
| | | if (!this.state.fstMenuId) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未获取到一级菜单信息,请稍等或刷新重试。', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | _menu.ParentID = this.props.supMenu.MenuID |
| | | _menu.supMenuList = this.props.supMenuList |
| | | _menu.fstMenuId = this.state.fstMenuId |
| | | _menu.fstMenuList = this.state.fstMenuList |
| | | _menu.roleList = this.state.roleList |
| | | |
| | | if (_menu.PageParam && _menu.PageParam.Template === 'RolePermission') { // 单页面修改 |
| | | let _menu_ = { |
| | | ..._menu, |
| | | ParentID: this.props.supMenu.MenuID, |
| | | Template: _menu.PageParam.Template |
| | | } |
| | | _menu.Template = _menu.PageParam.Template |
| | | |
| | | this.setState({ |
| | | handleMVisible: true, |
| | | sysMenu: _menu_ |
| | | sysMenu: _menu |
| | | }) |
| | | |
| | | return |
| | |
| | | } |
| | | |
| | | _menu.LongParam = _LongParam |
| | | _menu.ParentID = this.props.supMenu.MenuID |
| | | _menu.supMenuList = this.props.supMenuList |
| | | |
| | | |
| | | // 检测模板是否存在 |
| | | let _Template = this.state.sysTemplates.filter(temp => temp.type === _menu.PageParam.Template) |
| | |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | }) |
| | | } else { |
| | | if (this.state.fstMenuId) { |
| | | _menu.fstMenuId = this.state.fstMenuId |
| | | _menu.fstMenuList = this.state.fstMenuList |
| | | |
| | | this.setState({ |
| | | type: 'edit', |
| | | editMenu: _menu, |
| | | loading: false, |
| | | optionLibs: new Map(), // 编辑时,初始化为空 |
| | | tabview: _menu.PageParam.Template |
| | | }, () => { |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | }) |
| | | } else { |
| | | let _param = { |
| | | func: 's_Get_FSMenusForOpen', |
| | | SndMenuID: this.props.supMenu.MenuID, |
| | | TYPE: 20, |
| | | TypeCharOne: 'PC' |
| | | } |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | if (result.status) { |
| | | _menu.fstMenuId = result.FstIDSeleted |
| | | _menu.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 |
| | | }) |
| | | |
| | | this.setState({ |
| | | type: 'edit', |
| | | editMenu: _menu, |
| | | loading: false, |
| | | optionLibs: new Map(), // 编辑时,初始化为空 |
| | | tabview: _menu.PageParam.Template |
| | | }, () => { |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | this.setState({ |
| | | type: 'edit', |
| | | editMenu: _menu, |
| | | loading: false, |
| | | optionLibs: new Map(), // 编辑时,初始化为空 |
| | | tabview: _menu.PageParam.Template |
| | | }, () => { |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | }) |
| | | } |
| | | } else { |
| | | this.setState({ |
| | |
| | | return |
| | | } |
| | | |
| | | if (this.state.fstMenuId) { |
| | | this.setState({ |
| | | tabview: 'template', |
| | | editMenu: { |
| | | MenuID: Utils.getuuid(), |
| | | MenuName: '', |
| | | MenuNo: '', |
| | | type: '', |
| | | PageParam: '', |
| | | LongParam: '', |
| | | isSubtable: '', // 是否为主子表 |
| | | ParentID: this.props.supMenu.MenuID, |
| | | supMenuList: this.props.supMenuList, |
| | | fstMenuId: this.state.fstMenuId, |
| | | fstMenuList: this.state.fstMenuList |
| | | } |
| | | }, () => { |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | if (!this.state.fstMenuId) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未获取到一级菜单信息,请稍等或刷新重试', |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | | let _param = { |
| | | func: 's_Get_FSMenusForOpen', |
| | | SndMenuID: this.props.supMenu.MenuID, |
| | | TYPE: 20, |
| | | TypeCharOne: 'PC' |
| | | } |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | tabview: 'template', |
| | | editMenu: { |
| | | MenuID: Utils.getuuid(), |
| | | MenuName: '', |
| | | MenuNo: '', |
| | | type: '', |
| | | PageParam: '', |
| | | LongParam: '', |
| | | isSubtable: '', // 是否为主子表 |
| | | ParentID: this.props.supMenu.MenuID, |
| | | supMenuList: this.props.supMenuList, |
| | | 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 |
| | | }) |
| | | } |
| | | }, () => { |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | return |
| | | } |
| | | |
| | | |
| | | this.setState({ |
| | | tabview: 'template', |
| | | editMenu: { |
| | | MenuID: Utils.getuuid(), |
| | | MenuName: '', |
| | | MenuNo: '', |
| | | type: '', |
| | | PageParam: '', |
| | | LongParam: '', |
| | | isSubtable: '', // 是否为主子表 |
| | | ParentID: this.props.supMenu.MenuID, |
| | | supMenuList: this.props.supMenuList, |
| | | roleList: this.state.roleList, |
| | | fstMenuId: this.state.fstMenuId, |
| | | fstMenuList: this.state.fstMenuList |
| | | } |
| | | }, () => { |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | }) |
| | | } else if (type === 'thaw') { |
| | | if (!is(fromJS(this.props.menulist), fromJS(this.state.menulist))) { |
| | | notification.warning({ |
| | |
| | | |
| | | let param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | | FstID: res.fstMenuId, |
| | | SndID: res.ParentID, |
| | | ParentID: res.ParentID, |
| | | MenuID: sysMenu.MenuID, |
| | |
| | | TYPE: 20, |
| | | TypeCharOne: 'PC' |
| | | } |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | 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 menuDefer = new Promise(resolve => { |
| | | Api.getSystemConfig(_param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | 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 |
| | | }) |
| | | }) |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | resolve() |
| | | }) |
| | | }) |
| | | |
| | | let roleDefer = new Promise(resolve => { |
| | | Api.getSystemConfig({func: 'sPC_Get_RolesMenu'}).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | | roleList: res.Roles.map(role => { |
| | | return { |
| | | value: role.RoleID, |
| | | text: role.RoleName |
| | | } |
| | | }) |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | resolve() |
| | | }) |
| | | }) |
| | | |
| | | Promise.all([menuDefer, roleDefer]).then(() => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | } |
| | | |
| | |
| | | {!this.state.thawmenulist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} |
| | | {this.state.thawmenulist && <TransferForm ref="trawmenu" dict={this.state.dict} 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']} |
| | |
| | | <MenuForm |
| | | menu={this.state.sysMenu} |
| | | dict={this.state.dict} |
| | | supMenuList={this.props.supMenuList} |
| | | wrappedComponentRef={(inst) => this.menuFormRef = inst} |
| | | /> |
| | | </Modal> |