| | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import { |
| | | toggleCollapse, |
| | | modifyMenuTree, |
| | | modifyMainMenu, |
| | | modifyTabview, |
| | | resetState, |
| | |
| | | import LoginForm from './loginform' |
| | | import './index.scss' |
| | | |
| | | const EditMenu = asyncComponent(() => import('@/templates/headerconfig')) |
| | | const EditMenu = asyncComponent(() => import('@/templates/menuconfig/editfirstmenu')) |
| | | const { confirm } = Modal |
| | | const { Search } = Input |
| | | |
| | | class Header extends Component { |
| | | static propTpyes = { |
| | | collapse: PropTypes.bool, |
| | | mainMenu: PropTypes.oneOfType([ |
| | | PropTypes.string, |
| | | PropTypes.object |
| | | ]) |
| | | collapse: PropTypes.bool |
| | | } |
| | | state = { |
| | | menulist: null, // 一级菜单 |
| | |
| | | logourl: window.GLOB.mainlogo, |
| | | loginVisible: false, |
| | | loginLoading: false, |
| | | avatar: avatar, |
| | | avatar: Utils.getrealurl(sessionStorage.getItem('avatar')), |
| | | systems: [], |
| | | searchkey: '', |
| | | thdMenuList: [], |
| | |
| | | this.setState({ |
| | | confirmLoading: true |
| | | }) |
| | | this.resetPwdSubmitexec(res) |
| | | |
| | | let _param = { |
| | | func: 's_PwdUpt', |
| | | LText: `select '${res.originpwd}','${res.password}'` |
| | | } |
| | | |
| | | _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') // 时间戳 |
| | | _param.LText = Utils.formatOptions(_param.LText) // 关键字符替换,base64加密 |
| | | _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) // md5密钥 |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | this.setState({ |
| | | visible: !result.status, |
| | | confirmLoading: false |
| | | }) |
| | | |
| | | if (result.status) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: this.state.dict['main.password.resetsuccess'], |
| | | duration: 2 |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | }, () => {}) |
| | | } |
| | | |
| | | async resetPwdSubmitexec (param) { |
| | | let _param = { |
| | | func: 's_PwdUpt', |
| | | LText: `select '${param.originpwd}','${param.password}'` |
| | | } |
| | | |
| | | _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') // 时间戳 |
| | | _param.LText = Utils.formatOptions(_param.LText) // 关键字符替换,base64加密 |
| | | _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) // md5密钥 |
| | | |
| | | let result = await Api.getSystemConfig(_param) // 取消修改本地密码,只修改单点服务器 |
| | | |
| | | if (result.status) { |
| | | this.setState({ |
| | | visible: false, |
| | | confirmLoading: false |
| | | }) |
| | | notification.success({ |
| | | top: 92, |
| | | message: this.state.dict['main.password.resetsuccess'], |
| | | duration: 2 |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | this.setState({ |
| | | confirmLoading: false |
| | | }) |
| | | } |
| | | } |
| | | |
| | | handleCancel = () => { |
| | |
| | | |
| | | async loadmenu () { |
| | | // 获取主菜单 |
| | | let _param = {func: 'sPC_Get_MainMenu', systemType: options.sysType} |
| | | if (sessionStorage.getItem('isEditState') === 'true') { // 编辑状态时,获取一级菜单,增加参数debug |
| | | let _param = {func: 's_get_pc_menus', systemType: options.sysType} |
| | | if (sessionStorage.getItem('isEditState') === 'true') { // 编辑状态时,增加参数debug |
| | | _param.debug = 'Y' |
| | | } |
| | | if (options.sysType !== 'cloud' && window.GLOB.systemType !== 'production') { |
| | | _param.linkurl = window.GLOB.linkurl |
| | | } |
| | | _param.pro_sys = window.GLOB.systemType === 'production' ? 'Y' : '' |
| | | |
| | | let result = await Api.getSystemConfig(_param) |
| | | |
| | |
| | | if (!result) return |
| | | |
| | | if (result.status) { |
| | | let MainMenuId = sessionStorage.getItem('MainMenu') // 是否为打开新页面 |
| | | if (MainMenuId) { |
| | | // 通过url中menuid筛选出选中的主菜单 |
| | | let _menu = result.data.filter(item => item.MenuID === MainMenuId)[0] |
| | | sessionStorage.removeItem('MainMenu') |
| | | this.props.modifyMainMenu(_menu || result.data[0]) |
| | | } else { |
| | | this.props.modifyMainMenu(result.data[0]) |
| | | } |
| | | let res = this.getMenulist(result) |
| | | |
| | | this.setState({ |
| | | menulist: result.data.map((item, index) => { |
| | | item.id = index |
| | | item.text = item.MenuName |
| | | if (item.PageParam) { |
| | | try { |
| | | item.PageParam = JSON.parse(item.PageParam) |
| | | } catch (e) { |
| | | item.PageParam = {OpenType: 'menu', linkUrl: ''} |
| | | } |
| | | } else { |
| | | item.PageParam = {OpenType: 'menu', linkUrl: ''} |
| | | } |
| | | return item |
| | | }), |
| | | systems: sessionStorage.getItem('isEditState') === 'true' ? [] : result.Systems.filter(sys => sys.LinkUrl1 && sys.AppName && sys.AppKey !== window.GLOB.appkey) |
| | | menulist: res.menulist, |
| | | systems: [] |
| | | }) |
| | | |
| | | this.props.modifyMenuTree(res.menulist) |
| | | this.props.modifyMainMenu(res.menulist[0] || null) |
| | | } else { |
| | | notification.error({ |
| | | top: 92, |
| | |
| | | } |
| | | } |
| | | |
| | | async getRolesMenu () { |
| | | getRolesMenu () { |
| | | // 获取角色权限 |
| | | let promiseRole = new Promise(resolve => { |
| | | Api.getSystemConfig({func: 's_Get_TrdMenu_Role', edition_type: 'Y'}).then(result => { |
| | | let roledefer = new Promise(resolve => { |
| | | // edition_type 接口版本控制 ''、'Y'、'A' |
| | | Api.getSystemConfig({ |
| | | func: 's_Get_TrdMenu_Role', |
| | | edition_type: 'A', |
| | | pro_sys: window.GLOB.systemType === 'production' ? 'Y' : '' |
| | | }).then(result => { |
| | | let _permAction = {} // 按钮权限 |
| | | let _permMenus = {} // 菜单权限,字段透视等 |
| | | let menulist = [] // 三级菜单列表 |
| | | |
| | | if (result && result.status) { |
| | | if (result.UserRoles_Menu) { |
| | |
| | | _permAction[menu.MenuID] = true |
| | | }) |
| | | } |
| | | |
| | | if (result.UserRoles) { |
| | | let iframes = ['Main/Index', 'bda/rdt', 'Home/rdt'] |
| | | let menukeys = [] |
| | | |
| | | result.UserRoles.forEach(menu => { |
| | | if (!menu.MenuID) return |
| | | if (menukeys.includes(menu.MenuID)) { |
| | | console.warn('s_Get_TrdMenu_Role重复的菜单ID:' + menu.MenuID) |
| | | return |
| | | } |
| | | _permMenus[menu.MenuID] = true |
| | | |
| | | let _type = '' |
| | | if (menu.LinkUrl === 'CommonTable') { |
| | | _type = 'CommonTable' |
| | | } else if (menu.LinkUrl && iframes.includes(menu.LinkUrl.split('?')[0])) { |
| | | _type = 'iframe' |
| | | } |
| | | |
| | | if (_type !== 'iframe') { |
| | | let pageParam = {} |
| | | try { |
| | | pageParam = JSON.parse(menu.PageParam) |
| | | } catch (e) { |
| | | pageParam = {} |
| | | } |
| | | _type = pageParam.Template || _type |
| | | } |
| | | |
| | | menukeys.push(menu.MenuID) |
| | | |
| | | menulist.push({ |
| | | MenuID: menu.MenuID, |
| | | MenuName: menu.MenuName, |
| | | MenuNo: menu.MenuNo || '', |
| | | EasyCode: menu.EasyCode || '', |
| | | LinkUrl: menu.LinkUrl, |
| | | type: _type |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | thdMenuList: menulist |
| | | }) |
| | | |
| | | this.props.initMenuPermission(_permMenus) |
| | | } else if (result) { |
| | | notification.error({ |
| | | top: 92, |
| | |
| | | }) |
| | | } |
| | | |
| | | resolve(_permAction) |
| | | this.props.initActionPermission(_permAction) |
| | | resolve() |
| | | }) |
| | | }) |
| | | |
| | | // 获取主菜单参数 |
| | | let promiseMenu = new Promise(resolve => { |
| | | let _param = {func: 'sPC_Get_MainMenu', systemType: options.sysType} |
| | | let menudefer = new Promise(resolve => { |
| | | let _param = {func: 's_get_pc_menus', systemType: options.sysType} |
| | | if (options.sysType !== 'cloud' && window.GLOB.systemType !== 'production') { |
| | | _param.linkurl = window.GLOB.linkurl |
| | | } |
| | | |
| | | _param.pro_sys = window.GLOB.systemType === 'production' ? 'Y' : '' |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | let mainMenu = null |
| | | if (result && result.status) { |
| | | let MainMenuId = sessionStorage.getItem('MainMenu') // 是否为打开新页面 |
| | | if (MainMenuId) { |
| | | // 通过url中menuid筛选出选中的主菜单 |
| | | let _menu = result.data.filter(item => item.MenuID === MainMenuId)[0] |
| | | sessionStorage.removeItem('MainMenu') |
| | | mainMenu = _menu || result.data[0] |
| | | } else { |
| | | mainMenu = result.data[0] |
| | | } |
| | | |
| | | this.setState({ |
| | | menulist: result.data.map((item, index) => { |
| | | item.id = index |
| | | item.text = item.MenuName |
| | | if (item.PageParam) { |
| | | try { |
| | | item.PageParam = JSON.parse(item.PageParam) |
| | | } catch (e) { |
| | | item.PageParam = {OpenType: 'menu', linkUrl: ''} |
| | | } |
| | | } else { |
| | | item.PageParam = {OpenType: 'menu', linkUrl: ''} |
| | | } |
| | | return item |
| | | }), |
| | | systems: result.Systems.filter(sys => sys.LinkUrl1 && sys.AppName && sys.AppKey !== window.GLOB.appkey) |
| | | }) |
| | | } else if (result) { |
| | | if (!result.status || !result.fst_menu) { |
| | | notification.error({ |
| | | top: 92, |
| | | message: result.message, |
| | | message: result.message || '未查询到菜单信息!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | resolve(mainMenu) |
| | | let res = this.getMenulist(result) |
| | | |
| | | this.setState({ |
| | | menulist: res.menulist, |
| | | thdMenuList: res.thdMenuList, |
| | | systems: window.GLOB.systemType === 'production' || options.sysType === 'SSO' ? (result.sys_list || []) : [] |
| | | }) |
| | | |
| | | let mainMenu = res.menulist[0] || null |
| | | let _menu = null |
| | | |
| | | if (sessionStorage.getItem('ThirdMenu')) { // 是否为打开新页面 |
| | | let ThirdMenuId = sessionStorage.getItem('ThirdMenu') |
| | | _menu = res.thdMenuList.filter(item => item.MenuID === ThirdMenuId)[0] // 通过url中menuid筛选出选中的主菜单 |
| | | |
| | | if (_menu) { |
| | | mainMenu = res.menulist.filter(item => item.MenuID === _menu.FstId)[0] |
| | | mainMenu = fromJS(mainMenu).toJS() |
| | | mainMenu.openId = _menu.ParentId |
| | | } |
| | | |
| | | sessionStorage.removeItem('ThirdMenu') |
| | | } |
| | | |
| | | this.props.modifyMenuTree(res.menulist) |
| | | this.props.modifyMainMenu(mainMenu) |
| | | this.props.initMenuPermission(res.permMenus) |
| | | |
| | | resolve(_menu) |
| | | }) |
| | | }) |
| | | |
| | | let _mainMenu = await promiseMenu |
| | | if (_mainMenu) { |
| | | this.props.modifyMainMenu(_mainMenu) |
| | | } |
| | | Promise.all([roledefer, menudefer]).then(response => { |
| | | if (response[1]) { |
| | | let tabs = fromJS(this.props.tabviews).toJS() |
| | | let menu = fromJS(response[1]).toJS() |
| | | |
| | | let permAction = await promiseRole |
| | | tabs = tabs.map(tab => { |
| | | tab.selected = false |
| | | return tab |
| | | }) |
| | | |
| | | this.props.initActionPermission(permAction) |
| | | menu.selected = true |
| | | tabs.push(menu) |
| | | this.props.modifyTabview(tabs) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | getMenulist = (result) => { |
| | | let thdMenuList = [] |
| | | let permMenus = {} |
| | | let iframes = ['Main/Index', 'bda/rdt', 'Home/rdt'] |
| | | let menulist = result.fst_menu.map(fst => { |
| | | let fstItem = { |
| | | MenuID: fst.MenuID, |
| | | MenuName: fst.MenuName, |
| | | PageParam: {OpenType: 'menu', linkUrl: ''}, |
| | | children: [] |
| | | } |
| | | if (fst.PageParam) { |
| | | try { |
| | | fstItem.PageParam = JSON.parse(fst.PageParam) |
| | | } catch (e) { |
| | | fstItem.PageParam = {OpenType: 'menu', linkUrl: ''} |
| | | } |
| | | } |
| | | |
| | | if (fst.snd_menu) { |
| | | fstItem.children = fst.snd_menu.map(snd => { |
| | | let sndItem = { |
| | | ParentId: fst.MenuID, |
| | | MenuID: snd.MenuID, |
| | | MenuName: snd.MenuName, |
| | | PageParam: {Icon: 'folder'}, |
| | | children: [] |
| | | } |
| | | |
| | | if (snd.PageParam) { |
| | | try { |
| | | sndItem.PageParam = JSON.parse(snd.PageParam) |
| | | } catch (e) { |
| | | sndItem.PageParam = {Icon: 'folder'} |
| | | } |
| | | } |
| | | |
| | | let msg = { |
| | | UserID: sessionStorage.getItem('UserID'), |
| | | LoginUID: sessionStorage.getItem('LoginUID'), |
| | | User_Name: sessionStorage.getItem('User_Name'), |
| | | Full_Name: sessionStorage.getItem('Full_Name'), |
| | | Member_Level: sessionStorage.getItem('Member_Level'), |
| | | dataM: sessionStorage.getItem('dataM'), |
| | | avatar: sessionStorage.getItem('avatar'), |
| | | debug: sessionStorage.getItem('debug'), |
| | | role_id: sessionStorage.getItem('role_id'), |
| | | mainlogo: window.GLOB.mainlogo, |
| | | mstyle: window.GLOB.style |
| | | } |
| | | |
| | | if (snd.trd_menu) { |
| | | sndItem.children = snd.trd_menu.map(trd => { |
| | | let trdItem = { |
| | | FstId: fst.MenuID, |
| | | ParentId: snd.MenuID, |
| | | MenuID: trd.MenuID, |
| | | MenuName: trd.MenuName, |
| | | MenuNo: trd.MenuNo, |
| | | EasyCode: trd.EasyCode, |
| | | type: 'CommonTable', // 默认值为常用表 |
| | | OpenType: 'newtab' // 打开方式 |
| | | } |
| | | |
| | | if (trd.LinkUrl && iframes.includes(trd.LinkUrl.split('?')[0])) { |
| | | trdItem.type = 'iframe' |
| | | trdItem.LinkUrl = trd.LinkUrl |
| | | trdItem.forbidden = true |
| | | } else { |
| | | try { |
| | | trdItem.PageParam = trd.PageParam ? JSON.parse(trd.PageParam) : {OpenType: 'newtab'} |
| | | } catch (e) { |
| | | trdItem.PageParam = {OpenType: 'newtab'} |
| | | } |
| | | |
| | | trdItem.type = trdItem.PageParam.Template || trdItem.type |
| | | trdItem.OpenType = trdItem.PageParam.OpenType || trdItem.OpenType |
| | | |
| | | if (trdItem.type === 'CustomPage' && this.props.memberLevel < 20) { // 会员等级大于等于20时,有编辑权限 |
| | | trdItem.forbidden = true |
| | | } |
| | | if (trdItem.type === 'NewPage') { |
| | | trdItem.src = trdItem.PageParam.url || '' |
| | | |
| | | if (trdItem.src.indexOf('paramsmain/') > -1) { |
| | | try { |
| | | let _url = trdItem.src.split('paramsmain/')[0] + 'paramsmain/' |
| | | let _param = JSON.parse(window.decodeURIComponent(window.atob(trdItem.src.split('paramsmain/')[1]))) |
| | | _param.UserID = sessionStorage.getItem('UserID') |
| | | _param.LoginUID = sessionStorage.getItem('LoginUID') |
| | | _param.User_Name = sessionStorage.getItem('User_Name') |
| | | _param.Full_Name = sessionStorage.getItem('Full_Name') |
| | | |
| | | trdItem.src = _url + window.btoa(window.encodeURIComponent(JSON.stringify(_param))) |
| | | } catch { |
| | | console.warn('菜单参数解析错误!') |
| | | } |
| | | } |
| | | } else { |
| | | // 打开新页面链接 |
| | | trdItem.src = '#/paramsmain/' + window.btoa(window.encodeURIComponent(JSON.stringify({ |
| | | ...msg, |
| | | ThirdMenu: trd.MenuID |
| | | }))) |
| | | } |
| | | } |
| | | |
| | | permMenus[trd.MenuID] = true |
| | | thdMenuList.push(trdItem) |
| | | |
| | | return trdItem |
| | | }) |
| | | } |
| | | |
| | | return sndItem |
| | | }) |
| | | } |
| | | |
| | | return fstItem |
| | | }) |
| | | |
| | | return { menulist, thdMenuList, permMenus} |
| | | } |
| | | |
| | | reload = () => { |
| | | this.setState({ |
| | | menulist: null |
| | | }) |
| | | this.loadmenu() |
| | | } |
| | | |
| | | changeEditState = (state) => { |
| | | const { menulist } = this.state |
| | | |
| | | if (!state) { // 退出编辑,页面刷新 |
| | | window.location.reload() |
| | | return |
| | |
| | | let UserID = sessionStorage.getItem('CloudUserID') |
| | | let LoginUID = sessionStorage.getItem('CloudLoginUID') |
| | | |
| | | if (state && (!UserID || !LoginUID)) { |
| | | if (!UserID || !LoginUID) { |
| | | this.setState({ |
| | | loginVisible: true |
| | | }) |
| | | } else { |
| | | sessionStorage.setItem('isEditState', state) |
| | | let _userName = sessionStorage.getItem('User_Name') |
| | | let _avatar = avatar |
| | | sessionStorage.setItem('isEditState', 'true') |
| | | this.props.modifyDataManager(sessionStorage.getItem('cloudDataM') === 'true') |
| | | |
| | | if (sessionStorage.getItem('cloudDataM') === 'true') { |
| | | this.props.modifyDataManager(true) |
| | | } |
| | | if (!state && sessionStorage.getItem('avatar')) { |
| | | _avatar = Utils.getrealurl(sessionStorage.getItem('avatar')) // 头像 |
| | | } else if (state && sessionStorage.getItem('CloudAvatar')) { |
| | | _avatar = Utils.getrealurl(sessionStorage.getItem('CloudAvatar')) // 头像 |
| | | } |
| | | |
| | | if (state) { |
| | | _userName = sessionStorage.getItem('CloudUserName') |
| | | } |
| | | |
| | | if (window.GLOB.systemType === 'production' && state) { |
| | | if (window.GLOB.systemType === 'production') { |
| | | this.props.resetEditLevel('HS') |
| | | this.props.modifyMainMenu({ |
| | | MenuID: 'systemManageView' |
| | | }) |
| | | |
| | | this.setState({ |
| | | userName: _userName, |
| | | avatar: _avatar |
| | | }) |
| | | this.props.resetEditState(state) |
| | | |
| | | return |
| | | } else if (window.GLOB.systemType === 'production' && !state) { |
| | | this.props.resetEditLevel(false) |
| | | this.props.modifyMainMenu(menulist[0] || '') |
| | | |
| | | this.setState({ |
| | | userName: _userName, |
| | | avatar: _avatar |
| | | userName: sessionStorage.getItem('CloudUserName'), |
| | | avatar: Utils.getrealurl(sessionStorage.getItem('CloudAvatar')) |
| | | }) |
| | | this.props.resetEditState(state) |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | menulist: null, |
| | | userName: _userName, |
| | | avatar: _avatar |
| | | userName: sessionStorage.getItem('CloudUserName'), |
| | | avatar: Utils.getrealurl(sessionStorage.getItem('CloudAvatar')) |
| | | }) |
| | | this.loadmenu() |
| | | this.props.modifyMainMenu('') |
| | | this.props.modifyMainMenu(null) |
| | | this.props.resetEditState(state) |
| | | } |
| | | |
| | | if (state && this.props.sysRoles.length === 0 && this.props.permFuncField.length === 0 && window.GLOB.systemType !== 'production') { |
| | | if (window.GLOB.systemType !== 'production') { |
| | | Api.getSystemConfig({func: 'sPC_Get_Roles_sModular'}).then(res => { |
| | | if (res.status) { |
| | | let _permFuncField = [] |
| | |
| | | sessionStorage.setItem('CloudUserName', res.UserName) |
| | | sessionStorage.setItem('CloudFullName', res.FullName) |
| | | sessionStorage.setItem('CloudAvatar', res.icon) |
| | | sessionStorage.setItem('isEditState', 'true') |
| | | sessionStorage.setItem('cloudDataM', res.dataM ? 'true' : '') |
| | | |
| | | let _avatar = avatar |
| | | if (res.icon) { |
| | | _avatar = Utils.getrealurl(res.icon) // 头像 |
| | | } |
| | | |
| | | sessionStorage.setItem('isEditState', 'true') |
| | | |
| | | if (res.dataM) { |
| | | this.props.modifyDataManager(true) |
| | |
| | | loginVisible: false, |
| | | loginLoading: false, |
| | | userName: res.UserName, |
| | | avatar: _avatar |
| | | avatar: res.icon |
| | | }) |
| | | this.props.resetEditState(true) |
| | | |
| | |
| | | loginVisible: false, |
| | | loginLoading: false, |
| | | userName: res.UserName, |
| | | avatar: _avatar |
| | | avatar: res.icon |
| | | }) |
| | | this.loadmenu() |
| | | this.props.modifyMainMenu('') |
| | | this.props.modifyMainMenu(null) |
| | | this.props.resetEditState(true) |
| | | } else { |
| | | this.setState({ |
| | |
| | | * @description 退出管理界面菜单 |
| | | */ |
| | | exitManage = () => { |
| | | const { menulist } = this.state |
| | | |
| | | if (window.GLOB.systemType === 'production') { // 正式系统版本升级后,页面刷新 |
| | | window.location.reload() |
| | | return |
| | | } |
| | | |
| | | this.props.resetEditState(true) |
| | | this.props.modifyMainMenu(menulist[0] || null) |
| | | this.props.resetEditLevel(false) |
| | | this.reload() |
| | | } |
| | | |
| | | exitEdit = () => { |
| | |
| | | } |
| | | |
| | | selectMenu = (item) => { |
| | | const { tabviews } = this.props |
| | | |
| | | let menu = JSON.parse(JSON.stringify(item)) |
| | | let tabs = fromJS(this.props.tabviews).toJS() |
| | | let menu = fromJS(item).toJS() |
| | | menu.selected = true |
| | | |
| | | let index = 0 |
| | | let isexit = false |
| | | let tabs = tabviews.map((tab, i) => { |
| | | tabs = tabs.filter(tab => { |
| | | tab.selected = false |
| | | |
| | | if (tab.MenuID === menu.MenuID) { |
| | | tab.selected = true |
| | | isexit = true |
| | | } |
| | | |
| | | return tab |
| | | return tab.MenuID !== menu.MenuID |
| | | }) |
| | | |
| | | if (!isexit) { |
| | | tabs.splice(index + 1, 0, menu) |
| | | if (this.props.tabviews.length !== tabs.length) { |
| | | this.props.modifyTabview(fromJS(tabs).toJS()) |
| | | } |
| | | |
| | | this.props.modifyTabview(tabs) |
| | | this.setState({}, () => { |
| | | tabs.push(menu) |
| | | this.props.modifyTabview(tabs) |
| | | }) |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | // 组件加载时,获取菜单数据 |
| | | let _avatar = sessionStorage.getItem('avatar') |
| | | if (_avatar) { |
| | | _avatar = Utils.getrealurl(_avatar) // 头像 |
| | | this.setState({avatar: _avatar}) |
| | | } |
| | | |
| | | this.getRolesMenu() |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (!is(fromJS(this.props.menuTree), fromJS(nextProps.menuTree)) && !is(fromJS(this.state.menulist), fromJS(nextProps.menuTree))) { |
| | | this.setState({ |
| | | menulist: nextProps.menuTree |
| | | }) |
| | | } |
| | | } |
| | | |
| | | componentDidMount () { |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { mainMenu, collapse } = this.props |
| | | const { thdMenuList, searchkey, oriVersion, newVersion } = this.state |
| | | |
| | | const menu = ( |
| | |
| | | |
| | | return ( |
| | | <header className="header-container ant-menu-dark" id="main-header-container"> |
| | | <div className={this.props.collapse ? "collapse header-logo" : "header-logo"}><img src={this.state.logourl} alt=""/></div> |
| | | <div className={this.props.collapse ? "collapse header-collapse" : "header-collapse"} onClick={this.handleCollapse}> |
| | | <Icon type={this.props.collapse ? 'menu-unfold' : 'menu-fold'} /> |
| | | <div className={collapse ? "collapse header-logo" : "header-logo"}><img src={this.state.logourl} alt=""/></div> |
| | | <div className={collapse ? "collapse header-collapse" : "header-collapse"} onClick={this.handleCollapse}> |
| | | <Icon type={collapse ? 'menu-unfold' : 'menu-fold'} /> |
| | | </div> |
| | | {/* 正常菜单 */} |
| | | {this.props.editLevel !== 'level1' && this.state.menulist ? |
| | | <ul className={'header-menu ' + this.props.editLevel}>{ |
| | | this.state.menulist.map(item => { |
| | | return ( |
| | | <li key={item.MenuID} onClick={() => {this.changeMenu(item)}} className={this.props.selectmenu.MenuID === item.MenuID ? 'active' : ''}> |
| | | <li key={item.MenuID} onClick={() => {this.changeMenu(item)}} className={mainMenu && mainMenu.MenuID === item.MenuID ? 'active' : ''}> |
| | | <span>{item.MenuName}</span> |
| | | </li> |
| | | ) |
| | |
| | | {/* 头像、用户名 */} |
| | | <Dropdown className="header-setting" overlay={menu}> |
| | | <div> |
| | | <img src={this.state.avatar} alt=""/> |
| | | <img src={this.state.avatar || avatar} alt=""/> |
| | | <span> |
| | | <span className="username">{this.state.userName}</span> <Icon type="down" /> |
| | | </span> |
| | |
| | | return { |
| | | tabviews: state.tabviews, |
| | | collapse: state.collapse, |
| | | selectmenu: state.selectedMainMenu, |
| | | menuTree: state.menuTree, |
| | | mainMenu: state.mainMenu, |
| | | debug: state.debug, |
| | | editState: state.editState, |
| | | editLevel: state.editLevel, |
| | |
| | | return { |
| | | toggleCollapse: (collapse) => dispatch(toggleCollapse(collapse)), |
| | | modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)), |
| | | modifyMainMenu: (selectmenu) => dispatch(modifyMainMenu(selectmenu)), |
| | | modifyMenuTree: (menuTree) => dispatch(modifyMenuTree(menuTree)), |
| | | modifyMainMenu: (mainMenu) => dispatch(modifyMainMenu(mainMenu)), |
| | | resetEditState: (state) => dispatch(resetEditState(state)), |
| | | resetEditLevel: (level) => dispatch(resetEditLevel(level)), |
| | | initActionPermission: (permAction) => dispatch(initActionPermission(permAction)), |
| | |
| | | |
| | | .header-collapse { |
| | | float: left; |
| | | width: 80px; |
| | | width: 35px; |
| | | line-height: 48px; |
| | | padding-left: 20px; |
| | | padding-left: 10px; |
| | | margin: 0 10px; |
| | | cursor: pointer; |
| | | transition: padding-left 0.15s; |
| | | i { |
| | |
| | | } |
| | | } |
| | | .header-collapse.collapse { |
| | | padding-left: 30px; |
| | | width: 60px; |
| | | padding-left: 20px; |
| | | } |
| | | .header-menu { |
| | | float: left; |
| | |
| | | // 系统菜单 |
| | | export const SySMenuList = { |
| | | systemManageView: [{ |
| | | MenuID: 'systemManageViewConfig', |
| | | text: '配置', |
| | | PageParam: {Icon: 'folder'}, |
| | | children: [{ |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1581067625930haged11ieaivpavv77k', |
| | | MenuNo: 'sDatasM', |
| | | MenuName: '数据字典', |
| | | text: '数据字典' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1581734956310scks442ul2d955g9tu5', |
| | | MenuNo: 'sVersionM', |
| | | MenuName: '传输号管理', |
| | | text: '传输号管理' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1583991994144ndddg0bhh0is6shi0v1', |
| | | MenuNo: 'sVersionQueryM', |
| | | MenuName: '传输号查询', |
| | | text: '传输号查询' |
| | | }, { |
| | | src: '', |
| | | systems: ['production', 'local', 'SSO', 'cloud'], |
| | | PageParam: {OpenType: 'newtab', Template: 'VerupTable'}, |
| | | type: 'VerupTable', |
| | | MenuID: '1583979633842550imkchl4qt4qppsiv', |
| | | MenuNo: 'sVersionMUpgrade', |
| | | MenuName: '版本升级', |
| | | text: '版本升级' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'TabManage'}, |
| | | type: 'TabManage', |
| | | MenuID: 'TabManageView', |
| | | MenuNo: 'TabManage', |
| | | MenuName: '标签页管理', |
| | | text: '标签页管理' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1578900109100np8aqd0a77q3na46oas', |
| | | MenuNo: 'sPrintTemplateM', |
| | | MenuName: '标签打印模板', |
| | | text: '标签打印模板' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '16044812935562g807p3p12huk8kokmb', |
| | | MenuNo: 'sPrintTemplate_webM', |
| | | MenuName: '单据打印模板', |
| | | text: '单据打印模板' |
| | | }, { |
| | | src: '', |
| | | systems: ['SSO', 'cloud'], |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1585192949946f3et2ts8tn82krmumdf', |
| | | MenuNo: 'MyAppManage', |
| | | MenuName: '系统UI', |
| | | text: '系统UI' |
| | | }, { |
| | | src: '', |
| | | systems: ['SSO', 'cloud'], |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '15855615451212m12ip23vpcm79kloro', |
| | | MenuNo: 'sUsersAppM', |
| | | MenuName: '系统用户管理', |
| | | text: '系统用户管理' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ScriptTable'}, |
| | | type: 'ScriptTable', |
| | | MenuID: '1587005717541lov40vg61q7l1rbveon', |
| | | MenuNo: 's_custom_scriptM', |
| | | MenuName: '自定义函数', |
| | | text: '自定义函数' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1590458676585agbbr63t6ihighg2i1g', |
| | | MenuNo: 'LdropdownmenuNewM', |
| | | MenuName: '通用下拉菜单', |
| | | text: '通用下拉菜单' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1602315375262ikd33ii0nii34pt861o', |
| | | MenuNo: 's_worksflow_roleM', |
| | | MenuName: '关键角色管理', |
| | | text: '关键角色管理' |
| | | }] |
| | | export const SySMenuList = [{ |
| | | MenuID: 'systemManageViewConfig', |
| | | MenuName: '配置', |
| | | PageParam: {Icon: 'folder'}, |
| | | children: [{ |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1581067625930haged11ieaivpavv77k', |
| | | MenuNo: 'sDatasM', |
| | | MenuName: '数据字典', |
| | | }, { |
| | | MenuID: 'systemManageViewInterface', |
| | | text: '接口', |
| | | PageParam: {Icon: 'folder'}, |
| | | children: [{ |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1582771068837vsv54a089lgp45migbg', |
| | | MenuNo: 'KUNTitleM', |
| | | MenuName: '接口主数据', |
| | | text: '接口主数据' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1582777675954ifu05upurs465omoth7', |
| | | MenuNo: 'KUNMainM', |
| | | MenuName: '查询接口', |
| | | text: '查询接口' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '158294809668898cklbv6c5bou8e1fpu', |
| | | MenuNo: 'KUNMainMOut_advanced', |
| | | MenuName: '高阶查询', |
| | | text: '高阶查询' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1584676379094iktph45fb8imhg96bql', |
| | | MenuNo: 'KUNMainM_Out_usual', |
| | | MenuName: '通用查询接口', |
| | | text: '通用查询接口' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1584695125339vo5g7iqgfn01qmrd6s2', |
| | | MenuNo: 'KUNMainM_In_usual', |
| | | MenuName: '通用写入接口', |
| | | text: '通用写入接口' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1584699661372vhmpp9dn9foo0eob722', |
| | | MenuNo: 'KUNMainM_In', |
| | | MenuName: '写入接口', |
| | | text: '写入接口' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '15848421131551gg04ie8sitsd3f7467', |
| | | MenuNo: 'KUNOsMainM', |
| | | MenuName: '外部接口', |
| | | text: '外部接口' |
| | | }] |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1581734956310scks442ul2d955g9tu5', |
| | | MenuNo: 'sVersionM', |
| | | MenuName: '传输号管理', |
| | | }, { |
| | | MenuID: 'systemManageViewCommunication', |
| | | text: '通信', |
| | | PageParam: {Icon: 'folder'}, |
| | | children: [{ |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1589782279158ngr675kk3oksin35sul', |
| | | MenuNo: 'bd_msn_emailM', |
| | | MenuName: '邮件服务器', |
| | | text: '邮件服务器' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1589788042787ffdt9hle4s45k9r1nvs', |
| | | MenuNo: 'bd_msn_email_tempM', |
| | | MenuName: '邮件模板', |
| | | text: '邮件模板' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '15900310928174dro07ihfckghpb5h13', |
| | | MenuNo: 'bd_msn_sms_tempM', |
| | | MenuName: '大于短信模板', |
| | | text: '大于短信模板' |
| | | // }, { |
| | | // src: '', |
| | | // PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | // type: 'ManageTable', |
| | | // MenuID: '1599613340050c8nu6rbst9d4emnnbsq', |
| | | // MenuNo: 's_sms_qxM', |
| | | // MenuName: '奇云短信模板', |
| | | // text: '奇云短信模板' |
| | | }] |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1583991994144ndddg0bhh0is6shi0v1', |
| | | MenuNo: 'sVersionQueryM', |
| | | MenuName: '传输号查询', |
| | | }, { |
| | | MenuID: 'systemPayManage', |
| | | text: '支付', |
| | | PageParam: {Icon: 'folder'}, |
| | | children: [{ |
| | | src: '', |
| | | systems: ['local', 'cloud'], |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1594095599055qicg2eb642v5qglhnuo', |
| | | MenuNo: 's_weixin_pay_bdM', |
| | | MenuName: '微信支付', |
| | | text: '微信支付' |
| | | }] |
| | | src: '', |
| | | systems: ['production', 'local', 'SSO', 'cloud'], |
| | | PageParam: {OpenType: 'newtab', Template: 'VerupTable'}, |
| | | type: 'VerupTable', |
| | | MenuID: '1583979633842550imkchl4qt4qppsiv', |
| | | MenuNo: 'sVersionMUpgrade', |
| | | MenuName: '版本升级', |
| | | }, { |
| | | MenuID: 'systemManageViewParam', |
| | | text: '系统参数', |
| | | PageParam: {Icon: 'folder'}, |
| | | children: [{ |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1577972969199lei1g0qkvlh4tkc908m', |
| | | MenuNo: 'sModularM', |
| | | MenuName: '系统模块', |
| | | text: '系统模块' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1578479100252lfbp29v1kafk4s4q4ig', |
| | | MenuNo: 'BDLanguagePacksM', |
| | | MenuName: '语言包', |
| | | text: '语言包' |
| | | }, { |
| | | src: '', |
| | | systems: ['production', 'local', 'SSO', 'cloud'], |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1577971621421tg4v0i1ur8873k7e0ob', |
| | | MenuNo: 'sSystemParametersM', |
| | | MenuName: '接口地址', |
| | | text: '接口地址' |
| | | }, { |
| | | src: '', |
| | | systems: ['production', 'local', 'SSO', 'cloud'], |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1577929944419lgc5h3hepum765e2k7u', |
| | | MenuNo: 'sProcExcepM', |
| | | MenuName: '报错日志', |
| | | text: '报错日志' |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1588493493409k9guqp067d31lu7blsv', |
| | | MenuNo: 's_job_stepM', |
| | | MenuName: '计划任务', |
| | | text: '计划任务' |
| | | }] |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'TabManage'}, |
| | | type: 'TabManage', |
| | | MenuID: 'TabManageView', |
| | | MenuNo: 'TabManage', |
| | | MenuName: '标签页管理', |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1578900109100np8aqd0a77q3na46oas', |
| | | MenuNo: 'sPrintTemplateM', |
| | | MenuName: '标签打印模板', |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '16044812935562g807p3p12huk8kokmb', |
| | | MenuNo: 'sPrintTemplate_webM', |
| | | MenuName: '单据打印模板', |
| | | }, { |
| | | src: '', |
| | | systems: ['SSO', 'cloud'], |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1585192949946f3et2ts8tn82krmumdf', |
| | | MenuNo: 'MyAppManage', |
| | | MenuName: '系统UI', |
| | | }, { |
| | | src: '', |
| | | systems: ['SSO', 'cloud'], |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '15855615451212m12ip23vpcm79kloro', |
| | | MenuNo: 'sUsersAppM', |
| | | MenuName: '系统用户管理', |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ScriptTable'}, |
| | | type: 'ScriptTable', |
| | | MenuID: '1587005717541lov40vg61q7l1rbveon', |
| | | MenuNo: 's_custom_scriptM', |
| | | MenuName: '自定义函数', |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1590458676585agbbr63t6ihighg2i1g', |
| | | MenuNo: 'LdropdownmenuNewM', |
| | | MenuName: '通用下拉菜单', |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1602315375262ikd33ii0nii34pt861o', |
| | | MenuNo: 's_worksflow_roleM', |
| | | MenuName: '关键角色管理', |
| | | }] |
| | | } |
| | | }, { |
| | | MenuID: 'systemManageViewInterface', |
| | | MenuName: '接口', |
| | | PageParam: {Icon: 'folder'}, |
| | | children: [{ |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1582771068837vsv54a089lgp45migbg', |
| | | MenuNo: 'KUNTitleM', |
| | | MenuName: '接口主数据', |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1582777675954ifu05upurs465omoth7', |
| | | MenuNo: 'KUNMainM', |
| | | MenuName: '查询接口', |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '158294809668898cklbv6c5bou8e1fpu', |
| | | MenuNo: 'KUNMainMOut_advanced', |
| | | MenuName: '高阶查询', |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1584676379094iktph45fb8imhg96bql', |
| | | MenuNo: 'KUNMainM_Out_usual', |
| | | MenuName: '通用查询接口', |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1584695125339vo5g7iqgfn01qmrd6s2', |
| | | MenuNo: 'KUNMainM_In_usual', |
| | | MenuName: '通用写入接口', |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1584699661372vhmpp9dn9foo0eob722', |
| | | MenuNo: 'KUNMainM_In', |
| | | MenuName: '写入接口', |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '15848421131551gg04ie8sitsd3f7467', |
| | | MenuNo: 'KUNOsMainM', |
| | | MenuName: '外部接口', |
| | | }] |
| | | }, { |
| | | MenuID: 'systemManageViewCommunication', |
| | | MenuName: '通信', |
| | | PageParam: {Icon: 'folder'}, |
| | | children: [{ |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1589782279158ngr675kk3oksin35sul', |
| | | MenuNo: 'bd_msn_emailM', |
| | | MenuName: '邮件服务器', |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1589788042787ffdt9hle4s45k9r1nvs', |
| | | MenuNo: 'bd_msn_email_tempM', |
| | | MenuName: '邮件模板', |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '15900310928174dro07ihfckghpb5h13', |
| | | MenuNo: 'bd_msn_sms_tempM', |
| | | MenuName: '大于短信模板', |
| | | // }, { |
| | | // src: '', |
| | | // PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | // type: 'ManageTable', |
| | | // MenuID: '1599613340050c8nu6rbst9d4emnnbsq', |
| | | // MenuNo: 's_sms_qxM', |
| | | // MenuName: '奇云短信模板', |
| | | }] |
| | | }, { |
| | | MenuID: 'systemPayManage', |
| | | MenuName: '支付', |
| | | PageParam: {Icon: 'folder'}, |
| | | children: [{ |
| | | src: '', |
| | | systems: ['local', 'cloud'], |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1594095599055qicg2eb642v5qglhnuo', |
| | | MenuNo: 's_weixin_pay_bdM', |
| | | MenuName: '微信支付', |
| | | }] |
| | | }, { |
| | | MenuID: 'systemManageViewParam', |
| | | MenuName: '系统参数', |
| | | PageParam: {Icon: 'folder'}, |
| | | children: [{ |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1577972969199lei1g0qkvlh4tkc908m', |
| | | MenuNo: 'sModularM', |
| | | MenuName: '系统模块', |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1578479100252lfbp29v1kafk4s4q4ig', |
| | | MenuNo: 'BDLanguagePacksM', |
| | | MenuName: '语言包', |
| | | }, { |
| | | src: '', |
| | | systems: ['production', 'local', 'SSO', 'cloud'], |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1577971621421tg4v0i1ur8873k7e0ob', |
| | | MenuNo: 'sSystemParametersM', |
| | | MenuName: '接口地址', |
| | | }, { |
| | | src: '', |
| | | systems: ['production', 'local', 'SSO', 'cloud'], |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1577929944419lgc5h3hepum765e2k7u', |
| | | MenuNo: 'sProcExcepM', |
| | | MenuName: '报错日志', |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1588493493409k9guqp067d31lu7blsv', |
| | | MenuNo: 's_job_stepM', |
| | | MenuName: '计划任务', |
| | | }] |
| | | }] |
| | |
| | | import { Menu, Icon, notification } from 'antd' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import { modifyTabview, resetEditLevel } from '@/store/action' |
| | | import { modifyTabview, resetEditLevel, modifyMenuTree, modifyMainMenu } from '@/store/action' |
| | | import { SySMenuList } from './config' |
| | | import options from '@/store/options.js' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | |
| | | |
| | | class Sidemenu extends Component { |
| | | static propTypes = { |
| | | collapse: PropTypes.bool, |
| | | mainMenu: PropTypes.oneOfType([ |
| | | PropTypes.string, |
| | | PropTypes.object |
| | | ]) |
| | | collapse: PropTypes.bool |
| | | } |
| | | |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | mainMenuList: null, // 一级菜单,编辑调整上级菜单时获取 |
| | | subMenulist: [], // 二级菜单 |
| | | editMenu: null, // 编辑三级菜单时设置 |
| | | rootSubmenuKeys: null, |
| | |
| | | return |
| | | } |
| | | |
| | | let _param = {func: 'sPC_Get_FunMenu', ParentID: menu.MenuID, systemType: options.sysType} |
| | | menu = fromJS(menu).toJS() |
| | | let openKey = '' |
| | | |
| | | if (sessionStorage.getItem('isEditState') === 'true') { // 编辑状态时,获取菜单,增加参数debug |
| | | _param.debug = 'Y' |
| | | if (menu.children[0]) { |
| | | openKey = menu.openId || menu.children[0].MenuID |
| | | } |
| | | |
| | | let result = await Api.getSystemConfig(_param) |
| | | if (result.status) { |
| | | if (this.props.editState && this.props.editLevel === 'HS') return |
| | | |
| | | if (result.data.length === 0) { // 查询菜单为空 |
| | | this.setState({ |
| | | subMenulist: [], |
| | | rootSubmenuKeys: [], |
| | | openKeys: [] |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let SubMenuId = sessionStorage.getItem('SubMenu') // 是否为打开新页面 |
| | | let ThirdMenuId = sessionStorage.getItem('ThirdMenu') // 是否为打开新页面 |
| | | let submenuId = '' // 展开二级菜单ID |
| | | let tabId = '' // 打开的tab页id |
| | | let msg = { |
| | | UserID: sessionStorage.getItem('UserID'), |
| | | LoginUID: sessionStorage.getItem('LoginUID'), |
| | | User_Name: sessionStorage.getItem('User_Name'), |
| | | Full_Name: sessionStorage.getItem('Full_Name'), |
| | | Member_Level: sessionStorage.getItem('Member_Level'), |
| | | dataM: sessionStorage.getItem('dataM'), |
| | | avatar: sessionStorage.getItem('avatar'), |
| | | debug: sessionStorage.getItem('debug'), |
| | | role_id: sessionStorage.getItem('role_id'), |
| | | mainlogo: window.GLOB.mainlogo, |
| | | mstyle: window.GLOB.style, |
| | | MainMenu: menu.MenuID |
| | | } |
| | | |
| | | if (SubMenuId && ThirdMenuId) { |
| | | submenuId = SubMenuId |
| | | let submenu = result.data.filter(item => item.ParentID === SubMenuId)[0] |
| | | |
| | | if (!submenu) { |
| | | submenuId = '' |
| | | } else { |
| | | tabId = ThirdMenuId |
| | | let tabmenu = submenu.FunMenu.filter(item => item.MenuID === ThirdMenuId)[0] |
| | | if (!tabmenu) { |
| | | submenuId = '' |
| | | tabId = '' |
| | | } |
| | | } |
| | | sessionStorage.removeItem('SubMenu') |
| | | sessionStorage.removeItem('ThirdMenu') |
| | | } |
| | | let parentID = submenuId ? submenuId : result.data[0].ParentID // 展开二级菜单ID |
| | | |
| | | let iframes = ['Main/Index', 'bda/rdt', 'Home/rdt'] |
| | | |
| | | let menulist = result.data.map(item => { |
| | | let _smenu = {} |
| | | _smenu.id = item.ParentID |
| | | _smenu.MenuID = item.ParentID |
| | | _smenu.text = item.MenuNameP |
| | | |
| | | try { |
| | | _smenu.PageParam = JSON.parse(item.PageParamP) |
| | | } catch (e) { |
| | | _smenu.PageParam = {Icon: 'folder'} |
| | | } |
| | | |
| | | if (item.FunMenu) { |
| | | _smenu.children = item.FunMenu.map(child => { |
| | | let _tmenu = { |
| | | ParentId: item.ParentID, |
| | | OpenType: 'newtab' |
| | | } |
| | | |
| | | if (child.LinkUrl === 'CommonTable') { |
| | | _tmenu.type = 'CommonTable' |
| | | } else if (iframes.includes(child.LinkUrl.split('?')[0])) { |
| | | _tmenu.type = 'iframe' |
| | | _tmenu.forbidden = true |
| | | } |
| | | |
| | | if (_tmenu.type !== 'iframe') { |
| | | try { |
| | | _tmenu.PageParam = JSON.parse(child.PageParam) |
| | | } catch (e) { |
| | | _tmenu.PageParam = {OpenType: 'newtab'} |
| | | } |
| | | _tmenu.type = _tmenu.PageParam.Template || _tmenu.type |
| | | _tmenu.OpenType = _tmenu.PageParam.OpenType |
| | | } |
| | | |
| | | if (_tmenu.type === 'NewPage') { |
| | | _tmenu.src = _tmenu.PageParam.url |
| | | if (this.props.memberLevel < 20) { // 会员等级大于等于20时,有编辑权限 |
| | | _tmenu.forbidden = true |
| | | } |
| | | if (_tmenu.src.indexOf('paramsmain/') > -1) { |
| | | try { |
| | | let _url = _tmenu.src.split('paramsmain/')[0] + 'paramsmain/' |
| | | let _param = JSON.parse(window.decodeURIComponent(window.atob(_tmenu.src.split('paramsmain/')[1]))) |
| | | _param.UserID = sessionStorage.getItem('UserID') |
| | | _param.LoginUID = sessionStorage.getItem('LoginUID') |
| | | _param.User_Name = sessionStorage.getItem('User_Name') |
| | | _tmenu.src = _url + window.btoa(window.encodeURIComponent(JSON.stringify(_param))) |
| | | } catch { |
| | | console.warn('菜单参数解析错误!') |
| | | } |
| | | } |
| | | } else { |
| | | // 打开新页面链接 |
| | | _tmenu.src = '#/paramsmain/' + window.btoa(window.encodeURIComponent(JSON.stringify({ |
| | | ...msg, |
| | | SubMenu: _smenu.MenuID, |
| | | ThirdMenu: child.MenuID |
| | | }))) |
| | | } |
| | | |
| | | _tmenu.id = child.MenuID |
| | | _tmenu.MenuID = child.MenuID |
| | | _tmenu.MenuNo = child.MenuNo |
| | | _tmenu.MenuName = child.MenuName |
| | | _tmenu.text = child.MenuName |
| | | return _tmenu |
| | | }) |
| | | } |
| | | return _smenu |
| | | }) |
| | | |
| | | this.setState({ |
| | | subMenulist: menulist, |
| | | rootSubmenuKeys: result.data.map(item => item.ParentID), |
| | | openKeys: this.props.collapse ? [] : [parentID], |
| | | editMenu: this.props.editLevel === 'level3' && menulist.filter(menu => menu.MenuID === this.state.editMenu.MenuID)[0] |
| | | }) |
| | | if (tabId) { |
| | | let _menu = menulist.filter(menu => menu.MenuID === submenuId)[0] |
| | | let opentab = _menu && _menu.children.filter(tab => tab.MenuID === tabId)[0] |
| | | if (opentab) { |
| | | if (sessionStorage.getItem('MenuParam')) { |
| | | try { |
| | | let thParam = JSON.parse(sessionStorage.getItem('MenuParam')) |
| | | |
| | | if (tabId === thParam.ThirdMenu) { |
| | | delete thParam.ThirdMenu |
| | | opentab.param = thParam |
| | | } |
| | | } catch { |
| | | console.warn('菜单参数解析错误!') |
| | | } |
| | | sessionStorage.removeItem('MenuParam') |
| | | } |
| | | |
| | | opentab.selected = true |
| | | let home = this.props.tabviews[0] |
| | | home.selected = false |
| | | this.props.modifyTabview([home, opentab]) |
| | | } |
| | | } |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | this.setState({ |
| | | subMenulist: menu.children, |
| | | rootSubmenuKeys: menu.children.map(item => item.MenuID), |
| | | openKeys: this.props.collapse ? [] : [openKey], |
| | | editMenu: this.props.editLevel === 'level3' ? menu.children.filter(_menu => _menu.MenuID === this.state.editMenu.MenuID)[0] : null |
| | | }) |
| | | } |
| | | |
| | | enterManageView = (type) => { |
| | | let menulist = SySMenuList[type] |
| | | enterManageView = () => { |
| | | let menulist = SySMenuList |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | | menulist.forEach(menu => { |
| | |
| | | |
| | | let menu = JSON.parse(e.target.dataset.item) |
| | | |
| | | if (menu.OpenType === 'newpage') { |
| | | e.preventDefault() |
| | | window.open(menu.src) |
| | | } else if (menu.OpenType === 'NewPage') { |
| | | if (menu.OpenType === 'newpage' || menu.OpenType === 'NewPage') { |
| | | e.preventDefault() |
| | | window.open(menu.src) |
| | | } else if (menu.OpenType === 'blank') { |
| | |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (!is(fromJS(this.props.mainMenu), fromJS(nextProps.mainMenu)) && nextProps.mainMenu && nextProps.mainMenu.MenuID === 'systemManageView') { |
| | | this.enterManageView(nextProps.mainMenu.MenuID) |
| | | this.enterManageView() |
| | | } else if (!is(fromJS(this.props.mainMenu), fromJS(nextProps.mainMenu))) { |
| | | // 主菜单切换,请求2、3级菜单数据 |
| | | this.loadsubmenu(nextProps.mainMenu) |
| | |
| | | // 编辑二级菜单 |
| | | e.stopPropagation() |
| | | this.props.resetEditLevel('level2') |
| | | // 获取一级菜单列表 |
| | | Api.getSystemConfig({func: 'sPC_Get_MainMenu', debug: 'Y'}).then(res => { |
| | | this.setState({ |
| | | mainMenuList: res.data.map(item => { |
| | | return { |
| | | MenuID: item.MenuID, |
| | | text: item.MenuName |
| | | } |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | enterThrEdit = (e, menu) => { |
| | |
| | | } |
| | | |
| | | reload = () => { |
| | | this.loadsubmenu(this.props.mainMenu) |
| | | const { mainMenu } = this.props |
| | | let _param = {func: 's_get_pc_menus', systemType: options.sysType, debug: 'Y'} |
| | | if (options.sysType !== 'cloud' && window.GLOB.systemType !== 'production') { |
| | | _param.linkurl = window.GLOB.linkurl |
| | | } |
| | | _param.pro_sys = window.GLOB.systemType === 'production' ? 'Y' : '' |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | // 登录超时 |
| | | if (!result) return |
| | | |
| | | if (result.status) { |
| | | let res = this.getMenulist(result) |
| | | let _mainMenu = res.menulist.filter(item => item.MenuID === mainMenu.MenuID)[0] |
| | | |
| | | this.props.modifyMenuTree(res.menulist) |
| | | this.props.modifyMainMenu(_mainMenu || null) |
| | | } else { |
| | | notification.error({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | this.loadsubmenu(this.props.mainMenu) |
| | | }) |
| | | } |
| | | |
| | | getMenulist = (result) => { |
| | | let iframes = ['Main/Index', 'bda/rdt', 'Home/rdt'] |
| | | let menulist = result.fst_menu.map(fst => { |
| | | let fstItem = { |
| | | MenuID: fst.MenuID, |
| | | MenuName: fst.MenuName, |
| | | PageParam: {OpenType: 'menu', linkUrl: ''}, |
| | | children: [] |
| | | } |
| | | if (fst.PageParam) { |
| | | try { |
| | | fstItem.PageParam = JSON.parse(fst.PageParam) |
| | | } catch (e) { |
| | | fstItem.PageParam = {OpenType: 'menu', linkUrl: ''} |
| | | } |
| | | } |
| | | |
| | | if (fst.snd_menu) { |
| | | fstItem.children = fst.snd_menu.map(snd => { |
| | | let sndItem = { |
| | | ParentId: fst.MenuID, |
| | | MenuID: snd.MenuID, |
| | | MenuName: snd.MenuName, |
| | | PageParam: {Icon: 'folder'}, |
| | | children: [] |
| | | } |
| | | |
| | | if (snd.PageParam) { |
| | | try { |
| | | sndItem.PageParam = JSON.parse(snd.PageParam) |
| | | } catch (e) { |
| | | sndItem.PageParam = {Icon: 'folder'} |
| | | } |
| | | } |
| | | |
| | | if (snd.trd_menu) { |
| | | sndItem.children = snd.trd_menu.map(trd => { |
| | | let trdItem = { |
| | | FstId: fst.MenuID, |
| | | ParentId: snd.MenuID, |
| | | MenuID: trd.MenuID, |
| | | MenuName: trd.MenuName, |
| | | MenuNo: trd.MenuNo, |
| | | EasyCode: trd.EasyCode, |
| | | type: 'CommonTable', // 默认值为常用表 |
| | | OpenType: 'newtab' // 打开方式 |
| | | } |
| | | |
| | | if (trd.LinkUrl && iframes.includes(trd.LinkUrl.split('?')[0])) { |
| | | trdItem.type = 'iframe' |
| | | trdItem.LinkUrl = trd.LinkUrl |
| | | trdItem.forbidden = true |
| | | } else { |
| | | try { |
| | | trdItem.PageParam = trd.PageParam ? JSON.parse(trd.PageParam) : {OpenType: 'newtab'} |
| | | } catch (e) { |
| | | trdItem.PageParam = {OpenType: 'newtab'} |
| | | } |
| | | |
| | | trdItem.type = trdItem.PageParam.Template || trdItem.type |
| | | trdItem.OpenType = trdItem.PageParam.OpenType || trdItem.OpenType |
| | | |
| | | if (trdItem.type === 'CustomPage' && this.props.memberLevel < 20) { // 会员等级大于等于20时,有编辑权限 |
| | | trdItem.forbidden = true |
| | | } |
| | | } |
| | | |
| | | return trdItem |
| | | }) |
| | | } |
| | | |
| | | return sndItem |
| | | }) |
| | | } |
| | | |
| | | return fstItem |
| | | }) |
| | | |
| | | return { menulist } |
| | | } |
| | | |
| | | exitEdit = () => { |
| | |
| | | title={ |
| | | <span className={editShow && index === 0 ? 'edit-control' : ''}> |
| | | <Icon type={item.PageParam.Icon} /> |
| | | <span>{item.text}</span> |
| | | <span>{item.MenuName}</span> |
| | | </span> |
| | | } |
| | | > |
| | |
| | | {item.children.map(cell => { |
| | | return ( |
| | | <Menu.Item key={cell.MenuID}> |
| | | <a href={cell.src} id={cell.MenuID} data-item={JSON.stringify(cell)} onClick={this.changemenu.bind(this)}>{cell.text}</a> |
| | | <a href={cell.src} id={cell.MenuID} data-item={JSON.stringify(cell)} onClick={this.changemenu.bind(this)}>{cell.MenuName}</a> |
| | | </Menu.Item> |
| | | ) |
| | | })} |
| | |
| | | {this.props.editLevel === 'level2' ? |
| | | <EditSecMenu |
| | | menulist={this.state.subMenulist} |
| | | supMenuList={this.state.mainMenuList} |
| | | menuTree={this.props.menuTree} |
| | | supMenu={this.props.mainMenu} |
| | | reload={this.reload} |
| | | exitEdit={this.exitEdit} |
| | | /> : null |
| | | } |
| | | {this.props.editLevel === 'level3' && this.state.subMenulist && this.state.editMenu ? |
| | | {this.props.editLevel === 'level3' && this.state.editMenu ? |
| | | <EditThdMenu |
| | | menulist={this.state.editMenu.children} |
| | | supMenuList={this.state.subMenulist} |
| | |
| | | tabviews: state.tabviews, |
| | | collapse: state.collapse, |
| | | isiframe: state.isiframe, |
| | | mainMenu: state.selectedMainMenu, |
| | | mainMenu: state.mainMenu, |
| | | menuTree: state.menuTree, |
| | | memberLevel: state.memberLevel, |
| | | editState: state.editState, |
| | | editLevel: state.editLevel |
| | |
| | | |
| | | const mapDispatchToProps = (dispatch) => { |
| | | return { |
| | | modifyMenuTree: (menuTree) => dispatch(modifyMenuTree(menuTree)), |
| | | modifyMainMenu: (mainMenu) => dispatch(modifyMainMenu(mainMenu)), |
| | | modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)), |
| | | resetEditLevel: (level) => dispatch(resetEditLevel(level)) |
| | | } |
| | |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber, Cascader } from 'antd' |
| | | import { btnIcons, btnCustomClasses, formRule } from '@/utils/option.js' |
| | | |
| | | import Api from '@/api' |
| | | import options from '@/store/options.js' |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | |
| | | _options.push('execMode', 'intertype', 'innerFunc', 'Ot', 'execSuccess', 'execError') |
| | | } |
| | | } |
| | | } else { |
| | | } else if (_opentype === 'popview' && _opentype === 'tab') { |
| | | if (_intertype === 'outer') { |
| | | _options.push('innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc') |
| | | } else if (_intertype === 'inner') { |
| | |
| | | })( |
| | | <Cascader |
| | | options={this.state.menulist} |
| | | loadData={this.loadData} |
| | | placeholder="" |
| | | /> |
| | | )} |
| | |
| | | } |
| | | }) |
| | | return fields |
| | | } |
| | | |
| | | loadData = selectedOptions => { |
| | | const { MenuID } = this.props |
| | | const targetOption = selectedOptions[selectedOptions.length - 1] |
| | | targetOption.loading = true |
| | | |
| | | let _param = { |
| | | func: 'sPC_Get_FunMenu', |
| | | ParentID: targetOption.value, |
| | | systemType: options.sysType, |
| | | debug: 'Y' |
| | | } |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | if (result.status) { |
| | | targetOption.loading = false |
| | | targetOption.children = result.data.map(item => { |
| | | let submenu = { |
| | | value: item.ParentID, |
| | | label: item.MenuNameP, |
| | | children: item.FunMenu.map(cell => { |
| | | return { |
| | | value: cell.MenuID, |
| | | label: cell.MenuName, |
| | | MenuID: cell.MenuID, |
| | | MenuName: cell.MenuName, |
| | | MenuNo: cell.MenuNo, |
| | | Ot: cell.Ot, |
| | | PageParam: cell.PageParam, |
| | | LinkUrl: cell.LinkUrl, |
| | | disabled: cell.MenuID === MenuID |
| | | } |
| | | }) |
| | | } |
| | | |
| | | return submenu |
| | | }) |
| | | |
| | | this.setState({ |
| | | menulist: [...this.state.menulist] |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | targetOption.loading = false |
| | | } |
| | | }) |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { Modal, notification, Button } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import options from '@/store/options.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import DevUtils from '@/utils/devutils.js' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | |
| | | </div> |
| | | |
| | | let menulist = [] |
| | | |
| | | if (menu.fstMenuList) { |
| | | menulist = menu.fstMenuList.map(item => { |
| | | return { |
| | | value: item.MenuID, |
| | | label: item.text, |
| | | isLeaf: false |
| | | } |
| | | let trees = fromJS(menu.fstMenuList).toJS() |
| | | |
| | | menulist = trees.map(fst => { |
| | | fst.value = fst.MenuID |
| | | fst.label = fst.MenuName |
| | | fst.isLeaf = false |
| | | fst.children = fst.children.map(snd => { |
| | | snd.value = snd.MenuID |
| | | snd.label = snd.MenuName |
| | | |
| | | snd.children = snd.children.map(thd => { |
| | | thd.value = thd.MenuID |
| | | thd.label = thd.MenuName |
| | | thd.disabled = thd.MenuID === menu.MenuID |
| | | return thd |
| | | }) |
| | | return snd |
| | | }) |
| | | return fst |
| | | }) |
| | | } |
| | | |
| | | let modules = this.getModules(menu.components, config.uuid) |
| | | |
| | | if (menu.fstMenuList && card.linkmenu && card.linkmenu.length > 0) { |
| | | let _param = { |
| | | func: 'sPC_Get_FunMenu', |
| | | ParentID: card.linkmenu[0], |
| | | systemType: options.sysType, |
| | | debug: 'Y' |
| | | } |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | if (result.status) { |
| | | menulist = menulist.map(item => { |
| | | if (item.value === card.linkmenu[0]) { |
| | | item.children = result.data.map(item => { |
| | | let submenu = { |
| | | value: item.ParentID, |
| | | label: item.MenuNameP, |
| | | children: item.FunMenu.map(cell => { |
| | | return { |
| | | value: cell.MenuID, |
| | | label: cell.MenuName, |
| | | MenuID: cell.MenuID, |
| | | MenuName: cell.MenuName, |
| | | MenuNo: cell.MenuNo, |
| | | Ot: cell.Ot, |
| | | PageParam: cell.PageParam, |
| | | LinkUrl: cell.LinkUrl, |
| | | disabled: cell.MenuID === menu.MenuID |
| | | } |
| | | }) |
| | | } |
| | | |
| | | return submenu |
| | | }) |
| | | } |
| | | return item |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | card: card, |
| | | formlist: getActionForm(card, functip, config.setting, menu.permFuncField, this.props.type, menulist, modules) |
| | | }) |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | visible: true, |
| | | card: card, |
| | | formlist: getActionForm(card, functip, config.setting, menu.permFuncField, this.props.type, menulist, modules) |
| | | }) |
| | | } |
| | | this.setState({ |
| | | visible: true, |
| | | card: card, |
| | | formlist: getActionForm(card, functip, config.setting, menu.permFuncField, this.props.type, menulist, modules) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import {connect} from 'react-redux' |
| | | import { Modal, Button, notification } from 'antd' |
| | | import { Modal, Button } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import options from '@/store/options.js' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | |
| | | let menulist = [] |
| | | if (menu.fstMenuList) { |
| | | menulist = menu.fstMenuList.map(item => { |
| | | return { |
| | | value: item.MenuID, |
| | | label: item.text, |
| | | isLeaf: false |
| | | } |
| | | let trees = fromJS(menu.fstMenuList).toJS() |
| | | |
| | | menulist = trees.map(fst => { |
| | | fst.value = fst.MenuID |
| | | fst.label = fst.MenuName |
| | | fst.isLeaf = false |
| | | fst.children = fst.children.map(snd => { |
| | | snd.value = snd.MenuID |
| | | snd.label = snd.MenuName |
| | | |
| | | snd.children = snd.children.map(thd => { |
| | | thd.value = thd.MenuID |
| | | thd.label = thd.MenuName |
| | | thd.disabled = thd.MenuID === menu.MenuID |
| | | return thd |
| | | }) |
| | | return snd |
| | | }) |
| | | return fst |
| | | }) |
| | | } |
| | | |
| | | let modules = this.getModules(menu.components, cards.uuid) |
| | | |
| | | if (menu.fstMenuList && card.linkmenu && card.linkmenu.length > 0) { |
| | | let _param = { |
| | | func: 'sPC_Get_FunMenu', |
| | | ParentID: card.linkmenu[0], |
| | | systemType: options.sysType, |
| | | debug: 'Y' |
| | | } |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | if (result.status) { |
| | | menulist = menulist.map(item => { |
| | | if (item.value === card.linkmenu[0]) { |
| | | item.children = result.data.map(item => { |
| | | let submenu = { |
| | | value: item.ParentID, |
| | | label: item.MenuNameP, |
| | | children: item.FunMenu.map(cell => { |
| | | return { |
| | | value: cell.MenuID, |
| | | label: cell.MenuName, |
| | | MenuID: cell.MenuID, |
| | | MenuName: cell.MenuName, |
| | | MenuNo: cell.MenuNo, |
| | | Ot: cell.Ot, |
| | | PageParam: cell.PageParam, |
| | | LinkUrl: cell.LinkUrl, |
| | | disabled: cell.MenuID === menu.MenuID |
| | | } |
| | | }) |
| | | } |
| | | |
| | | return submenu |
| | | }) |
| | | } |
| | | return item |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | actvisible: true, |
| | | card: card, |
| | | formlist: getActionForm(card, functip, cards.setting, menu.permFuncField, 'card', menulist, modules) |
| | | }) |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | actvisible: true, |
| | | card: card, |
| | | formlist: getActionForm(card, functip, cards.setting, menu.permFuncField, 'card', menulist, modules) |
| | | }) |
| | | } |
| | | this.setState({ |
| | | actvisible: true, |
| | | card: card, |
| | | formlist: getActionForm(card, functip, cards.setting, menu.permFuncField, 'card', menulist, modules) |
| | | }) |
| | | } |
| | | |
| | | getModules = (components, selfId) => { |
| | |
| | | </Col> : null} |
| | | {MenuType !== 'billPrint' && config.subtype !== 'tablecard' ? <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="选择卡片切换时,可向其他组件传递主键值。"> |
| | | <Tooltip placement="topLeft" title="卡片点击时,是否向其他组件传递主键值。"> |
| | | <Icon type="question-circle" /> |
| | | 是否切换 |
| | | 传递主键 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('switch', { |
| | |
| | | // 初始化菜单信息 |
| | | export const MODIFY_MENUTREE = 'MODIFY_MENUTREE' |
| | | |
| | | // 切换主菜单 |
| | | export const MODIFY_MAINMENU = 'MODIFY_MAINMENU' |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | // 初始化菜单信息 |
| | | export const modifyMenuTree = (menuTree) => { |
| | | return { |
| | | type: user.MODIFY_MENUTREE, |
| | | menuTree |
| | | } |
| | | } |
| | | |
| | | // 切换主菜单 |
| | | export const modifyMainMenu = (selectedMainMenu) => { |
| | | export const modifyMainMenu = (mainMenu) => { |
| | | return { |
| | | type: user.MODIFY_MAINMENU, |
| | | selectedMainMenu |
| | | mainMenu |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | let defaultState = { |
| | | selectedMainMenu: '', // 已选主菜单 |
| | | menuTree: null, // 菜单结构树 |
| | | mainMenu: null, // 已选主菜单 |
| | | tabviews: [], // 导航栏 |
| | | collapse: _collapse, // 是否收起侧边栏导航 |
| | | isiframe: false, // 是否为iframe窗口 |
| | |
| | | ...state, |
| | | collapse: action.collapse |
| | | } |
| | | case Type.MODIFY_MENUTREE: |
| | | // 初始化菜单信息 |
| | | return { |
| | | ...state, |
| | | menuTree: action.menuTree |
| | | } |
| | | case Type.MODIFY_MAINMENU: |
| | | // 切换主菜单 |
| | | return { |
| | | ...state, |
| | | selectedMainMenu: action.selectedMainMenu |
| | | mainMenu: action.mainMenu |
| | | } |
| | | case Type.MODIFY_TABVIEW: |
| | | // tab页改变 |
| | |
| | | return { |
| | | ...state, |
| | | ...{ |
| | | selectedMainMenu: '', |
| | | mainMenu: null, |
| | | tabviews: [], |
| | | collapse: false, |
| | | isiframe: false |
| | |
| | | } |
| | | case Type.RESET_EDITSTATE: |
| | | // 重置编辑状态 |
| | | if (action.editState) { |
| | | state.tabviews = [] |
| | | } else { |
| | | state.tabviews = [{ |
| | | MenuID: 'home_page_id', |
| | | MenuName: '首页', |
| | | selected: true, |
| | | type: 'Home' |
| | | }] |
| | | } |
| | | return { |
| | | ...state, |
| | | tabviews: [], |
| | | editState: action.editState, |
| | | collapse: false |
| | | } |
| | |
| | | // 重置编辑级别 |
| | | return { |
| | | ...state, |
| | | editState: true, |
| | | editLevel: action.editLevel |
| | | } |
| | | case Type.INIT_ROLESPERMISSION: |
| | |
| | | } |
| | | case Type.LOGOUT: |
| | | return { |
| | | selectedMainMenu: '', |
| | | menuTree: null, |
| | | mainMenu: null, |
| | | tabviews: [], |
| | | collapse: localStorage.getItem('collapse') === 'true', |
| | | isiframe: false, |
| | |
| | | val = '' + val |
| | | } |
| | | |
| | | if (card.format === 'thdSeparator') { |
| | | if (card.format === 'percent') { |
| | | val = val + '%' |
| | | } else if (card.format === 'thdSeparator') { |
| | | val = val.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') |
| | | } |
| | | } |
| | |
| | | loadmaindata = (params) => { |
| | | const { config } = this.props |
| | | let LText_field = [] |
| | | let diffUser = false |
| | | let LText = params.map((item, index) => { |
| | | let _sql = item.sql |
| | | let _script = item.script |
| | | |
| | | if (index === 0) { |
| | |
| | | ${_script} |
| | | ` |
| | | } |
| | | if (!diffUser && (/@userid@/ig.test(item.sql) || /@userid@/ig.test(_script))) { |
| | | diffUser = true |
| | | } |
| | | |
| | | item.columns.forEach(cell => { |
| | | LText_field.push(`Select '${item.name}' as tablename,'${cell.field}' as fieldname,'${cell.datatype}' as field_type`) |
| | | }) |
| | | return `Select '${item.name}' as tablename,'${window.btoa(window.encodeURIComponent(_sql))}' as LText,'${window.btoa(window.encodeURIComponent(_script))}' as Lcustomize,'${item.type}' as table_type,'${item.primaryKey}' as primary_key,'${item.par_tablename}' as par_tablename,'${item.foreign_key}' as foreign_key,'${index}' as Sort` |
| | | return `Select '${item.name}' as tablename,'${window.btoa(window.encodeURIComponent(item.sql))}' as LText,'${window.btoa(window.encodeURIComponent(_script))}' as Lcustomize,'${item.type}' as table_type,'${item.primaryKey}' as primary_key,'${item.par_tablename}' as par_tablename,'${item.foreign_key}' as foreign_key,'${index}' as Sort` |
| | | }) |
| | | |
| | | let param = { |
| | |
| | | if (config.cacheUseful === 'true') { |
| | | param.time_type = config.timeUnit |
| | | param.time_limit = config.cacheTime |
| | | if (config.diffUser) { |
| | | if (diffUser) { |
| | | param.userid = sessionStorage.getItem('UserID') |
| | | } |
| | | param.data_md5 = md5(JSON.stringify(param)) |
| | |
| | | |
| | | // 数据缓存设置 |
| | | if (config.cacheUseful === 'true') { |
| | | config.diffUser = config.diffUser !== 'false' |
| | | if (!['day', 'hour'].includes(config.timeUnit)) { |
| | | config.timeUnit = 'day' |
| | | } |
| | |
| | | inherit.cacheUseful = config.cacheUseful |
| | | inherit.timeUnit = config.timeUnit |
| | | inherit.cacheTime = config.cacheTime |
| | | inherit.diffUser = config.diffUser |
| | | } |
| | | |
| | | config.components = this.formatSetting(config.components, params, mainSearch, permAction, inherit) |
| | |
| | | loadmaindata = (params) => { |
| | | const { config } = this.state |
| | | let LText_field = [] |
| | | let diffUser = false |
| | | let LText = params.map((item, index) => { |
| | | let _sql = item.sql |
| | | let _script = item.script |
| | | |
| | | if (index === 0) { |
| | |
| | | ${_script} |
| | | ` |
| | | } |
| | | if (!diffUser && (/@userid@/ig.test(item.sql) || /@userid@/ig.test(_script))) { |
| | | diffUser = true |
| | | } |
| | | |
| | | item.columns.forEach(cell => { |
| | | LText_field.push(`Select '${item.name}' as tablename,'${cell.field}' as fieldname,'${cell.datatype}' as field_type`) |
| | | }) |
| | | return `Select '${item.name}' as tablename,'${window.btoa(window.encodeURIComponent(_sql))}' as LText,'${window.btoa(window.encodeURIComponent(_script))}' as Lcustomize,'${item.type}' as table_type,'${item.primaryKey}' as primary_key,'${item.par_tablename}' as par_tablename,'${item.foreign_key}' as foreign_key,'${index}' as Sort` |
| | | return `Select '${item.name}' as tablename,'${window.btoa(window.encodeURIComponent(item.sql))}' as LText,'${window.btoa(window.encodeURIComponent(_script))}' as Lcustomize,'${item.type}' as table_type,'${item.primaryKey}' as primary_key,'${item.par_tablename}' as par_tablename,'${item.foreign_key}' as foreign_key,'${index}' as Sort` |
| | | }) |
| | | |
| | | let param = { |
| | |
| | | if (config.cacheUseful === 'true') { |
| | | param.time_type = config.timeUnit |
| | | param.time_limit = config.cacheTime |
| | | if (config.diffUser) { |
| | | if (diffUser) { |
| | | param.userid = sessionStorage.getItem('UserID') |
| | | } |
| | | param.data_md5 = md5(JSON.stringify(param)) |
| | |
| | | |
| | | if (key === 'fstMenuId') { |
| | | let _menu = menulist.filter(cell => cell.MenuID === value)[0] |
| | | let options = _menu ? _menu.options : [] |
| | | let options = _menu ? _menu.children : [] |
| | | let ParentId = options[0] ? options[0].MenuID : '' |
| | | |
| | | this.setState({ |
| | |
| | | <Select onChange={(value) => {this.selectChange('fstMenuId', value)}}> |
| | | {this.state.menulist.map(option => |
| | | <Select.Option key={option.MenuID} value={option.MenuID}> |
| | | {option.text} |
| | | {option.text || option.MenuName} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | |
| | | <Select onChange={(value) => {this.selectChange('ParentId', value)}}> |
| | | {this.state.submenulist.map(option => |
| | | <Select.Option key={option.MenuID} value={option.MenuID}> |
| | | {option.text} |
| | | {option.text || option.MenuName} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
File was renamed from src/templates/headerconfig/dragelement/card.jsx |
| | |
| | | }) |
| | | const [, drop] = useDrop({ |
| | | accept: ItemTypes.CARD, |
| | | canDrop: () => false, |
| | | hover({ id: draggedId }) { |
| | | if (draggedId !== id) { |
| | | canDrop: () => true, |
| | | drop: ({ id: draggedId }) => { |
| | | if (draggedId && draggedId !== id) { |
| | | const { index: overIndex } = findCard(id) |
| | | moveCard(draggedId, overIndex) |
| | | } |
File was renamed from src/templates/headerconfig/dragelement/index.jsx |
| | |
| | | import React, { useState } from 'react' |
| | | import { useDrop } from 'react-dnd' |
| | | import { Icon, Button } from 'antd' |
| | | import { is, fromJS } from 'immutable' |
| | | import update from 'immutability-helper' |
| | | import Card from './card' |
| | | import ItemTypes from './itemtypes' |
| | |
| | | handlePreviewList(_cards) |
| | | } |
| | | |
| | | if (!is(fromJS(cards), fromJS(list))) { |
| | | setCards(list) |
| | | } |
| | | |
| | | const findCard = id => { |
| | | const card = cards.filter(c => `${c.id}` === id)[0] |
| | | const card = cards.filter(c => c.MenuID === id)[0] |
| | | return { |
| | | card, |
| | | index: cards.indexOf(card), |
| | |
| | | <div ref={drop} className="dragdashboard"> |
| | | {cards.map(card => ( |
| | | <Card |
| | | key={card.id} |
| | | id={`${card.id}`} |
| | | text={card.text} |
| | | key={card.MenuID} |
| | | id={`${card.MenuID}`} |
| | | text={card.MenuName} |
| | | moveCard={moveCard} |
| | | editCard={editCard} |
| | | delCard={delCard} |
| | | findCard={findCard} |
| | | /> |
| | | ))} |
| | | <div className="btn-group"> |
| | | <div className="card-add" onClick={add}> |
| | | <Icon type="plus" /> |
| | | </div> |
| | | <Button type="primary" onClick={thawmenu}>{dict['model.thaw'] + dict['model.menu']}</Button> |
| | | <Button type="primary" onClick={confirm}>{dict['model.confirm']}</Button> |
| | | <Button onClick={cancel}>{dict['model.close']}</Button> |
| | | <div className="card-add" onClick={add}> |
| | | <Icon type="plus" /> |
| | | </div> |
| | | <Button type="primary" onClick={thawmenu}>{dict['model.thaw'] + dict['model.menu']}</Button> |
| | | <Button type="primary" onClick={confirm}>{dict['model.confirm']}</Button> |
| | | <Button onClick={cancel}>{dict['model.close']}</Button> |
| | | </div> |
| | | ) |
| | | } |
File was renamed from src/templates/headerconfig/dragelement/index.scss |
| | |
| | | .dragdashboard { |
| | | position: relative; |
| | | z-index: 1; |
| | | width: calc(100vw - 400px); |
| | | width: calc(100vw - 350px); |
| | | float: left; |
| | | background: #001529; |
| | | padding-bottom: 5px; |
| | | .card-add { |
| | | border: 1px dashed gray; |
| | | padding: 2px; |
| | | margin-top: 13px; |
| | | padding: 4px; |
| | | margin-top: 9px; |
| | | margin-left: 10px; |
| | | width: 50px; |
| | | float: left; |
File was renamed from src/templates/headerconfig/index.jsx |
| | |
| | | import card5 from '@/assets/img/card-bg6.jpg' |
| | | |
| | | const { confirm } = Modal |
| | | let previewList = null |
| | | |
| | | class EditMenu extends Component { |
| | | static propTpyes = { |
| | |
| | | state = { |
| | | thawmenulist: null, // 已冻结的一级菜单 |
| | | addMvisible: null, |
| | | menulist: null, |
| | | editMenu: null, // 编辑菜单 |
| | | editMvisible: false, // 编辑菜单模态框 |
| | | thawMvisible: false, // 解除冻结模态框 |
| | |
| | | |
| | | handlePreviewList = (List) => { |
| | | // 菜单顺序改变时,保存中间状态 |
| | | previewList = List |
| | | this.setState({menulist: List}) |
| | | } |
| | | |
| | | editMenuModal = (Menu) => { |
| | | // 菜单编辑:修改 |
| | | const menu = fromJS(Menu).toJS() |
| | | if (previewList && !is(fromJS(previewList), fromJS(this.props.menulist))) { |
| | | if (!is(fromJS(this.state.menulist), fromJS(this.props.menulist))) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['model.menu.presave'], |
| | |
| | | |
| | | handleButton = (type) => { |
| | | // 菜单编辑:添加,确定,取消 |
| | | let _menuchange = previewList && !is(fromJS(previewList), fromJS(this.props.menulist)) |
| | | let _menuchange = !is(fromJS(this.state.menulist), fromJS(this.props.menulist)) |
| | | |
| | | if ((type === 'add' || type === 'thawmenu') && _menuchange) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | let _this = this |
| | | let param = { |
| | | func: 'sPC_Menu_SortUpt', |
| | | LText: previewList.map((item, index) => { |
| | | LText: this.state.menulist.map((item, index) => { |
| | | return 'select \'' + item.MenuID + '\' as Menuid,' + (index + 1) * 10 + ' as sort' |
| | | }) |
| | | } |
| | |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else if (type === 'cancel' && _menuchange) { |
| | | let _this = this |
| | | |
| | | confirm({ |
| | | title: '菜单顺序已调整,放弃保存吗?', |
| | | content: '', |
| | | onOk() { |
| | | _this.props.exitEdit() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | previewList = null |
| | | this.setState({menulist: fromJS(this.props.menulist).toJS()}) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (!is(fromJS(this.props.menulist), fromJS(nextProps.menulist))) { |
| | | previewList = null |
| | | this.setState({menulist: fromJS(nextProps.menulist).toJS()}) |
| | | } |
| | | } |
| | | |
| | | render () { |
| | | const { dict } = this.state |
| | | const { dict, menulist } = this.state |
| | | |
| | | return ( |
| | | <div className="header-edit-box"> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | {this.props.menulist && <DndProvider backend={HTML5Backend}> |
| | | <DndProvider backend={HTML5Backend}> |
| | | <DragElement |
| | | dict={dict} |
| | | list={this.props.menulist} |
| | | list={menulist} |
| | | handlePreviewList={this.handlePreviewList} |
| | | handleMenu={this.editMenuModal} |
| | | deleteMemu={this.deleteMemu} |
| | | handleButton={this.handleButton} |
| | | /> |
| | | </DndProvider>} |
| | | </DndProvider> |
| | | {/* 新建菜单模态框 */} |
| | | <Modal |
| | | title={dict['model.add'] + dict['model.menu']} |
File was renamed from src/templates/headerconfig/menuform/index.jsx |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select } from 'antd' |
| | | import { Form, Row, Col, Input, Select, Radio } from 'antd' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | type: 'radio', |
| | | key: 'openType', |
| | | label: this.props.dict['model.openway'], |
| | | initVal: 'menu', |
| | |
| | | options: [{ |
| | | id: 'menu', |
| | | text: this.props.dict['model.menu'] |
| | | // }, { |
| | | // id: 'newpage', |
| | | // text: this.props.dict['model.new'] + this.props.dict['model.window'] |
| | | }, { |
| | | id: 'outpage', |
| | | text: '外部页面' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | type: 'text', |
| | | key: 'linkUrl', |
| | | label: '页面地址', |
| | | initVal: '', |
| | | hidden: true, |
| | | label: this.props.dict['model.new'] + this.props.dict['model.window'], |
| | | initVal: 'service', |
| | | required: true, |
| | | options: [] |
| | | required: true |
| | | } |
| | | ] |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { menu } = this.props |
| | | |
| | | if (this.props.type === 'add') { |
| | | this.setState({ |
| | | formlist: this.state.defaultMenu |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | formlist: this.state.defaultMenu.map(menu => { |
| | | if (menu.key === 'menuName') { |
| | | menu.initVal = this.props.menu.MenuName |
| | | } else if (menu.key === 'openType') { |
| | | menu.initVal = this.props.menu.PageParam.OpenType |
| | | } else if (menu.key === 'linkUrl') { |
| | | menu.initVal = this.props.menu.PageParam.linkUrl |
| | | if (this.props.menu.PageParam.OpenType === 'menu') { |
| | | menu.hidden = true |
| | | } else if (this.props.menu.PageParam.OpenType === 'newpage') { |
| | | menu.hidden = false |
| | | formlist: this.state.defaultMenu.map(item => { |
| | | if (item.key === 'menuName') { |
| | | item.initVal = menu.MenuName |
| | | } else if (item.key === 'openType') { |
| | | item.initVal = menu.PageParam.OpenType |
| | | } else if (item.key === 'linkUrl') { |
| | | item.initVal = menu.PageParam.linkUrl |
| | | if (menu.PageParam.OpenType === 'menu') { |
| | | item.hidden = true |
| | | } else if (menu.PageParam.OpenType === 'outpage') { |
| | | item.hidden = false |
| | | } |
| | | } |
| | | return menu |
| | | return item |
| | | }) |
| | | }) |
| | | } |
| | |
| | | openTypeChange = (key, value) => { |
| | | if (key === 'openType') { |
| | | let formlist = this.state.formlist |
| | | if (value === 'newpage') { |
| | | if (value === 'outpage') { |
| | | formlist.forEach(item => { |
| | | if (item.key === 'linkUrl') { |
| | | item.hidden = false |
| | | item.initVal = 'service' |
| | | item.initVal = '' |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | this.setState({formlist}) |
| | | } |
| | | } |
| | |
| | | getPopupContainer={() => document.getElementById('form-box')} |
| | | > |
| | | {item.options.map(option => |
| | | <Select.Option id={option.id} title={option.text} key={option.id} value={option.id}>{option.text}</Select.Option> |
| | | <Select.Option key={option.id} value={option.id}>{option.text}</Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'radio') { // 下拉搜索 |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal || '', |
| | | rules: [ |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.openTypeChange(item.key, e.target.value)}}> |
| | | { |
| | | item.options.map(option => { |
| | | return ( |
| | | <Radio key={option.id} value={option.id}>{option.text}</Radio> |
| | | ) |
| | | }) |
| | | } |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } |
| | | }) |
| | | |
| | |
| | | class EditMenu extends Component { |
| | | static propTpyes = { |
| | | menulist: PropTypes.any, // 二级菜单列表 |
| | | supMenuList: PropTypes.array, // 一级菜单列表 |
| | | menuTree: PropTypes.array, // 一级菜单列表 |
| | | supMenu: PropTypes.object, // 二级菜单所对应的一级菜单 |
| | | reload: PropTypes.func, // 刷新二级菜单数据 |
| | | exitEdit: PropTypes.func // 退出编辑 |
| | |
| | | }) |
| | | } else if (menu.type === 'close') { |
| | | confirm({ |
| | | title: dict['model.menu.close'].replace('@M', menu.card.text), |
| | | title: dict['model.menu.close'].replace('@M', menu.card.MenuName), |
| | | content: '', |
| | | onOk() { |
| | | let param = { |
| | |
| | | label: dict['model.super'] + dict['model.menu'], |
| | | initVal: this.props.supMenu.MenuID, |
| | | required: true, |
| | | options: this.props.supMenuList |
| | | options: this.props.menuTree |
| | | }, |
| | | { // 菜单名称 |
| | | type: 'text', |
| | | key: 'menuName', |
| | | label: dict['model.menu'] + dict['model.name'], |
| | | initVal: menu.card.text, |
| | | initVal: menu.card.MenuName, |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | |
| | | label: dict['model.super'] + dict['model.menu'], |
| | | initVal: this.props.supMenu.MenuID, |
| | | required: true, |
| | | options: this.props.supMenuList |
| | | options: this.props.menuTree |
| | | }, |
| | | { // 菜单名称 |
| | | type: 'text', |
| | |
| | | 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() |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | confirmLoading={this.state.confirmLoading} |
| | | onCancel={this.memuHandleCancel} |
| | | > |
| | | {this.state.formlist && |
| | | <MenuForm |
| | | dict={dict} |
| | | formlist={this.state.formlist} |
| | | wrappedComponentRef={(inst) => this.menuFormRef = inst} |
| | | />} |
| | | {this.state.formlist ? |
| | | <MenuForm |
| | | dict={dict} |
| | | formlist={this.state.formlist} |
| | | wrappedComponentRef={(inst) => this.menuFormRef = inst} |
| | | /> : null} |
| | | </Modal> |
| | | <Modal |
| | | title={dict['model.thaw'] + dict['model.menu']} |
| | |
| | | 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 |
| | | } |
| | | } |
| | |
| | | |
| | | if (submenu) { |
| | | this.setState({ |
| | | menu: {...menu, supMenuList: submenu.options} |
| | | menu: {...menu, supMenuList: submenu.children} |
| | | }, () => { |
| | | this.props.form.setFieldsValue({ParentID: submenu.options[0] ? submenu.options[0].MenuID : ''}) |
| | | this.props.form.setFieldsValue({ParentID: submenu.children[0] ? submenu.children[0].MenuID : ''}) |
| | | }) |
| | | } |
| | | } |
| | |
| | | onChange={this.changeMenu} |
| | | > |
| | | {menu.fstMenuList.map(option => |
| | | <Select.Option id={option.MenuID} title={option.text} key={option.MenuID} value={option.MenuID}>{option.text}</Select.Option> |
| | | <Select.Option key={option.MenuID} value={option.MenuID}>{option.text || option.MenuName}</Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | > |
| | | {menu.supMenuList.map(option => |
| | | <Select.Option id={option.MenuID} title={option.text} key={option.MenuID} value={option.MenuID}>{option.text}</Select.Option> |
| | | <Select.Option key={option.MenuID} value={option.MenuID}>{option.text || option.MenuName}</Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '页面地址!' |
| | | }, |
| | | { |
| | | max: 1024, |
| | | message: '地址最长为1024个字符!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | |
| | | }) |
| | | const [, drop] = useDrop({ |
| | | accept: ItemTypes.CARD, |
| | | canDrop: () => false, |
| | | hover({ id: draggedId }) { |
| | | canDrop: () => true, |
| | | drop({ id: draggedId }) { |
| | | if (draggedId !== id) { |
| | | const { index: overIndex } = findCard(id) |
| | | moveCard(draggedId, overIndex) |
| | |
| | | <div className="side-card" style={{ opacity }}> |
| | | <div ref={node => drag(drop(node))}> |
| | | {card.PageParam && card.PageParam.Icon && <Icon type={card.PageParam.Icon} />} |
| | | {card.text} |
| | | {card.MenuName} |
| | | </div> |
| | | {/* 自定义模板,在新页面编辑 */} |
| | | {!card.forbidden && card.type !== 'CustomPage' ? <Icon className="edit" type="edit" onClick={edit} /> : null} |
| | |
| | | } |
| | | |
| | | const findCard = id => { |
| | | const card = cards.filter(c => `${c.id}` === id)[0] |
| | | const card = cards.filter(c => c.MenuID === id)[0] |
| | | return { |
| | | card, |
| | | index: cards.indexOf(card), |
| | |
| | | <div ref={drop} className="sidemenu-dragboard"> |
| | | {cards.map(card => ( |
| | | <Card |
| | | key={card.id} |
| | | id={card.id} |
| | | key={card.MenuID} |
| | | id={card.MenuID} |
| | | card={card} |
| | | moveCard={moveCard} |
| | | editCard={editCard} |
| | |
| | | getPopupContainer={() => document.getElementById('form-box')} |
| | | > |
| | | {item.options.map(option => |
| | | <Select.Option id={option.MenuID} title={option.text} key={option.MenuID} value={option.MenuID}> |
| | | {item.key === 'icon' && <Icon type={option.text} />} {option.text} |
| | | <Select.Option id={option.MenuID} key={option.MenuID} value={option.MenuID}> |
| | | {item.key === 'icon' && <Icon type={option.text} />} {option.text || option.MenuName} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber, Cascader } from 'antd' |
| | | import { btnIcons, btnClasses, formRule } from '@/utils/option.js' |
| | | |
| | | import Api from '@/api' |
| | | import options from '@/store/options.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <Cascader |
| | | options={this.state.menulist} |
| | | loadData={this.loadData} |
| | | placeholder="" |
| | | /> |
| | | <Cascader options={this.state.menulist} placeholder="" /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | |
| | | } |
| | | }) |
| | | return fields |
| | | } |
| | | |
| | | loadData = selectedOptions => { |
| | | const { MenuID } = this.props |
| | | const targetOption = selectedOptions[selectedOptions.length - 1] |
| | | targetOption.loading = true |
| | | |
| | | let _param = { |
| | | func: 'sPC_Get_FunMenu', |
| | | ParentID: targetOption.value, |
| | | systemType: options.sysType, |
| | | debug: 'Y' |
| | | } |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | if (result.status) { |
| | | targetOption.loading = false |
| | | targetOption.children = result.data.map(item => { |
| | | let submenu = { |
| | | value: item.ParentID, |
| | | label: item.MenuNameP, |
| | | children: item.FunMenu.map(cell => { |
| | | return { |
| | | value: cell.MenuID, |
| | | label: cell.MenuName, |
| | | MenuID: cell.MenuID, |
| | | MenuName: cell.MenuName, |
| | | MenuNo: cell.MenuNo, |
| | | Ot: cell.Ot, |
| | | PageParam: cell.PageParam, |
| | | LinkUrl: cell.LinkUrl, |
| | | disabled: cell.MenuID === MenuID |
| | | } |
| | | }) |
| | | } |
| | | |
| | | return submenu |
| | | }) |
| | | |
| | | this.setState({ |
| | | menulist: [...this.state.menulist] |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | targetOption.loading = false |
| | | } |
| | | }) |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import options from '@/store/options.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import DevUtils from '@/utils/devutils.js' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | |
| | | </div> |
| | | |
| | | let menulist = [] |
| | | |
| | | if (menu.fstMenuList) { |
| | | menulist = menu.fstMenuList.map(item => { |
| | | return { |
| | | value: item.MenuID, |
| | | label: item.text, |
| | | isLeaf: false |
| | | } |
| | | }) |
| | | } |
| | | let trees = fromJS(menu.fstMenuList).toJS() |
| | | |
| | | if (menu.fstMenuList && card.linkmenu && card.linkmenu.length > 0) { |
| | | let _param = { |
| | | func: 'sPC_Get_FunMenu', |
| | | ParentID: card.linkmenu[0], |
| | | systemType: options.sysType, |
| | | debug: 'Y' |
| | | } |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | if (result.status) { |
| | | menulist = menulist.map(item => { |
| | | if (item.value === card.linkmenu[0]) { |
| | | item.children = result.data.map(item => { |
| | | let submenu = { |
| | | value: item.ParentID, |
| | | label: item.MenuNameP, |
| | | children: item.FunMenu.map(cell => { |
| | | return { |
| | | value: cell.MenuID, |
| | | label: cell.MenuName, |
| | | MenuID: cell.MenuID, |
| | | MenuName: cell.MenuName, |
| | | MenuNo: cell.MenuNo, |
| | | Ot: cell.Ot, |
| | | PageParam: cell.PageParam, |
| | | LinkUrl: cell.LinkUrl, |
| | | disabled: cell.MenuID === menu.MenuID |
| | | } |
| | | }) |
| | | } |
| | | menulist = trees.map(fst => { |
| | | fst.value = fst.MenuID |
| | | fst.label = fst.MenuName |
| | | fst.isLeaf = false |
| | | fst.children = fst.children.map(snd => { |
| | | snd.value = snd.MenuID |
| | | snd.label = snd.MenuName |
| | | |
| | | return submenu |
| | | }) |
| | | } |
| | | return item |
| | | snd.children = snd.children.map(thd => { |
| | | thd.value = thd.MenuID |
| | | thd.label = thd.MenuName |
| | | thd.disabled = thd.MenuID === menu.MenuID |
| | | return thd |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | card: card, |
| | | formlist: getActionForm(card, functip, this.props.config, this.props.usefulFields, this.props.type, menulist, this.state.printTemps) |
| | | return snd |
| | | }) |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | visible: true, |
| | | card: card, |
| | | formlist: getActionForm(card, functip, this.props.config, this.props.usefulFields, this.props.type, menulist, this.state.printTemps) |
| | | return fst |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | card: card, |
| | | formlist: getActionForm(card, functip, this.props.config, this.props.usefulFields, this.props.type, menulist, this.state.printTemps) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Icon, Cascader, notification } from 'antd' |
| | | import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Icon, Cascader } from 'antd' |
| | | |
| | | import { formRule } from '@/utils/option.js' |
| | | import options from '@/store/options.js' |
| | | import Api from '@/api' |
| | | import './index.scss' |
| | | |
| | | const columnTypeOptions = { |
| | |
| | | })( |
| | | <Cascader |
| | | options={this.state.menulist} |
| | | loadData={this.loadData} |
| | | placeholder="" |
| | | getPopupContainer={() => document.getElementById('columnwinter')} |
| | | /> |
| | |
| | | } |
| | | }) |
| | | return fields |
| | | } |
| | | |
| | | loadData = selectedOptions => { |
| | | const { MenuID } = this.props |
| | | const targetOption = selectedOptions[selectedOptions.length - 1] |
| | | targetOption.loading = true |
| | | |
| | | let _param = { |
| | | func: 'sPC_Get_FunMenu', |
| | | ParentID: targetOption.value, |
| | | systemType: options.sysType, |
| | | debug: 'Y' |
| | | } |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | if (result.status) { |
| | | targetOption.loading = false |
| | | targetOption.children = result.data.map(item => { |
| | | let submenu = { |
| | | value: item.ParentID, |
| | | label: item.MenuNameP, |
| | | children: item.FunMenu.map(cell => { |
| | | return { |
| | | value: cell.MenuID, |
| | | label: cell.MenuName, |
| | | MenuID: cell.MenuID, |
| | | MenuName: cell.MenuName, |
| | | MenuNo: cell.MenuNo, |
| | | Ot: cell.Ot, |
| | | PageParam: cell.PageParam, |
| | | LinkUrl: cell.LinkUrl, |
| | | disabled: cell.MenuID === MenuID |
| | | } |
| | | }) |
| | | } |
| | | |
| | | return submenu |
| | | }) |
| | | |
| | | this.setState({ |
| | | menulist: [...this.state.menulist] |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | targetOption.loading = false |
| | | } |
| | | }) |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { Icon, Tooltip, Modal, notification, Switch, message, Spin } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import options from '@/store/options.js' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import { getColumnForm } from '@/templates/zshare/formconfig' |
| | |
| | | const { menu } = this.props |
| | | |
| | | if (card.type !== 'colspan') { |
| | | let menulist = menu.fstMenuList.map(item => { |
| | | return { |
| | | value: item.MenuID, |
| | | label: item.text, |
| | | isLeaf: false |
| | | } |
| | | }) |
| | | let menulist = [] |
| | | |
| | | if ((card.type === 'text' || card.type === 'number') && card.linkmenu && card.linkmenu.length > 0) { |
| | | let _param = { |
| | | func: 'sPC_Get_FunMenu', |
| | | ParentID: card.linkmenu[0], |
| | | systemType: options.sysType, |
| | | debug: 'Y' |
| | | } |
| | | if (menu.fstMenuList) { |
| | | let trees = fromJS(menu.fstMenuList).toJS() |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | if (result.status) { |
| | | menulist = menulist.map(item => { |
| | | if (item.value === card.linkmenu[0]) { |
| | | item.children = result.data.map(item => { |
| | | let submenu = { |
| | | value: item.ParentID, |
| | | label: item.MenuNameP, |
| | | children: item.FunMenu.map(cell => { |
| | | return { |
| | | value: cell.MenuID, |
| | | label: cell.MenuName, |
| | | MenuID: cell.MenuID, |
| | | MenuName: cell.MenuName, |
| | | MenuNo: cell.MenuNo, |
| | | Ot: cell.Ot, |
| | | PageParam: cell.PageParam, |
| | | LinkUrl: cell.LinkUrl, |
| | | disabled: cell.MenuID === menu.MenuID |
| | | } |
| | | }) |
| | | } |
| | | menulist = trees.map(fst => { |
| | | fst.value = fst.MenuID |
| | | fst.label = fst.MenuName |
| | | fst.isLeaf = false |
| | | fst.children = fst.children.map(snd => { |
| | | snd.value = snd.MenuID |
| | | snd.label = snd.MenuName |
| | | |
| | | return submenu |
| | | }) |
| | | } |
| | | return item |
| | | snd.children = snd.children.map(thd => { |
| | | thd.value = thd.MenuID |
| | | thd.label = thd.MenuName |
| | | thd.disabled = thd.MenuID === menu.MenuID |
| | | return thd |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | loading: false, |
| | | modaltype: 'columns', |
| | | card: card, |
| | | formlist: getColumnForm(card, this.props.sysRoles, menulist) |
| | | return snd |
| | | }) |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | modaltype: 'columns', |
| | | card: card, |
| | | formlist: getColumnForm(card, this.props.sysRoles, menulist) |
| | | return fst |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | modaltype: 'columns', |
| | | card: card, |
| | | formlist: getColumnForm(card, this.props.sysRoles, menulist) |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | modaltype: 'colspan', |
| | |
| | | } else { |
| | | baseurl = window.GLOB.location + window.GLOB.service |
| | | } |
| | | // if (!/Content\/images\/upload\//.test(url)) { |
| | | // baseurl = baseurl + 'Content/images/upload/' |
| | | // } |
| | | |
| | | let realurl = url.match(/^http/) || url.match(/^\/\//) ? url : baseurl + url |
| | | return realurl |
| | | } |
| | |
| | | } |
| | | |
| | | config.style = config.style || {} |
| | | config.zoom = 1 |
| | | config.pageSize = ['A4', 'A3', 'A5'].includes(config.pageSize) ? config.pageSize : 'A4' |
| | | config.pageLayout = config.pageLayout !== 'horizontal' ? 'vertical' : 'horizontal' |
| | | config.pagePadding = config.pagePadding !== 'without' ? 'default' : 'without' |
| | | |
| | | if (config.pageSize === 'A3') { |
| | | if (config.pageLayout === 'horizontal') { |
| | | config.zoom = 1.35 |
| | | config.style.height = 845 |
| | | } else { |
| | | config.style.height = 1695 |
| | | } |
| | | } else if (config.pageSize === 'A5') { |
| | | config.zoom = 0.7 |
| | | if (config.pageLayout === 'horizontal') { |
| | | config.style.height = 840 |
| | | } else { |
| | | config.style.height = 1700 |
| | | } |
| | | } else { |
| | | if (config.pageLayout === 'horizontal') { |
| | | config.style.height = 845 |
| | | } else { |
| | | config.style.height = 1680 |
| | | let pageParam = { |
| | | A4: { |
| | | vertical: 1000, |
| | | horizontal: 1200, |
| | | verticaldefault: 1.45789, |
| | | verticalwithout: 1.41428, |
| | | horizontaldefault: 0.685, |
| | | horizontalwithout: 0.705, |
| | | }, |
| | | A3: { |
| | | vertical: 1200, |
| | | horizontal: 1600, |
| | | verticaldefault: 1.44404, |
| | | verticalwithout: 1.41414, |
| | | horizontaldefault: 0.6923, |
| | | horizontalwithout: 0.707, |
| | | }, |
| | | A5: { |
| | | vertical: 700, |
| | | horizontal: 1000, |
| | | verticaldefault: 1.482, |
| | | verticalwithout: 1.417, |
| | | horizontaldefault: 0.6736, |
| | | horizontalwithout: 0.7047, |
| | | } |
| | | } |
| | | |
| | | config.width = pageParam[config.pageSize][config.pageLayout] |
| | | config.style.height = Math.floor(config.width * pageParam[config.pageSize][config.pageLayout + config.pagePadding]) |
| | | |
| | | let params = [] |
| | | let _pars = [] |
| | |
| | | |
| | | print = () => { |
| | | const { config } = this.state |
| | | |
| | | let jubuData = document.getElementById('bill-print').innerHTML |
| | | window.document.body.innerHTML = jubuData |
| | | document.getElementsByTagName('body')[0].style.width = '1200px' |
| | | document.getElementsByTagName('body')[0].style.margin = '0 auto' |
| | | document.getElementsByTagName('body')[0].style.zoom = config.zoom |
| | | |
| | | |
| | | try { |
| | | if (window.ActiveXObject) { |
| | | let hkeyRoot |
| | | let hkeyPath |
| | | let hkeyKey |
| | | // eslint-disable-next-line |
| | | let RegWsh = new ActiveXObject('WScript.Shell') |
| | | let iframe = document.createElement('IFRAME') |
| | | let linkList = document.getElementsByTagName('link') // 获取父窗口link标签对象列表 |
| | | let styleList = document.getElementsByTagName('style') // 获取父窗口style标签对象列表 |
| | | |
| | | hkeyRoot = 'HKEY_CURRENT_USER' |
| | | hkeyPath = '\\Software\\Microsoft\\Internet Explorer\\PageSetup\\' |
| | | |
| | | // 设置页眉/脚的字体样式 |
| | | hkeyKey = 'font' |
| | | RegWsh.RegWrite(hkeyRoot + hkeyPath + hkeyKey, 'font-size: 12px; font-family: 黑体; line-height: 24px') |
| | | |
| | | // 设置页眉 |
| | | hkeyKey = 'header' |
| | | RegWsh.RegWrite(hkeyRoot + hkeyPath + hkeyKey, '打印编号') |
| | | |
| | | // 设置页脚 |
| | | hkeyKey = 'footer' |
| | | RegWsh.RegWrite(hkeyRoot + hkeyPath + hkeyKey, '&b第 &p 页/共 &P 页') |
| | | |
| | | // 设置页边距(0.6 要乘以 2.5为实际打印的尺寸) |
| | | hkeyKey = 'margin_bottom' |
| | | RegWsh.RegWrite(hkeyRoot + hkeyPath + hkeyKey, '0.6') |
| | | |
| | | hkeyKey = 'margin_left' |
| | | RegWsh.RegWrite(hkeyRoot + hkeyPath + hkeyKey, '0.6') |
| | | |
| | | hkeyKey = 'margin_right' |
| | | RegWsh.RegWrite(hkeyRoot + hkeyPath + hkeyKey, '0.6') |
| | | |
| | | hkeyKey = 'margin_top' |
| | | RegWsh.RegWrite(hkeyRoot + hkeyPath + hkeyKey, '0.6') |
| | | |
| | | window.print() |
| | | } else { |
| | | window.print() |
| | | document.body.appendChild(iframe) |
| | | let doc = iframe.contentWindow.document |
| | | |
| | | doc.open() |
| | | doc.write(`<!DOCTYPE html><html lang="en"><head>`) |
| | | for (let i = 0;i < linkList.length;i++) { |
| | | if (linkList[i].type === 'text/css') { |
| | | doc.write(`<LINK rel="stylesheet" type="text/css" href="${linkList[i].href}">`) |
| | | } |
| | | } |
| | | doc.write(`<style>body{width: ${config.width}px!important;}</style>`) |
| | | for (let i = 0;i < styleList.length;i++) { |
| | | doc.write('<style>' + styleList[i].innerHTML + '</style>') |
| | | } |
| | | doc.write(`</head><body>`) |
| | | doc.write(jubuData) |
| | | doc.write(`</body></html>`) |
| | | doc.close() |
| | | iframe.contentWindow.focus() |
| | | iframe.contentWindow.print() |
| | | |
| | | document.getElementsByTagName('body')[0].style.zoom = 1 |
| | | document.body.removeChild(iframe) |
| | | |
| | | setTimeout(() => { |
| | | window.close() |
| | |
| | | |
| | | if (key === 'cacheUseful') { |
| | | this.props.updateConfig({...config, cacheUseful: value}) |
| | | } else if (key === 'diffUser') { |
| | | this.props.updateConfig({...config, diffUser: value}) |
| | | } else if (key === 'timeUnit') { |
| | | this.props.updateConfig({...config, timeUnit: value}) |
| | | } |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | {config.cacheUseful === 'true' ? <Col span={24}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="对于不同用户,查询信息是否存在差异。"> |
| | | <Icon type="question-circle" /> |
| | | 区分用户 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('diffUser', { |
| | | initialValue: config.diffUser || 'true' |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.selectChange('diffUser', e.target.value)}}> |
| | | <Radio value="true">是</Radio> |
| | | <Radio value="false">否</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {config.cacheUseful === 'true' ? <Col span={24}> |
| | | <Form.Item label="单位"> |
| | | {getFieldDecorator('timeUnit', { |
| | |
| | | import { Form, Row, Col, Input, Select, notification, Radio, Icon, Tooltip, InputNumber } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import options from '@/store/options.js' |
| | | import './index.scss' |
| | | |
| | | class CustomMenuForm extends Component { |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { parentId } = this.props |
| | | let param = { |
| | | func: 's_Get_FSMenusForOpen', |
| | | SndMenuID: parentId, |
| | | TYPE: 20, |
| | | TypeCharOne: 'PC' |
| | | const { MenuId } = this.props |
| | | let _param = {func: 's_get_pc_menus', systemType: options.sysType, debug: 'Y'} |
| | | if (options.sysType !== 'cloud' && window.GLOB.systemType !== 'production') { |
| | | _param.linkurl = window.GLOB.linkurl |
| | | } |
| | | _param.pro_sys = window.GLOB.systemType === 'production' ? 'Y' : '' |
| | | |
| | | Api.getSystemConfig(param).then(result => { |
| | | Api.getSystemConfig(_param).then(result => { |
| | | if (result.status) { |
| | | let menulist = result.data.map(smenu => { |
| | | let _smenu = { |
| | | value: smenu.FstID, |
| | | text: smenu.FstName, |
| | | options: smenu.SndData.map(menu => { |
| | | return { |
| | | value: menu.SndID, |
| | | text: menu.SndName, |
| | | let thdMenu = null |
| | | let menulist = result.fst_menu.map(fst => { |
| | | let fstItem = { |
| | | MenuID: fst.MenuID, |
| | | MenuName: fst.MenuName, |
| | | children: [] |
| | | } |
| | | |
| | | if (fst.snd_menu) { |
| | | fstItem.children = fst.snd_menu.map(snd => { |
| | | let sndItem = { |
| | | ParentId: fst.MenuID, |
| | | MenuID: snd.MenuID, |
| | | MenuName: snd.MenuName, |
| | | children: [] |
| | | } |
| | | |
| | | if (snd.trd_menu) { |
| | | sndItem.children = snd.trd_menu.map(trd => { |
| | | let trdItem = { |
| | | FstId: fst.MenuID, |
| | | ParentId: snd.MenuID, |
| | | MenuID: trd.MenuID, |
| | | MenuName: trd.MenuName, |
| | | MenuNo: trd.MenuNo, |
| | | EasyCode: trd.EasyCode |
| | | } |
| | | |
| | | if (MenuId === trd.MenuID) { |
| | | thdMenu = trdItem |
| | | } |
| | | return trdItem |
| | | }) |
| | | } |
| | | return sndItem |
| | | }) |
| | | } |
| | | |
| | | return _smenu |
| | | return fstItem |
| | | }) |
| | | |
| | | let smenulist = [] |
| | | menulist.forEach(item => { |
| | | if (item.value === result.FstIDSeleted) { |
| | | smenulist = item.options |
| | | if (thdMenu && (item.MenuID === thdMenu.FstId)) { |
| | | smenulist = item.children |
| | | } |
| | | }) |
| | | |
| | | this.props.initMenuList({fstMenuList: fromJS(menulist).toJS(), fstMenuId: result.FstIDSeleted}) |
| | | this.props.initMenuList({fstMenuList: fromJS(menulist).toJS(), fstMenuId: thdMenu ? thdMenu.FstId : ''}) |
| | | |
| | | this.setState({ |
| | | fstMenuId: result.FstIDSeleted, |
| | | fstMenuId: thdMenu ? thdMenu.FstId : '', |
| | | menulist, |
| | | smenulist |
| | | }, () => { |
| | | this.props.form.setFieldsValue({ |
| | | fstMenuId: result.FstIDSeleted, |
| | | parentId: parentId |
| | | fstMenuId: thdMenu ? thdMenu.FstId : '', |
| | | parentId: thdMenu ? thdMenu.ParentId : '' |
| | | }) |
| | | }) |
| | | } else { |
| | |
| | | if (key === 'fstMenuId') { |
| | | let smenulist = [] |
| | | menulist.forEach(item => { |
| | | if (item.value === value) { |
| | | smenulist = item.options |
| | | if (item.MenuID === value) { |
| | | smenulist = item.children |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | smenulist |
| | | }, () => { |
| | | let _id = smenulist[0] ? smenulist[0].value : '' |
| | | let _id = smenulist[0] ? smenulist[0].MenuID : '' |
| | | this.props.form.setFieldsValue({parentId: _id}) |
| | | this.props.updateConfig({...config, fstMenuId: value, parentId: _id}) |
| | | }) |
| | |
| | | this.props.updateConfig({...config, parentId: value}) |
| | | } else if (key === 'cacheUseful') { |
| | | this.props.updateConfig({...config, cacheUseful: value}) |
| | | } else if (key === 'diffUser') { |
| | | this.props.updateConfig({...config, diffUser: value}) |
| | | } else if (key === 'timeUnit') { |
| | | this.props.updateConfig({...config, timeUnit: value}) |
| | | } |
| | |
| | | })( |
| | | <Select onChange={(value) => {this.selectChange('fstMenuId', value)}}> |
| | | {menulist.map(option => |
| | | <Select.Option key={option.value} value={option.value}> |
| | | {option.text} |
| | | <Select.Option key={option.MenuID} value={option.MenuID}> |
| | | {option.MenuName} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | |
| | | })( |
| | | <Select onChange={(value) => {this.selectChange('parentId', value)}}> |
| | | {smenulist.map(option => |
| | | <Select.Option key={option.value} value={option.value}> |
| | | {option.text} |
| | | <Select.Option key={option.MenuID} value={option.MenuID}> |
| | | {option.MenuName} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | {config.cacheUseful === 'true' ? <Col span={24}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="对于不同用户,查询信息是否存在差异。"> |
| | | <Icon type="question-circle" /> |
| | | 区分用户 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('diffUser', { |
| | | initialValue: config.diffUser || 'true' |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.selectChange('diffUser', e.target.value)}}> |
| | | <Radio value="true">是</Radio> |
| | | <Radio value="false">否</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {config.cacheUseful === 'true' ? <Col span={24}> |
| | | <Form.Item label="单位"> |
| | | {getFieldDecorator('timeUnit', { |
| | |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: dict['mob.required.input'] + '打印布局!' |
| | | message: dict['mob.required.select'] + '打印布局!' |
| | | } |
| | | ] |
| | | })( |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <Form.Item label="打印边距"> |
| | | {getFieldDecorator('pagePadding', { |
| | | initialValue: config.pagePadding || 'default', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: dict['mob.required.select'] + '打印边距!' |
| | | } |
| | | ] |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.onRadioChange(e.target.value)}}> |
| | | <Radio value="default">默认</Radio> |
| | | <Radio value="without">无</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <Form.Item label="首页数(条)"> |
| | | {getFieldDecorator('firstCount', { |
| | | initialValue: config.firstCount, |