| | |
| | | _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' // 时间戳 |
| | | _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) // md5密钥 |
| | | |
| | | let localResult = await Api.getLocalConfig(_param) |
| | | let result = {status: true} |
| | | let result = await Api.getSystemConfig(_param) // 取消修改本地密码,只修改单点服务器 |
| | | |
| | | if (window.GLOB.mainSystemApi && window.GLOB.subSystemApi !== window.GLOB.mainSystemApi) { |
| | | result = await Api.getSystemConfig(_param) |
| | | } |
| | | |
| | | if (result.status && localResult.status) { |
| | | if (result.status) { |
| | | this.setState({ |
| | | visible: false, |
| | | confirmLoading: false |
| | |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message || localResult.message, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | this.setState({ |
| | |
| | | let _permFuncField = [] |
| | | if (result.UserRoles && result.UserRoles[0] && result.UserRoles[0].RoleMenu) { |
| | | result.UserRoles[0].RoleMenu.forEach(menu => { |
| | | if (!menu.MenuID) return |
| | | _permAction[menu.MenuID] = true |
| | | }) |
| | | } |
| | |
| | | |
| | | let param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | | SndID: res.ParentID, |
| | | ParentID: res.ParentID, |
| | | MenuID: sysMenu.MenuID, |
| | | MenuNo: res.MenuNo, |
| | | Template: sysMenu.Template, |
| | | MenuName: res.MenuName, |
| | | PageParam: JSON.stringify({Template: sysMenu.Template, OpenType: 'newtab'}), |
| | | LongParam: '' |
| | | LongParam: '', |
| | | LText: '', |
| | | LTexttb: '' |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | this.setState({ |
| | | confirmLoading: true |
| | | }) |
| | |
| | | } |
| | | |
| | | // 权限过滤 |
| | | config.action = config.action.filter(item => permAction[item.uuid]) |
| | | config.action = config.action.filter(item => permAction[item.uuid] || (item.linkTab && permAction[item.linkTab])) |
| | | config.tabgroups.forEach(group => { |
| | | if (!config[group]) return |
| | | |
| | |
| | | const { Search } = Input |
| | | const { TabPane } = Tabs |
| | | const { TreeNode, DirectoryTree } = Tree |
| | | let _checkedKeys = null |
| | | let checkedKeysMap = null |
| | | let linkMap = null |
| | | let selectMap = null |
| | | |
| | | export default class RoleManage extends Component { |
| | | static propTpyes = { |
| | |
| | | return { |
| | | title: item.MenuName, |
| | | key: item.MenuID, |
| | | children: [] |
| | | children: [], |
| | | selected: true |
| | | } |
| | | }) |
| | | }, () => { |
| | |
| | | } |
| | | |
| | | if (tabKey === '') { |
| | | let _mainMenuKeys = mainMenus.map(menu => menu.key) |
| | | |
| | | _checkedKeys = [] |
| | | let _checkMainKeys = [] // 选中的一级菜单,需判断是否含有子菜单 |
| | | let _initCheckKeys = [] // 初始选中的菜单id |
| | | checkedKeysMap = new Map() |
| | | linkMap = new Map() |
| | | selectMap = new Map() |
| | | |
| | | result.data.forEach(item => { |
| | | if (item.Selected !== 'true') return |
| | | |
| | | if (!_mainMenuKeys.includes(item.MenuID)) { |
| | | _checkedKeys.push(item.MenuID) |
| | | } else { |
| | | _checkMainKeys.push(item.MenuID) |
| | | } |
| | | checkedKeysMap.set(item.MenuID, true) |
| | | _initCheckKeys.push(item.MenuID) |
| | | }) |
| | | |
| | |
| | | this.getOpenNode(_tree[0], _openKeys) |
| | | } |
| | | |
| | | _tree.forEach(item => { |
| | | if (_checkMainKeys.includes(item.key) && !item.children) { |
| | | _checkedKeys.push(item.key) |
| | | } |
| | | }) |
| | | |
| | | _state.menuTrees = _tree |
| | | _state.initCheckKeys = _initCheckKeys |
| | | _state.checkedKeys = _checkedKeys |
| | | _state.checkedKeys = Array.from(checkedKeysMap.keys()) |
| | | _state.menuOpenKeys = _openKeys |
| | | } else { |
| | | _tree = this.getTree(JSON.parse(JSON.stringify(mainMenus)), result.data) |
| | | _tree = this.getSelectTree(JSON.parse(JSON.stringify(mainMenus)), result.data) |
| | | _tree = _tree.filter(node => node.children) |
| | | |
| | | if (_tree[0]) { |
| | |
| | | parents.forEach(parent => { |
| | | parent.children = [] |
| | | |
| | | options.forEach((option, index) => { |
| | | options.forEach(option => { |
| | | if (option.ParentID === parent.key) { |
| | | parent.children.push({ |
| | | title: option.MenuName, |
| | | key: option.MenuID, |
| | | selected: option.Selected === 'true' |
| | | selected: parent.selected && option.Selected === 'true', |
| | | addSelf: option.OnlySelf === 'true', |
| | | tabs: option.Tabs |
| | | }) |
| | | } |
| | | }) |
| | |
| | | |
| | | if (parent.children.length === 0) { |
| | | parent.children = null |
| | | } else { |
| | | if (_checkedKeys && parent.selected) { |
| | | _checkedKeys = _checkedKeys.filter(key => key !== parent.key) |
| | | if (parent.tabs) { |
| | | let _uuid = Utils.getuuid() |
| | | linkMap.set(_uuid, parent.key) |
| | | |
| | | if (parent.selected) { |
| | | checkedKeysMap.set(_uuid, true) |
| | | checkedKeysMap.delete(parent.key) |
| | | |
| | | selectMap.set(_uuid, parent.key) |
| | | } |
| | | |
| | | parent.key = _uuid |
| | | } |
| | | } else { |
| | | if (parent.selected) { |
| | | checkedKeysMap.delete(parent.key) |
| | | } |
| | | if (parent.addSelf) { |
| | | let _uuid = Utils.getuuid() |
| | | linkMap.set(_uuid, parent.key) |
| | | |
| | | if (parent.selected) { |
| | | checkedKeysMap.set(_uuid, true) |
| | | } |
| | | |
| | | parent.children.unshift({ |
| | | title: parent.title + '(仅页面)', |
| | | key: _uuid, |
| | | }) |
| | | } |
| | | |
| | | if (parent.tabs) { |
| | | let _uuid = Utils.getuuid() |
| | | linkMap.set(_uuid, parent.key) |
| | | |
| | | if (parent.selected) { |
| | | selectMap.set(_uuid, parent.key) |
| | | } |
| | | |
| | | parent.key = _uuid |
| | | } |
| | | |
| | | parent.children = this.getTree(parent.children, options) |
| | | } |
| | | }) |
| | | |
| | | return parents |
| | | } |
| | | |
| | | getSelectTree = (parents, options) => { |
| | | parents.forEach(parent => { |
| | | parent.children = [] |
| | | |
| | | options.forEach(option => { |
| | | if (option.ParentID === parent.key) { |
| | | parent.children.push({ |
| | | title: option.MenuName, |
| | | key: option.MenuID, |
| | | tabs: option.Tabs |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | |
| | | parent.key = Utils.getuuid() |
| | | if (parent.children.length === 0) { |
| | | parent.children = null |
| | | } else { |
| | | parent.children = this.getSelectTree(parent.children, options) |
| | | } |
| | | }) |
| | | |
| | |
| | | } |
| | | |
| | | onCheck = (checkedKeys, info) => { |
| | | console.log(checkedKeys) |
| | | this.setState({ |
| | | checkedKeys: checkedKeys, |
| | | halfCheckedKeys: info.halfCheckedKeys, |
| | |
| | | if (initCheckKeys) { |
| | | _keys = initCheckKeys |
| | | } else { |
| | | _keys = checkedKeys.concat(halfCheckedKeys) |
| | | let _cKeys = checkedKeys.concat(halfCheckedKeys) |
| | | _cKeys.forEach(key => { |
| | | if (linkMap.has(key)) { |
| | | _keys.push(linkMap.get(key)) |
| | | } else { |
| | | _keys.push(key) |
| | | } |
| | | }) |
| | | _cKeys = new Map(_cKeys.map(key => [key, true])) |
| | | _keys = new Map(_keys.map(key => [key, true])) |
| | | |
| | | Array.from(selectMap.keys()).forEach(key => { |
| | | if (!_cKeys.has(key)) { |
| | | _keys.delete(selectMap.get(key)) |
| | | } |
| | | }) |
| | | |
| | | _keys = Array.from(_keys.keys()) |
| | | } |
| | | |
| | | let _LText = _keys.map(key => `select '${key}' as MenuID`) |
| | |
| | | }) |
| | | this.setState({ |
| | | submitloading: false, |
| | | menuTrees: null, |
| | | checkedKeys: [], |
| | | menuOpenKeys: [], |
| | | selectMenuTrees: null, |
| | | selectMenuOpenKeys: [] |
| | | }, () => { |
| | | this.getAllMenuList() |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | |
| | | .role-title { |
| | | display: inline-block; |
| | | width: 100%; |
| | | // color: #36c6d3; |
| | | color: #1890ff; |
| | | .anticon-bank { |
| | | margin-right: 5px; |
| | |
| | | float: right; |
| | | input { |
| | | border-radius: 20px; |
| | | // border: 1px solid #e9e9e9; |
| | | height: 30px; |
| | | } |
| | | } |
| | |
| | | |
| | | // 权限过滤 |
| | | if (this.props.menuType !== 'HS') { |
| | | config.action = config.action.filter(item => permAction[item.uuid]) |
| | | config.action = config.action.filter(item => permAction[item.uuid] || (item.linkTab && permAction[item.linkTab])) |
| | | } |
| | | |
| | | // 1、筛选字段集,2、过滤隐藏列及合并列中的字段uuid |
| | |
| | | } |
| | | |
| | | let _sort = 0 |
| | | let btntabs = [] |
| | | |
| | | let btnParam = { // 添加菜单按钮 |
| | | func: 'sPC_Button_AddUpt', |
| | |
| | | Template: menu.PageParam.Template || '', |
| | | PageParam: '', |
| | | LongParam: '', |
| | | LText: _config.action.map(item => { |
| | | _sort++ |
| | | return `select '${item.uuid}' as menuid, '${item.label}' as menuname, '${_sort * 10}' as Sort` |
| | | }) |
| | | LText: [] |
| | | } |
| | | |
| | | _config.action.forEach(item => { |
| | | _sort++ |
| | | if (item.OpenType === 'popview') { |
| | | btntabs.push({ |
| | | uuid: item.uuid, |
| | | linkTab: item.linkTab, |
| | | label: item.label, |
| | | sort: _sort |
| | | }) |
| | | } else { |
| | | btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${_sort * 10}' as Sort`) |
| | | } |
| | | }) |
| | | |
| | | btnParam.LText = btnParam.LText.join(' union all ') |
| | | btnParam.LText = Utils.formatOptions(btnParam.LText) |
| | |
| | | |
| | | let _LText = [] |
| | | |
| | | btntabs.forEach(item => { |
| | | _LText.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${item.sort * 10}' as Sort`) |
| | | }) |
| | | _config.tabgroups.forEach(groupId => { |
| | | _config[groupId].forEach(item => { |
| | | _sort++ |
| | |
| | | tabview: _tabview |
| | | } |
| | | |
| | | this.state.copyActions.forEach(item => { |
| | | let _param = { |
| | | func: 'sPC_MainMenu_Del', |
| | | MenuID: item |
| | | } |
| | | Api.getSystemConfig(_param) |
| | | }) |
| | | |
| | | this.props.handleView(param) |
| | | } |
| | | |
| | |
| | | Template: 'SubTable', |
| | | PageParam: '', |
| | | LongParam: '', |
| | | LText: config.action.map((item, index) => { |
| | | return `select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort` |
| | | }) |
| | | LText: [] |
| | | } |
| | | |
| | | let btntabs = [] |
| | | |
| | | config.action.forEach((item, index) => { |
| | | if (item.OpenType === 'popview') { |
| | | btntabs.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort`) |
| | | } else { |
| | | btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort`) |
| | | } |
| | | }) |
| | | |
| | | btnParam.LText = btnParam.LText.join(' union all ') |
| | | btnParam.LText = Utils.formatOptions(btnParam.LText) |
| | | btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) |
| | | |
| | | let tabParam = { // 添加标签按钮tab页 |
| | | func: 'sPC_sMenusTab_AddUpt', |
| | | MenuID: _config.uuid, |
| | | LText: btntabs.join(' union all ') |
| | | } |
| | | |
| | | tabParam.LText = Utils.formatOptions(tabParam.LText) |
| | | tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) |
| | | |
| | | let param = { |
| | | func: 'sPC_Tab_AddUpt', |
| | |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | this.submitAction(btnParam) |
| | | this.submitAction(btnParam, tabParam) |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | |
| | | /** |
| | | * @description 保存或修改菜单按钮 |
| | | */ |
| | | submitAction = (param) => { |
| | | submitAction = (btnParam, tabParam) => { |
| | | const { config } = this.state |
| | | |
| | | new Promise(resolve => { |
| | | if (param.LText) { |
| | | Api.getSystemConfig(param).then(res => { |
| | | if (res.status) { |
| | | resolve(true) |
| | | } else { |
| | | let deffers = [] |
| | | |
| | | if (tabParam.LText) { |
| | | let defer = new Promise(resolve => { |
| | | Api.getSystemConfig(tabParam).then(result => { |
| | | resolve(result) |
| | | }) |
| | | }) |
| | | deffers.push(defer) |
| | | } |
| | | |
| | | if (btnParam.LText) { |
| | | let defer = new Promise(resolve => { |
| | | Api.getSystemConfig(btnParam).then(result => { |
| | | if (result.status) { |
| | | this.setState({ // 保存成功后清空复制列表 |
| | | copyActions: [] |
| | | }) |
| | | } |
| | | resolve(result) |
| | | }) |
| | | }) |
| | | deffers.push(defer) |
| | | } |
| | | |
| | | if (deffers.length === 0) { |
| | | resolve(true) |
| | | } else { |
| | | Promise.all(deffers).then(result => { |
| | | let error = false |
| | | result.forEach(res => { |
| | | if (!res.status) { |
| | | error = res |
| | | } |
| | | }) |
| | | |
| | | if (error) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | message: error.message, |
| | | duration: 10 |
| | | }) |
| | | resolve(false) |
| | | } else { |
| | | resolve(true) |
| | | } |
| | | }) |
| | | } else { |
| | | resolve(true) |
| | | } |
| | | }).then(response => { |
| | | if (response === false) return response |