| | |
| | | import PropTypes from 'prop-types' |
| | | import {connect} from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import {Tabs, Icon, Button, message, BackTop} from 'antd' |
| | | import {Tabs, Icon, BackTop} from 'antd' |
| | | import moment from 'moment' |
| | | import 'moment/locale/zh-cn' |
| | | |
| | | 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' |
| | |
| | | tabviews: null, // 标签集 |
| | | iFrameHeight: 0, |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? mzhCN : menUS, |
| | | debug: sessionStorage.getItem('debug') === 'true' |
| | | } |
| | | |
| | | handleTabview = (e, menu) => { |
| | |
| | | } else if (view.type === 'FormTab') { |
| | | return (<FormTab MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) |
| | | } else if (view.type === 'iframe') { |
| | | return (<Iframe key={view.MenuID} title={view.MenuName} MenuName={view.MenuName} url={service + view.LinkUrl}/>) |
| | | return (<Iframe key={view.MenuID} MenuID={view.MenuID} MenuNo={view.MenuNo} title={view.MenuName} MenuName={view.MenuName} url={service + view.LinkUrl}/>) |
| | | } else { |
| | | return (<NotFount key={view.MenuID} />) |
| | | } |
| | | } |
| | | |
| | | copyMenuNo = (e) => { |
| | | e.stopPropagation() |
| | | let oInput = document.createElement('input') |
| | | oInput.value = e.target.dataset.menuno || '' |
| | | document.body.appendChild(oInput) |
| | | oInput.select() |
| | | document.execCommand('Copy') |
| | | oInput.className = 'oInput' |
| | | oInput.style.display = 'none' |
| | | message.success(this.state.dict['main.copy.success']) |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | componentDidMount () { |
| | | let home = { |
| | | MenuID: 'home_page_id', |
| | | MenuName: '首页', |
| | | MenuName: this.state.dict['main.homepage'], |
| | | selected: true, |
| | | type: 'Home' |
| | | } |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { menuType } = this.props |
| | | const { tabviews, activeId, debug } = this.state |
| | | const { tabviews, activeId } = this.state |
| | | |
| | | return ( |
| | | <section className={'flex-container content-box' + (this.props.collapse ? ' collapsed' : '')}> |
| | |
| | | <Tabs.TabPane |
| | | tab={ |
| | | <span className="tab-control"> |
| | | {['CommonTable', 'FormTab', 'TreePage', 'CalendarPage', 'CustomPage', 'ManageTable', 'VerupTable'].includes(view.type) ? |
| | | <Icon type="redo" onClick={(e) => {this.refreshTabview(e, view)}}/> : null |
| | | } |
| | | <Icon type="redo" onClick={(e) => {this.refreshTabview(e, view)}}/> |
| | | <span className="tab-name" onClick={(e) => {this.changeTab(e, view)}}> |
| | | {view.MenuName} |
| | | </span> |
| | |
| | | key={view.MenuID} |
| | | > |
| | | {this.selectcomponent(view)} |
| | | {debug && options.sysType !== 'cloud' && menuType !== 'HS' && !['CommonTable', 'TreePage', 'ManageTable', 'CalendarPage', 'Home'].includes(view.type) ? |
| | | <Button |
| | | icon="copy" |
| | | shape="circle" |
| | | className={'main-copy ' + (view.type === 'iframe' ? 'ifr-copy' : '')} |
| | | data-menuno={view.MenuNo} |
| | | onClick={this.copyMenuNo} |
| | | /> : null |
| | | } |
| | | <BackTop> |
| | | <div className="ant-back-top"> |
| | | <div className="ant-back-top-content"> |
| | |
| | | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | menuType: state.editLevel, |
| | | tabviews: state.tabviews, |
| | | collapse: state.collapse, |
| | | isiframe: state.isiframe |
| | |
| | | 'main.cancel': 'Cancel', |
| | | 'main.logout': 'Logout', |
| | | 'main.doc': '文档中心', |
| | | 'main.homepage': '首页', |
| | | 'main.logout.hint': 'Are you sure you want to log out?', |
| | | 'main.verup': 'Version upgrade', |
| | | 'main.password': 'Change the password', |
| | |
| | | 'main.cancel': '取消', |
| | | 'main.logout': '退出', |
| | | 'main.doc': '文档中心', |
| | | 'main.homepage': '首页', |
| | | 'main.logout.hint': '您确定要退出吗?', |
| | | 'main.verup': '版本升级', |
| | | 'main.password': '修改密码', |
| | |
| | | prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width'], |
| | | exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width'], |
| | | excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'sheet', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width'], |
| | | excelOut: ['label', 'OpenType', 'intertype', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'pagination', 'search', 'width'], |
| | | excelOut: ['label', 'OpenType', 'intertype', 'show', 'icon', 'class', 'execSuccess', 'execError', 'syncComponent', 'resetPageIndex', 'pagination', 'search', 'width'], |
| | | popview: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'popClose', 'resetPageIndex', 'width'], |
| | | tab: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'linkmenu', 'width'], |
| | | innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'show', 'icon', 'class', 'width'], |
| | |
| | | |
| | | let refresh = [] |
| | | if (sessionStorage.getItem('editMenuType') === 'popview') { // 弹窗标签 |
| | | opentypes = opentypes.filter(item => item.value !== 'popview') |
| | | opentypes = opentypes.filter(item => item.value !== 'popview' && item.value !== 'funcbutton') |
| | | refresh.push({ |
| | | value: 'popclose', |
| | | text: '标签刷新' |
| | |
| | | card.uuid = Utils.getuuid() |
| | | if (card.elements) { |
| | | if (sessionStorage.getItem('editMenuType') === 'popview') { |
| | | card.elements = card.elements.filter(b => b.OpenType !== 'popview') |
| | | card.elements = card.elements.filter(b => b.OpenType !== 'popview' && b.OpenType !== 'funcbutton') |
| | | } |
| | | card.elements = card.elements.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | |
| | | } |
| | | if (card.backElements) { |
| | | if (sessionStorage.getItem('editMenuType') === 'popview') { |
| | | card.elements = card.elements.filter(b => b.OpenType !== 'popview') |
| | | card.elements = card.elements.filter(b => b.OpenType !== 'popview' && b.OpenType !== 'funcbutton') |
| | | } |
| | | card.backElements = card.backElements.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | |
| | | }) |
| | | } else if (c.type === 'action' && c.elements) { |
| | | if (sessionStorage.getItem('editMenuType') === 'popview') { |
| | | c.elements = c.elements.filter(b => b.OpenType !== 'popview') |
| | | c.elements = c.elements.filter(b => b.OpenType !== 'popview' && b.OpenType !== 'funcbutton') |
| | | } |
| | | c.elements = c.elements.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | |
| | | }) |
| | | } else if (col.type === 'action' && col.elements) { |
| | | if (sessionStorage.getItem('editMenuType') === 'popview') { |
| | | col.elements = col.elements.filter(c => c.OpenType !== 'popview') |
| | | col.elements = col.elements.filter(c => c.OpenType !== 'popview' && c.OpenType !== 'funcbutton') |
| | | } |
| | | col.elements = col.elements.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | |
| | | |
| | | if (item.action) { |
| | | if (sessionStorage.getItem('editMenuType') === 'popview') { |
| | | item.action = item.action.filter(c => c.OpenType !== 'popview') |
| | | item.action = item.action.filter(c => c.OpenType !== 'popview' && c.OpenType !== 'funcbutton') |
| | | } |
| | | item.action = item.action.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | |
| | | } else { |
| | | config.uuid = MenuId |
| | | config.MenuID = MenuId |
| | | config.Template = 'CustomPage' |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | destroyOnClose |
| | | > |
| | | {config.tab ? <SubTabTable |
| | | type="calendar" |
| | | BID={triggerTime} |
| | | Tab={config.tab} |
| | | SupMenuID={this.props.MenuID} |
| | |
| | | import PropTypes from 'prop-types' |
| | | import {connect} from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import { notification, Spin, Tabs, Icon, Switch, Modal, Button, message, Tree, Typography, Row, Col } from 'antd' |
| | | import { notification, Spin, Tabs, Icon, Switch, Modal, Button, message, Typography, Row, Col } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import options from '@/store/options.js' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | const ChartComponent = asyncSpinComponent(() => import('@/tabviews/zshare/chartcomponent')) |
| | | |
| | | const { TabPane } = Tabs |
| | | const { TreeNode } = Tree |
| | | const { Paragraph } = Typography |
| | | |
| | | class NormalTable extends Component { |
| | |
| | | statFields: [], // 合计字段 |
| | | statFValue: [], // 合计值 |
| | | absFields: [], // 绝对值字段 |
| | | debug: sessionStorage.getItem('debug') === 'true' |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | item.key = index |
| | | item.$$uuid = item[setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | |
| | | return item |
| | | }), |
| | | total: result.total, |
| | |
| | | data = data.map(item => { |
| | | if (item[setting.primaryKey] === _data[setting.primaryKey]) { |
| | | _data.key = item.key |
| | | _data.$$uuid = _data[setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | |
| | | return _data |
| | | } else { |
| | | return item |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮操作完成后(成功或失败),页面刷新,重置页码及选择项 |
| | | */ |
| | | refreshbyaction = (position, btn) => { |
| | | if (position === 'grid' || position === 'view') { |
| | | this.reloadtable(btn) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | getexceloutparam = (menuId, btnId) => { |
| | |
| | | if (_others) { |
| | | _title = _title + ': ' + _others |
| | | } |
| | | |
| | | if (item.subfuncs && item.subfuncs.length > 0) { |
| | | return ( |
| | | <TreeNode title={_title} key={item.uuid} dataRef={item} selectable={false}> |
| | | {this.getTreeNode(item.subfuncs)} |
| | | </TreeNode> |
| | | ) |
| | | } |
| | | return <TreeNode key={item.uuid} title={_title} isLeaf selectable={false} /> |
| | | return <p key={item.uuid}>{_title}</p> |
| | | }) |
| | | } |
| | | |
| | |
| | | this.setShortcut() |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮执行完成后页面刷新 |
| | | * @param {*} menuId // 菜单Id |
| | | * @param {*} position // 刷新位置 |
| | | * @param {*} btn // 执行的按钮 |
| | | */ |
| | | refreshByButtonResult = (menuId, position, btn) => { |
| | | const { MenuID } = this.props |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | | this.reloadtable(btn) |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | // 组件加载时,获取菜单数据 |
| | | this.loadconfig() |
| | |
| | | MKEmitter.addListener('reloadMenuView', this.reloadMenuView) |
| | | MKEmitter.addListener('resetActiveMenu', this.resetActiveMenu) |
| | | MKEmitter.addListener('getexceloutparam', this.getexceloutparam) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | | /** |
| | |
| | | MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) |
| | | MKEmitter.removeListener('resetActiveMenu', this.resetActiveMenu) |
| | | MKEmitter.removeListener('getexceloutparam', this.getexceloutparam) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | | render() { |
| | | const { menuType, MenuName } = this.props |
| | | const { debug, BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, userConfig, tabActive, chartId, search, selectedData } = this.state |
| | | const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, userConfig, tabActive, chartId, search, selectedData } = this.state |
| | | |
| | | return ( |
| | | <div className="commontable" id={this.state.ContainerId}> |
| | |
| | | MenuID={this.props.MenuID} |
| | | selectedData={selectedData} |
| | | ContainerId={this.state.ContainerId} |
| | | refreshdata={this.refreshbyaction} |
| | | /> |
| | | </div> |
| | | <div className="main-table-box"> |
| | |
| | | } |
| | | <MainTable |
| | | tableId="mainTable" |
| | | BID={BID} |
| | | pickup={pickup} |
| | | setting={setting} |
| | | columns={columns} |
| | |
| | | total={this.state.total} |
| | | MenuID={this.props.MenuID} |
| | | loading={this.state.loading} |
| | | refreshdata={this.refreshbytable} |
| | | statFValue={this.state.statFValue} |
| | | handleTableId={this.handleTableId} |
| | | ContainerId={this.state.ContainerId} |
| | | refreshbyaction={this.refreshbyaction} |
| | | refreshdata={this.refreshbytable} |
| | | handleTableId={this.handleTableId} |
| | | chgSelectData={this.changeSelectedData} |
| | | /> |
| | | </div> |
| | |
| | | MenuID={this.props.MenuID} |
| | | loading={this.state.loading} |
| | | ContainerId={this.state.ContainerId} |
| | | refreshdata={this.refreshbyaction} |
| | | handleTableId={this.handleTableId} |
| | | /> |
| | | </Col> |
| | |
| | | })} |
| | | </Row> : null } |
| | | {setting && config.tabgroups.map(group => ( |
| | | <Tabs key={group.uuid} onChange={(key) => this.setState({tabActive: {...tabActive, [group.uuid]: key}})}> |
| | | {group.sublist.map(_tab => { |
| | | return ( |
| | | <TabPane tab={ |
| | | <span> |
| | | {_tab.icon ? <Icon type={_tab.icon} /> : null} |
| | | {_tab.label} |
| | | </span> |
| | | } key={_tab.uuid}> |
| | | <SubTable |
| | | Tab={_tab} |
| | | MenuID={_tab.linkTab} |
| | | mainSearch={_tab.searchPass === 'true' ? search : null} |
| | | userConfig={userConfig ? userConfig[_tab.uuid] : null} |
| | | SupMenuID={this.props.MenuID} |
| | | ContainerId={this.state.ContainerId} |
| | | BID={this.state.BIDs[_tab.supMenu] || ''} |
| | | BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} |
| | | handleTableId={this.handleTableId} |
| | | /> |
| | | </TabPane> |
| | | ) |
| | | })} |
| | | </Tabs>) |
| | | ) |
| | | <Tabs key={group.uuid} onChange={(key) => this.setState({tabActive: {...tabActive, [group.uuid]: key}})}> |
| | | {group.sublist.map(_tab => { |
| | | return ( |
| | | <TabPane tab={ |
| | | <span> |
| | | {_tab.icon ? <Icon type={_tab.icon} /> : null} |
| | | {_tab.label} |
| | | </span> |
| | | } key={_tab.uuid}> |
| | | <SubTable |
| | | Tab={_tab} |
| | | MenuID={_tab.linkTab} |
| | | mainSearch={_tab.searchPass === 'true' ? search : null} |
| | | userConfig={userConfig ? userConfig[_tab.uuid] : null} |
| | | SupMenuID={this.props.MenuID} |
| | | ContainerId={this.state.ContainerId} |
| | | BID={this.state.BIDs[_tab.supMenu] || ''} |
| | | BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} |
| | | handleTableId={this.handleTableId} |
| | | /> |
| | | </TabPane> |
| | | ) |
| | | })} |
| | | </Tabs>)) |
| | | } |
| | | {debug && options.sysType !== 'cloud' && menuType !== 'HS' ? <Button |
| | | {menuType !== 'HS' ? <Button |
| | | icon="copy" |
| | | shape="circle" |
| | | className="common-table-copy" |
| | |
| | | /> : null} |
| | | <Modal |
| | | className="menu-tree-modal" |
| | | title={'菜单结构树'} |
| | | title={'菜单信息'} |
| | | width={'650px'} |
| | | maskClosable={false} |
| | | visible={this.state.treevisible} |
| | |
| | | <span>菜单名称:{this.props.MenuName}</span> |
| | | <span>菜单参数:{<Paragraph copyable>{this.props.MenuNo}</Paragraph>}</span> |
| | | </div> |
| | | {this.state.treevisible ? <Tree defaultExpandAll showLine={true}> |
| | | {this.getTreeNode(config.funcs)} |
| | | </Tree> : null} |
| | | {this.state.treevisible ? this.getTreeNode(config.funcs) : null} |
| | | </Modal> |
| | | {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} |
| | | </div> |
| | |
| | | cursor: default; |
| | | } |
| | | } |
| | | .common-table-copy { |
| | | .page-message { |
| | | position: fixed; |
| | | z-index: 2; |
| | | bottom: 65px; |
| | |
| | | cards: PropTypes.object, // 卡片行配置信息 |
| | | card: PropTypes.object, // 卡片配置信息 |
| | | data: PropTypes.object, |
| | | updateStatus: PropTypes.func // 状态更新 |
| | | } |
| | | |
| | | state = { |
| | |
| | | |
| | | return ( |
| | | <div className="card-item-box" style={card.style}> |
| | | <CardCellComponent data={data} cards={cards} cardCell={card} elements={card.elements} updateStatus={this.props.updateStatus}/> |
| | | <CardCellComponent data={data} cards={cards} cardCell={card} elements={card.elements}/> |
| | | {card.setting.type === 'multi' ? <div className={'back-side ' + card.setting.transform} style={card.backStyle}> |
| | | <CardCellComponent data={data} cards={cards} cardCell={card} elements={card.backElements} updateStatus={this.props.updateStatus}/> |
| | | <CardCellComponent data={data} cards={cards} cardCell={card} elements={card.backElements}/> |
| | | </div> : null} |
| | | </div> |
| | | ) |
| | |
| | | cardCell: PropTypes.object, |
| | | data: PropTypes.object, |
| | | elements: PropTypes.array, // 元素集 |
| | | updateStatus: PropTypes.func, // 状态更新 |
| | | } |
| | | |
| | | state = { |
| | |
| | | setting={cards.setting} |
| | | columns={cards.columns} |
| | | selectedData={[data]} |
| | | updateStatus={this.props.updateStatus} |
| | | /> |
| | | </div> |
| | | </Col> |
| | |
| | | style={card.btnstyle} |
| | | setting={cards.setting} |
| | | selectedData={[data]} |
| | | updateStatus={this.props.updateStatus} |
| | | /> |
| | | </div> |
| | | </Col> |
| | |
| | | show={card.show} |
| | | style={card.btnstyle} |
| | | setting={cards.setting} |
| | | updateStatus={this.props.updateStatus} |
| | | /> |
| | | </div> |
| | | </Col> |
| | |
| | | style={card.btnstyle} |
| | | setting={cards.setting} |
| | | selectedData={[data]} |
| | | updateStatus={this.props.updateStatus} |
| | | /> |
| | | </div> |
| | | </Col> |
| | |
| | | style={card.btnstyle} |
| | | setting={cards.setting} |
| | | selectedData={[data]} |
| | | updateStatus={this.props.updateStatus} |
| | | /> |
| | | </div> |
| | | </Col> |
| | |
| | | style={card.btnstyle} |
| | | setting={cards.setting} |
| | | selectedData={[data]} |
| | | updateStatus={this.props.updateStatus} |
| | | /> |
| | | </div> |
| | | </Col> |
| | |
| | | style={card.btnstyle} |
| | | setting={cards.setting} |
| | | selectedData={[data]} |
| | | updateStatus={this.props.updateStatus} |
| | | /> |
| | | </div> |
| | | </Col> |
| | |
| | | style={card.btnstyle} |
| | | setting={cards.setting} |
| | | selectedData={[data]} |
| | | updateStatus={this.props.updateStatus} |
| | | /> |
| | | </div> |
| | | </Col> |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('syncRefreshComponentId', this.reload) |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('getexceloutparam', this.getexceloutparam) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('syncRefreshComponentId', this.reload) |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('getexceloutparam', this.getexceloutparam) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | | reload = (syncId) => { |
| | | /** |
| | | * @description 按钮执行完成后页面刷新 |
| | | * @param {*} menuId // 菜单Id |
| | | * @param {*} position // 刷新位置 |
| | | * @param {*} btn // 执行的按钮 |
| | | */ |
| | | refreshByButtonResult = (menuId, position, btn) => { |
| | | const { config, BID } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | this.loadData(btn) // 数据刷新 |
| | | |
| | | if (btn.syncComponentId && btn.syncComponentId !== config.uuid && btn.syncComponentId !== config.setting.supModule) { |
| | | MKEmitter.emit('reloadData', btn.syncComponentId) // 同级标签刷新 |
| | | } |
| | | |
| | | if (position === 'mainline' && config.setting.supModule) { // 主表行刷新 |
| | | MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty')) |
| | | } else if (position === 'popclose') { // 标签关闭刷新 |
| | | config.setting.supModule && MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty')) |
| | | btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) |
| | | } |
| | | } |
| | | |
| | | reloadData = (menuId, id) => { |
| | | const { config } = this.state |
| | | |
| | | if (syncId && syncId !== config.uuid) return |
| | | if (config.uuid !== menuId) return |
| | | if (id === 'empty') return |
| | | |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | if (!id) { |
| | | this.loadData() |
| | | }) |
| | | } else { |
| | | this.loadLinedata(id) |
| | | } |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id, data) => { |
| | |
| | | } |
| | | } |
| | | |
| | | updateStatus = (type, position, btn) => { |
| | | const { config } = this.state |
| | | /** |
| | | * @description 获取单行数据 |
| | | */ |
| | | async loadLinedata (id) { |
| | | const { mainSearch, menuType } = this.props |
| | | const { config, arr_field, pageIndex, search, BID } = this.state |
| | | |
| | | if (type === 'refresh' && position === 'grid') { |
| | | this.loadData() |
| | | if (btn && btn.syncComponent && btn.syncComponent[0]) { |
| | | let syncId = btn.syncComponent.slice(-1)[0] |
| | | if (config.uuid !== syncId) { |
| | | MKEmitter.emit('syncRefreshComponentId', syncId) |
| | | let searches = fromJS(search).toJS() |
| | | if (mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | | let keys = searches.map(item => item.key.toLowerCase()) |
| | | mainSearch.forEach(item => { |
| | | if (!keys.includes(item.key.toLowerCase())) { |
| | | searches.push(item) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, pageIndex, config.setting.pageSize, BID, menuType, id) |
| | | |
| | | if (param.func === 'sPC_Get_TableData') { |
| | | param.menuname = config.name || '' |
| | | } |
| | | |
| | | 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[config.setting.primaryKey] === _data[config.setting.primaryKey]) { |
| | | _data.key = item.key |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | 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 |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | {data && data.length > 0 ? <div className="card-row-list"> |
| | | {data.map((item, index) => ( |
| | | <Col className={activeKey === index ? 'active' : (selectKeys.indexOf(index) > -1 ? 'selected' : '')} key={index} span={card.setting.width} offset={!index ? offset : 0} onClick={() => {this.changeCard(index, item)}}> |
| | | <CardItem card={card} cards={config} data={item} updateStatus={this.updateStatus}/> |
| | | <CardItem card={card} cards={config} data={item}/> |
| | | </Col> |
| | | ))} |
| | | </div> : null} |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('syncRefreshComponentId', this.reload) |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('syncRefreshComponentId', this.reload) |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮执行完成后页面刷新 |
| | | * @param {*} menuId // 菜单Id |
| | | * @param {*} position // 刷新位置 |
| | | * @param {*} btn // 执行的按钮 |
| | | */ |
| | | refreshByButtonResult = (menuId, position, btn) => { |
| | | const { config, BID } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | this.loadData() // 数据刷新 |
| | | |
| | | if (btn.syncComponentId && btn.syncComponentId !== config.uuid && btn.syncComponentId !== config.setting.supModule) { |
| | | MKEmitter.emit('reloadData', btn.syncComponentId) // 同级标签刷新 |
| | | } |
| | | |
| | | if (position === 'mainline' && config.setting.supModule) { // 主表行刷新 |
| | | MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty')) |
| | | } else if (position === 'popclose') { // 标签关闭刷新 |
| | | config.setting.supModule && MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty')) |
| | | btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) |
| | | } |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | reload = (syncId) => { |
| | | reloadData = (menuId) => { |
| | | const { config } = this.state |
| | | |
| | | if (syncId && syncId !== config.uuid) return |
| | | if (menuId !== config.uuid) return |
| | | |
| | | this.loadData() |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | updateStatus = (type, position, btn) => { |
| | | const { config } = this.state |
| | | |
| | | if (type === 'refresh' && position === 'grid') { |
| | | this.loadData() |
| | | if (btn && btn.syncComponent && btn.syncComponent[0]) { |
| | | let syncId = btn.syncComponent.slice(-1)[0] |
| | | if (config.uuid !== syncId) { |
| | | MKEmitter.emit('syncRefreshComponentId', syncId) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | changeCard = (index, item) => { |
| | | const { config, data, activeKey } = this.state |
| | | |
| | |
| | | <div className={`card-row-list ${config.wrap.cardType || ''} ${config.wrap.scale || ''}`}> |
| | | {config.subcards.map((item, index) => ( |
| | | <Col className={activeKey === index ? 'active' : ''} key={index} span={item.setting.width || 6} offset={item.offset || 0} onClick={() => {this.changeCard(index, item)}}> |
| | | <CardItem card={item} cards={config} data={data} updateStatus={this.updateStatus}/> |
| | | <CardItem card={item} cards={config} data={data}/> |
| | | </Col> |
| | | ))} |
| | | </div> |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('syncRefreshComponentId', this.reload) |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('getexceloutparam', this.getexceloutparam) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('syncRefreshComponentId', this.reload) |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('getexceloutparam', this.getexceloutparam) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮执行完成后页面刷新 |
| | | * @param {*} menuId // 菜单Id |
| | | * @param {*} position // 刷新位置 |
| | | * @param {*} btn // 执行的按钮 |
| | | */ |
| | | refreshByButtonResult = (menuId, position, btn) => { |
| | | const { config, BID } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | this.loadData(btn) // 数据刷新 |
| | | |
| | | if (btn.syncComponentId && btn.syncComponentId !== config.uuid && btn.syncComponentId !== config.setting.supModule) { |
| | | MKEmitter.emit('reloadData', btn.syncComponentId) // 同级标签刷新 |
| | | } |
| | | |
| | | if (position === 'mainline' && config.setting.supModule) { // 主表行刷新 |
| | | MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty')) |
| | | } else if (position === 'popclose') { // 标签关闭刷新 |
| | | config.setting.supModule && MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty')) |
| | | btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) |
| | | } |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | reload = (syncId) => { |
| | | reloadData = (menuId) => { |
| | | const { config } = this.state |
| | | |
| | | if (syncId && syncId !== config.uuid) return |
| | | if (config.uuid !== menuId) return |
| | | |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadData() |
| | | }) |
| | | this.loadData() |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | updateStatus = (type, position, btn) => { |
| | | const { config } = this.state |
| | | |
| | | if (type === 'refresh' && position === 'grid') { |
| | | this.loadData() |
| | | if (btn && btn.syncComponent && btn.syncComponent[0]) { |
| | | let syncId = btn.syncComponent.slice(-1)[0] |
| | | if (config.uuid !== syncId) { |
| | | MKEmitter.emit('syncRefreshComponentId', syncId) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | changePageIndex = (page) => { |
| | | this.setState({ |
| | | pageIndex: page |
| | |
| | | line.push( |
| | | <Col key={index} span={24}> |
| | | <div className="card-item-box" style={item.style}> |
| | | <CardCellComponent seq={seq} data={data} cards={config} cardCell={item} elements={item.elements} updateStatus={this.updateStatus}/> |
| | | <CardCellComponent seq={seq} data={data} cards={config} cardCell={item} elements={item.elements}/> |
| | | </div> |
| | | </Col> |
| | | ) |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('getexceloutparam', this.getexceloutparam) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | | /** |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('getexceloutparam', this.getexceloutparam) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮执行完成后页面刷新 |
| | | * @param {*} menuId // 菜单Id |
| | | * @param {*} position // 刷新位置 |
| | | * @param {*} btn // 执行的按钮 |
| | | */ |
| | | refreshByButtonResult = (menuId, position, btn) => { |
| | | const { config, BID } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | this.loadData() // 数据刷新 |
| | | |
| | | if (btn.syncComponentId && btn.syncComponentId !== config.uuid && btn.syncComponentId !== config.setting.supModule) { |
| | | MKEmitter.emit('reloadData', btn.syncComponentId) // 同级标签刷新 |
| | | } |
| | | |
| | | if (position === 'mainline' && config.setting.supModule) { // 主表行刷新 |
| | | MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty')) |
| | | } else if (position === 'popclose') { // 标签关闭刷新 |
| | | config.setting.supModule && MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty')) |
| | | btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) |
| | | } |
| | | } |
| | | |
| | | reloadData = (menuId) => { |
| | | const { config } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | this.loadData() |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id) => { |
| | |
| | | btn={item} |
| | | show="icon" |
| | | setting={config.setting} |
| | | updateStatus={() => {}} |
| | | /> |
| | | ) |
| | | } else { |
| | |
| | | btn={item} |
| | | show="icon" |
| | | setting={config.setting} |
| | | updateStatus={() => {}} |
| | | /> |
| | | ) |
| | | } |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | | |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | | |
| | | reloadData = (menuId) => { |
| | | const { config } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | this.loadData() |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | } |
| | | |
| | | render() { |
| | | let { col, config, record, className, style, triggerLink, updateStatus, ...resProps } = this.props |
| | | let { col, config, record, className, style, triggerLink, ...resProps } = this.props |
| | | |
| | | if (!col) return (<td {...resProps} className={className} style={style}/>) |
| | | |
| | |
| | | } else if (col.type === 'custom') { |
| | | style.padding = '0px' |
| | | resProps.children = ( |
| | | <CardCellComponent data={record} cards={config} elements={col.elements} updateStatus={this.props.updateStatus}/> |
| | | <CardCellComponent data={record} cards={config} elements={col.elements}/> |
| | | ) |
| | | } else if (col.type === 'action') { |
| | | style.padding = '0px 5px' |
| | | resProps.children = ( |
| | | <CardCellComponent data={record} cards={config} elements={col.elements} updateStatus={this.props.updateStatus}/> |
| | | <CardCellComponent data={record} cards={config} elements={col.elements}/> |
| | | ) |
| | | } |
| | | |
| | |
| | | loading: PropTypes.bool, // 表格加载中 |
| | | refreshdata: PropTypes.func, // 表格中排序列、页码的变化时刷新 |
| | | chgSelectData: PropTypes.func, // 数据切换 |
| | | refreshbyaction: PropTypes.func, // 按钮执行完成后刷新 |
| | | } |
| | | |
| | | state = { |
| | |
| | | record, |
| | | col: item, |
| | | config: item.type === 'custom' || item.type === 'action' ? {setting, columns: fields} : null, |
| | | triggerLink: this.triggerLink, |
| | | updateStatus: this.updateStatus |
| | | triggerLink: this.triggerLink |
| | | }) |
| | | } |
| | | } |
| | |
| | | return |
| | | } |
| | | MKEmitter.removeListener('resetTable', this.resetTable) |
| | | } |
| | | |
| | | updateStatus = (type, positon, btn) => { |
| | | if (type === 'refresh') { |
| | | this.props.refreshbyaction(positon, btn) |
| | | } |
| | | } |
| | | |
| | | // 字段透视 |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮操作完成后(成功或失败),页面刷新,重置页码及选择项 |
| | | */ |
| | | refreshbyaction = (position, btn) => { |
| | | if (position === 'grid' || position === 'view') { |
| | | this.reloadtable(btn) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | getexceloutparam = (menuId, btnId) => { |
| | |
| | | }) |
| | | } |
| | | |
| | | reloadData = (menuId, id, btn) => { |
| | | reloadData = (menuId, id) => { |
| | | const { config } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | if (id === 'empty') return |
| | | |
| | | if (id === 'formtab') { // 表单标签页刷新 |
| | | this.reloadtable(btn) |
| | | return |
| | | } |
| | | |
| | | if (!id) { |
| | | this.reloadtable() |
| | | } else { |
| | |
| | | this.loadmaindata(true, 'true') |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮执行完成后页面刷新 |
| | | * @param {*} menuId // 菜单Id |
| | | * @param {*} position // 刷新位置 |
| | | * @param {*} btn // 执行的按钮 |
| | | */ |
| | | refreshByButtonResult = (menuId, position, btn) => { |
| | | const { config, BID } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | this.reloadtable(btn) // 数据刷新 |
| | | |
| | | if (btn.syncComponentId && btn.syncComponentId !== config.uuid && btn.syncComponentId !== config.setting.supModule) { |
| | | MKEmitter.emit('reloadData', btn.syncComponentId) // 同级标签刷新 |
| | | } |
| | | |
| | | if (position === 'mainline' && config.setting.supModule) { // 主表行刷新 |
| | | MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty')) |
| | | } else if (position === 'popclose') { // 标签关闭刷新 |
| | | config.setting.supModule && MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty')) |
| | | btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) |
| | | } |
| | | } |
| | | |
| | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('getexceloutparam', this.getexceloutparam) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | | /** |
| | |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('getexceloutparam', this.getexceloutparam) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | | render() { |
| | |
| | | BData={this.state.BData} |
| | | columns={config.columns} |
| | | selectedData={selectedData} |
| | | refreshdata={this.refreshbyaction} |
| | | /> |
| | | <div className={'main-table-box ' + (!actions || actions.length === 0 ? 'no-action' : '')}> |
| | | <MainTable |
| | |
| | | loading={this.state.loading} |
| | | refreshdata={this.refreshbytable} |
| | | statFValue={this.state.statFValue} |
| | | refreshbyaction={this.refreshbyaction} |
| | | chgSelectData={(selects) => this.setState({selectedData: selects})} |
| | | /> |
| | | </div> |
| | |
| | | class CustomPage extends Component { |
| | | static propTpyes = { |
| | | param: PropTypes.any, // 其他页面传递的参数 |
| | | Tab: PropTypes.string, // 弹窗标签 |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | MenuNo: PropTypes.string, // 菜单参数 |
| | | MenuName: PropTypes.string // 菜单名称 |
| | |
| | | |
| | | // 权限过滤 |
| | | let isHS = this.props.menuType === 'HS' |
| | | let tabId = this.props.Tab ? this.props.Tab.uuid : '' // 弹窗标签按钮Id |
| | | if (item.action && item.action.length > 0) { |
| | | item.action = item.action.filter(cell => { |
| | | cell.logLabel = item.name + '-' + cell.label |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? cell.syncComponent.pop() : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$tabId = tabId |
| | | cell.$type = 'CustomPage' |
| | | |
| | | return isHS || permAction[cell.uuid] |
| | | }) |
| | |
| | | cell.logLabel = item.name + '-' + cell.label |
| | | cell.Ot = 'requiredSgl' |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? cell.syncComponent.pop() : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$tabId = tabId |
| | | cell.$type = 'CustomPage' |
| | | } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | |
| | | cell.logLabel = item.name + '-' + cell.label |
| | | cell.Ot = 'requiredSgl' |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? cell.syncComponent.pop() : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$tabId = tabId |
| | | cell.$type = 'CustomPage' |
| | | } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | |
| | | cell.logLabel = item.name + '-' + cell.label |
| | | cell.Ot = 'requiredSgl' |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? cell.syncComponent.pop() : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$tabId = tabId |
| | | cell.$type = 'CustomPage' |
| | | } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | |
| | | cell.logLabel = item.name + '-' + cell.label |
| | | cell.Ot = 'requiredSgl' |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? cell.syncComponent.pop() : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$tabId = tabId |
| | | cell.$type = 'CustomPage' |
| | | |
| | | return isHS || permAction[cell.uuid] |
| | | }) |
| | |
| | | } |
| | | |
| | | if (item.setting && item.setting.supModule) { |
| | | let pid = item.setting.supModule.slice(-1)[0] |
| | | let pid = item.setting.supModule.pop() |
| | | if (pid && pid !== 'empty') { |
| | | item.setting.supModule = pid |
| | | } else { |
| | |
| | | } |
| | | |
| | | if (col.linkmenu && col.linkmenu.length > 0) { |
| | | let menu_id = col.linkmenu.slice(-1)[0] |
| | | let menu_id = col.linkmenu.pop() |
| | | col.linkThdMenu = permMenus.filter(m => m.MenuID === menu_id)[0] || '' |
| | | } else { |
| | | col.linkThdMenu = '' |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Button, message } from 'antd' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import mzhCN from '@/locales/zh-CN/main.js' |
| | | import menUS from '@/locales/en-US/main.js' |
| | | |
| | | class Iframe extends Component { |
| | | static propTypes = { |
| | | title: PropTypes.string, |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | MenuNo: PropTypes.string, // 菜单参数 |
| | | url: PropTypes.string |
| | | } |
| | | |
| | | state = { |
| | | visible: true, |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? mzhCN : menUS, |
| | | debug: sessionStorage.getItem('debug') === 'true' |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('reloadMenuView', this.reloadMenuView) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) |
| | | } |
| | | |
| | | reloadMenuView = (menuId) => { |
| | | const { MenuID } = this.props |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | | this.setState({visible: false}, () => { |
| | | this.setState({visible: true}) |
| | | }) |
| | | } |
| | | |
| | | copyMenuNo = (e) => { |
| | | const { MenuNo } = this.props |
| | | |
| | | e.stopPropagation() |
| | | let oInput = document.createElement('input') |
| | | oInput.value = MenuNo || '' |
| | | document.body.appendChild(oInput) |
| | | oInput.select() |
| | | document.execCommand('Copy') |
| | | oInput.className = 'oInput' |
| | | oInput.style.display = 'none' |
| | | message.success(this.state.dict['main.copy.success']) |
| | | } |
| | | |
| | | render () { |
| | | return ( |
| | | <iframe title={this.props.title} src={this.props.url} /> |
| | | ) |
| | | const { visible, debug } = this.state |
| | | |
| | | return (<div> |
| | | {visible ? <iframe title={this.props.title} src={this.props.url} /> : null} |
| | | {debug ? <Button |
| | | icon="copy" |
| | | shape="circle" |
| | | className={'main-copy ifr-copy'} |
| | | onClick={this.copyMenuNo} |
| | | /> : null} |
| | | </div>) |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import './index.scss' |
| | |
| | | }) |
| | | } |
| | | |
| | | reloadMenuView = (menuId) => { |
| | | const { MenuID } = this.props |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | | this.setState({ |
| | | loading: true, |
| | | loadingTree: false, |
| | | roleList: null, |
| | | selectRoleId: '', |
| | | mainMenus: null, |
| | | menuTrees: null, |
| | | checkedKeys: [], |
| | | menuOpenKeys: [], |
| | | selectMenuTrees: null, |
| | | selectMenuOpenKeys: [], |
| | | primarykey: '', |
| | | tabKey: '', |
| | | submitloading: false, |
| | | initCheckKeys: null |
| | | }) |
| | | this.getRoleList() |
| | | this.getMainMenuList() |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | this.getRoleList() |
| | | this.getMainMenuList() |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('reloadMenuView', this.reloadMenuView) |
| | | } |
| | | |
| | | /** |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | import { scriptMainTable, buttonConfig } from './config' |
| | | import MKEmitter from '@/utils/events.js' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | import TopSearch from './topSearch' |
| | | import MainAction from './actionList' |
| | | import './index.scss' |
| | | |
| | | const MainSearch = asyncComponent(() => import('@/tabviews/zshare/topSearch')) |
| | | const MainTable = asyncSpinComponent(() => import('@/tabviews/zshare/normalTable')) |
| | | |
| | | class ScriptTable extends Component { |
| | |
| | | }) |
| | | } |
| | | |
| | | reloadMenuView = (menuId) => { |
| | | const { MenuID } = this.props |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | | this.reloadview() |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | // 组件加载时,获取菜单数据 |
| | | this.loadconfig() |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('reloadMenuView', this.reloadMenuView) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) |
| | | } |
| | | |
| | | render() { |
| | | const { dict, searchlist, setting, actions, columns, pickup, selectedData } = this.state |
| | | const { searchlist, setting, actions, columns, pickup, selectedData } = this.state |
| | | |
| | | return ( |
| | | <div className="script-manage-table" id={this.state.ContainerId}> |
| | | <TopSearch |
| | | dict={dict} |
| | | searchlist={searchlist} |
| | | refreshdata={this.refreshbysearch} |
| | | /> |
| | | <MainSearch searchlist={searchlist} menuType="HS" refreshdata={this.refreshbysearch}/> |
| | | <MainAction |
| | | BID="" |
| | | type="main" |
| | |
| | | }) |
| | | } |
| | | item.key = index |
| | | item.$$uuid = item[setting.primaryKey] || '' |
| | | item.$$BID = _BID || '' |
| | | |
| | | return item |
| | | }), |
| | | total: result.total, |
| | |
| | | data = data.map(item => { |
| | | if (item[setting.primaryKey] === _data[setting.primaryKey]) { |
| | | _data.key = item.key |
| | | _data.$$uuid = _data[setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | |
| | | return _data |
| | | } else { |
| | | return item |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮操作完成后(成功或失败),页面刷新,重置页码及选择项 |
| | | */ |
| | | refreshbyaction = (position, btn) => { |
| | | const { Tab, SupMenuID, BID } = this.props |
| | | |
| | | 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级标签 |
| | | } |
| | | } else if (position === 'equaltab') { |
| | | this.reloadtable(btn) |
| | | if (Tab.equalTab && Tab.equalTab.length > 0) { |
| | | MKEmitter.emit('reloadData', Tab.equalTab.join(',')) // 同级标签重置 |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | getexceloutparam = (menuId, btnId) => { |
| | |
| | | this.setState({chartId: uuid}) |
| | | } |
| | | |
| | | reloadData = (menuId, id) => { |
| | | reloadData = (menuId, id) => { // Id存在时,刷新行 |
| | | const { MenuID } = this.props |
| | | |
| | | if (menuId.indexOf(MenuID) === -1) return |
| | |
| | | this.reloadtable() |
| | | } else { |
| | | this.loadmainLinedata(id) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮执行完成后页面刷新 |
| | | * @param {*} menuId // 菜单Id |
| | | * @param {*} position // 刷新位置 |
| | | * @param {*} btn // 执行的按钮 |
| | | */ |
| | | refreshByButtonResult = (menuId, position, btn) => { |
| | | const { MenuID } = this.props |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | | const { Tab, SupMenuID, BID } = this.props |
| | | |
| | | 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级标签 |
| | | } |
| | | } else if (position === 'equaltab') { |
| | | this.reloadtable(btn) |
| | | if (Tab.equalTab && Tab.equalTab.length > 0) { |
| | | MKEmitter.emit('reloadData', Tab.equalTab.join(',')) // 同级标签重置 |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('getexceloutparam', this.getexceloutparam) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('getexceloutparam', this.getexceloutparam) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | | render() { |
| | |
| | | BData={this.props.BData} |
| | | MenuID={this.props.MenuID} |
| | | selectedData={selectedData} |
| | | refreshdata={this.refreshbyaction} |
| | | ContainerId={this.props.ContainerId} |
| | | /> |
| | | </div> |
| | |
| | | setting={setting} |
| | | columns={columns} |
| | | pageSize={pageSize} |
| | | BID={this.props.BID} |
| | | dict={this.state.dict} |
| | | data={this.state.data} |
| | | BData={this.props.BData} |
| | | total={this.state.total} |
| | | MenuID={this.props.MenuID} |
| | | loading={this.state.loading} |
| | | refreshdata={this.refreshbytable} |
| | | statFValue={this.state.statFValue} |
| | | handleTableId={this.handleTableId} |
| | | ContainerId={this.props.ContainerId} |
| | | refreshbyaction={this.refreshbyaction} |
| | | refreshdata={this.refreshbytable} |
| | | handleTableId={this.handleTableId} |
| | | chgSelectData={this.changeSelectedData} |
| | | /> |
| | | </div> |
| | |
| | | MenuID={this.props.MenuID} |
| | | loading={this.state.loading} |
| | | tableId={this.props.Tab.uuid} |
| | | refreshdata={this.refreshbyaction} |
| | | handleTableId={this.handleTableId} |
| | | /> |
| | | </Col> |
| | |
| | | |
| | | class SubTabModalTable extends Component { |
| | | static propTpyes = { |
| | | type: PropTypes.any, // 类型,calendar需特殊处理 |
| | | Tab: PropTypes.any, // 日历标签信息或标签按钮信息 |
| | | BID: PropTypes.string, // 上级数据ID |
| | | BData: PropTypes.any, // 上级数据 |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | mainSearch: PropTypes.any, // 主表搜索条件 |
| | | SupMenuID: PropTypes.string, // 上级菜单Id |
| | | refreshSupView: PropTypes.any, // 刷新上级菜单 |
| | | closeModalView: PropTypes.any // 关闭模态框 |
| | | } |
| | | |
| | | state = { |
| | |
| | | * @description 获取页面配置信息 |
| | | */ |
| | | async loadconfig () { |
| | | const { permAction, type, Tab } = this.props |
| | | const { permAction, Tab } = this.props |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_LongParam', |
| | |
| | | // 版本兼容 |
| | | config = UtilsUpdate.updateSubTable(config) |
| | | |
| | | // 仅支持exec、prompt、pop 三种类型按钮 |
| | | // 不支持funcbutton、popview 类型按钮 |
| | | let labels = [] |
| | | if (type === 'calendar') { |
| | | config.action = config.action.filter(item => { |
| | | if (['exec', 'prompt', 'pop', 'tab', 'excelIn', 'excelOut'].includes(item.OpenType)) return true |
| | | config.action = config.action.filter(item => { |
| | | if (['exec', 'prompt', 'pop', 'tab', 'excelIn', 'excelOut', 'innerpage'].includes(item.OpenType)) return true |
| | | |
| | | labels.push(item.label) |
| | | labels.push(item.label) |
| | | |
| | | return false |
| | | }) |
| | | |
| | | } else { |
| | | config.action = config.action.filter(item => { |
| | | if (['exec', 'prompt', 'pop'].includes(item.OpenType)) return true |
| | | |
| | | labels.push(item.label) |
| | | |
| | | return false |
| | | }) |
| | | } |
| | | return false |
| | | }) |
| | | |
| | | if (window.GLOB.systemType !== 'production' && labels.length > 0) { |
| | | notification.warning({ |
| | |
| | | }) |
| | | } |
| | | item.key = index |
| | | item.$$uuid = item[setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | |
| | | return item |
| | | }), |
| | | total: result.total, |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮操作完成后(成功或失败),页面刷新,重置页码及选择项 |
| | | */ |
| | | 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() |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | getexceloutparam = (menuId, btnId) => { |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮执行完成后页面刷新 |
| | | * @param {*} menuId // 菜单Id |
| | | * @param {*} position // 刷新位置 |
| | | * @param {*} btn // 执行的按钮 |
| | | */ |
| | | refreshByButtonResult = (menuId, position, btn) => { |
| | | const { MenuID } = this.props |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | | this.reloadtable(btn) |
| | | MKEmitter.emit('refreshPopButton', this.props.Tab.uuid) |
| | | } |
| | | |
| | | /** |
| | | * @description 图表视图切换 |
| | | */ |
| | | changeChart = (uuid) => { |
| | |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('getexceloutparam', this.getexceloutparam) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | | /** |
| | |
| | | return |
| | | } |
| | | MKEmitter.removeListener('getexceloutparam', this.getexceloutparam) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | | render() { |
| | |
| | | BData={this.props.BData} |
| | | selectedData={selectedData} |
| | | MenuID={this.props.SupMenuID} |
| | | refreshdata={this.refreshbyaction} |
| | | /> |
| | | </div> |
| | | <SubTable |
| | |
| | | setting={setting} |
| | | columns={columns} |
| | | pageSize={pageSize} |
| | | BID={this.props.BID} |
| | | data={this.state.data} |
| | | dict={this.state.dict} |
| | | BData={this.props.BData} |
| | |
| | | loading={this.state.loading} |
| | | refreshdata={this.refreshbytable} |
| | | statFValue={this.state.statFValue} |
| | | refreshbyaction={this.refreshbyaction} |
| | | chgSelectData={this.changeSelectedData} |
| | | handleTableId={() => {}} |
| | | /> |
| | |
| | | data={this.state.data} |
| | | BData={this.props.BData} |
| | | loading={this.state.loading} |
| | | refreshdata={this.refreshbyaction} |
| | | handleTableId={() => {}} |
| | | /> |
| | | </Col> |
| | |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import TransferForm from './transferform' |
| | | import MutilForm from './mutilform' |
| | | import subtableurl from '@/assets/img/subtable.jpg' |
| | |
| | | |
| | | componentDidMount () { |
| | | this.getTabs() |
| | | MKEmitter.addListener('reloadMenuView', this.reloadMenuView) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) |
| | | } |
| | | |
| | | reloadMenuView = (menuId) => { |
| | | const { MenuID } = this.props |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | | this.setState({ |
| | | searchKey: '', |
| | | tabviews: null, |
| | | loading: true, |
| | | modaltype: '', |
| | | editTab: null, |
| | | submitloading: false, |
| | | thawVisible: false, |
| | | thawmenulist: null |
| | | }) |
| | | this.getTabs() |
| | | } |
| | | |
| | | handleTab = (tab, type) => { |
| | |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | import { verupMainTable, buttonConfig } from './config' |
| | | import MKEmitter from '@/utils/events.js' |
| | | |
| | | import TopSearch from './topSearch' |
| | | import MainAction from './actionList' |
| | | import './index.scss' |
| | | |
| | | const SubTable = asyncSpinComponent(() => import('./subtabtable')) |
| | | const MainSearch = asyncComponent(() => import('@/tabviews/zshare/topSearch')) |
| | | const MainTable = asyncSpinComponent(() => import('@/tabviews/zshare/normalTable')) |
| | | |
| | | const { TabPane } = Tabs |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { dict, searchlist, setting, actions, columns, pickup, config, selectedData } = this.state |
| | | const { searchlist, setting, actions, columns, pickup, config, selectedData } = this.state |
| | | |
| | | return ( |
| | | <div className="veruptable" id={this.state.ContainerId}> |
| | | <TopSearch |
| | | dict={dict} |
| | | searchlist={searchlist} |
| | | refreshdata={this.refreshbysearch} |
| | | /> |
| | | <MainSearch searchlist={searchlist} menuType="HS" refreshdata={this.refreshbysearch}/> |
| | | <MainAction |
| | | BID="" |
| | | type="main" |
| | |
| | | import { buttonConfig, tabConfig } from '../config' |
| | | import MKEmitter from '@/utils/events.js' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | import SubAction from '../actionList' |
| | | import SubSearch from '../topSearch' |
| | | |
| | | import './index.scss' |
| | | |
| | | const MainSearch = asyncComponent(() => import('@/tabviews/zshare/topSearch')) |
| | | const SubTable = asyncSpinComponent(() => import('@/tabviews/zshare/normalTable')) |
| | | |
| | | class VerupSubTabViewTable extends Component { |
| | |
| | | this.setState({ |
| | | data: result.data.map((item, index) => { |
| | | item.key = index |
| | | item.$$BID = _BID || '' |
| | | return item |
| | | }), |
| | | total: result.total, |
| | |
| | | |
| | | return ( |
| | | <div className="verup-subtable" id={'subtable' + this.props.MenuID}> |
| | | {searchlist && searchlist.length > 0 ? |
| | | <SubSearch |
| | | dict={this.state.dict} |
| | | searchlist={searchlist} |
| | | refreshdata={this.refreshbysearch} |
| | | /> : null |
| | | {searchlist && searchlist.length ? |
| | | <MainSearch searchlist={searchlist} menuType="HS" refreshdata={this.refreshbysearch}/> : null |
| | | } |
| | | {actions ? |
| | | <div className="sub-action"> |
| | |
| | | btn: PropTypes.object, // 按钮 |
| | | selectedData: PropTypes.any, // 子表中选择数据 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | updateStatus: PropTypes.func, // 按钮状态更新 |
| | | } |
| | | |
| | | state = { |
| | |
| | | return ( |
| | | <Button |
| | | type="link" |
| | | title={show === 'icon' ? btn.label : ''} |
| | | loading={loading} |
| | | style={btn.btnstyle} |
| | | icon={show === 'text' ? '' : (btn.icon || '')} |
| | |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | | btn: PropTypes.object, // 按钮 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | updateStatus: PropTypes.func, // 按钮状态更新 |
| | | } |
| | | |
| | | state = { |
| | |
| | | loading: false |
| | | }) |
| | | |
| | | this.props.updateStatus('refresh', btn.execSuccess, btn) |
| | | if (btn.execSuccess !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn) |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | loading: false |
| | | }) |
| | | |
| | | this.props.updateStatus('refresh', btn.execError, btn) |
| | | if (btn.execError !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn) |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> |
| | | <Button |
| | | type="link" |
| | | title={show === 'icon' ? btn.label : ''} |
| | | loading={loading} |
| | | style={btn.btnstyle} |
| | | icon={show === 'text' ? '' : (show === 'icon' ? (btn.icon || 'upload') : (btn.icon || ''))} |
| | |
| | | loading: false |
| | | }) |
| | | |
| | | this.props.updateStatus('refresh', btn.execSuccess, btn) |
| | | if (btn.execSuccess !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn) |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | loading: false |
| | | }) |
| | | |
| | | this.props.updateStatus('refresh', btn.execError, btn) |
| | | if (btn.execError !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn) |
| | | } |
| | | } |
| | | |
| | | render() { |
| | |
| | | return ( |
| | | <Button |
| | | type="link" |
| | | title={show === 'icon' ? btn.label : ''} |
| | | loading={loading} |
| | | style={btn.btnstyle} |
| | | icon={show === 'text' ? '' : (show === 'icon' ? (btn.icon || 'download') : (btn.icon || ''))} |
| | |
| | | actions: PropTypes.array, // 按钮组 |
| | | columns: PropTypes.array, // 显示列 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | ContainerId: PropTypes.any, // tab页面ID,用于弹窗控制 |
| | | refreshdata: PropTypes.func, // 执行完成后数据刷新 |
| | | ContainerId: PropTypes.any // tab页面ID,用于弹窗控制 |
| | | } |
| | | |
| | | state = { |
| | |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | updateStatus = (type, positon, btn) => { |
| | | if (type === 'refresh') { |
| | | this.props.refreshdata(positon, btn) |
| | | } else if (type === 'trigger') { // 日历中的新标签页触发事件 |
| | | this.props.refreshdata('trigger') |
| | | } |
| | | } |
| | | |
| | | getButtonList = (actions) => { |
| | |
| | | position="toolbar" |
| | | ContainerId={ContainerId} |
| | | selectedData={selectedData} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | | ) |
| | | } else if (item.OpenType === 'excelIn') { |
| | |
| | | setting={setting} |
| | | position="toolbar" |
| | | selectedData={selectedData} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | | ) |
| | | } else if (item.OpenType === 'excelOut') { |
| | |
| | | btn={item} |
| | | setting={setting} |
| | | position="toolbar" |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | | ) |
| | | } else if (item.OpenType === 'popview') { |
| | |
| | | setting={setting} |
| | | position="toolbar" |
| | | selectedData={selectedData} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | | ) |
| | | } else if (item.OpenType === 'tab' || item.OpenType === 'blank') { |
| | |
| | | setting={setting} |
| | | position="toolbar" |
| | | selectedData={selectedData} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | | ) |
| | | } else if (item.OpenType === 'innerpage' || item.OpenType === 'outerpage') { |
| | |
| | | setting={setting} |
| | | position="toolbar" |
| | | selectedData={selectedData} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | | ) |
| | | } else if (item.OpenType === 'funcbutton') { |
| | |
| | | setting={setting} |
| | | position="toolbar" |
| | | selectedData={selectedData} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | | ) |
| | | } else if (item.funcType === 'print') { |
| | |
| | | position="toolbar" |
| | | ContainerId={ContainerId} |
| | | selectedData={selectedData} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | | ) |
| | | } |
| | |
| | | btn: PropTypes.object, // 按钮 |
| | | selectedData: PropTypes.any, // 子表中选择数据 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | updateStatus: PropTypes.func, // 按钮状态更新 |
| | | } |
| | | |
| | | state = { |
| | |
| | | */ |
| | | actionTrigger = (triggerId, record) => { |
| | | const { setting, btn, selectedData } = this.props |
| | | const _this = this |
| | | |
| | | if (triggerId && btn.uuid !== triggerId) return |
| | | |
| | |
| | | okText: '支付成功', |
| | | cancelText: '支付遇到问题', |
| | | onOk() { |
| | | _this.props.updateStatus('refresh', 'grid') |
| | | // 支付后刷新界面 |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, 'grid', btn) |
| | | }, |
| | | onCancel() { |
| | | _this.props.updateStatus('refresh', 'grid') |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, 'grid', btn) |
| | | }, |
| | | }) |
| | | window.open(url) |
| | |
| | | return ( |
| | | <Button |
| | | type="link" |
| | | title={show === 'icon' ? btn.label : ''} |
| | | style={btn.btnstyle} |
| | | icon={show === 'text' ? '' : (btn.icon || '')} |
| | | onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} |
| | |
| | | columns: PropTypes.any, // 字段列 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | ContainerId: PropTypes.any, // tab页面ID,用于弹窗控制 |
| | | updateStatus: PropTypes.func, // 按钮状态更新 |
| | | } |
| | | |
| | | state = { |
| | |
| | | this.sendMessage() |
| | | } |
| | | |
| | | this.props.updateStatus('refresh', btn.execSuccess, btn) |
| | | if (btn.execSuccess !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn) |
| | | } |
| | | } |
| | | |
| | | sendMessage = () => { |
| | |
| | | loading: false |
| | | }) |
| | | |
| | | this.props.updateStatus('refresh', btn.execError, btn) |
| | | if (btn.execError !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn) |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> |
| | | <Button |
| | | type="link" |
| | | title={show === 'icon' ? btn.label : ''} |
| | | loading={loading} |
| | | style={btn.btnstyle || style} |
| | | icon={show === 'text' ? '' : (btn.icon || '')} |
| | |
| | | MenuID: PropTypes.string, // 菜单ID |
| | | btn: PropTypes.object, // 按钮 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | updateStatus: PropTypes.func, // 按钮状态更新 |
| | | } |
| | | |
| | | state = { |
| | |
| | | if (position === 'toolbar') { |
| | | MKEmitter.addListener('triggerBtnId', this.actionTrigger) |
| | | } |
| | | MKEmitter.addListener('openNewTab', this.openNewTab) |
| | | MKEmitter.addListener('refreshPopButton', this.refreshPopButton) |
| | | } |
| | | |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('openNewTab', this.openNewTab) |
| | | MKEmitter.removeListener('triggerBtnId', this.actionTrigger) |
| | | MKEmitter.removeListener('refreshPopButton', this.refreshPopButton) |
| | | } |
| | | |
| | | /** |
| | | * @description 打开新标签时,关闭弹窗标签页 |
| | | */ |
| | | openNewTab = () => { |
| | | this.setState({ |
| | | visible: false, |
| | | loading: false |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 弹窗标签页刷新 |
| | | */ |
| | | refreshPopButton = (tabId) => { |
| | | const { btn } = this.props |
| | | |
| | | if (btn.uuid !== tabId) return |
| | | |
| | | if (btn.$type === 'CustomPage') { |
| | | if (btn.popClose !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.popClose, btn) |
| | | } |
| | | } else { |
| | | let position = btn.popClose !== 'never' ? btn.popClose : 'grid' |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, position, btn) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 触发按钮操作 |
| | | */ |
| | |
| | | }) |
| | | } |
| | | |
| | | // 操作后刷新主表 |
| | | reloadtable = () => { |
| | | const { btn } = this.props |
| | | this.props.updateStatus('refresh', 'grid', btn) |
| | | } |
| | | |
| | | /** |
| | | * @description 弹窗关闭 |
| | | */ |
| | |
| | | loading: false |
| | | }) |
| | | |
| | | this.props.updateStatus('refresh', btn.popClose, btn) |
| | | if (btn.popClose !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.popClose, btn) |
| | | } |
| | | } |
| | | |
| | | render() { |
| | |
| | | >{btn.label}</Button> : null} |
| | | {show !== 'actionList' ? <Button |
| | | type="link" |
| | | title={show === 'icon' ? btn.label : ''} |
| | | loading={loading} |
| | | style={btn.btnstyle} |
| | | icon={show === 'text' ? '' : (btn.icon || '')} |
| | | onClick={() => {this.actionTrigger()}} |
| | | >{show === 'icon' && btn.icon ? '' : btn.label}</Button> : null} |
| | | <Modal |
| | | className={'popview-modal ' + (btn.$menuId ? 'custom-popview' : '')} |
| | | className={'popview-modal ' + (btn.$type === 'CustomPage' ? 'custom-popview' : '')} |
| | | title={btn.label} |
| | | width={'80vw'} |
| | | maskClosable={false} |
| | |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | | {!btn.$menuId ? <SubTabTable |
| | | {btn.$type !== 'CustomPage' ? <SubTabTable |
| | | Tab={btn} |
| | | MenuID={btn.linkTab} |
| | | SupMenuID={this.props.MenuID} |
| | | BID={popData ? primaryId : this.props.BID} |
| | | BData={popData || this.props.BData} |
| | | SupMenuID={this.props.MenuID} |
| | | refreshSupView={this.reloadtable} |
| | | /> : null} |
| | | {btn.$menuId ? <CustomPage MenuID={btn.uuid} param={{BID: (popData ? primaryId : this.props.BID), data: (popData || this.props.BData)}} /> : null} |
| | | {btn.$type === 'CustomPage' ? <CustomPage Tab={btn} MenuID={btn.uuid} param={{BID: (popData ? primaryId : this.props.BID), data: (popData || this.props.BData)}} /> : null} |
| | | </Modal> |
| | | </div> |
| | | ) |
| | |
| | | btn: PropTypes.object, // 按钮 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | ContainerId: PropTypes.any, // tab页面ID,用于弹窗控制 |
| | | updateStatus: PropTypes.func, // 按钮状态更新 |
| | | } |
| | | |
| | | state = { |
| | |
| | | loading: false |
| | | }) |
| | | |
| | | this.props.updateStatus('refresh', btn.execSuccess, btn) |
| | | if (btn.execSuccess !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn) |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | loading: false |
| | | }) |
| | | |
| | | this.props.updateStatus('refresh', btn.execError, btn) |
| | | if (btn.execError !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn) |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> |
| | | <Button |
| | | type="link" |
| | | title={show === 'icon' ? btn.label : ''} |
| | | loading={loading} |
| | | style={btn.btnstyle} |
| | | icon={show === 'text' ? '' : (btn.icon || '')} |
| | |
| | | btn: PropTypes.object, // 按钮 |
| | | selectedData: PropTypes.any, // 子表中选择数据 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | updateStatus: PropTypes.any |
| | | } |
| | | |
| | | state = { |
| | |
| | | this.props.modifyTabview(tabs) |
| | | }) |
| | | |
| | | if (this.props.updateStatus) { |
| | | this.props.updateStatus('trigger') |
| | | } |
| | | MKEmitter.emit('openNewTab') |
| | | } |
| | | |
| | | render() { |
| | |
| | | return ( |
| | | <Button |
| | | type="link" |
| | | title={show === 'icon' ? btn.label : ''} |
| | | style={btn.btnstyle} |
| | | icon={show === 'text' ? '' : (btn.icon || '')} |
| | | onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} |
| | |
| | | data: PropTypes.object, // 卡片数据 |
| | | selectKey: PropTypes.string, // 选择卡片的序号 |
| | | colMap: PropTypes.any, // 显示列信息,用于设置标记 |
| | | refreshdata: PropTypes.func, // 按钮操作后数据刷新 |
| | | switchCard: PropTypes.func // 卡片切换 |
| | | } |
| | | |
| | |
| | | * @description 获取按钮元素 |
| | | */ |
| | | getActionList = (actions, show) => { |
| | | const { BID, BData, Tab, setting, columns, ContainerId, data, MenuID } = this.props |
| | | const { BData, Tab, setting, columns, ContainerId, data, MenuID } = this.props |
| | | |
| | | return actions.map(item => { |
| | | if (['exec', 'prompt', 'pop'].includes(item.OpenType)) { |
| | | return ( |
| | | <NormalButton |
| | | key={item.uuid} |
| | | BID={BID} |
| | | BID={data.$$BID} |
| | | Tab={Tab} |
| | | btn={item} |
| | | show={show} |
| | |
| | | columns={columns} |
| | | selectedData={[data]} |
| | | ContainerId={ContainerId} |
| | | updateStatus={this.props.refreshdata} |
| | | /> |
| | | ) |
| | | } else if (item.OpenType === 'popview') { |
| | | return ( |
| | | <PopupButton |
| | | key={item.uuid} |
| | | BID={BID} |
| | | BID={data.$$BID} |
| | | Tab={Tab} |
| | | btn={item} |
| | | show={show} |
| | | BData={BData} |
| | | setting={setting} |
| | | selectedData={[data]} |
| | | updateStatus={this.props.refreshdata} |
| | | /> |
| | | ) |
| | | } else if (item.OpenType === 'tab' || item.OpenType === 'blank') { |
| | |
| | | MenuID={MenuID} |
| | | setting={setting} |
| | | selectedData={[data]} |
| | | updateStatus={this.props.refreshdata} |
| | | /> |
| | | ) |
| | | } else if (item.OpenType === 'innerpage' || item.OpenType === 'outerpage') { |
| | |
| | | show={show} |
| | | setting={setting} |
| | | selectedData={[data]} |
| | | updateStatus={this.props.refreshdata} |
| | | /> |
| | | ) |
| | | } else if (item.OpenType === 'funcbutton') { |
| | |
| | | return ( |
| | | <ChangeUserButton |
| | | key={item.uuid} |
| | | BID={BID} |
| | | BID={data.$$BID} |
| | | btn={item} |
| | | show={show} |
| | | setting={setting} |
| | | selectedData={[data]} |
| | | updateStatus={this.props.refreshdata} |
| | | /> |
| | | ) |
| | | } else if (item.funcType === 'print') { |
| | | return ( |
| | | <PrintButton |
| | | key={item.uuid} |
| | | BID={BID} |
| | | BID={data.$$BID} |
| | | Tab={Tab} |
| | | btn={item} |
| | | show={show} |
| | |
| | | setting={setting} |
| | | selectedData={[data]} |
| | | ContainerId={ContainerId} |
| | | updateStatus={this.props.refreshdata} |
| | | /> |
| | | ) |
| | | } |
| | |
| | | columns={this.props.columns} |
| | | selectedData={[]} |
| | | ContainerId={this.props.ContainerId} |
| | | updateStatus={this.props.refreshdata} |
| | | /> |
| | | </div> |
| | | </Card> : null} |
| | |
| | | tableId: PropTypes.string, |
| | | loading: PropTypes.bool, |
| | | data: PropTypes.array, |
| | | refreshdata: PropTypes.func, |
| | | handleTableId: PropTypes.func |
| | | } |
| | | |
| | |
| | | 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, columns, ContainerId } = this.props |
| | | const { card, colMap, selectKey, actionList } = this.state |
| | |
| | | show="icon" |
| | | btn={action} |
| | | setting={config.setting} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | | ) |
| | | } else { |
| | |
| | | show="icon" |
| | | btn={action} |
| | | setting={config.setting} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | | ) |
| | | } |
| | |
| | | setting={config.setting} |
| | | ContainerId={ContainerId} |
| | | switchCard={this.switchCard} |
| | | refreshdata={this.updateStatus} |
| | | /> |
| | | )) |
| | | } |
| | |
| | | setting={config.setting} |
| | | ContainerId={ContainerId} |
| | | switchCard={() => {}} |
| | | refreshdata={this.updateStatus} |
| | | /> : null |
| | | } |
| | | {(loading || !card.insertAction) && (!data || data.length === 0) ? <Empty description={false}/> : null} |
| | |
| | | btn={item} |
| | | show="icon" |
| | | setting={config.setting} |
| | | updateStatus={() => {}} |
| | | /> |
| | | ) |
| | | } else { |
| | |
| | | btn={item} |
| | | show="icon" |
| | | setting={config.setting} |
| | | updateStatus={() => {}} |
| | | /> |
| | | ) |
| | | } |
| | |
| | | pickup: PropTypes.any, // 数据收起 |
| | | columns: PropTypes.array, // 表格列 |
| | | fields: PropTypes.array, // 组件字段集 |
| | | BID: PropTypes.any, // 主表Id |
| | | ContainerId: PropTypes.any, // 标签页外层Id |
| | | BData: PropTypes.any, // 主表数据 |
| | | data: PropTypes.any, // 表格数据 |
| | |
| | | refreshdata: PropTypes.func, // 表格中排序列、页码的变化时刷新 |
| | | handleTableId: PropTypes.func, // 数据切换 |
| | | chgSelectData: PropTypes.func, // 数据切换 |
| | | refreshbyaction: PropTypes.func, // 按钮执行完成后刷新 |
| | | } |
| | | |
| | | state = { |
| | |
| | | return |
| | | } |
| | | MKEmitter.removeListener('resetTable', this.resetTable) |
| | | } |
| | | |
| | | updateStatus = (type, positon, btn) => { |
| | | if (type === 'refresh') { |
| | | this.props.refreshbyaction(positon, btn) |
| | | } |
| | | } |
| | | |
| | | // 字段透视 |
| | |
| | | <NormalButton |
| | | key={btn.uuid} |
| | | btn={btn} |
| | | BID={this.props.BID} |
| | | BID={record.$$BID} |
| | | selectedData={[record]} |
| | | BData={this.props.BData} |
| | | setting={this.props.setting} |
| | | columns={this.props.fields || this.props.columns} |
| | | ContainerId={this.props.ContainerId} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | | ) |
| | | } else if (btn.OpenType === 'popview') { |
| | |
| | | <PopupButton |
| | | key={btn.uuid} |
| | | btn={btn} |
| | | BID={this.props.BID} |
| | | BID={record.$$BID} |
| | | selectedData={[record]} |
| | | BData={this.props.BData} |
| | | setting={this.props.setting} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | | ) |
| | | } else if (btn.OpenType === 'tab' || btn.OpenType === 'blank') { |
| | |
| | | selectedData={[record]} |
| | | MenuID={this.props.MenuID} |
| | | setting={this.props.setting} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | | ) |
| | | } else if (btn.OpenType === 'innerpage' || btn.OpenType === 'outerpage') { |
| | |
| | | btn={btn} |
| | | selectedData={[record]} |
| | | setting={this.props.setting} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | | ) |
| | | } |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Button } from 'antd' |
| | | |
| | | import options from '@/store/options.js' |
| | | |
| | | class PageMessage extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // 父级Id,用于查询下拉选择项 |
| | | menuType: PropTypes.any, // 菜单权限,是否为HS |
| | | } |
| | | |
| | | state = { |
| | | debug: sessionStorage.getItem('debug') === 'true' |
| | | } |
| | | |
| | | render() { |
| | | const { debug } = this.state |
| | | |
| | | return (debug && options.sysType !== 'cloud' ? <Button |
| | | icon="copy" |
| | | shape="circle" |
| | | className="page-message" |
| | | onClick={this.handleviewconfig} |
| | | /> : null) |
| | | } |
| | | } |
| | | |
| | | export default PageMessage |
New file |
| | |
| | | .top-search { |
| | | background: #ffffff; |
| | | .ant-form-item { |
| | | display: flex; |
| | | margin-bottom: 0px; |
| | | min-height: 60px; |
| | | .ant-form-explain { |
| | | white-space: nowrap; |
| | | } |
| | | } |
| | | .ant-form-item-control-wrapper { |
| | | flex: 1; |
| | | width: calc(100% - 100px); |
| | | } |
| | | .ant-form-item-label { |
| | | text-overflow: ellipsis; |
| | | } |
| | | .daterange .ant-calendar-picker-input { |
| | | padding: 4px 20px 4px 5px; |
| | | font-size: 13px; |
| | | } |
| | | .ant-select-dropdown { |
| | | z-index: 10 !important; |
| | | } |
| | | .ant-calendar-picker-container { |
| | | z-index: 10 !important; |
| | | } |
| | | .group-required { |
| | | label::before { |
| | | display: inline-block; |
| | | margin-right: 4px; |
| | | color: #f5222d; |
| | | font-size: 14px; |
| | | font-family: SimSun, sans-serif; |
| | | line-height: 1; |
| | | content: '*'; |
| | | } |
| | | } |
| | | } |
| | | .top-search.right { |
| | | >.ant-row { |
| | | >.ant-col { |
| | | float: right; |
| | | } |
| | | } |
| | | } |
| | |
| | | } else { |
| | | config.uuid = MenuId |
| | | config.MenuID = MenuId |
| | | config.Template = 'CustomPage' |
| | | } |
| | | |
| | | if (MenuType === 'billPrint') { |