| | |
| | | * @description 获取或修改本地配置,增加appkey |
| | | */ |
| | | getLocalConfig (param) { |
| | | param.userid = sessionStorage.getItem('UserID') |
| | | param.userid = sessionStorage.getItem('UserID') || '' |
| | | param.lang = localStorage.getItem('lang') || '' |
| | | param.SessionUid = localStorage.getItem('SessionUid') || '' |
| | | param.LoginUID = sessionStorage.getItem('LoginUID') || '' |
| | |
| | | modifyMainMenu, |
| | | modifyTabview, |
| | | resetState, |
| | | resetDebug, |
| | | resetEditState, |
| | | resetEditLevel, |
| | | initPermission, |
| | |
| | | if (!result) return |
| | | |
| | | if (result.status) { |
| | | if (result.debug === 'true') { // 是否为debug模式,即可复制菜单参数 |
| | | this.props.resetDebug() |
| | | } |
| | | |
| | | let MainMenuId = sessionStorage.getItem('MainMenu') // 是否为打开新页面 |
| | | if (MainMenuId) { |
| | | // 通过url中menuid筛选出选中的主菜单 |
| | |
| | | }), |
| | | systems: result.Systems.filter(sys => sys.LinkUrl1 && sys.AppKey !== window.GLOB.appkey) |
| | | }) |
| | | |
| | | if (result.dataM) { |
| | | this.props.modifyDataManager(true) |
| | | } |
| | | } else { |
| | | notification.error({ |
| | | top: 92, |
| | |
| | | async getRolesMenu () { |
| | | // 获取角色权限 |
| | | let promiseRole = new Promise(resolve => { |
| | | Api.getSystemConfig({func: 'sPC_Get_RolesMenu'}).then(result => { |
| | | let _permAction = {} |
| | | let _permRoles = [] |
| | | if (result && result.status) { |
| | | if (result.UserRoles) { |
| | | result.UserRoles.forEach(role => { |
| | | _permRoles.push(role.RoleID) |
| | | Api.getSystemConfig({func: 's_Get_TrdMenu_Role', edition_type: 'Y'}).then(result => { |
| | | let _permAction = {} // 按钮权限 |
| | | let _permMenus = {} // 菜单权限,字段透视等 |
| | | let menulist = [] // 三级菜单列表 |
| | | |
| | | role.RoleMenu.forEach(menu => { |
| | | if (!menu.MenuID) return |
| | | _permAction[menu.MenuID] = true |
| | | if (result && result.status) { |
| | | if (result.UserRoles_Menu) { |
| | | result.UserRoles_Menu.forEach(menu => { |
| | | if (!menu.MenuID) return |
| | | _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: _permAction, permRoles: _permRoles}) |
| | | resolve({permAction: _permAction}) |
| | | }) |
| | | }) |
| | | |
| | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | let mainMenu = null |
| | | if (result && result.status) { |
| | | if (result.debug === 'true') { // 是否为debug模式,即可复制菜单参数 |
| | | this.props.resetDebug() |
| | | } |
| | | |
| | | let MainMenuId = sessionStorage.getItem('MainMenu') // 是否为打开新页面 |
| | | if (MainMenuId) { |
| | | // 通过url中menuid筛选出选中的主菜单 |
| | |
| | | }), |
| | | systems: result.Systems.filter(sys => sys.LinkUrl1 && sys.AppKey !== window.GLOB.appkey) |
| | | }) |
| | | |
| | | if (result.dataM) { |
| | | this.props.modifyDataManager(true) |
| | | } |
| | | } else if (result) { |
| | | notification.error({ |
| | | top: 92, |
| | |
| | | |
| | | let _role = await promiseRole |
| | | |
| | | this.props.initActionPermission(_role.permRoles, _role.permAction) |
| | | this.props.initActionPermission(_role.permAction) |
| | | } |
| | | |
| | | reload = () => { |
| | |
| | | let _userName = sessionStorage.getItem('User_Name') |
| | | let _avatar = avatar |
| | | |
| | | 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')) { |
| | |
| | | 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) // 头像 |
| | | } |
| | | |
| | | if (res.dataM) { |
| | | this.props.modifyDataManager(true) |
| | | } |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | |
| | | _avatar = Utils.getrealurl(_avatar) // 头像 |
| | | this.setState({avatar: _avatar}) |
| | | } |
| | | |
| | | this.getRolesMenu() |
| | | } |
| | | |
| | | componentDidMount () { |
| | | // 获取角色菜单权限 |
| | | Api.getSystemConfig({func: 's_Get_TrdMenu_Role'}).then(result => { |
| | | if (!result) return |
| | | if (result.status) { |
| | | let _permMenus = {} |
| | | let menulist = [] |
| | | |
| | | if (result.UserRoles) { |
| | | let iframes = ['Main/Index', 'bda/rdt', 'Home/rdt'] |
| | | let menukeys = [] |
| | | |
| | | result.UserRoles.forEach(role => { |
| | | role.RoleMenu.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 |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | // 获取系统的版本信息,延时查询 |
| | | setTimeout(() => { |
| | | new Promise((resolve, reject) => { |
| | | Api.getAppVersion(resolve, reject) |
| | | }).then(res => { |
| | | this.setState({ |
| | | thdMenuList: menulist |
| | | oriVersion: res.oldVersion, |
| | | newVersion: res.newVersion |
| | | }) |
| | | |
| | | this.props.initMenuPermission(_permMenus) |
| | | } else { |
| | | notification.error({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | // 获取系统的版本信息 |
| | | new Promise((resolve, reject) => { |
| | | Api.getAppVersion(resolve, reject) |
| | | }).then(res => { |
| | | this.setState({ |
| | | oriVersion: res.oldVersion, |
| | | newVersion: res.newVersion |
| | | }) |
| | | }) |
| | | }, 1000) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | modifyMainMenu: (selectmenu) => dispatch(modifyMainMenu(selectmenu)), |
| | | resetEditState: (state) => dispatch(resetEditState(state)), |
| | | resetEditLevel: (level) => dispatch(resetEditLevel(level)), |
| | | initActionPermission: (permRoles, permAction) => dispatch(initActionPermission(permRoles, permAction)), |
| | | initActionPermission: (permAction) => dispatch(initActionPermission(permAction)), |
| | | initPermission: (sysRoles, permFuncField) => dispatch(initPermission(sysRoles, permFuncField)), |
| | | initMenuPermission: (permMenus) => dispatch(initMenuPermission(permMenus)), |
| | | modifyDataManager: (dataManager) => dispatch(modifyDataManager(dataManager)), |
| | | resetState: () => dispatch(resetState()), |
| | | resetDebug: () => dispatch(resetDebug()), |
| | | logout: () => dispatch(logout()) |
| | | } |
| | | } |
| | |
| | | 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 |
| | |
| | | import moment from 'moment' |
| | | import 'moment/locale/zh-cn' |
| | | |
| | | import {modifyTabview, toggleIsiframe, refreshTabView} from '@/store/action' |
| | | import { modifyTabview, toggleIsiframe } from '@/store/action' |
| | | import asyncComponent from '@/utils/asyncLoadComponent' |
| | | import NotFount from '@/components/404' |
| | | import options from '@/store/options.js' |
| | | import mzhCN from '@/locales/zh-CN/main.js' |
| | | import menUS from '@/locales/en-US/main.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | |
| | | import './index.scss' |
| | | |
| | |
| | | } |
| | | |
| | | state = { |
| | | activeId: '', |
| | | tabviews: null, // 标签集 |
| | | iFrameHeight: 0, |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? mzhCN : menUS |
| | |
| | | return tab.MenuID !== menu.MenuID |
| | | }) |
| | | |
| | | if (menu.selected) { |
| | | tabs[0] && (tabs[0].selected = true) |
| | | if (menu.selected && tabs[0]) { |
| | | tabs[0].selected = true |
| | | this.setState({ |
| | | activeId: tabs[0].MenuID || '' |
| | | }) |
| | | |
| | | if (this.props.isiframe) { |
| | | this.props.toggleIsiframe(false) |
| | | } |
| | | } |
| | | |
| | | this.props.modifyTabview(tabs) |
| | |
| | | e.stopPropagation() |
| | | window.GLOB.CacheMap = new Map() |
| | | |
| | | let _menu = { |
| | | MenuID: menu.MenuID, |
| | | position: 'view' |
| | | } |
| | | this.props.refreshTabView(_menu) |
| | | MKEmitter.emit('reloadMenuView', menu.MenuID) |
| | | } |
| | | |
| | | changeTab = (e, menu) => { |
| | |
| | | return tab |
| | | }) |
| | | |
| | | if (menu) { |
| | | let _isiframe = this.props.isiframe |
| | | if (menu.type === 'iframe') { |
| | | _isiframe = true |
| | | } else { |
| | | _isiframe = false |
| | | } |
| | | |
| | | if (_isiframe !== this.props.isiframe) { |
| | | this.props.toggleIsiframe(_isiframe) |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | tabviews: tabs |
| | | tabviews: tabs, |
| | | activeId: menu.MenuID || '' |
| | | }, () => { |
| | | if (menu.MenuID) { |
| | | MKEmitter.emit('resetActiveMenu', menu.MenuID) |
| | | } |
| | | }) |
| | | |
| | | this.props.modifyTabview(tabs) |
| | |
| | | return (<Iframe key={view.MenuID} title={view.MenuName} MenuName={view.MenuName} url={service + view.LinkUrl}/>) |
| | | } else { |
| | | return (<NotFount key={view.MenuID} />) |
| | | } |
| | | } |
| | | |
| | | resetWindow = (view) => { |
| | | // 窗口在iframe与普通页面切换时,修改左侧菜单栏样式 |
| | | if (!view) return |
| | | let _isiframe = this.props.isiframe |
| | | if (view && view.type === 'iframe') { |
| | | _isiframe = true |
| | | } else { |
| | | _isiframe = false |
| | | } |
| | | |
| | | if (_isiframe !== this.props.isiframe) { |
| | | this.props.toggleIsiframe(_isiframe) |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (nextProps.tabviews && !is(fromJS(this.state.tabviews), fromJS(nextProps.tabviews))) { |
| | | let view = nextProps.tabviews.filter(tab => tab.selected)[0] |
| | | |
| | | // 窗口在iframe与普通页面切换时,修改左侧菜单栏样式 |
| | | let activeId = '' |
| | | if (view) { |
| | | let _isiframe = this.props.isiframe |
| | | if (view.type === 'iframe') { |
| | | _isiframe = true |
| | | } else { |
| | | _isiframe = false |
| | | } |
| | | |
| | | if (_isiframe !== this.props.isiframe) { |
| | | this.props.toggleIsiframe(_isiframe) |
| | | } |
| | | |
| | | activeId = view.MenuID |
| | | } |
| | | |
| | | // 保存修改标签集 |
| | | this.setState({ |
| | | tabviews: nextProps.tabviews |
| | | tabviews: nextProps.tabviews, |
| | | activeId |
| | | }) |
| | | |
| | | let node = document.getElementById('root').parentNode.parentNode |
| | |
| | | |
| | | render () { |
| | | const { menuType } = this.props |
| | | const { tabviews } = this.state |
| | | let view = tabviews.filter(tab => tab.selected)[0] |
| | | this.resetWindow(view) |
| | | let selectedTabId = view ? view.MenuID : '' |
| | | const { tabviews, activeId } = this.state |
| | | |
| | | return ( |
| | | <section className={'flex-container content-box' + (this.props.collapse ? ' collapsed' : '')}> |
| | | <div className="content-header"> |
| | | {tabviews && tabviews.length > 0 && |
| | | <Tabs activeKey={selectedTabId}> |
| | | <Tabs activeKey={activeId}> |
| | | {tabviews.map(view => { |
| | | return ( |
| | | <Tabs.TabPane |
| | |
| | | const mapDispatchToProps = (dispatch) => { |
| | | return { |
| | | modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)), |
| | | refreshTabView: (refreshTab) => dispatch(refreshTabView(refreshTab)), |
| | | toggleIsiframe: (isiframe) => dispatch(toggleIsiframe(isiframe)) |
| | | } |
| | | } |
| | |
| | | 'header.form.errorTime': 'Residence time', |
| | | 'header.form.refresh': 'Refresh', |
| | | 'header.form.refresh.never': 'Don\'t refresh', |
| | | 'header.form.refresh.view': 'Refresh the page', |
| | | 'header.form.refresh.grid': 'Refresh the table', |
| | | 'header.form.refresh.maingrid': 'Refresh the main table', |
| | | 'header.form.refresh.mainline': 'Refresh the main table (rows)', |
| | | 'header.form.refresh.equaltab': 'Refresh sibling tag', |
| | | 'header.form.refresh.subgrid': 'Refresh the child table', |
| | | 'header.form.popClose': 'Label closing', |
| | |
| | | 'header.form.errorTime': '停留时间', |
| | | 'header.form.refresh': '刷新', |
| | | 'header.form.refresh.never': '不刷新', |
| | | 'header.form.refresh.view': '刷新页面', |
| | | 'header.form.refresh.grid': '刷新表格', |
| | | 'header.form.refresh.maingrid': '刷新主表', |
| | | 'header.form.refresh.mainline': '刷新主表(行)', |
| | | 'header.form.refresh.maingrid': '刷新主表(行)', |
| | | 'header.form.refresh.equaltab': '刷新同级标签', |
| | | 'header.form.refresh.subgrid': '刷新子表', |
| | | 'header.form.popClose': '标签关闭', |
| | |
| | | let _param = JSON.parse(window.decodeURIComponent(window.atob(props.match.params.param))) |
| | | |
| | | if (typeof(_param) === 'object') { |
| | | if (_param.UserID && !sessionStorage.getItem('UserID')) { |
| | | sessionStorage.setItem('UserID', _param.UserID) |
| | | } |
| | | if (_param.LoginUID && !sessionStorage.getItem('LoginUID')) { |
| | | sessionStorage.setItem('LoginUID', _param.LoginUID) |
| | | } |
| | | if (_param.User_Name && !sessionStorage.getItem('User_Name')) { |
| | | sessionStorage.setItem('User_Name', _param.User_Name) |
| | | } |
| | | _param.UserID && sessionStorage.setItem('UserID', _param.UserID) |
| | | _param.LoginUID && sessionStorage.setItem('LoginUID', _param.LoginUID) |
| | | _param.User_Name && sessionStorage.setItem('User_Name', _param.User_Name) |
| | | _param.Full_Name && sessionStorage.setItem('Full_Name', _param.Full_Name) |
| | | _param.debug && sessionStorage.setItem('debug', _param.debug) |
| | | _param.dataM && sessionStorage.setItem('dataM', _param.dataM) |
| | | _param.avatar && sessionStorage.setItem('avatar', _param.avatar) |
| | | _param.role_id && sessionStorage.setItem('role_id', _param.role_id) |
| | | _param.Member_Level && sessionStorage.setItem('Member_Level', _param.Member_Level) |
| | | |
| | | if (_param.mainlogo) { |
| | | window.GLOB.mainlogo = _param.mainlogo |
| | | } |
| | |
| | | // 重置编辑级别 |
| | | export const RESET_EDITLEVEL = 'RESET_EDITLEVEL' |
| | | |
| | | // 初始化角色权限 |
| | | export const INIT_ROLESPERMISSION = 'INIT_ROLESPERMISSION' |
| | | |
| | | // 初始化按钮权限 |
| | | export const INIT_ACTIONPERMISSION = 'INIT_ACTIONPERMISSION' |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | // 刷新tab页面 |
| | | export const refreshTabView = (refreshTab) => { |
| | | return { |
| | | type: user.REFRESH_TABVIEW, |
| | | refreshTab |
| | | } |
| | | } |
| | | |
| | | // 重置编辑状态 |
| | | export const resetEditState = (editState) => { |
| | | return { |
| | |
| | | } |
| | | |
| | | // 初始化按钮权限 |
| | | export const initActionPermission = (permRoles, permAction) => { |
| | | export const initRolesPermission = (permRoles) => { |
| | | return { |
| | | type: user.INIT_ROLESPERMISSION, |
| | | permRoles: permRoles |
| | | } |
| | | } |
| | | |
| | | // 初始化按钮权限 |
| | | export const initActionPermission = (permAction) => { |
| | | return { |
| | | type: user.INIT_ACTIONPERMISSION, |
| | | permRoles: permRoles, |
| | | permAction: permAction |
| | | } |
| | | } |
| | |
| | | debug: false, // 知否可以复制菜单参数, 是否可进入编辑模式 |
| | | editState: false, // 是否为编辑状态,值为false、true |
| | | editLevel: null, // 编辑菜单级别,值为level1、level2、level3、HS |
| | | refreshTab: null, // 刷新tabview页面信息 |
| | | permRoles: [], // 用户角色列表 |
| | | permAction: {}, // 用户按钮权限 |
| | | permMenus: {}, // 用户三级菜单权限 |
| | |
| | | ...state, |
| | | debug: true |
| | | } |
| | | case Type.REFRESH_TABVIEW: |
| | | // 刷新tab页面 |
| | | return { |
| | | ...state, |
| | | refreshTab: action.refreshTab |
| | | } |
| | | case Type.RESET_EDITSTATE: |
| | | // 重置编辑状态 |
| | | if (action.editState) { |
| | |
| | | ...state, |
| | | editLevel: action.editLevel |
| | | } |
| | | case Type.INIT_ROLESPERMISSION: |
| | | // 初始化按钮权限 |
| | | return { |
| | | ...state, |
| | | permRoles: action.permRoles |
| | | } |
| | | case Type.INIT_ACTIONPERMISSION: |
| | | // 初始化按钮权限 |
| | | return { |
| | | ...state, |
| | | permRoles: action.permRoles, |
| | | permAction: action.permAction |
| | | } |
| | | case Type.INIT_PERMISSION: |
| | |
| | | debug: false, |
| | | editState: false, |
| | | editLevel: null, |
| | | refreshTab: null, |
| | | permAction: {}, |
| | | permFuncField: [], |
| | | sysRoles: [], |
| | |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | import { refreshTabView } from '@/store/action' |
| | | import MKEmitter from '@/utils/events.js' |
| | | |
| | | import MainSearch from '@/tabviews/zshare/topSearch' |
| | | import NotFount from '@/components/404' |
| | |
| | | }) |
| | | } |
| | | |
| | | reloadMenuView = (menuId) => { |
| | | const { MenuID } = this.props |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | | this.reloadview() |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | // 组件加载时,获取菜单数据 |
| | | this.loadconfig() |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (nextProps.refreshTab && nextProps.refreshTab.MenuID === this.props.MenuID) { |
| | | this.reloadview() |
| | | this.props.refreshTabView('') |
| | | } else if (nextProps.param && !is(fromJS(this.props.param), fromJS(nextProps.param))) { |
| | | if (nextProps.param && !is(fromJS(this.props.param), fromJS(nextProps.param))) { |
| | | let search = this.state.search.map(item => { |
| | | if (item.type === 'text' && item.key === nextProps.param.searchkey) { |
| | | item.value = nextProps.param.searchval |
| | |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('reloadMenuView', this.reloadMenuView) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新,清除快捷键设置 |
| | | */ |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) |
| | | } |
| | | |
| | | changeDate = (value) => { |
| | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | menuType: state.editLevel, |
| | | tabviews: state.tabviews, |
| | | refreshTab: state.refreshTab, |
| | | permAction: state.permAction, |
| | | permRoles: state.permRoles, |
| | | dataManager: state.dataManager |
| | | } |
| | | } |
| | | |
| | | const mapDispatchToProps = (dispatch) => { |
| | | return { |
| | | refreshTabView: (refreshTab) => dispatch(refreshTabView(refreshTab)) |
| | | } |
| | | const mapDispatchToProps = () => { |
| | | return {} |
| | | } |
| | | |
| | | export default connect(mapStateToProps, mapDispatchToProps)(NormalTable) |
| | |
| | | import UtilsUpdate from '@/utils/utils-update.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | import { refreshTabView } from '@/store/action' |
| | | import MKEmitter from '@/utils/events.js' |
| | | |
| | | import MainSearch from '@/tabviews/zshare/topSearch' |
| | |
| | | BIDs: {}, // 上级表id |
| | | pickup: false, // 主表数据隐藏显示切换 |
| | | treevisible: false, // 菜单结构树弹框显示隐藏控制 |
| | | refreshtabs: null, // 需要刷新的标签集 |
| | | tabActive: null, // 标签页展开控制 |
| | | chartId: '', // 展开图表ID |
| | | statFields: [], // 合计字段 |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 获取单行数据 |
| | | */ |
| | | async loadmainLinedata (id) { |
| | | const { setting, arr_field, search, orderBy, BID, pageIndex, pageSize } = this.state |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType, this.props.dataManager, id) |
| | | |
| | | if (param.func === 'sPC_Get_TableData') { |
| | | param.menuname = this.props.MenuName || '' |
| | | } |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let data = fromJS(this.state.data).toJS() |
| | | if (result.data && result.data[0]) { |
| | | let _data = result.data[0] |
| | | |
| | | try { |
| | | data = data.map(item => { |
| | | if (item[setting.primaryKey] === _data[setting.primaryKey]) { |
| | | _data.key = item.key |
| | | return _data |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | } catch { |
| | | console.warn('数据查询错误') |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | loading: false |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.error({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取合计字段值 |
| | | */ |
| | | getStatFieldsValue = () => { |
| | |
| | | /** |
| | | * @description 表格刷新 |
| | | */ |
| | | reloadtable = () => { |
| | | MKEmitter.emit('resetTable', this.props.MenuID + 'mainTable') // 列表重置 |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | reloadtable = (btn) => { |
| | | if (!btn || btn.resetPageIndex !== 'false') { |
| | | MKEmitter.emit('resetTable', this.props.MenuID + 'mainTable') // 列表重置 |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadmaindata() |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } else { |
| | | MKEmitter.emit('resetTable', this.props.MenuID + 'mainTable', 'false') // 列表重置 |
| | | this.loadmaindata() |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 页面刷新,重新获取配置 |
| | | */ |
| | | reloadview = () => { |
| | | this.setState({ loadingview: true, viewlost: false, lostmsg: '', |
| | | this.setState({ loadingview: true, viewlost: false, config: {}, setting: null, |
| | | data: null, total: 0, loading: false, pageIndex: 1, |
| | | pageSize: 10, orderBy: '', search: '', BIDs: {}, pickup: false |
| | | }, () => { |
| | |
| | | /** |
| | | * @description 按钮操作完成后(成功或失败),页面刷新,重置页码及选择项 |
| | | */ |
| | | refreshbyaction = (position) => { |
| | | if (position === 'grid') { |
| | | this.reloadtable() |
| | | } else if (position === 'view') { |
| | | this.reloadview() |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 子表操作完成后刷新主表 |
| | | */ |
| | | handleMainTable = (type, tab) => { |
| | | if (type === 'maingrid' && tab.supMenu === 'mainTable') { |
| | | this.reloadtable() |
| | | } else if (type === 'mainline' && tab.supMenu === 'mainTable') { |
| | | this.reloadtable() |
| | | } else if ((type === 'maingrid' || type === 'mainline') && tab.supMenu) { |
| | | this.setState({ |
| | | refreshtabs: [type, tab.supMenu] |
| | | }, () => { |
| | | this.setState({ |
| | | refreshtabs: null |
| | | }) |
| | | }) |
| | | } else if (type === 'equaltab' && tab.equalTab && tab.equalTab.length > 0) { |
| | | this.setState({ |
| | | refreshtabs: tab.equalTab |
| | | }, () => { |
| | | this.setState({ |
| | | refreshtabs: null |
| | | }) |
| | | }) |
| | | refreshbyaction = (position, btn) => { |
| | | if (position === 'grid' || position === 'view') { |
| | | this.reloadtable(btn) |
| | | } |
| | | } |
| | | |
| | |
| | | this.setState({chartId: uuid}) |
| | | } |
| | | |
| | | reloadData = (menuId, id, btn) => { |
| | | const { MenuID } = this.props |
| | | |
| | | if (MenuID !== menuId) return |
| | | if (id === 'empty') return |
| | | |
| | | if (id === 'formtab') { // 表单标签页刷新 |
| | | this.reloadtable(btn) |
| | | return |
| | | } |
| | | |
| | | if (!id) { |
| | | this.reloadtable() |
| | | } else { |
| | | this.loadmainLinedata(id) |
| | | } |
| | | } |
| | | |
| | | reloadMenuView = (menuId) => { |
| | | const { MenuID } = this.props |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | | this.reloadview() |
| | | } |
| | | |
| | | resetActiveMenu = (menuId) => { |
| | | const { MenuID } = this.props |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | | this.setShortcut() |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | // 组件加载时,获取菜单数据 |
| | | this.loadconfig() |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (nextProps.refreshTab && nextProps.refreshTab.MenuID === this.props.MenuID) { |
| | | this.reloadview() |
| | | this.props.refreshTabView('') |
| | | } else if (!is(fromJS(this.props.tabviews), fromJS(nextProps.tabviews))) { |
| | | if (!is(fromJS(this.props.tabviews), fromJS(nextProps.tabviews))) { |
| | | let selectTab = nextProps.tabviews.filter(tab => tab.selected)[0] |
| | | if (selectTab && selectTab.MenuID === this.props.MenuID) { |
| | | this.setShortcut() |
| | |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('reloadMenuView', this.reloadMenuView) |
| | | MKEmitter.addListener('resetActiveMenu', this.resetActiveMenu) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新,清除快捷键设置 |
| | | */ |
| | |
| | | return |
| | | } |
| | | document.onkeydown = () => {} |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) |
| | | MKEmitter.removeListener('resetActiveMenu', this.resetActiveMenu) |
| | | } |
| | | |
| | | render() { |
| | |
| | | mainSearch={_tab.searchPass === 'true' ? search : null} |
| | | userConfig={userConfig ? userConfig[_tab.uuid] : null} |
| | | SupMenuID={this.props.MenuID} |
| | | refreshtabs={this.state.refreshtabs} |
| | | ContainerId={this.state.ContainerId} |
| | | BID={this.state.BIDs[_tab.supMenu] || ''} |
| | | BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} |
| | | handleTableId={this.handleTableId} |
| | | handleMainTable={(type) => this.handleMainTable(type, _tab)} |
| | | /> |
| | | </TabPane> |
| | | ) |
| | |
| | | return { |
| | | menuType: state.editLevel, |
| | | tabviews: state.tabviews, |
| | | refreshTab: state.refreshTab, |
| | | permAction: state.permAction, |
| | | permMenus: state.permMenus, |
| | | permRoles: state.permRoles, |
| | |
| | | } |
| | | } |
| | | |
| | | const mapDispatchToProps = (dispatch) => { |
| | | return { |
| | | refreshTabView: (refreshTab) => dispatch(refreshTabView(refreshTab)) |
| | | } |
| | | const mapDispatchToProps = () => { |
| | | return {} |
| | | } |
| | | |
| | | export default connect(mapStateToProps, mapDispatchToProps)(NormalTable) |
| | |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import options from '@/store/options.js' |
| | | import { buttonConfig, tabConfig, refCodes } from './config' |
| | | import MKEmitter from '@/utils/events.js' |
| | | |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | import SubAction from './actionList' |
| | |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: null, // 列表数据集 |
| | | selectedData: [], // 已选表格数据 |
| | | resetTable: false, // 表格重置,值在true与false之间切换,切换时表格重置 |
| | | loading: false, // 列表数据加载中 |
| | | visible: false, // 弹框显示隐藏控制 |
| | | pickup: false, // 子表数据隐藏显示切换 |
| | |
| | | */ |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (this.state.config && this.props.Tab.supMenu && !is(fromJS(this.props.BID), fromJS(nextProps.BID))) { |
| | | MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 列表重置 |
| | | this.setState({ |
| | | pageIndex: 1, |
| | | selectedData: [], |
| | | resetTable: !this.state.resetTable, |
| | | }, () => { |
| | | this.loadmaindata(nextProps.BID, 'refresh') |
| | | }) |
| | |
| | | * @description 表格刷新 |
| | | */ |
| | | reloadtable = () => { |
| | | MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 列表重置 |
| | | this.setState({ |
| | | loading: true, |
| | | selectedData: [], |
| | | resetTable: !this.state.resetTable |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | return !is(fromJS(this.state), fromJS(nextState)) || !is(fromJS(this.props), fromJS(nextProps)) |
| | | } |
| | | |
| | | /** |
| | |
| | | loading: false, // 数据加载状态 |
| | | activeKey: '', // 选中数据 |
| | | sync: false, // 是否统一请求数据 |
| | | data: null, // 数据 |
| | | data: {} // 数据 |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | let _config = fromJS(this.props.config).toJS() |
| | | let _cols = new Map() |
| | | |
| | | let _data = null |
| | | let _data = {} |
| | | let _sync = false |
| | | if (_config.setting && _config.wrap.datatype !== 'static') { |
| | | _sync = _config.setting.sync === 'true' |
| | |
| | | <Spin /> |
| | | </div> : null |
| | | } |
| | | {data ? <div className="card-row-list"> |
| | | <div className="card-row-list"> |
| | | {config.subcards.map((item, index) => ( |
| | | <Col className={activeKey === index ? 'active' : ''} key={index} span={item.setting.width || 6} onClick={() => {this.changeCard(index, item)}}> |
| | | <CardItem BID={BID} card={item} cards={config} data={data} updateStatus={this.updateStatus}/> |
| | | </Col> |
| | | ))} |
| | | </div> : null} |
| | | </div> |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { Row, Col, Empty, notification } from 'antd' |
| | | import moment from 'moment' |
| | | import md5 from 'md5' |
| | | |
| | | import Api from '@/api' |
| | | import options from '@/store/options.js' |
| | |
| | | }) |
| | | |
| | | this.setState({mainSearch: _mainSearch, self}) |
| | | this.loadmaindata(params) |
| | | |
| | | if (params.length > 0) { |
| | | this.loadmaindata(params) |
| | | } |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | |
| | | * @description 主表数据加载 |
| | | */ |
| | | loadmaindata = (params) => { |
| | | if (!params || params.length === 0) return |
| | | const { config } = this.props |
| | | let LText_field = [] |
| | | let LText = params.map((item, index) => { |
| | | let _sql = item.sql |
| | |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.LText_field = Utils.formatOptions(param.LText_field) |
| | | |
| | | if (config.cacheUseful === 'true') { |
| | | param.time_type = config.timeUnit |
| | | param.time_limit = config.cacheTime |
| | | if (config.diffUser) { |
| | | param.userid = sessionStorage.getItem('UserID') |
| | | } |
| | | param.data_md5 = md5(JSON.stringify(param)) |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { notification, Spin, Row, Col, Button, message } from 'antd' |
| | | import moment from 'moment' |
| | | import md5 from 'md5' |
| | | |
| | | import Api from '@/api' |
| | | import options from '@/store/options.js' |
| | |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import { refreshTabView } from '@/store/action' |
| | | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import NotFount from '@/components/404' |
| | | import './index.scss' |
| | | |
| | |
| | | return |
| | | } |
| | | |
| | | // 数据缓存设置 |
| | | if (config.cacheUseful === 'true') { |
| | | config.diffUser = config.diffUser !== 'false' |
| | | if (!['day', 'hour'].includes(config.timeUnit)) { |
| | | config.timeUnit = 'day' |
| | | } |
| | | config.cacheTime = config.cacheTime || 1 |
| | | } |
| | | |
| | | // 权限过滤 |
| | | if (this.props.menuType !== 'HS') { |
| | | config.components = this.filterComponent(config.components) |
| | |
| | | |
| | | let params = [] |
| | | let BID = param && param.BID ? param.BID : '' |
| | | config.components = this.formatSetting(config.components, params, mainSearch, permAction) |
| | | let inherit = {} |
| | | |
| | | if (config.cacheUseful === 'true') { // 缓存继承 |
| | | 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) |
| | | |
| | | this.setState({ |
| | | BID: BID, |
| | |
| | | } |
| | | |
| | | // 格式化默认设置 |
| | | formatSetting = (components, params, mainSearch, permAction) => { |
| | | formatSetting = (components, params, mainSearch, permAction, inherit) => { |
| | | return components.map(component => { |
| | | if (component.type === 'tabs') { |
| | | component.subtabs = component.subtabs.map(tab => { |
| | | tab.components = this.formatSetting(tab.components, [], [], permAction) |
| | | tab.components = this.formatSetting(tab.components, [], [], permAction, inherit) |
| | | tab = {...tab, ...inherit} |
| | | return tab |
| | | }) |
| | | } |
| | |
| | | * @description 主表数据加载 |
| | | */ |
| | | loadmaindata = (params) => { |
| | | const { config } = this.state |
| | | let LText_field = [] |
| | | let LText = params.map((item, index) => { |
| | | let _sql = item.sql |
| | |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.LText_field = Utils.formatOptions(param.LText_field) |
| | | |
| | | if (config.cacheUseful === 'true') { |
| | | param.time_type = config.timeUnit |
| | | param.time_limit = config.cacheTime |
| | | if (config.diffUser) { |
| | | param.userid = sessionStorage.getItem('UserID') |
| | | } |
| | | param.data_md5 = md5(JSON.stringify(param)) |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | reloadMenuView = (menuId) => { |
| | | const { MenuID } = this.props |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | | this.reloadview() |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | // 组件加载时,获取菜单数据 |
| | | this.loadconfig() |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (nextProps.refreshTab && nextProps.refreshTab.MenuID === this.props.MenuID) { |
| | | this.reloadview() |
| | | this.props.refreshTabView('') |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('reloadMenuView', this.reloadMenuView) |
| | | } |
| | | |
| | | /** |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) |
| | | } |
| | | |
| | | reloadview = () => { |
| | |
| | | } |
| | | } |
| | | |
| | | const mapDispatchToProps = (dispatch) => { |
| | | return { |
| | | refreshTabView: (refreshTab) => dispatch(refreshTabView(refreshTab)) |
| | | } |
| | | const mapDispatchToProps = () => { |
| | | return {} |
| | | } |
| | | |
| | | export default connect(mapStateToProps, mapDispatchToProps)(CustomPage) |
| | |
| | | > .ant-spin { |
| | | position: absolute; |
| | | z-index: 10; |
| | | left: calc(50% - 22px); |
| | | left: calc(50% - 16px); |
| | | top: calc(50vh - 70px); |
| | | } |
| | | |
| | |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import asyncComponent from '@/utils/asyncLoadComponent' |
| | | import MKEmitter from '@/utils/events.js' |
| | | |
| | | import FormGroup from './formgroup' |
| | | import FormAction from './actionList' |
| | | import NotFount from '@/components/404' |
| | | import {refreshTabView, modifyTabview} from '@/store/action' |
| | | import {modifyTabview} from '@/store/action' |
| | | import './index.scss' |
| | | |
| | | const { TabPane } = Tabs |
| | |
| | | static propTpyes = { |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | param: PropTypes.any, // 主表传递参数 |
| | | refresh: PropTypes.any // 刷新主表页面 |
| | | } |
| | | |
| | | state = { |
| | |
| | | arr_field: '', // 使用 sPC_Get_TableData 时的查询字段集 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: null, // 列表数据集 |
| | | configMap: {}, // 页面配置信息:下拉、按钮等 |
| | | BIDs: {}, // 上级表id |
| | | setsingle: false, // 主表单选多选切换 |
| | | pickup: false, // 主表数据隐藏显示切换 |
| | | popData: false, // 弹框页面,所选的表格数据 |
| | | visible: false, // 弹框显示隐藏控制 |
| | | primaryId: null, |
| | | refreshtabs: null |
| | | } |
| | | |
| | | /** |
| | |
| | | this.setState({ |
| | | primaryId: primaryId |
| | | }, () => { |
| | | if (btn.execSuccess === 'refresh') { |
| | | if (btn.execSuccess === 'refresh' || btn.execSuccess === 'grid') { |
| | | this.loadmaindata() |
| | | } else { |
| | | let data = {} |
| | |
| | | } |
| | | }) |
| | | } else if (type === 'success' && btn.afterExecSuccess === 'close') { |
| | | if (this.props.refresh) { |
| | | this.props.refresh(btn.execSuccess) |
| | | } else { |
| | | if (btn.execSuccess !== 'never') { |
| | | let PMenu = { |
| | | MenuID: this.props.param.parentId || '' |
| | | } |
| | | this.props.refreshTabView(PMenu) |
| | | if (btn.execSuccess !== 'never') { |
| | | MKEmitter.emit('reloadData', this.props.param.parentId, 'formtab', btn) |
| | | } |
| | | |
| | | let tabs = this.props.tabviews.filter(tab => { |
| | | tab.selected = false |
| | | if (tab.MenuID === this.props.param.parentId) { |
| | | tab.selected = true |
| | | } |
| | | |
| | | let tabs = this.props.tabviews.filter(tab => { |
| | | tab.selected = false |
| | | if (tab.MenuID === this.props.param.parentId) { |
| | | tab.selected = true |
| | | } |
| | | return tab.MenuID !== this.props.MenuID |
| | | }) |
| | | |
| | | return tab.MenuID !== this.props.MenuID |
| | | }) |
| | | |
| | | this.props.modifyTabview(tabs) |
| | | } |
| | | this.props.modifyTabview(tabs) |
| | | } else if (type === 'error' && btn.afterExecError === 'notclose') { |
| | | if (btn.execError === 'refresh') { |
| | | this.loadmaindata() |
| | | } |
| | | } else if (type === 'error' && btn.afterExecError === 'close') { |
| | | if (this.props.refresh) { |
| | | this.props.refresh(btn.execError) |
| | | } else { |
| | | if (btn.execError !== 'never') { |
| | | let PMenu = { |
| | | MenuID: this.props.param.parentId || '', |
| | | } |
| | | this.props.refreshTabView(PMenu) |
| | | if (btn.execError !== 'never') { |
| | | MKEmitter.emit('reloadData', this.props.param.parentId, 'formtab', btn) |
| | | } |
| | | |
| | | let tabs = this.props.tabviews.filter(tab => { |
| | | tab.selected = false |
| | | if (tab.MenuID === this.props.param.parentId) { |
| | | tab.selected = true |
| | | } |
| | | |
| | | let tabs = this.props.tabviews.filter(tab => { |
| | | tab.selected = false |
| | | if (tab.MenuID === this.props.param.parentId) { |
| | | tab.selected = true |
| | | } |
| | | return tab.MenuID !== this.props.MenuID |
| | | }) |
| | | |
| | | return tab.MenuID !== this.props.MenuID |
| | | }) |
| | | |
| | | this.props.modifyTabview(tabs) |
| | | } |
| | | this.props.modifyTabview(tabs) |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 子表操作完成后刷新主表 |
| | | */ |
| | | handleMainTable = (type, tab) => { |
| | | if ((type === 'maingrid' || type === 'mainline') && tab.supMenu === 'mainTable') { |
| | | this.loadmaindata() |
| | | } else if ((type === 'maingrid' || type === 'mainline') && tab.supMenu) { |
| | | this.setState({ |
| | | refreshtabs: [type, tab.supMenu] |
| | | }, () => { |
| | | this.setState({ |
| | | refreshtabs: null |
| | | }) |
| | | }) |
| | | } else if (type === 'equaltab' && tab.equalTab && tab.equalTab.length > 0) { |
| | | this.setState({ |
| | | refreshtabs: tab.equalTab |
| | | }, () => { |
| | | this.setState({ |
| | | refreshtabs: null |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取表单参数 |
| | | */ |
| | | getFormData = () => { |
| | |
| | | config: {}, |
| | | groups: null, |
| | | actions: null, |
| | | arr_field: '', |
| | | setting: null, |
| | | data: null, |
| | | configMap: {}, |
| | | BIDs: {}, |
| | | setsingle: false, |
| | | pickup: false, |
| | | popData: false, |
| | | visible: false, |
| | | primaryId: null, |
| | | refreshtabs: null |
| | | }, () => { |
| | | this.loadconfig() |
| | | }) |
| | | } |
| | | |
| | | reloadMenuView = (menuId) => { |
| | | const { MenuID } = this.props |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | | this.reloadview() |
| | | } |
| | | |
| | | reloadData = (menuId) => { |
| | | const { MenuID } = this.props |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | | this.loadmaindata() |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | this.loadconfig() |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (nextProps.refreshTab && nextProps.refreshTab.MenuID === this.props.MenuID) { |
| | | this.reloadview() |
| | | this.props.refreshTabView('') |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('reloadMenuView', this.reloadMenuView) |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | } |
| | | |
| | | /** |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | |
| | | MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | } |
| | | |
| | | render() { |
| | |
| | | Tab={_tab} |
| | | MenuID={_tab.linkTab} |
| | | SupMenuID={this.props.MenuID} |
| | | refreshtabs={this.state.refreshtabs} |
| | | ContainerId={this.state.ContainerId} |
| | | BID={this.state.BIDs[_tab.supMenu] || ''} |
| | | BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} |
| | | handleTableId={this.handleTableId} |
| | | handleMainTable={(type) => this.handleMainTable(type, _tab)} |
| | | /> : null} |
| | | </TabPane> |
| | | ) |
| | |
| | | return { |
| | | menuType: state.editLevel, |
| | | tabviews: state.tabviews, |
| | | refreshTab: state.refreshTab, |
| | | permAction: state.permAction, |
| | | dataManager: state.dataManager, |
| | | permRoles: state.permRoles |
| | |
| | | |
| | | const mapDispatchToProps = (dispatch) => { |
| | | return { |
| | | refreshTabView: (refreshTab) => dispatch(refreshTabView(refreshTab)), |
| | | modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)) |
| | | } |
| | | } |
| | |
| | | mainSearch: PropTypes.any, // 主表搜索条件 |
| | | ContainerId: PropTypes.any, // 三级菜单Container(html) ID |
| | | handleTableId: PropTypes.func, // 控制表格数据切换时,更新在主表中的id |
| | | handleMainTable: PropTypes.func, // 刷新主表 |
| | | refreshtabs: PropTypes.any, // 标签刷新控制 |
| | | userConfig: PropTypes.any, // 用户自定义设置 |
| | | } |
| | | |
| | |
| | | this.getStatFieldsValue(nextProps.BID, 'refresh') |
| | | } |
| | | }) |
| | | } else if (this.state.config && nextProps.refreshtabs && nextProps.refreshtabs.includes(this.props.Tab.uuid)) { |
| | | this.reloadtable() |
| | | } else if (!this.props.Tab.supMenu && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | if (this.state.setting) { |
| | | this.setState({}, () => { |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 获取单行数据 |
| | | */ |
| | | async loadmainLinedata (id) { |
| | | const { mainSearch, BID } = this.props |
| | | const { setting, arr_field, search, orderBy, pageIndex, pageSize } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | | searches = [...mainSearch, ...searches] |
| | | } |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, this.props.menuType, this.props.dataManager, id) |
| | | |
| | | if (param.func === 'sPC_Get_TableData') { |
| | | param.menuname = this.props.Tab.label || '' |
| | | } |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let data = fromJS(this.state.data).toJS() |
| | | if (result.data && result.data[0]) { |
| | | let _data = result.data[0] |
| | | |
| | | try { |
| | | data = data.map(item => { |
| | | if (item[setting.primaryKey] === _data[setting.primaryKey]) { |
| | | _data.key = item.key |
| | | return _data |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | } catch { |
| | | console.warn('数据查询错误') |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | loading: false |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.error({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取合计字段值 |
| | | */ |
| | | getStatFieldsValue = (bid, type) => { |
| | |
| | | /** |
| | | * @description 表格刷新 |
| | | */ |
| | | reloadtable = () => { |
| | | MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 列表重置 |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | reloadtable = (btn) => { |
| | | if (!btn || btn.resetPageIndex !== 'false') { |
| | | MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 列表重置 |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadmaindata() |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } else { |
| | | MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid, 'false') // 列表重置 |
| | | this.loadmaindata() |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 页面刷新,重新获取配置 |
| | | */ |
| | | reloadview = () => { |
| | | this.setState({ loadingview: true, viewlost: false, lostmsg: '', config: null, searchlist: null, actions: null, |
| | | columns: null, arr_field: '', setting: null, data: null, total: 0, loading: false, pageIndex: 1, pageSize: 10, |
| | | orderBy: '', search: [] |
| | | }, () => { |
| | | this.loadconfig() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮操作完成后(成功或失败),页面刷新,重置页码及选择项 |
| | | */ |
| | | refreshbyaction = (position) => { |
| | | const { Tab } = this.props |
| | | refreshbyaction = (position, btn) => { |
| | | const { Tab, SupMenuID, BID } = this.props |
| | | |
| | | if (position === 'grid') { |
| | | this.reloadtable() |
| | | } else if (position === 'view') { |
| | | this.reloadview() |
| | | } else if (position === 'maingrid') { |
| | | if (Tab.isTreeNode) { |
| | | this.reloadtable() |
| | | if (position === 'grid' || position === 'view') { |
| | | this.reloadtable(btn) |
| | | } else if (position === 'maingrid' || position === 'mainline') { |
| | | this.reloadtable(btn) |
| | | if (Tab.supMenu === 'mainTable') { |
| | | MKEmitter.emit('reloadData', SupMenuID, (BID || 'empty')) // 主表重置 |
| | | } else if (Tab.supMenu) { |
| | | MKEmitter.emit('reloadData', Tab.supMenu, (BID || 'empty')) // 主表重置 |
| | | } else if (!Tab.supMenu && Tab.level === 0) { |
| | | MKEmitter.emit('reloadData', SupMenuID, (BID || 'empty')) // 树形结构,0级标签 |
| | | } |
| | | this.props.handleMainTable('maingrid') |
| | | } else if (position === 'equaltab') { |
| | | this.reloadtable() |
| | | this.props.handleMainTable('equaltab') |
| | | } else if (position === 'mainline') { |
| | | this.reloadtable() |
| | | this.props.handleMainTable('mainline') |
| | | this.reloadtable(btn) |
| | | if (Tab.equalTab && Tab.equalTab.length > 0) { |
| | | MKEmitter.emit('reloadData', Tab.equalTab.join(',')) // 同级标签重置 |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | this.setState({chartId: uuid}) |
| | | } |
| | | |
| | | reloadData = (menuId, id) => { |
| | | const { MenuID } = this.props |
| | | |
| | | if (menuId.indexOf(MenuID) === -1) return |
| | | if (id === 'empty') return |
| | | |
| | | if (!id) { |
| | | this.reloadtable() |
| | | } else { |
| | | this.loadmainLinedata(id) |
| | | } |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | // 组件加载时,获取菜单数据 |
| | | this.loadconfig() |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { // handleMainTable 函数判断时不相等 |
| | | return !is(fromJS({...this.props, handleMainTable: '', handleTableId: ''}), fromJS({...nextProps, handleMainTable: '', handleTableId: ''})) || !is(fromJS(this.state), fromJS(nextState)) |
| | | shouldComponentUpdate (nextProps, nextState) { // handleTableId 函数判断时不相等 |
| | | return !is(fromJS({...this.props, handleTableId: ''}), fromJS({...nextProps, handleTableId: ''})) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | } |
| | | |
| | | /** |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | } |
| | | |
| | | render() { |
| | |
| | | /** |
| | | * @description 表格刷新 |
| | | */ |
| | | reloadtable = () => { |
| | | MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 列表重置 |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | reloadtable = (btn) => { |
| | | if (!btn || btn.resetPageIndex !== 'false') { |
| | | MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 列表重置 |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadmaindata() |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } else { |
| | | MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid, 'false') // 列表重置 |
| | | this.loadmaindata() |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 页面刷新,重新获取配置 |
| | | */ |
| | | reloadview = () => { |
| | | this.setState({ loadingview: true, viewlost: false, lostmsg: '', config: null, searchlist: null, actions: null, columns: null, |
| | | arr_field: '', setting: null, data: null, total: 0, loading: false, pageIndex: 1, pageSize: 10, orderBy: '', search: '' |
| | | }, () => { |
| | | this.loadconfig() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮操作完成后(成功或失败),页面刷新,重置页码及选择项 |
| | | */ |
| | | refreshbyaction = (position) => { |
| | | if (position === 'grid' || position === 'maingrid') { |
| | | this.reloadtable() |
| | | this.props.refreshSupView() |
| | | } else if (position === 'view') { |
| | | this.reloadview() |
| | | refreshbyaction = (position, btn) => { |
| | | if (position === 'grid' || position === 'view' || position === 'maingrid') { |
| | | this.reloadtable(btn) |
| | | this.props.refreshSupView() |
| | | } else if (position === 'trigger') { // 日历子表触发标签点击事件 |
| | | this.props.closeModalView && this.props.closeModalView() |
| | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | import {refreshTabView, modifyTabview} from '@/store/action' |
| | | |
| | | import NotFount from '@/components/404' |
| | | import './index.scss' |
| | | |
| | |
| | | BIDs: {}, // 上级表id |
| | | visible: false, // 弹框显示隐藏控制 |
| | | treevisible: false, // 菜单结构树弹框显示隐藏控制 |
| | | refreshtabs: null, // 需要刷新的标签集 |
| | | confirmLoading: false,// 自定义设置模态框加载中 |
| | | revertLoading: false, // 恢复默认设置 |
| | | settingVisible: false,// 自定义设置模态框 |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 子表操作完成后刷新主表 |
| | | */ |
| | | handleMainTable = (type, tab) => { |
| | | if (type === 'maingrid' && (tab.supMenu === 'mainTable' || (!tab.supMenu && tab.level === 0))) { |
| | | this.loadmaindata() |
| | | } else if (type === 'mainline' && (tab.supMenu === 'mainTable' || (!tab.supMenu && tab.level === 0))) { |
| | | this.loadmaindata() |
| | | } else if ((type === 'maingrid' || type === 'mainline') && tab.supMenu) { |
| | | this.setState({ |
| | | refreshtabs: [type, tab.supMenu] |
| | | }, () => { |
| | | this.setState({ |
| | | refreshtabs: null |
| | | }) |
| | | }) |
| | | } else if (type === 'equaltab' && tab.equalTab && tab.equalTab.length > 0) { |
| | | this.setState({ |
| | | refreshtabs: tab.equalTab |
| | | }, () => { |
| | | this.setState({ |
| | | refreshtabs: null |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 表格Id变化 |
| | | */ |
| | | handleTableId = (type, id, data) => { |
| | |
| | | }) |
| | | } |
| | | |
| | | reloadData = (menuId) => { |
| | | const { MenuID } = this.props |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | | this.loadmaindata() |
| | | } |
| | | |
| | | reloadMenuView = (menuId) => { |
| | | const { MenuID } = this.props |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | | this.reloadview() |
| | | } |
| | | |
| | | resetActiveMenu = (menuId) => { |
| | | const { MenuID } = this.props |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | | this.setShortcut() |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | // 组件加载时,获取菜单数据 |
| | | this.loadconfig() |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (nextProps.refreshTab && nextProps.refreshTab.MenuID === this.props.MenuID) { |
| | | this.reloadview() |
| | | this.props.refreshTabView('') |
| | | } else if (!is(fromJS(this.props.tabviews), fromJS(nextProps.tabviews))) { |
| | | let selectTab = nextProps.tabviews.filter(tab => tab.selected)[0] |
| | | if (selectTab && selectTab.MenuID === this.props.MenuID) { |
| | | this.setShortcut() |
| | | } |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('reloadMenuView', this.reloadMenuView) |
| | | MKEmitter.addListener('resetActiveMenu', this.resetActiveMenu) |
| | | } |
| | | |
| | | /** |
| | |
| | | return |
| | | } |
| | | document.onkeydown = () => {} |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) |
| | | MKEmitter.removeListener('resetActiveMenu', this.resetActiveMenu) |
| | | } |
| | | |
| | | changeExpandedKeys = (expandedKeys) => { |
| | |
| | | mainSearch={null} |
| | | userConfig={userConfig ? userConfig[_tab.uuid] : null} |
| | | SupMenuID={this.props.MenuID} |
| | | refreshtabs={this.state.refreshtabs} |
| | | ContainerId={this.state.ContainerId} |
| | | BID={this.state.BIDs[_tab.supMenu] || ''} |
| | | BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} |
| | | handleTableId={this.handleTableId} |
| | | handleMainTable={(type) => this.handleMainTable(type, _tab)} |
| | | /> : null} |
| | | </TabPane> |
| | | ) |
| | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | menuType: state.editLevel, |
| | | tabviews: state.tabviews, |
| | | refreshTab: state.refreshTab, |
| | | permAction: state.permAction, |
| | | permRoles: state.permRoles, |
| | | memberLevel: state.memberLevel, |
| | |
| | | } |
| | | } |
| | | |
| | | const mapDispatchToProps = (dispatch) => { |
| | | return { |
| | | refreshTabView: (refreshTab) => dispatch(refreshTabView(refreshTab)), |
| | | modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)) |
| | | } |
| | | const mapDispatchToProps = () => { |
| | | return {} |
| | | } |
| | | |
| | | export default connect(mapStateToProps, mapDispatchToProps)(TreePage) |
| | |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | updateStatus = (type, positon) => { |
| | | updateStatus = (type, positon, btn) => { |
| | | if (type === 'refresh') { |
| | | this.props.refreshdata(positon) |
| | | this.props.refreshdata(positon, btn) |
| | | } else if (type === 'trigger') { // 日历中的新标签页触发事件 |
| | | this.props.refreshdata('trigger') |
| | | } |
| | |
| | | |
| | | // 操作后刷新主表 |
| | | reloadtable = () => { |
| | | this.props.updateStatus('refresh', 'grid') |
| | | const { btn } = this.props |
| | | this.props.updateStatus('refresh', 'grid', btn) |
| | | } |
| | | |
| | | /** |
| | |
| | | columns={logcolumns} |
| | | selectedData={[data]} |
| | | ContainerId={ContainerId} |
| | | updateStatus={this.updateStatus} |
| | | updateStatus={this.props.refreshdata} |
| | | /> |
| | | ) |
| | | } else if (item.OpenType === 'popview') { |
| | |
| | | BData={BData} |
| | | setting={setting} |
| | | selectedData={[data]} |
| | | updateStatus={this.updateStatus} |
| | | updateStatus={this.props.refreshdata} |
| | | /> |
| | | ) |
| | | } else if (item.OpenType === 'tab' || item.OpenType === 'blank') { |
| | |
| | | MenuID={MenuID} |
| | | setting={setting} |
| | | selectedData={[data]} |
| | | updateStatus={this.updateStatus} |
| | | updateStatus={this.props.refreshdata} |
| | | /> |
| | | ) |
| | | } else if (item.OpenType === 'innerpage' || item.OpenType === 'outerpage') { |
| | |
| | | show={show} |
| | | setting={setting} |
| | | selectedData={[data]} |
| | | updateStatus={this.updateStatus} |
| | | updateStatus={this.props.refreshdata} |
| | | /> |
| | | ) |
| | | } else if (item.OpenType === 'funcbutton') { |
| | |
| | | show={show} |
| | | setting={setting} |
| | | selectedData={[data]} |
| | | updateStatus={this.updateStatus} |
| | | updateStatus={this.props.refreshdata} |
| | | /> |
| | | ) |
| | | } else if (item.funcType === 'print') { |
| | |
| | | setting={setting} |
| | | selectedData={[data]} |
| | | ContainerId={ContainerId} |
| | | updateStatus={this.updateStatus} |
| | | updateStatus={this.props.refreshdata} |
| | | /> |
| | | ) |
| | | } |
| | |
| | | |
| | | return null |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 操作完成后,数据刷新 |
| | | */ |
| | | updateStatus = (type, positon) => { |
| | | if (type === 'refresh') { |
| | | this.props.refreshdata(positon) |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | columns={this.props.logcolumns} |
| | | selectedData={[]} |
| | | ContainerId={this.props.ContainerId} |
| | | updateStatus={this.updateStatus} |
| | | updateStatus={this.props.refreshdata} |
| | | /> |
| | | </div> |
| | | </Card> : null} |
| | |
| | | this.props.handleTableId(this.props.tableId, _id, data) |
| | | } |
| | | |
| | | /** |
| | | * @description 操作完成后,数据刷新 |
| | | */ |
| | | updateStatus = (type, positon, btn) => { |
| | | if (type === 'refresh') { |
| | | this.props.refreshdata(positon, btn) |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | const { plot, data, loading, BID, BData, Tab, MenuID, config, logcolumns, ContainerId, MenuName } = this.props |
| | | const { card, colMap, selectKey, actionList } = this.state |
| | |
| | | show="icon" |
| | | MenuName={MenuName} |
| | | setting={config.setting} |
| | | updateStatus={() => {}} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | | ) |
| | | } else { |
| | |
| | | MenuName={MenuName} |
| | | setting={config.setting} |
| | | getexceloutparam={this.props.getexceloutparam} |
| | | updateStatus={() => {}} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | | ) |
| | | } |
| | |
| | | setting={config.setting} |
| | | ContainerId={ContainerId} |
| | | switchCard={this.switchCard} |
| | | refreshdata={this.props.refreshdata} |
| | | refreshdata={this.updateStatus} |
| | | /> |
| | | )) |
| | | } |
| | |
| | | setting={config.setting} |
| | | ContainerId={ContainerId} |
| | | switchCard={() => {}} |
| | | refreshdata={this.props.refreshdata} |
| | | refreshdata={this.updateStatus} |
| | | /> : null |
| | | } |
| | | {(loading || !card.insertAction) && (!data || data.length === 0) ? <Empty description={false}/> : null} |
| | |
| | | refreshdata: PropTypes.func, // 表格中排序列、页码的变化时刷新 |
| | | handleTableId: PropTypes.func, // 数据切换 |
| | | chgSelectData: PropTypes.func, // 数据切换 |
| | | refreshbyaction: PropTypes.func, // 数据切换 |
| | | refreshbyaction: PropTypes.func, // 按钮执行完成后刷新 |
| | | } |
| | | |
| | | state = { |
| | |
| | | return |
| | | } |
| | | MKEmitter.removeListener('resetTable', this.resetTable) |
| | | } |
| | | |
| | | updateStatus = (type, positon, btn) => { |
| | | if (type === 'refresh') { |
| | | this.props.refreshbyaction(positon, btn) |
| | | } |
| | | } |
| | | |
| | | // 字段透视 |
| | |
| | | MenuName={this.props.MenuName} |
| | | columns={this.props.logcolumns} |
| | | ContainerId={this.props.ContainerId} |
| | | updateStatus={this.props.refreshbyaction} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | | ) |
| | | } else if (btn.OpenType === 'popview') { |
| | |
| | | selectedData={[record]} |
| | | BData={this.props.BData} |
| | | setting={this.props.setting} |
| | | updateStatus={this.props.refreshbyaction} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | | ) |
| | | } else if (btn.OpenType === 'tab' || btn.OpenType === 'blank') { |
| | |
| | | selectedData={[record]} |
| | | MenuID={this.props.MenuID} |
| | | setting={this.props.setting} |
| | | updateStatus={this.props.refreshbyaction} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | | ) |
| | | } else if (btn.OpenType === 'innerpage' || btn.OpenType === 'outerpage') { |
| | |
| | | btn={btn} |
| | | selectedData={[record]} |
| | | setting={this.props.setting} |
| | | updateStatus={this.props.refreshbyaction} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | | ) |
| | | } |
| | |
| | | this.props.handleTableId(this.props.tableId, _id, _data) |
| | | } |
| | | |
| | | resetTable = (id) => { |
| | | resetTable = (id, repage) => { |
| | | const { MenuID, tableId } = this.props |
| | | |
| | | if (id !== (MenuID + tableId)) return |
| | | |
| | | this.setState({ |
| | | pageIndex: 1, |
| | | selectedRowKeys: [], |
| | | activeIndex: null |
| | | }) |
| | | if (repage === 'false') { |
| | | this.setState({ |
| | | selectedRowKeys: [], |
| | | activeIndex: null |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | pageIndex: 1, |
| | | selectedRowKeys: [], |
| | | activeIndex: null |
| | | }) |
| | | } |
| | | } |
| | | |
| | | render() { |
| | |
| | | text: this.props.dict['header.form.refresh.never'] |
| | | }, { |
| | | value: 'grid', |
| | | text: this.props.dict['header.form.refresh.grid'] |
| | | }, { |
| | | value: 'view', |
| | | text: this.props.dict['header.form.refresh.view'] |
| | | text: this.props.dict['header.form.refresh'] |
| | | }], |
| | | currentoptions: [{ // 不返回时-不刷新、刷新 |
| | | value: 'never', |
| | |
| | | UNSAFE_componentWillMount () { |
| | | const { card } = this.props |
| | | let _intertype = '' |
| | | let _success = 'close' |
| | | let _error = 'notclose' |
| | | |
| | | this.props.formlist.forEach(form => { |
| | | if (form.key === 'intertype') { |
| | |
| | | if (card.btnType !== 'confirm') { |
| | | form.options = form.options.filter(op => op.value !== 'system') |
| | | } |
| | | } else if (form.key === 'afterExecSuccess') { |
| | | _success = form.initVal |
| | | } else if (form.key === 'afterExecError') { |
| | | _error = form.initVal |
| | | } |
| | | }) |
| | | |
| | |
| | | item.options = btnClasses |
| | | } else if (item.key === 'icon') { |
| | | item.options = btnIcons |
| | | } else if (item.key === 'resetPageIndex') { |
| | | item.tooltip = '页面关闭,且执行刷新时生效' |
| | | } else if (item.key === 'sqlType') { |
| | | item.options = this.state.insertUpdateOptions |
| | | } else if (item.key === 'OpenType') { |
| | |
| | | } |
| | | } else if (item.key === 'execSuccess' && card.btnType === 'cancel') { |
| | | item.label = '关闭后' |
| | | } else if (item.key === 'execSuccess' && card.btnType !== 'cancel') { |
| | | if (_success === 'close') { |
| | | item.options = this.state.returnoptions |
| | | } else { |
| | | item.options = this.state.currentoptions |
| | | } |
| | | } else if (item.key === 'execError') { |
| | | if (_error === 'close') { |
| | | item.options = this.state.returnoptions |
| | | } else { |
| | | item.options = this.state.currentoptions |
| | | } |
| | | item.options[1].text = '刷新' |
| | | } else if (item.key === 'execSuccess' || item.key === 'execError') { |
| | | item.options[1].text = '刷新' |
| | | } else if (item.key === 'innerFunc' && card.btnType !== 'confirm' && _intertype === 'inner') { |
| | | item.required = true |
| | | } |
| | |
| | | let _options = [] |
| | | |
| | | if (btnType === 'cancel') { |
| | | _options = ['label', 'OpenType', 'icon', 'class', 'execSuccess'] |
| | | _options = ['label', 'OpenType', 'icon', 'class', 'execSuccess', 'resetPageIndex'] |
| | | } else if (btnType === 'confirm') { |
| | | if (intertype === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError'] |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError', 'resetPageIndex'] |
| | | } else if (intertype === 'system') { |
| | | _options = ['label', 'OpenType', 'intertype', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType', 'afterExecSuccess', 'afterExecError'] |
| | | _options = ['label', 'OpenType', 'intertype', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType', 'afterExecSuccess', 'afterExecError', 'resetPageIndex'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError'] |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError', 'resetPageIndex'] |
| | | } |
| | | } else { |
| | | if (intertype === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError'] |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError', 'resetPageIndex'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError'] |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError', 'resetPageIndex'] |
| | | } |
| | | } |
| | | |
| | | return _options |
| | | } |
| | | |
| | | selectChange = (key, value) => { |
| | | if (key === 'afterExecSuccess') { |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | if (item.key === 'execSuccess') { |
| | | if (value === 'close') { |
| | | item.options = this.state.returnoptions |
| | | } else { |
| | | item.options = this.state.currentoptions |
| | | } |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | execSuccess: 'never' |
| | | }) |
| | | } else if (key === 'afterExecError') { |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | if (item.key === 'execError') { |
| | | if (value === 'close') { |
| | | item.options = this.state.returnoptions |
| | | } else { |
| | | item.options = this.state.currentoptions |
| | | } |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | execError: 'never' |
| | | }) |
| | | } |
| | | } |
| | | |
| | | onChange = (e, key) => { |
| | |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | getPopupContainer={() => document.getElementById('winter')} |
| | | onChange={(val) => this.selectChange(item.key, val)} |
| | | disabled={!!item.readonly} |
| | | > |
| | | {item.options.map((option, index) => |
| | |
| | | } else if (item.type === 'radio') { |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal, |
| | | rules: [ |
| | |
| | | } |
| | | } |
| | | |
| | | if (_options.includes('execSuccess') || _options.includes('popClose')) { |
| | | _options.push('resetPageIndex') |
| | | } |
| | | |
| | | return _options |
| | | } |
| | | |
| | |
| | | tabTems = [] |
| | | } |
| | | |
| | | if (card.execSuccess === 'view' || card.execSuccess === 'refresh') { // refresh为表单标签页 |
| | | card.execSuccess = 'grid' |
| | | } |
| | | if (card.execError === 'view' || card.execSuccess === 'refresh') { |
| | | card.execError = 'grid' |
| | | } |
| | | if (card.popClose === 'view') { |
| | | card.popClose = 'grid' |
| | | } |
| | | |
| | | let refresh = [] |
| | | if (type === 'subtable') { // 子表页面,可设置刷新主表及同级标签 |
| | | refresh.push({ |
| | |
| | | }, { |
| | | value: 'equaltab', |
| | | text: Formdict['header.form.refresh.equaltab'] |
| | | // }, { |
| | | // value: 'mainline', |
| | | // text: Formdict['header.form.refresh.mainline'] |
| | | }) |
| | | } |
| | | |
| | |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'select', |
| | | type: 'radio', |
| | | key: 'afterExecSuccess', |
| | | label: Formdict['header.form.afterExecSuccess'], |
| | | initVal: card.afterExecSuccess || 'close', |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | type: 'radio', |
| | | key: 'afterExecError', |
| | | label: Formdict['header.form.afterExecError'], |
| | | initVal: card.afterExecError || 'notclose', |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | type: refresh.length === 0 ? 'radio' : 'select', |
| | | key: 'execSuccess', |
| | | label: Formdict['model.form.afterSuccess'], |
| | | initVal: card.execSuccess || 'never', |
| | |
| | | }, { |
| | | value: 'grid', |
| | | text: Formdict['header.form.refresh.grid'] |
| | | }, { |
| | | value: 'view', |
| | | text: Formdict['header.form.refresh.view'] |
| | | }, |
| | | ...refresh] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | type: refresh.length === 0 ? 'radio' : 'select', |
| | | key: 'execError', |
| | | label: Formdict['model.form.afterError'], |
| | | initVal: card.execError || 'never', |
| | |
| | | }, { |
| | | value: 'grid', |
| | | text: Formdict['header.form.refresh.grid'] |
| | | }, { |
| | | value: 'view', |
| | | text: Formdict['header.form.refresh.view'] |
| | | }] |
| | | }, |
| | | ...refresh] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | type: refresh.length === 0 ? 'radio' : 'select', |
| | | key: 'popClose', |
| | | label: Formdict['header.form.popClose'], |
| | | initVal: card.popClose || 'never', |
| | |
| | | }, { |
| | | value: 'grid', |
| | | text: Formdict['header.form.refresh.grid'] |
| | | }, { |
| | | value: 'view', |
| | | text: Formdict['header.form.refresh.view'] |
| | | }, |
| | | ...refresh] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'resetPageIndex', |
| | | label: '刷新时', |
| | | initVal: card.resetPageIndex || 'true', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '重置页码' |
| | | }, { |
| | | value: 'false', |
| | | text: '不重置' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'icon', |
| | | label: Formdict['model.icon'], |
| | |
| | | * @param {Boolean} dataManager 数据权限 |
| | | * @return {Object} param |
| | | */ |
| | | static getQueryDataParams (setting, arrFields, search = [], orderBy = '', pageIndex = 1, pageSize = 10, BID, menuType, dataManager) { |
| | | static getQueryDataParams (setting, arrFields, search = [], orderBy = '', pageIndex = 1, pageSize = 10, BID, menuType, dataManager, id) { |
| | | let param = null |
| | | |
| | | if (setting.interType === 'system' || (setting.interType === 'inner' && !setting.innerFunc)) { |
| | | param = this.getDefaultQueryParam(setting, arrFields, search, orderBy, pageIndex, pageSize, menuType) |
| | | param = this.getDefaultQueryParam(setting, arrFields, search, orderBy, pageIndex, pageSize, menuType, id) |
| | | } else { |
| | | param = this.getCustomQueryParam(setting, search, orderBy, pageIndex, pageSize, menuType) |
| | | param = this.getCustomQueryParam(setting, search, orderBy, pageIndex, pageSize, menuType, id) |
| | | } |
| | | |
| | | if (BID) { |
| | |
| | | /** |
| | | * @description 获取用户自定义存储过程传参 |
| | | */ |
| | | static getCustomQueryParam (setting, search, orderBy, pageIndex, pageSize, menuType) { |
| | | static getCustomQueryParam (setting, search, orderBy, pageIndex, pageSize, menuType, id) { |
| | | let param = Utils.formatCustomMainSearch(search) |
| | | |
| | | if (orderBy) { |
| | | param.OrderCol = orderBy |
| | | } |
| | | |
| | | if (setting.laypage) { |
| | | if (id) { |
| | | param.ID = id |
| | | } else if (setting.laypage) { |
| | | param.PageIndex = pageIndex |
| | | param.PageSize = pageSize |
| | | } |
| | |
| | | /** |
| | | * @description 获取系统存储过程 sPC_Get_TableData 的参数 |
| | | */ |
| | | static getDefaultQueryParam (setting, arrFields, search, orderBy, pageIndex, pageSize, menuType) { |
| | | static getDefaultQueryParam (setting, arrFields, search, orderBy, pageIndex, pageSize, menuType, id) { |
| | | let param = { |
| | | func: 'sPC_Get_TableData', |
| | | obj_name: 'data', |
| | |
| | | regoptions.forEach(item => { |
| | | _dataresource = _dataresource.replace(item.reg, item.value) |
| | | }) |
| | | } else if (_dataresource) { |
| | | } else if (_dataresource && !id) { |
| | | _search = Utils.joinMainSearchkey(search) |
| | | if (_search) { |
| | | _search = 'where ' + _search |
| | | } |
| | | } else if (_dataresource && id) { |
| | | _search = Utils.joinMainSearchkey(search) |
| | | _search = `where ${_search ? _search + ' AND ' : ''} ${setting.primaryKey || 'ID'}='${id}'` |
| | | } |
| | | |
| | | if (_customScript) { |
| | |
| | | let LText = '' |
| | | let DateCount = '' |
| | | |
| | | if (_dataresource && setting.laypage && orderBy) { |
| | | if (_dataresource && setting.laypage && orderBy && !id) { |
| | | LText = ` select top ${pageSize} ${arrFields} from (select ${arrFields} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows ` |
| | | DateCount = `select count(1) as total from ${_dataresource} ${_search}` |
| | | } else if (_dataresource && orderBy) { |
| | |
| | | }) |
| | | } |
| | | |
| | | reload = () => { |
| | | this.setState({ |
| | | loadingview: true, |
| | | pages: null, |
| | | data: '', |
| | | config: null |
| | | }, () => { |
| | | this.getMenuParam() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 获取系统存储过程 sPC_Get_TableData 的参数 |
| | | */ |
| | |
| | | </div> : null} |
| | | {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} |
| | | {pages && !loadingview && !viewlost ? <div className="print-button"><Button icon="printer" size="large" shape="circle" onClick={this.print}></Button></div> : null} |
| | | {!loadingview && !viewlost ? <div className="refresh-button"><Button icon="reload" size="large" shape="circle" onClick={this.reload}></Button></div> : null} |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | .print-button { |
| | | position: fixed; |
| | | right: 10px; |
| | | top: 45vh; |
| | | top: 40vh; |
| | | } |
| | | .refresh-button { |
| | | position: fixed; |
| | | right: 10px; |
| | | top: calc(40vh + 70px); |
| | | } |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 账号密码登录 |
| | | * @param {Object} param 用户名密码等信息 |
| | | */ |
| | | async loginsubmit (param) { |
| | | if (options.sysType === 'local' && !window.GLOB.mainSystemApi) { // 业务系统必须设置单点地址 |
| | | Modal.warning({ |
| | |
| | | sessionStorage.setItem('User_Name', res.UserName) |
| | | sessionStorage.setItem('Full_Name', res.FullName) |
| | | sessionStorage.setItem('avatar', res.icon || '') |
| | | sessionStorage.setItem('dataM', res.dataM ? 'true' : '') |
| | | sessionStorage.setItem('debug', res.debug || '') |
| | | sessionStorage.setItem('role_id', res.role_id || '') |
| | | |
| | | localStorage.setItem('lang', param.lang || 'zh-CN') |
| | | |
| | |
| | | sessionStorage.setItem('User_Name', res.UserName) |
| | | sessionStorage.setItem('Full_Name', res.FullName) |
| | | sessionStorage.setItem('avatar', res.icon || '') |
| | | sessionStorage.setItem('dataM', res.dataM ? 'true' : '') |
| | | sessionStorage.setItem('debug', res.debug || '') |
| | | sessionStorage.setItem('role_id', res.role_id || '') |
| | | |
| | | localStorage.setItem('lang', param.lang || 'zh-CN') |
| | | |
| | |
| | | import React, {Component} from 'react' |
| | | import { ConfigProvider } from 'antd' |
| | | import { connect } from 'react-redux' |
| | | import enUS from 'antd/es/locale/en_US' |
| | | import zhCN from 'antd/es/locale/zh_CN' |
| | | import Header from '@/components/header' |
| | | import Sidemenu from '@/components/sidemenu' |
| | | import Tabview from '@/components/tabview' |
| | | import { resetDebug, modifyDataManager, initRolesPermission } from '@/store/action' |
| | | |
| | | import './index.scss' |
| | | |
| | | const _locale = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | |
| | | class Main extends Component { |
| | | UNSAFE_componentWillMount() { |
| | | if (sessionStorage.getItem('dataM') === 'true') { |
| | | this.props.modifyDataManager(true) |
| | | } |
| | | if (sessionStorage.getItem('debug') === 'true') { |
| | | this.props.resetDebug() |
| | | } |
| | | if (sessionStorage.getItem('role_id')) { |
| | | let roles = sessionStorage.getItem('role_id') |
| | | roles = roles.split(',') |
| | | |
| | | this.props.initRolesPermission(roles) |
| | | } |
| | | } |
| | | |
| | | render () { |
| | | return ( |
| | | <div className="flex-container"> |
| | |
| | | } |
| | | } |
| | | |
| | | export default Main |
| | | const mapStateToProps = () => { |
| | | return {} |
| | | } |
| | | |
| | | const mapDispatchToProps = (dispatch) => { |
| | | return { |
| | | resetDebug: () => dispatch(resetDebug()), |
| | | initRolesPermission: (roles) => dispatch(initRolesPermission(roles)), |
| | | modifyDataManager: (dataManager) => dispatch(modifyDataManager(dataManager)) |
| | | } |
| | | } |
| | | |
| | | export default connect(mapStateToProps, mapDispatchToProps)(Main) |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Radio, Icon, Tooltip, InputNumber } from 'antd' |
| | | |
| | | import './index.scss' |
| | | |
| | | class CustomMenuForm extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | config: PropTypes.object, |
| | | updateConfig: PropTypes.func |
| | | } |
| | | |
| | | // 一二级菜单切换 |
| | | selectChange = (key, value) => { |
| | | const { config } = this.props |
| | | |
| | | 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}) |
| | | } |
| | | } |
| | | |
| | | changeCacheDay = (val) => { |
| | | if (typeof(val) !== 'number') { |
| | | val = '' |
| | | } |
| | | this.props.updateConfig({...this.props.config, cacheTime: val}) |
| | | } |
| | | |
| | | render() { |
| | | const { dict, config } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 8 } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 } |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} className="custom-menu-form"> |
| | | <Row> |
| | | <Col span={24}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="对于不经常性变动的信息,缓存数据有助于提高查询效率。"> |
| | | <Icon type="question-circle" /> |
| | | 缓存数据 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('cacheUseful', { |
| | | initialValue: config.cacheUseful || 'false' |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.selectChange('cacheUseful', e.target.value)}}> |
| | | <Radio value="true">使用</Radio> |
| | | <Radio value="false">不使用</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </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', { |
| | | initialValue: config.timeUnit || 'day' |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> |
| | | <Radio value="day">天</Radio> |
| | | <Radio value="hour">小时</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {config.cacheUseful === 'true' ? <Col span={24}> |
| | | <Form.Item label="时长"> |
| | | {getFieldDecorator('cacheTime', { |
| | | initialValue: config.cacheTime, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: dict['mob.required.input'] + '时长!' |
| | | } |
| | | ] |
| | | })( |
| | | <InputNumber min={1} max={config.timeUnit !== 'hour' ? 7 : 23} precision={0} onChange={this.changeCacheDay}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | </Row> |
| | | </Form> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default Form.create()(CustomMenuForm) |
New file |
| | |
| | | .custom-menu-form { |
| | | .anticon-question-circle { |
| | | color: #c49f47; |
| | | position: relative; |
| | | left: -3px; |
| | | } |
| | | .ant-input-number { |
| | | width: 100%; |
| | | } |
| | | } |
| | |
| | | const _locale = localStorage.getItem('lang') !== 'en-US' ? antdZhCN : antdEnUS |
| | | |
| | | const MenuForm = asyncComponent(() => import('./menuform')) |
| | | const HomeForm = asyncComponent(() => import('./homeform')) |
| | | const PrintMenuForm = asyncComponent(() => import('./printmenuform')) |
| | | const Header = asyncComponent(() => import('@/menu/header')) |
| | | const SourceWrap = asyncComponent(() => import('@/menu/modelsource')) |
| | |
| | | }) |
| | | } |
| | | |
| | | getMenuMessage = () => { |
| | | const { config } = this.state |
| | | let buttons = [] |
| | | let _sort = 1 |
| | | |
| | | let traversal = (components) => { |
| | | components.forEach(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | traversal(tab.components) |
| | | }) |
| | | } else if (item.type === 'card' || (item.type === 'table' && item.subtype === 'tablecard')) { |
| | | item.subcards.forEach(card => { |
| | | card.elements && card.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`) |
| | | _sort++ |
| | | }) |
| | | card.backElements && card.backElements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`) |
| | | _sort++ |
| | | }) |
| | | }) |
| | | } else if (item.type === 'line' || item.type === 'bar') { |
| | | item.action && item.action.forEach(btn => { |
| | | buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`) |
| | | _sort++ |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | traversal(config.components) |
| | | |
| | | return buttons |
| | | } |
| | | |
| | | submitConfig = () => { |
| | | const { config, openEdition } = this.state |
| | | |
| | |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (config.MenuType === 'custom' && (!config.MenuName || !config.MenuNo || !config.fstMenuId || !config.parentId)) { |
| | | } else if (config.MenuType === 'home' && (config.cacheUseful === 'true' && !config.cacheTime)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请完善菜单基本信息!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (config.MenuType === 'custom' && (!config.MenuName || !config.MenuNo || !config.fstMenuId || !config.parentId || (config.cacheUseful === 'true' && !config.cacheTime))) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请完善菜单基本信息!', |
| | |
| | | delete _config.sysRoles |
| | | delete _config.tableFields |
| | | |
| | | let funcs = [] |
| | | if (config.MenuType !== 'billPrint') { |
| | | _config.components.forEach(component => { |
| | | if (component.setting && component.setting.innerFunc) { |
| | | funcs.push(`select '${_config.uuid}' as MenuID,'${component.setting.innerFunc}' as ProcName,'${component.setting.name}' as MenuName`) |
| | | } |
| | | if (component.action) { |
| | | component.action.forEach(item => { |
| | | if (!item.innerFunc) return |
| | | funcs.push(`select '${_config.uuid}' as MenuID,'${item.innerFunc}' as ProcName,'${item.label}' as MenuName`) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | let param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | | FstID: _config.fstMenuId || '', |
| | |
| | | MenuName: _config.MenuName || '', |
| | | PageParam: JSON.stringify({Template: 'CustomPage', OpenType: 'newtab'}), |
| | | LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(_config))), |
| | | LText: funcs.join(' union all '), |
| | | LTexttb: '' // 表名 |
| | | LText: '', |
| | | LTexttb: '' |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | |
| | | |
| | | if (openEdition) { // 版本管理 |
| | | param.open_edition = openEdition |
| | | } |
| | | |
| | | let btnParam = { // 添加菜单按钮 |
| | | func: 'sPC_Button_AddUpt', |
| | | Type: 40, // 添加菜单下的按钮type为40,按钮下的按钮type为60 |
| | | ParentID: _config.uuid, |
| | | MenuNo: _config.MenuNo, |
| | | Template: 'CustomPage', |
| | | PageParam: '', |
| | | LongParam: '', |
| | | LText: [] |
| | | } |
| | | |
| | | if (config.MenuType !== 'billPrint') { |
| | | btnParam.LText = this.getMenuMessage() |
| | | |
| | | btnParam.LText = btnParam.LText.join(' union all ') |
| | | btnParam.LText = Utils.formatOptions(btnParam.LText) |
| | | btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) |
| | | } else { |
| | | btnParam.LText = '' |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | initMenuList={this.initMenuList} |
| | | updateConfig={this.updateConfig} |
| | | /> : null} |
| | | {config && MenuType === 'home' ? <HomeForm |
| | | dict={dict} |
| | | config={config} |
| | | updateConfig={this.updateConfig} |
| | | /> : null} |
| | | {config && MenuType === 'billPrint' ? <PrintMenuForm |
| | | dict={dict} |
| | | config={config} |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Select, notification } from 'antd' |
| | | import { Form, Row, Col, Input, Select, notification, Radio, Icon, Tooltip, InputNumber } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import './index.scss' |
| | |
| | | }) |
| | | } else if (key === 'parentId') { |
| | | 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}) |
| | | } |
| | | } |
| | | |
| | |
| | | this.props.updateConfig({...this.props.config, easyCode: e.target.value}) |
| | | } |
| | | |
| | | changeCacheDay = (val) => { |
| | | if (typeof(val) !== 'number') { |
| | | val = '' |
| | | } |
| | | this.props.updateConfig({...this.props.config, cacheTime: val}) |
| | | } |
| | | |
| | | render() { |
| | | const { dict, MenuName, MenuNo, config } = this.props |
| | | const { menulist, smenulist } = this.state |
| | |
| | | } |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} className="ant-advanced-search-form"> |
| | | <Form {...formItemLayout} className="custom-menu-form"> |
| | | <Row> |
| | | <Col span={24}> |
| | | <Form.Item label={dict['mob.menu.first'] + dict['mob.menu']}> |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="对于不经常性变动的信息,缓存数据有助于提高查询效率。"> |
| | | <Icon type="question-circle" /> |
| | | 缓存数据 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('cacheUseful', { |
| | | initialValue: config.cacheUseful || 'false' |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.selectChange('cacheUseful', e.target.value)}}> |
| | | <Radio value="true">使用</Radio> |
| | | <Radio value="false">不使用</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </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', { |
| | | initialValue: config.timeUnit || 'day' |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> |
| | | <Radio value="day">天</Radio> |
| | | <Radio value="hour">小时</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {config.cacheUseful === 'true' ? <Col span={24}> |
| | | <Form.Item label="时长"> |
| | | {getFieldDecorator('cacheTime', { |
| | | initialValue: config.cacheTime, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: dict['mob.required.input'] + '时长!' |
| | | } |
| | | ] |
| | | })( |
| | | <InputNumber min={1} max={config.timeUnit !== 'hour' ? 7 : 23} precision={0} onChange={this.changeCacheDay}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={24}> |
| | | <Form.Item label={dict['mob.menu.easycode']}> |
| | | {getFieldDecorator('easyCode', { |
| | | initialValue: config.easyCode |
| | |
| | | .custom-menu-form { |
| | | .anticon-question-circle { |
| | | color: #c49f47; |
| | | position: relative; |
| | | left: -3px; |
| | | } |
| | | .ant-input-number { |
| | | width: 100%; |
| | | } |
| | | } |