From da7068bd48791cdee966c786ce0dfd46f6e03df9 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 08 一月 2021 19:02:24 +0800 Subject: [PATCH] 2021-01-08 --- src/components/tabview/index.jsx | 37 - src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 39 + src/tabviews/zshare/actionList/popupbutton/index.jsx | 53 ++ src/tabviews/verupmanage/subtabtable/index.jsx | 12 src/tabviews/zshare/normalTable/index.jsx | 16 src/tabviews/custom/components/card/cardItem/index.jsx | 5 src/tabviews/zshare/chartcomponent/index.jsx | 2 src/tabviews/calendar/index.jsx | 1 src/tabviews/zshare/actionList/excelInbutton/index.jsx | 10 src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 9 src/tabviews/zshare/pageMessage/index.scss | 46 ++ src/tabviews/zshare/actionList/index.jsx | 19 src/tabviews/custom/components/share/normalTable/index.jsx | 16 src/tabviews/iframe/index.jsx | 64 +++ src/tabviews/zshare/actionList/newpagebutton/index.jsx | 8 src/tabviews/subtable/index.jsx | 75 ++- src/locales/en-US/main.js | 1 src/tabviews/subtabtable/index.jsx | 64 +- src/tabviews/commontable/index.jsx | 113 ++--- src/tabviews/zshare/actionList/normalbutton/index.jsx | 10 src/tabviews/zshare/actionList/changeuserbutton/index.jsx | 2 src/views/menudesign/index.jsx | 1 src/tabviews/custom/components/card/data-card/index.jsx | 114 +++++ src/tabviews/custom/components/card/table-card/index.jsx | 57 +- src/tabviews/custom/components/card/cardcellList/index.jsx | 9 src/tabviews/custom/components/card/prop-card/index.jsx | 51 +- src/tabviews/zshare/actionList/tabbutton/index.jsx | 6 src/locales/zh-CN/main.js | 1 src/tabviews/rolemanage/index.jsx | 31 + src/menu/components/share/actioncomponent/formconfig.jsx | 2 src/tabviews/custom/components/table/normal-table/index.jsx | 45 + src/tabviews/custom/components/chart/antv-pie/index.jsx | 10 src/menu/pastecontroller/index.jsx | 10 src/tabviews/zshare/actionList/printbutton/index.jsx | 10 /dev/null | 26 - src/tabviews/commontable/index.scss | 2 src/menu/components/share/actioncomponent/actionform/index.jsx | 2 src/tabviews/custom/index.jsx | 21 + src/tabviews/tabmanage/index.jsx | 21 + src/tabviews/zshare/pageMessage/index.jsx | 29 + src/tabviews/scriptmanage/index.jsx | 24 src/tabviews/verupmanage/index.jsx | 11 src/tabviews/zshare/cardcomponent/index.jsx | 32 - src/menu/popview/index.jsx | 1 44 files changed, 700 insertions(+), 418 deletions(-) diff --git a/src/components/tabview/index.jsx b/src/components/tabview/index.jsx index faf1a35..b9afa22 100644 --- a/src/components/tabview/index.jsx +++ b/src/components/tabview/index.jsx @@ -2,14 +2,13 @@ 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' @@ -47,7 +46,6 @@ tabviews: null, // 鏍囩闆� iFrameHeight: 0, dict: localStorage.getItem('lang') !== 'en-US' ? mzhCN : menUS, - debug: sessionStorage.getItem('debug') === 'true' } handleTabview = (e, menu) => { @@ -141,22 +139,10 @@ } 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 () { @@ -173,7 +159,7 @@ componentDidMount () { let home = { MenuID: 'home_page_id', - MenuName: '棣栭〉', + MenuName: this.state.dict['main.homepage'], selected: true, type: 'Home' } @@ -224,8 +210,7 @@ } 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' : '')}> @@ -237,9 +222,7 @@ <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> @@ -251,15 +234,6 @@ 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"> @@ -280,7 +254,6 @@ const mapStateToProps = (state) => { return { - menuType: state.editLevel, tabviews: state.tabviews, collapse: state.collapse, isiframe: state.isiframe diff --git a/src/locales/en-US/main.js b/src/locales/en-US/main.js index c5f9d09..7a30ffe 100644 --- a/src/locales/en-US/main.js +++ b/src/locales/en-US/main.js @@ -10,6 +10,7 @@ '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', diff --git a/src/locales/zh-CN/main.js b/src/locales/zh-CN/main.js index 600ca52..f99de1b 100644 --- a/src/locales/zh-CN/main.js +++ b/src/locales/zh-CN/main.js @@ -10,6 +10,7 @@ 'main.cancel': '鍙栨秷', 'main.logout': '閫�鍑�', 'main.doc': '鏂囨。涓績', + 'main.homepage': '棣栭〉', 'main.logout.hint': '鎮ㄧ‘瀹氳閫�鍑哄悧?', 'main.verup': '鐗堟湰鍗囩骇', 'main.password': '淇敼瀵嗙爜', diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index 83d1aab..1240c61 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -12,7 +12,7 @@ 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'], diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index c76a0b0..0444ac7 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -49,7 +49,7 @@ 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: '鏍囩鍒锋柊' diff --git a/src/menu/pastecontroller/index.jsx b/src/menu/pastecontroller/index.jsx index 12a510d..a227bf1 100644 --- a/src/menu/pastecontroller/index.jsx +++ b/src/menu/pastecontroller/index.jsx @@ -63,7 +63,7 @@ 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() @@ -72,7 +72,7 @@ } 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() @@ -94,7 +94,7 @@ }) } 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() @@ -119,7 +119,7 @@ }) } 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() @@ -136,7 +136,7 @@ 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() diff --git a/src/menu/popview/index.jsx b/src/menu/popview/index.jsx index 097040e..59c0dcb 100644 --- a/src/menu/popview/index.jsx +++ b/src/menu/popview/index.jsx @@ -172,6 +172,7 @@ } else { config.uuid = MenuId config.MenuID = MenuId + config.Template = 'CustomPage' } this.setState({ diff --git a/src/tabviews/calendar/index.jsx b/src/tabviews/calendar/index.jsx index 47d5b4e..80e4661 100644 --- a/src/tabviews/calendar/index.jsx +++ b/src/tabviews/calendar/index.jsx @@ -629,7 +629,6 @@ destroyOnClose > {config.tab ? <SubTabTable - type="calendar" BID={triggerTime} Tab={config.tab} SupMenuID={this.props.MenuID} diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 293205f..3f0ae4c 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -2,10 +2,9 @@ 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' @@ -27,7 +26,6 @@ const ChartComponent = asyncSpinComponent(() => import('@/tabviews/zshare/chartcomponent')) const { TabPane } = Tabs -const { TreeNode } = Tree const { Paragraph } = Typography class NormalTable extends Component { @@ -68,7 +66,6 @@ statFields: [], // 鍚堣瀛楁 statFValue: [], // 鍚堣鍊� absFields: [], // 缁濆鍊煎瓧娈� - debug: sessionStorage.getItem('debug') === 'true' } /** @@ -513,6 +510,9 @@ } item.key = index + item.$$uuid = item[setting.primaryKey] || '' + item.$$BID = BID || '' + return item }), total: result.total, @@ -567,6 +567,9 @@ 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 @@ -727,15 +730,6 @@ } /** - * @description 鎸夐挳鎿嶄綔瀹屾垚鍚庯紙鎴愬姛鎴栧け璐ワ級锛岄〉闈㈠埛鏂帮紝閲嶇疆椤电爜鍙婇�夋嫨椤� - */ - refreshbyaction = (position, btn) => { - if (position === 'grid' || position === 'view') { - this.reloadtable(btn) - } - } - - /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ getexceloutparam = (menuId, btnId) => { @@ -831,15 +825,7 @@ 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> }) } @@ -884,6 +870,20 @@ 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() @@ -915,6 +915,7 @@ MKEmitter.addListener('reloadMenuView', this.reloadMenuView) MKEmitter.addListener('resetActiveMenu', this.resetActiveMenu) MKEmitter.addListener('getexceloutparam', this.getexceloutparam) + MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) } /** @@ -929,11 +930,12 @@ 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}> @@ -965,7 +967,6 @@ MenuID={this.props.MenuID} selectedData={selectedData} ContainerId={this.state.ContainerId} - refreshdata={this.refreshbyaction} /> </div> <div className="main-table-box"> @@ -984,7 +985,6 @@ } <MainTable tableId="mainTable" - BID={BID} pickup={pickup} setting={setting} columns={columns} @@ -994,11 +994,10 @@ 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> @@ -1017,7 +1016,6 @@ MenuID={this.props.MenuID} loading={this.state.loading} ContainerId={this.state.ContainerId} - refreshdata={this.refreshbyaction} handleTableId={this.handleTableId} /> </Col> @@ -1038,33 +1036,32 @@ })} </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" @@ -1072,7 +1069,7 @@ /> : null} <Modal className="menu-tree-modal" - title={'鑿滃崟缁撴瀯鏍�'} + title={'鑿滃崟淇℃伅'} width={'650px'} maskClosable={false} visible={this.state.treevisible} @@ -1086,9 +1083,7 @@ <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> diff --git a/src/tabviews/commontable/index.scss b/src/tabviews/commontable/index.scss index 127ac7c..db5c6a7 100644 --- a/src/tabviews/commontable/index.scss +++ b/src/tabviews/commontable/index.scss @@ -91,7 +91,7 @@ cursor: default; } } - .common-table-copy { + .page-message { position: fixed; z-index: 2; bottom: 65px; diff --git a/src/tabviews/commontable/secretKeyTable/actionList/index.jsx b/src/tabviews/commontable/secretKeyTable/actionList/index.jsx deleted file mode 100644 index b720409..0000000 --- a/src/tabviews/commontable/secretKeyTable/actionList/index.jsx +++ /dev/null @@ -1,355 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import moment from 'moment' -import { Button, Modal, notification, message } from 'antd' -import MutilForm from '@/tabviews/zshare/mutilform' -import Utils from '@/utils/utils.js' -import { refCodes } from '../config' -import Api from '@/api' -import './index.scss' - -const { confirm } = Modal - -class MainAction extends Component { - static propTpyes = { - BID: PropTypes.string, // 涓昏〃ID - datalist: PropTypes.any, // 鍒楄〃鏁版嵁 - Tab: PropTypes.any, // 濡傛灉褰撳墠鍏冪礌涓烘爣绛炬椂锛宼ab涓烘爣绛句俊鎭� - MenuID: PropTypes.string, // 鑿滃崟ID - actions: PropTypes.array, // 鎸夐挳缁� - selectedData: PropTypes.array, // 閫変腑鏁版嵁 - dict: PropTypes.object, // 瀛楀吀椤� - setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 - ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� - refreshdata: PropTypes.func, // 鎵ц瀹屾垚鍚庢暟鎹埛鏂� - } - - state = { - visible: false, - formdata: null, - tabledata: null, - confirmLoading: false, - execAction: null, - configMap: {}, - loadingNumber: '' - } - - /** - * @description 瑙﹀彂鎸夐挳鎿嶄綔 - */ - actionTrigger = (item) => { - const { setting, BID, datalist, selectedData } = this.props - - if (!BID) { - notification.warning({ - top: 92, - message: '闇�瑕佷笂绾т富閿�硷紒', - duration: 5 - }) - return - } - - let _this = this - let data = selectedData || [] - - if (item.Ot !== 'notRequired' && data.length === 0) { - // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹� - notification.warning({ - top: 92, - message: this.props.dict['main.action.confirm.selectline'], - duration: 5 - }) - return - } else if (item.Ot === 'requiredSgl' && data.length !== 1) { - // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁 - notification.warning({ - top: 92, - message: this.props.dict['main.action.confirm.selectSingleLine'], - duration: 5 - }) - return - } else if (item.Ot !== 'notRequired' && !setting.primaryKey) { - // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾槸鍚﹁缃富閿� - notification.warning({ - top: 92, - message: '鏈缃富閿紒', - duration: 5 - }) - return - } - - if (item.sqlType === 'delete') { - let sysKeys = data.filter(cell => cell.uuid === 'sso_system' || cell.uuid === 'local_system') - if (sysKeys.length > 0) { - notification.warning({ - top: 92, - message: '绯荤粺瀵嗛挜涓嶅彲鍒犻櫎锛�', - duration: 5 - }) - return - } - } - - if ((!datalist || datalist.length === 0) && item.sqlType !== 'revert') { - notification.warning({ - top: 92, - message: '鏁版嵁涓㈠け鎴栭敊璇紝璇锋仮澶嶉粯璁よ缃紒', - duration: 5 - }) - return - } - - if (item.OpenType === 'prompt') { - confirm({ - title: this.props.dict['main.action.confirm.tip'], - onOk() { - return new Promise(resolve => { - _this.execSubmit(item, data, resolve) - }) - }, - onCancel() {} - }) - } else if (item.OpenType === 'pop') { - this.setState({ - visible: true, - execAction: item, - tabledata: data - }) - } - } - - /** - * @description 鎸夐挳鎻愪氦鎵ц - */ - execSubmit = (btn, data, _resolve, formdata) => { - let datalist = JSON.parse(JSON.stringify(this.props.datalist)) - - let cell = {} - if (formdata) { - formdata.forEach(_cell => { - cell[_cell.key] = _cell.value - }) - } - - if (btn.sqlType === 'insert') { - let newkey = { - uuid: Utils.getuuid(), - keyType: 'other', - ...cell - } - datalist.push(newkey) - } else if (btn.sqlType === 'update') { - let newkey = { - ...data[0], - ...cell - } - - datalist = datalist.map(item => { - if (item.uuid === newkey.uuid) { - return newkey - } else { - return item - } - }) - } else if (btn.sqlType === 'update') { - let keys = data.map(item => item.uuid) - - datalist = datalist.filter(item => !keys.includes(item.uuid)) - } else if (btn.sqlType === 'revert') { - datalist = [ - {uuid: 'sso_system', public: 'a', private: 'apple', keyType: 'sso'}, - {uuid: 'local_system', public: 'b', private: 'banana', keyType: 'local'}, - {uuid: 'other_system1', public: 'c', private: 'cherry', keyType: 'other'}, - {uuid: 'other_system2', public: 'd', private: 'damson', keyType: 'other'} - ] - } - - let _number = Math.floor(Math.random() * 10) - let keyString = window.btoa(window.encodeURIComponent(JSON.stringify(datalist))) - let regular = refCodes[_number] - keyString = keyString.replace(new RegExp(regular.char, 'g'), regular.md5str) - keyString = window.btoa(keyString) - keyString = _number + keyString - - let param = { - func: 's_app_secret_param_adduptdel', - BID: this.props.BID, - LText: keyString, - timestamp: moment().format('YYYY-MM-DD HH:mm:ss') - } - - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - Api.getLocalConfig(param).then((res) => { - if (res.status) { - this.execSuccess(btn, res) - } else { - this.execError(res, btn) - } - _resolve() - }) - } - - - /** - * @description 鎿嶄綔鎴愬姛鍚庡鐞� - * 1銆乪xcel瀵煎嚭锛屾垚鍔熷悗鍙栨秷瀵煎嚭鎸夐挳鍔犺浇涓姸鎬� - * 2銆佺姸鎬佺爜涓� S 鏃讹紝鏄剧ず鎴愬姛淇℃伅鍚庣郴缁熼粯璁や俊鎭� - * 3銆佺姸鎬佺爜涓� -1 鏃讹紝涓嶆樉绀轰换浣曚俊鎭� - * 4銆佹ā鎬佹鎵ц鎴愬姛鍚庢槸鍚﹀叧闂� - * 5銆侀�氱煡涓诲垪琛ㄥ埛鏂� - */ - execSuccess = (btn, res) => { - if (res && res.ErrCode === 'S') { // 鎵ц鎴愬姛 - notification.success({ - top: 92, - message: res.ErrMesg || this.props.dict['main.action.confirm.success'], - duration: btn.verify && btn.verify.stime ? btn.verify.stime : 2 - }) - } else if (res && res.ErrCode === 'Y') { // 鎵ц鎴愬姛 - Modal.success({ - title: res.ErrMesg || this.props.dict['main.action.confirm.success'] - }) - } else if (res && res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず - - } - - if (btn.OpenType === 'pop' && btn.setting && btn.setting.finish !== 'unclose') { - this.setState({ - visible: false - }) - } - - this.props.refreshdata(btn.execSuccess) - } - - /** - * @description 鎿嶄綔澶辫触鍚庡鐞� - * 1銆佺姸鎬佺爜涓� E銆丯銆丗銆丯M 鏃讹紝鏄剧ず鐩稿簲鎻愮ず淇℃伅 - * 2銆乪xcel瀵煎嚭锛屽け璐ュ悗鍙栨秷瀵煎嚭鎸夐挳鍔犺浇涓姸鎬� - * 3銆侀�氱煡涓诲垪琛ㄥ埛鏂� - */ - execError = (res, btn) => { - if (res.ErrCode === 'E') { - Modal.error({ - title: res.message || res.ErrMesg, - }) - } else if (res.ErrCode === 'N') { - notification.error({ - top: 92, - message: res.message || res.ErrMesg, - duration: btn.verify && btn.verify.ntime ? btn.verify.ntime : 10 - }) - } else if (res.ErrCode === 'F') { - notification.error({ - className: 'notification-custom-error', - top: 92, - message: res.message || res.ErrMesg, - duration: btn.verify && btn.verify.ftime ? btn.verify.ftime : 10 - }) - } else if (res.ErrCode === 'NM') { - message.error(res.message || res.ErrMesg) - } - - this.props.refreshdata(btn.execError) - } - - /** - * @description 妯℃�佹锛堣〃鍗曪級锛岀‘璁� - */ - handleOk = () => { - this.formRef.handleConfirm().then(res => { - this.setState({ - confirmLoading: true - }) - - this.execSubmit(this.state.execAction, this.state.tabledata, () => { - this.setState({ - confirmLoading: false - }) - }, res) - }, () => {}) - } - - /** - * @description 妯℃�佹锛堣〃鍗曪級锛屽彇娑� - */ - handleCancel = () => { - this.setState({ - visible: false - }) - } - - /** - * @description 鏄剧ず妯℃�佹 - */ - getModels = () => { - const { execAction } = this.state - - if (!execAction || !this.state.visible) return - - let title = '' - let width = '62vw' - let clickouter = false - let container = document.body - - if (execAction && execAction.setting) { - title = execAction.setting.title - width = execAction.setting.width + 'vw' - - if (execAction.setting.container === 'tab' && this.props.ContainerId) { - width = execAction.setting.width + '%' - container = () => document.getElementById(this.props.ContainerId) - } - - if (execAction.setting.clickouter === 'close') { - clickouter = true - } - } - - return ( - <Modal - title={title} - maskClosable={clickouter} - getContainer={container} - wrapClassName='action-modal' - visible={this.state.visible} - width={width} - onOk={this.handleOk} - confirmLoading={this.state.confirmLoading} - onCancel={this.handleCancel} - destroyOnClose - > - <MutilForm - dict={this.props.dict} - menuType="HS" - action={execAction} - inputSubmit={this.handleOk} - configMap={this.state.configMap} - data={this.state.tabledata[0]} - BData={this.props.BData} - wrappedComponentRef={(inst) => this.formRef = inst} - /> - </Modal> - ) - } - - render() { - return ( - <div className="secret-button-list secret-toolbar-button"> - {this.props.actions.map((item, index) => { - return ( - <Button - className={'mk-btn mk-' + item.class} - icon={item.icon} - key={'action' + index} - onClick={() => {this.actionTrigger(item)}} - >{item.label}</Button> - ) - })} - {this.getModels()} - </div> - ) - } -} - -export default MainAction \ No newline at end of file diff --git a/src/tabviews/commontable/secretKeyTable/actionList/index.scss b/src/tabviews/commontable/secretKeyTable/actionList/index.scss deleted file mode 100644 index 8259d3f..0000000 --- a/src/tabviews/commontable/secretKeyTable/actionList/index.scss +++ /dev/null @@ -1,43 +0,0 @@ -.secret-button-list.secret-toolbar-button { - position: relative; - background: #ffffff; - button { - min-width: 65px; - margin-right: 15px; - margin-bottom: 10px; - overflow: hidden; - } - .ant-spin { - position: fixed; - z-index: 1010; - left: calc(50vw - 22px); - top: calc(50vh - 70px); - } -} -// 璁剧疆妯℃�佹鏍峰紡锛岃瀹氭渶澶ф渶灏忛珮搴︼紝閲嶇疆婊氬姩鏉� -.action-modal { - .ant-modal { - max-width: 95vw; - } - .ant-modal-body { - max-height: calc(100vh - 235px); - min-height: 150px; - overflow-y: auto; - padding-bottom: 35px; - } - .ant-modal-body::-webkit-scrollbar { - width: 10px; - height: 10px; - } - .ant-modal-body::-webkit-scrollbar-thumb { - border-radius: 5px; - box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); - background: rgba(0, 0, 0, 0.13); - } - .ant-modal-body::-webkit-scrollbar-track { - box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); - border-radius: 3px; - border: 1px solid rgba(0, 0, 0, 0.07); - background: rgba(0, 0, 0, 0); - } -} \ No newline at end of file diff --git a/src/tabviews/commontable/secretKeyTable/config.jsx b/src/tabviews/commontable/secretKeyTable/config.jsx deleted file mode 100644 index f60d550..0000000 --- a/src/tabviews/commontable/secretKeyTable/config.jsx +++ /dev/null @@ -1,298 +0,0 @@ -// HS椤甸潰閰嶇疆 -export const verupMainTable = {} - -export const buttonConfig = { - '1586616122586986g400tf610dc3rhcd': { - "type":"Modal", - "setting":{ - "title":"娣诲姞", - "width":45, - "focus":"p", - "cols":"1", - "finish":"close", - "clickouter":"unclose", - "display":"modal", - "container":"view" - }, - "tables":[], - "groups":[], - "fields":[{ - "label":"鍏挜", - "field":"public", - "type":"text", - "initval":"", - "readonly":"false", - "required":"true", - "hidden":"false", - "readin":"true", - "fieldlength":50, - "regular":"", - "supField":"", - "blacklist":[], - "uuid":"1586616164754mshqhn0dqulorb4k2ot" - }, { - "label":"绉侀挜", - "field":"private", - "type":"text", - "initval":"", - "readonly":"false", - "required":"true", - "hidden":"false", - "readin":"true", - "fieldlength":50, - "regular":"", - "supField":"", - "blacklist":[], - "uuid":"1586616188792q2m9km3k8lqbtabf8og" - }] - }, - '1586616351568k8rb0fvp3t7g6h7qso0': { - "type":"Modal", - "setting":{ - "title":"淇敼", - "width":45, - "focus":"p", - "cols":"1", - "finish":"close", - "clickouter":"unclose", - "display":"modal", - "container":"view" - }, - "tables":[], - "groups":[], - "fields":[{ - "label":"鍏挜", - "field":"public", - "type":"text", - "initval":"", - "readonly":"false", - "required":"true", - "hidden":"false", - "readin":"true", - "fieldlength":50, - "regular":"", - "supField":"", - "blacklist":[], - "uuid":"1586616164754mshqhn0dqulorb4k2ot" - },{ - "label":"绉侀挜", - "field":"private", - "type":"text", - "initval":"", - "readonly":"false", - "required":"true", - "hidden":"false", - "readin":"true", - "fieldlength":50, - "regular":"", - "supField":"", - "blacklist":[], - "uuid":"1586616188792q2m9km3k8lqbtabf8og" - }] - } -} - -export const tabConfig = { - '1586577325055l2ng7t75g7i4ek2ng8o': { - tabName:"瀵嗛挜绠$悊鏍囩椤�", - tabNo:"secret_paramM", - Remark:"", - uuid:"1586577325055l2ng7t75g7i4ek2ng8o", - setting:{ - "tableName":"sApp", - "tableType":"checkbox", - "interType":"inner", - "innerFunc":"s_get_app_secret_param", - "dataresource":"select 'a' as p,'apple' as s,'sso' as st,10 as ID union all\nselect 'b' as p,'banana' as s,'local' as st,20 as ID union all\nselect 'c' as p,'cherry' as s,'other' as st,30 as ID union all\nselect 'd' as p,'damson' as s,'other' as st,40 as ID", - "queryType":"query", - "primaryKey":"key", - "order":"key", - "onload":"true", - "laypage": "false", - "actionfixed":false, - "columnfixed":false - }, - search:[], - action:[ - { - "label":"娣诲姞", - "OpenType":"pop", - "intertype":"inner", - "innerFunc":"", - "position":"toolbar", - "Ot":"notRequired", - "execSuccess":"grid", - "execError":"never", - "icon":"", - "class":"green", - "sql":"sApp", - "sqlType":"insert", - "uuid":"1586616122586986g400tf610dc3rhcd", - "verify": { - "default":"true", - "invalid":"false", - "uniques":[ - { - "field":"BID,p", - "errorCode":"E", - "verifyType":"physical", - "uuid":"15866162339252q7vs9qvp83bdomkk93", - "fieldlabel":"BID,鍏挜" - } - ], - "contrasts":[], - "accountdate":"false", - "customverifys":[ - { - "sql":"select ID from sApp where id=@BID@", - "result":"false", - "errmsg":"椤甸潰鏁版嵁宸插け鏁堬紝璇峰埛鏂板悗閲嶈瘯", - "errorCode":"E", - "uuid":"1586616302289f8ic4pl2mn6so2ns3be", - "resultName":"涓嶅瓨鍦�" - } - ], - "billcodes":[], - "voucher":{"enabled":false}, - "scripts":[] - } - }, - { - "label":"淇敼", - "OpenType":"pop", - "intertype":"inner", - "innerFunc":"", - "position":"toolbar", - "Ot":"requiredSgl", - "execSuccess":"grid", - "execError":"never", - "icon":"", - "class":"purple", - "sql":"sApp", - "sqlType":"update", - "uuid":"1586616351568k8rb0fvp3t7g6h7qso0", - "verify":{ - "default":"true", - "invalid":"false", - "uniques":[{"field":"BID,p","errorCode":"E","verifyType":"physical","uuid":"15866162339252q7vs9qvp83bdomkk93","fieldlabel":"BID,鍏挜"}], - "contrasts":[], - "accountdate":"false", - "customverifys":[{"sql":"select ID from sApp where id=@BID@","result":"false","errmsg":"椤甸潰鏁版嵁宸插け鏁堬紝璇峰埛鏂板悗閲嶈瘯","errorCode":"E","uuid":"1586616302289f8ic4pl2mn6so2ns3be","resultName":"涓嶅瓨鍦�"}], - "billcodes":[], - "voucher":{"enabled":false}, - "scripts":[] - } - }, - { - "label":"鍒犻櫎", - "OpenType":"prompt", - "intertype":"inner", - "innerFunc":"", - "position":"toolbar", - "execSuccess":"grid", - "execError":"never", - "icon":"", - "class":"danger", - "sql":"sApp", - "Ot":"required", - "sqlType":"delete", - "uuid":"158661662660590kra03kb4su0t108rt", - "verify":{ - "default":"true", - "invalid":"true", - "uniques":[], - "contrasts":[{"frontfield":"@st","operator":"!=","backfield":"'other'","errmsg":"sso涓巐ocal涓虹郴缁熼粯璁ゅ彛浠や笉鍙垹闄�","errorCode":"E","uuid":"15866167196190he7utt2vbsmqu2gips"}], - "accountdate":"false", - "customverifys":[{"sql":"select ID from sApp where id=@BID@","result":"false","errmsg":"椤甸潰鏁版嵁宸插け鏁堬紝璇峰埛鏂板悗閲嶈瘯","errorCode":"E","uuid":"1586616302289f8ic4pl2mn6so2ns3be","resultName":"涓嶅瓨鍦�"}], - "billcodes":[], - "voucher":{"enabled":false}, - "scripts":[] - } - }, - { - "label":"鎭㈠榛樿璁剧疆", - "OpenType":"prompt", - "intertype":"inner", - "innerFunc":"", - "position":"toolbar", - "execSuccess":"grid", - "execError":"never", - "icon":"", - "class":"primary", - "sql":"sApp", - "Ot":"notRequired", - "sqlType":"revert", - "uuid":"158661672660590kra03kb4su0t108rt" - } - ], - columns:[ - {"label":"鍏挜","field":"public","type":"text","Align":"left","Hide":"false","IsSort":"true","Width":120,"prefix":"","postfix":"","matchVal":"","color":"","fieldlength":50,"blacklist":[],"linkmenu":[],"uuid":"15866156221702kced0rmbsnekd82s6d"}, - {"label":"绉侀挜","field":"private","type":"text","Align":"left","Hide":"false","IsSort":"true","Width":120,"prefix":"","postfix":"","matchVal":"","color":"","fieldlength":50,"blacklist":[],"linkmenu":[],"uuid":"1586615651169h67un3tmhuc8pf7kehs"}, - {"label":"绫诲瀷","field":"keyType","type":"text","Align":"left","Hide":"false","IsSort":"true","Width":120,"prefix":"","postfix":"","matchVal":"","color":"","fieldlength":50,"blacklist":[],"linkmenu":[],"uuid":"15866156745953m73rhs9c0nmu6mmbo6"} - ], - gridBtn:{"display":false,"Align":"center","IsSort":"false","uuid":"1586577404115eudahgc9nn0gam1saho","label":"鎿嶄綔","type":"action","style":"button","show":"horizontal","Width":120}, - } -} - -export const refCodes = [ - { - index: 0, - char: 'a', - sqlstr: 'b6831c399e269772661', - md5str: '526a465ab0fa6f6df28ca459d50b2622' - }, - { - index: 1, - char: 'b', - sqlstr: '2fec3ad71c777531578f', - md5str: '5d941f8268e5e5ba47a93fa2b4ed960e' - }, - { - index: 2, - char: 'd', - sqlstr: '0195b448797616e091a', - md5str: 'ed65250fa9757c60f9acc9f3e977fb17' - }, - { - index: 3, - char: 'g', - sqlstr: '71b6e533d8dc3614845d', - md5str: '6609c8e4f10ed61fea96a747cb54d00e' - }, - { - index: 4, - char: 'k', - sqlstr: '8894aa86c421e8759df3', - md5str: '759ecadb8eaf10ec9daeefe6e8928b18' - }, - { - index: 5, - char: 'p', - sqlstr: '38902e0fe0fb97a8c47a', - md5str: 'b7679fa01bd435f407746351a6aecf2b' - }, - { - index: 6, - char: 'v', - sqlstr: '5bd57058fd4664205d2a', - md5str: 'c1761cd95acb804220e0429cd63a9e9a' - }, - { - index: 7, - char: 'x', - sqlstr: '8034f5c8564e155c67a6', - md5str: '8d844d9007aa9ea9e2f2a822e432edbe' - }, - { - index: 8, - char: 'y', - sqlstr: '460e2e485922904f345d', - md5str: '6dfbe93c0570998a740ba410a6ec0f49' - }, - { - index: 9, - char: '0', - sqlstr: '65ef66e7dff9f98764da', - md5str: '3340c8dc496c953865d920d06ff8c4c9' - } -] diff --git a/src/tabviews/commontable/secretKeyTable/index.jsx b/src/tabviews/commontable/secretKeyTable/index.jsx deleted file mode 100644 index ec09fb6..0000000 --- a/src/tabviews/commontable/secretKeyTable/index.jsx +++ /dev/null @@ -1,367 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { notification, Switch} from 'antd' - -import Api from '@/api' -import zhCN from '@/locales/zh-CN/main.js' -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' - -import './index.scss' - -const SubTable = asyncSpinComponent(() => import('@/tabviews/zshare/normalTable')) - -class VerupSubTabViewTable extends Component { - static propTpyes = { - menuType: PropTypes.any, // 鑿滃崟绫诲瀷锛屾櫘閫氳彍鍗曟垨HS - Tab: PropTypes.object, // 鏍囩淇℃伅 - BID: PropTypes.string, // 涓婄骇鏁版嵁ID - BData: PropTypes.any, // 涓婄骇鏁版嵁 - MenuID: PropTypes.string, // 鑿滃崟Id - SupMenuID: PropTypes.string, // 涓婄骇鑿滃崟Id - ContainerId: PropTypes.any, // 涓夌骇鑿滃崟Container(html) ID - handleMainTable: PropTypes.func, // 鍒锋柊涓昏〃 - refreshtabs:PropTypes.any - } - - state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, - config: null, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 - actions: null, // 鎸夐挳闆� - columns: null, // 鏄剧ず鍒� - setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 - data: null, // 鍒楄〃鏁版嵁闆� - selectedData: [], // 宸查�夎〃鏍兼暟鎹� - loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� - visible: false, // 寮规鏄剧ず闅愯棌鎺у埗 - pickup: false, // 瀛愯〃鏁版嵁闅愯棌鏄剧ず鍒囨崲 - } - - /** - * @description 涓婄骇鑿滃崟id鍙樺寲鏃讹紝鍒锋柊鏁版嵁 - */ - 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: [], - }, () => { - this.loadmaindata(nextProps.BID, 'refresh') - }) - } else if (this.state.config && nextProps.refreshtabs && nextProps.refreshtabs.includes(this.props.Tab.uuid)) { - - this.reloadtable() - } - } - - /** - * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 - */ - async loadconfig () { - const { Tab, BID } = this.props - - let config = tabConfig[this.props.MenuID] - - let _arrField = [] // 瀛楁闆� - let _columns = [] // 鏄剧ず鍒� - let _hideCol = [] // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆� - let colMap = new Map() - - // 1銆佺瓫閫夊瓧娈甸泦锛�2銆佽繃婊ら殣钘忓垪鍙婂悎骞跺垪涓殑瀛楁uuid - config.columns.forEach(col => { - if (col.field) { - _arrField.push(col.field) - } - if (col.type === 'colspan' && col.sublist) { // 绛涢�夐殣钘忓垪 - _hideCol = _hideCol.concat(col.sublist) - } - colMap.set(col.uuid, col) - }) - - // 鐢熸垚鏄剧ず鍒楋紝澶勭悊鍚堝苟鍒椾腑鐨勫瓧娈� - config.columns.forEach(col => { - if (_hideCol.includes(col.uuid)) return - - if (col.type === 'colspan') { - if (col.unfold !== 'true') { // 涓嶅睍寮�涓烘棫鐗堝悎骞跺垪 - col.type = 'old_colspan' - } - - let _col = fromJS(col).toJS() - let subcols = [] - _col.sublist && _col.sublist.forEach(sub => { - if (colMap.has(sub)) { - subcols.push(colMap.get(sub)) - } - }) - _col.subcols = subcols - _columns.push(_col) - } else { - _columns.push(col) - } - }) - - config.setting.tabType = 'sub' - - this.setState({ - config: config, - setting: config.setting, - actions: config.action.map(item => { - if (buttonConfig[item.uuid]) { - item = {...buttonConfig[item.uuid], ...item} - } - return item - }), - columns: _columns - }, () => { - if (config.setting.onload !== 'false' && (!Tab.supMenu || BID)) { // 鍒濆鍖栧彲鍔犺浇 - this.setState({ - loading: true - }) - this.loadmaindata() - } - }) - } - - /** - * @description 瀛愯〃鏁版嵁鍔犺浇 - */ - async loadmaindata (bid, type) { - let _BID = this.props.BID - - if (type === 'refresh') { - _BID = bid - if (!bid) { // 涓昏〃ID涓嶅瓨鍦ㄦ椂锛屼笉鏌ヨ瀛愯〃 - this.setState({ - data: [], - loading: false - }) - return - } - } - - let param = this.getCustomParam(_BID) - let result = await Api.getLocalConfig(param) - - if (result.status) { - let str = result.secret_param - - try { - if (str) { - str = str.substring(1) - str = window.atob(str) - refCodes.forEach(item => { - str = str.replace(new RegExp(item.md5str, 'g'), item.char) - }) - str = JSON.parse(window.decodeURIComponent(window.atob(str))) - } - } catch { - str = '' - } - - if (!str) { - this.setState({ - loading: false, - pickup: false, - data: [] - }) - notification.error({ - top: 92, - message: '瀵嗛挜缁勬暟鎹涪澶辨垨鏍煎紡閿欒锛岃鎭㈠榛樿璁剧疆锛岄噸鏂版坊鍔狅紒', - duration: 10 - }) - return - } - - let _data = str.map((item, index) => { - item.key = index - return item - }) - - this.setState({ - data: _data, - pickup: false, - loading: false - }) - } else { - this.setState({ - loading: false - }) - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } - } - - /** - * @description 鑾峰彇鐢ㄦ埛鑷畾涔夊瓨鍌ㄨ繃绋嬩紶鍙� - */ - getCustomParam = (BID) => { - const { setting } = this.state - - let param = { - BID: BID - } - - if (setting.interType === 'inner') { - param.func = setting.innerFunc - } else { - if (setting.sysInterface === 'true' && options.cloudServiceApi) { - param.rduri = options.cloudServiceApi - } else if (setting.sysInterface !== 'true') { - param.rduri = setting.interface - } - - if (setting.outerFunc) { - param.func = setting.outerFunc - } - } - - return param - } - - /** - * @description 琛ㄦ牸鏉′欢鏀瑰彉鏃堕噸缃暟鎹紙鍒嗛〉鎴栨帓搴忥級 - */ - refreshbytable = (pagination, filters, sorter) => { - let { data } = this.state - - if (!data || data.length === 0 || !sorter.columnKey) return - - if (sorter.order === 'asc' || sorter.order === 'ascend') { - data.sort((a, b) => { - return a[sorter.columnKey].localeCompare(b[sorter.columnKey]) - }) - } else if (sorter.order === 'desc' || sorter.order === 'descend') { - data.sort((a, b) => { - return b[sorter.columnKey].localeCompare(a[sorter.columnKey]) - }) - } - - this.setState({data: data, selectedData: []}) - } - - /** - * @description 琛ㄦ牸鍒锋柊 - */ - reloadtable = () => { - MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 鍒楄〃閲嶇疆 - this.setState({ - loading: true, - selectedData: [], - }, () => { - this.loadmaindata() - }) - } - - /** - * @description 椤甸潰鍒锋柊锛岄噸鏂拌幏鍙栭厤缃� - */ - reloadview = () => { - this.setState({ - config: null, actions: null, columns: null, setting: null, data: null, loading: false, selectedData: [] - }, () => { - this.loadconfig() - }) - } - - /** - * @description 鎸夐挳鎿嶄綔瀹屾垚鍚庯紙鎴愬姛鎴栧け璐ワ級锛岄〉闈㈠埛鏂帮紝閲嶇疆椤电爜鍙婇�夋嫨椤� - */ - refreshbyaction = (position) => { - if (position === 'grid') { - this.reloadtable() - } else if (position === 'view') { - this.reloadview() - } - } - - /** - * @description 琛ㄦ牸閫夋嫨椤瑰垏鎹� - */ - changeSelectedData = (selectedData) => { - this.setState({selectedData}) - } - - /** - * @description 鏁版嵁灞曞紑鍚堝苟鍒囨崲 - */ - pickupChange = () => { - const { pickup } = this.state - - this.setState({ - pickup: !pickup - }) - } - - UNSAFE_componentWillMount() { - // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁 - this.loadconfig() - } - - shouldComponentUpdate (nextProps, nextState) { // handleMainTable 鍑芥暟鍒ゆ柇鏃朵笉鐩哥瓑 - return !is(fromJS({...this.props, handleMainTable: ''}), fromJS({...nextProps, handleMainTable: ''})) || !is(fromJS(this.state), fromJS(nextState)) - } - - /** - * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 - */ - componentWillUnmount () { - this.setState = () => { - return - } - } - - render() { - const { setting, actions, columns, pickup, config, selectedData } = this.state - - return ( - <div className="secretKey-subtable" id={'subtable' + this.props.MenuID}> - <div className="sub-action"> - <SubAction - setting={setting} - actions={actions} - Tab={this.props.Tab} - BID={this.props.BID} - datalist={this.state.data} - dict={this.state.dict} - selectedData={selectedData} - MenuID={this.props.SupMenuID} - refreshdata={this.refreshbyaction} - ContainerId={this.props.ContainerId} - /> - </div> - <div className="subtable-box"> - {this.state.data && this.state.data.length > 0 ? - <Switch title="鏀惰捣" className="subtable-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" defaultChecked={pickup} onChange={this.pickupChange} /> : null - } - <SubTable - tableId={this.props.Tab.uuid} - pickup={pickup} - setting={setting} - columns={columns} - dict={this.state.dict} - data={this.state.data} - MenuID={this.props.MenuID} - loading={this.state.loading} - refreshdata={this.refreshbytable} - buttonTrigger={() => {}} - handleTableId={() => {}} - chgSelectData={this.changeSelectedData} - /> - </div> - </div> - ) - } -} - -export default VerupSubTabViewTable \ No newline at end of file diff --git a/src/tabviews/commontable/secretKeyTable/index.scss b/src/tabviews/commontable/secretKeyTable/index.scss deleted file mode 100644 index 564ff3f..0000000 --- a/src/tabviews/commontable/secretKeyTable/index.scss +++ /dev/null @@ -1,47 +0,0 @@ -.secretKey-subtable { - position: relative; - min-height: 200px; - - > .top-search { - padding: 0 0px 20px; - } - >.sub-action { - min-height: 25px; - .button-list { - padding: 10px 0px 5px; - } - } - .normal-data-table { - padding: 0px; - } - .box404 { - padding-top: 30px; - } - .ant-modal-mask { - position: absolute; - } - .ant-modal-wrap { - position: absolute; - } - .action-modal .ant-modal { - top: 40px; - max-width: 95%; - .ant-modal-body { - max-height: calc(100vh - 265px); - } - } - > .ant-spin { - position: absolute; - left: calc(50% - 22px); - top: 100px; - } - .subtable-box { - position: relative; - .subtable-pickup { - position: absolute; - right: 5px; - top: -22px; - z-index: 10; - } - } -} diff --git a/src/tabviews/custom/components/card/cardItem/index.jsx b/src/tabviews/custom/components/card/cardItem/index.jsx index b288055..10aa604 100644 --- a/src/tabviews/custom/components/card/cardItem/index.jsx +++ b/src/tabviews/custom/components/card/cardItem/index.jsx @@ -15,7 +15,6 @@ cards: PropTypes.object, // 鍗$墖琛岄厤缃俊鎭� card: PropTypes.object, // 鍗$墖閰嶇疆淇℃伅 data: PropTypes.object, - updateStatus: PropTypes.func // 鐘舵�佹洿鏂� } state = { @@ -48,9 +47,9 @@ 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> ) diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index ed89792..961b02b 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -31,7 +31,6 @@ cardCell: PropTypes.object, data: PropTypes.object, elements: PropTypes.array, // 鍏冪礌闆� - updateStatus: PropTypes.func, // 鐘舵�佹洿鏂� } state = { @@ -544,7 +543,6 @@ setting={cards.setting} columns={cards.columns} selectedData={[data]} - updateStatus={this.props.updateStatus} /> </div> </Col> @@ -560,7 +558,6 @@ style={card.btnstyle} setting={cards.setting} selectedData={[data]} - updateStatus={this.props.updateStatus} /> </div> </Col> @@ -575,7 +572,6 @@ show={card.show} style={card.btnstyle} setting={cards.setting} - updateStatus={this.props.updateStatus} /> </div> </Col> @@ -591,7 +587,6 @@ style={card.btnstyle} setting={cards.setting} selectedData={[data]} - updateStatus={this.props.updateStatus} /> </div> </Col> @@ -606,7 +601,6 @@ style={card.btnstyle} setting={cards.setting} selectedData={[data]} - updateStatus={this.props.updateStatus} /> </div> </Col> @@ -621,7 +615,6 @@ style={card.btnstyle} setting={cards.setting} selectedData={[data]} - updateStatus={this.props.updateStatus} /> </div> </Col> @@ -638,7 +631,6 @@ style={card.btnstyle} setting={cards.setting} selectedData={[data]} - updateStatus={this.props.updateStatus} /> </div> </Col> @@ -654,7 +646,6 @@ style={card.btnstyle} setting={cards.setting} selectedData={[data]} - updateStatus={this.props.updateStatus} /> </div> </Col> diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index 92dc59b..30ba645 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -100,9 +100,10 @@ } 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) { @@ -139,21 +140,48 @@ 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) => { @@ -255,17 +283,69 @@ } } - 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 + }) } } @@ -396,7 +476,7 @@ {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} diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index a313c2e..f621976 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -106,8 +106,9 @@ } componentDidMount () { - MKEmitter.addListener('syncRefreshComponentId', this.reload) + MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('resetSelectLine', this.resetParentParam) + MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) } shouldComponentUpdate (nextProps, nextState) { @@ -118,8 +119,9 @@ this.setState = () => { return } - MKEmitter.removeListener('syncRefreshComponentId', this.reload) + MKEmitter.removeListener('reloadData', this.reloadData) MKEmitter.removeListener('resetSelectLine', this.resetParentParam) + MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) } /** @@ -151,6 +153,31 @@ } } + /** + * @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 @@ -162,10 +189,10 @@ } } - reload = (syncId) => { + reloadData = (menuId) => { const { config } = this.state - if (syncId && syncId !== config.uuid) return + if (menuId !== config.uuid) return this.loadData() } @@ -227,20 +254,6 @@ } } - 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 @@ -268,7 +281,7 @@ <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> diff --git a/src/tabviews/custom/components/card/table-card/index.jsx b/src/tabviews/custom/components/card/table-card/index.jsx index 5552c95..a557611 100644 --- a/src/tabviews/custom/components/card/table-card/index.jsx +++ b/src/tabviews/custom/components/card/table-card/index.jsx @@ -102,9 +102,10 @@ } 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) { @@ -115,9 +116,10 @@ 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) } /** @@ -149,6 +151,31 @@ } } + /** + * @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 @@ -160,16 +187,12 @@ } } - 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() } /** @@ -259,20 +282,6 @@ } } - 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 @@ -312,7 +321,7 @@ 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> ) diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx index 7c07cc0..c9a083d 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -232,8 +232,10 @@ } componentDidMount () { + MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('resetSelectLine', this.resetParentParam) MKEmitter.addListener('getexceloutparam', this.getexceloutparam) + MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) } /** @@ -243,8 +245,43 @@ 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) => { @@ -1317,7 +1354,6 @@ btn={item} show="icon" setting={config.setting} - updateStatus={() => {}} /> ) } else { @@ -1328,7 +1364,6 @@ btn={item} show="icon" setting={config.setting} - updateStatus={() => {}} /> ) } diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx index 139a13a..df58e29 100644 --- a/src/tabviews/custom/components/chart/antv-pie/index.jsx +++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx @@ -113,6 +113,7 @@ } componentDidMount () { + MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('resetSelectLine', this.resetParentParam) } @@ -123,9 +124,18 @@ 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 diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index ec561d4..e75297d 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -170,7 +170,7 @@ } 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}/>) @@ -347,12 +347,12 @@ } 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}/> ) } @@ -376,7 +376,6 @@ loading: PropTypes.bool, // 琛ㄦ牸鍔犺浇涓� refreshdata: PropTypes.func, // 琛ㄦ牸涓帓搴忓垪銆侀〉鐮佺殑鍙樺寲鏃跺埛鏂� chgSelectData: PropTypes.func, // 鏁版嵁鍒囨崲 - refreshbyaction: PropTypes.func, // 鎸夐挳鎵ц瀹屾垚鍚庡埛鏂� } state = { @@ -442,8 +441,7 @@ record, col: item, config: item.type === 'custom' || item.type === 'action' ? {setting, columns: fields} : null, - triggerLink: this.triggerLink, - updateStatus: this.updateStatus + triggerLink: this.triggerLink }) } } @@ -498,12 +496,6 @@ return } MKEmitter.removeListener('resetTable', this.resetTable) - } - - updateStatus = (type, positon, btn) => { - if (type === 'refresh') { - this.props.refreshbyaction(positon, btn) - } } // 瀛楁閫忚 diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index 24367ee..516709b 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -399,15 +399,6 @@ } /** - * @description 鎸夐挳鎿嶄綔瀹屾垚鍚庯紙鎴愬姛鎴栧け璐ワ級锛岄〉闈㈠埛鏂帮紝閲嶇疆椤电爜鍙婇�夋嫨椤� - */ - refreshbyaction = (position, btn) => { - if (position === 'grid' || position === 'view') { - this.reloadtable(btn) - } - } - - /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ getexceloutparam = (menuId, btnId) => { @@ -434,17 +425,12 @@ }) } - 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 { @@ -465,6 +451,31 @@ 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) } } @@ -501,6 +512,7 @@ MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('resetSelectLine', this.resetParentParam) MKEmitter.addListener('getexceloutparam', this.getexceloutparam) + MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) } /** @@ -513,6 +525,7 @@ MKEmitter.removeListener('reloadData', this.reloadData) MKEmitter.removeListener('resetSelectLine', this.resetParentParam) MKEmitter.removeListener('getexceloutparam', this.getexceloutparam) + MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) } render() { @@ -531,7 +544,6 @@ BData={this.state.BData} columns={config.columns} selectedData={selectedData} - refreshdata={this.refreshbyaction} /> <div className={'main-table-box ' + (!actions || actions.length === 0 ? 'no-action' : '')}> <MainTable @@ -545,7 +557,6 @@ loading={this.state.loading} refreshdata={this.refreshbytable} statFValue={this.state.statFValue} - refreshbyaction={this.refreshbyaction} chgSelectData={(selects) => this.setState({selectedData: selects})} /> </div> diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 47a8849..7fad292 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -30,6 +30,7 @@ class CustomPage extends Component { static propTpyes = { param: PropTypes.any, // 鍏朵粬椤甸潰浼犻�掔殑鍙傛暟 + Tab: PropTypes.string, // 寮圭獥鏍囩 MenuID: PropTypes.string, // 鑿滃崟Id MenuNo: PropTypes.string, // 鑿滃崟鍙傛暟 MenuName: PropTypes.string // 鑿滃崟鍚嶇О @@ -249,11 +250,15 @@ // 鏉冮檺杩囨护 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] }) @@ -272,7 +277,10 @@ 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' } @@ -284,7 +292,10 @@ 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' } @@ -299,7 +310,10 @@ 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' } @@ -313,7 +327,10 @@ 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] }) @@ -322,7 +339,7 @@ } 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 { @@ -355,7 +372,7 @@ } 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 = '' diff --git a/src/tabviews/iframe/index.jsx b/src/tabviews/iframe/index.jsx index 11b6299..2dea067 100644 --- a/src/tabviews/iframe/index.jsx +++ b/src/tabviews/iframe/index.jsx @@ -1,16 +1,74 @@ 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>) } } diff --git a/src/tabviews/rolemanage/index.jsx b/src/tabviews/rolemanage/index.jsx index 59eb71c..7730ca1 100644 --- a/src/tabviews/rolemanage/index.jsx +++ b/src/tabviews/rolemanage/index.jsx @@ -5,6 +5,7 @@ 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' @@ -474,9 +475,38 @@ }) } + 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) } /** @@ -486,6 +516,7 @@ this.setState = () => { return } + MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) } shouldComponentUpdate (nextProps, nextState) { diff --git a/src/tabviews/scriptmanage/index.jsx b/src/tabviews/scriptmanage/index.jsx index 12d0fd9..8e48202 100644 --- a/src/tabviews/scriptmanage/index.jsx +++ b/src/tabviews/scriptmanage/index.jsx @@ -12,11 +12,12 @@ 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 { @@ -283,9 +284,21 @@ }) } + 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) { @@ -299,18 +312,15 @@ 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" diff --git a/src/tabviews/scriptmanage/topSearch/index.jsx b/src/tabviews/scriptmanage/topSearch/index.jsx deleted file mode 100644 index 853f358..0000000 --- a/src/tabviews/scriptmanage/topSearch/index.jsx +++ /dev/null @@ -1,120 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Button } from 'antd' -import './index.scss' - -class MainSearch extends Component { - static propTpyes = { - searchlist: PropTypes.array, // 鎼滅储鏉′欢鍒楄〃 - dict: PropTypes.object // 瀛楀吀椤� - } - - state = { - match: null, // 鎼滅储鏉′欢鍖归厤瑙勫垯 - style: null, - searchlist: null - } - - UNSAFE_componentWillMount () { - let searchlist = JSON.parse(JSON.stringify(this.props.searchlist)) - let match = {} - let style = {} - let _list = [] - - searchlist.forEach(item => { - match[item.field] = item.match - style[item.field] = item.type - - _list.push(item) - }) - - this.setState({ - match: match, - style: style, - searchlist: _list - }) - } - - getFields() { - const { getFieldDecorator } = this.props.form - const fields = [] - - this.state.searchlist.forEach((item, index) => { - fields.push( - <Col span={6} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.field, {initialValue: item.initval })(<Input placeholder="" autoComplete="off" />)} - </Form.Item> - </Col> - ) - }) - - fields.push( - <Col span={6} style={{ whiteSpace: 'nowrap' }} key="actions"> - <Form.Item label={' '} colon={false}> - <Button type="primary" htmlType="submit"> - {this.props.dict['main.search']} - </Button> - <Button style={{ marginLeft: 8 }} onClick={this.handleReset}> - {this.props.dict['main.reset']} - </Button> - </Form.Item> - </Col> - ) - - return fields - } - - handleSearch = (e) => { - // 鍥炶溅鎴栫偣鍑绘悳绱� - e.preventDefault() - this.props.form.validateFields((err, values) => { - let searches = this.getFieldsValues(values) - this.props.refreshdata(searches) - }) - } - - handleReset = () => { - // 閲嶇疆 - this.props.form.resetFields() - this.props.form.validateFields((err, values) => { - let searches = this.getFieldsValues(values) - this.props.refreshdata(searches) - }) - } - - getFieldsValues = (values) => { - // 鑾峰彇鎼滅储鏉′欢鍊� - let search = [] - Object.keys(values).forEach(key => { - search.push({ - type: this.state.style[key], - key: key, - value: values[key].replace(/(^\s*|\s*$)/ig, ''), - match: this.state.match[key] - }) - }) - return search - } - - render() { - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 } - } - } - - return ( - <Form {...formItemLayout} className="verup-search-line" onSubmit={this.handleSearch}> - <Row gutter={24}>{this.getFields()}</Row> - </Form> - ) - } -} - -export default Form.create()(MainSearch) \ No newline at end of file diff --git a/src/tabviews/scriptmanage/topSearch/index.scss b/src/tabviews/scriptmanage/topSearch/index.scss deleted file mode 100644 index 35cfc73..0000000 --- a/src/tabviews/scriptmanage/topSearch/index.scss +++ /dev/null @@ -1,26 +0,0 @@ -.verup-search-line { - padding: 0px 24px 20px; - border-bottom: 1px solid #efefef; - .ant-form-item { - display: flex; - margin-bottom: 10px; - } - .ant-form-item-control-wrapper { - flex: 1; - width: calc(100% - 100px); - } - .ant-form-item-label { - // width: 100px; - 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; - } -} \ No newline at end of file diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 0652a25..dabe4b3 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -428,6 +428,9 @@ }) } item.key = index + item.$$uuid = item[setting.primaryKey] || '' + item.$$BID = _BID || '' + return item }), total: result.total, @@ -489,6 +492,9 @@ 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 @@ -642,31 +648,6 @@ } /** - * @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) => { @@ -720,7 +701,7 @@ this.setState({chartId: uuid}) } - reloadData = (menuId, id) => { + reloadData = (menuId, id) => { // Id瀛樺湪鏃讹紝鍒锋柊琛� const { MenuID } = this.props if (menuId.indexOf(MenuID) === -1) return @@ -730,6 +711,38 @@ 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(',')) // 鍚岀骇鏍囩閲嶇疆 + } } } @@ -745,6 +758,7 @@ componentDidMount () { MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('getexceloutparam', this.getexceloutparam) + MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) } /** @@ -756,6 +770,7 @@ } MKEmitter.removeListener('reloadData', this.reloadData) MKEmitter.removeListener('getexceloutparam', this.getexceloutparam) + MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) } render() { @@ -790,7 +805,6 @@ BData={this.props.BData} MenuID={this.props.MenuID} selectedData={selectedData} - refreshdata={this.refreshbyaction} ContainerId={this.props.ContainerId} /> </div> @@ -804,18 +818,16 @@ 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> @@ -835,7 +847,6 @@ MenuID={this.props.MenuID} loading={this.state.loading} tableId={this.props.Tab.uuid} - refreshdata={this.refreshbyaction} handleTableId={this.handleTableId} /> </Col> diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index 6f760fb..302c278 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -26,15 +26,12 @@ class SubTabModalTable extends Component { static propTpyes = { - type: PropTypes.any, // 绫诲瀷锛宑alendar闇�鐗规畩澶勭悊 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 = { @@ -66,7 +63,7 @@ * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 */ async loadconfig () { - const { permAction, type, Tab } = this.props + const { permAction, Tab } = this.props let param = { func: 'sPC_Get_LongParam', @@ -112,26 +109,15 @@ // 鐗堟湰鍏煎 config = UtilsUpdate.updateSubTable(config) - // 浠呮敮鎸乪xec銆乸rompt銆乸op 涓夌绫诲瀷鎸夐挳 + // 涓嶆敮鎸乫uncbutton銆乸opview 绫诲瀷鎸夐挳 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({ @@ -370,6 +356,9 @@ }) } item.key = index + item.$$uuid = item[setting.primaryKey] || '' + item.$$BID = BID || '' + return item }), total: result.total, @@ -510,18 +499,6 @@ } /** - * @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) => { @@ -544,6 +521,21 @@ } /** + * @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) => { @@ -561,6 +553,7 @@ componentDidMount () { MKEmitter.addListener('getexceloutparam', this.getexceloutparam) + MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) } /** @@ -571,6 +564,7 @@ return } MKEmitter.removeListener('getexceloutparam', this.getexceloutparam) + MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) } render() { @@ -606,7 +600,6 @@ BData={this.props.BData} selectedData={selectedData} MenuID={this.props.SupMenuID} - refreshdata={this.refreshbyaction} /> </div> <SubTable @@ -614,7 +607,6 @@ setting={setting} columns={columns} pageSize={pageSize} - BID={this.props.BID} data={this.state.data} dict={this.state.dict} BData={this.props.BData} @@ -623,7 +615,6 @@ loading={this.state.loading} refreshdata={this.refreshbytable} statFValue={this.state.statFValue} - refreshbyaction={this.refreshbyaction} chgSelectData={this.changeSelectedData} handleTableId={() => {}} /> @@ -641,7 +632,6 @@ data={this.state.data} BData={this.props.BData} loading={this.state.loading} - refreshdata={this.refreshbyaction} handleTableId={() => {}} /> </Col> diff --git a/src/tabviews/tabmanage/index.jsx b/src/tabviews/tabmanage/index.jsx index 0d78278..7be8cb2 100644 --- a/src/tabviews/tabmanage/index.jsx +++ b/src/tabviews/tabmanage/index.jsx @@ -8,6 +8,7 @@ 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' @@ -83,6 +84,7 @@ componentDidMount () { this.getTabs() + MKEmitter.addListener('reloadMenuView', this.reloadMenuView) } shouldComponentUpdate (nextProps, nextState) { @@ -96,6 +98,25 @@ 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) => { diff --git a/src/tabviews/verupmanage/index.jsx b/src/tabviews/verupmanage/index.jsx index d06a455..34cb622 100644 --- a/src/tabviews/verupmanage/index.jsx +++ b/src/tabviews/verupmanage/index.jsx @@ -9,15 +9,16 @@ 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 @@ -455,15 +456,11 @@ } 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" diff --git a/src/tabviews/verupmanage/subtabtable/index.jsx b/src/tabviews/verupmanage/subtabtable/index.jsx index 181a65c..c16e0d0 100644 --- a/src/tabviews/verupmanage/subtabtable/index.jsx +++ b/src/tabviews/verupmanage/subtabtable/index.jsx @@ -12,12 +12,13 @@ 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 { @@ -180,6 +181,7 @@ this.setState({ data: result.data.map((item, index) => { item.key = index + item.$$BID = _BID || '' return item }), total: result.total, @@ -439,12 +441,8 @@ 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"> diff --git a/src/tabviews/verupmanage/topSearch/index.jsx b/src/tabviews/verupmanage/topSearch/index.jsx deleted file mode 100644 index 853f358..0000000 --- a/src/tabviews/verupmanage/topSearch/index.jsx +++ /dev/null @@ -1,120 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Button } from 'antd' -import './index.scss' - -class MainSearch extends Component { - static propTpyes = { - searchlist: PropTypes.array, // 鎼滅储鏉′欢鍒楄〃 - dict: PropTypes.object // 瀛楀吀椤� - } - - state = { - match: null, // 鎼滅储鏉′欢鍖归厤瑙勫垯 - style: null, - searchlist: null - } - - UNSAFE_componentWillMount () { - let searchlist = JSON.parse(JSON.stringify(this.props.searchlist)) - let match = {} - let style = {} - let _list = [] - - searchlist.forEach(item => { - match[item.field] = item.match - style[item.field] = item.type - - _list.push(item) - }) - - this.setState({ - match: match, - style: style, - searchlist: _list - }) - } - - getFields() { - const { getFieldDecorator } = this.props.form - const fields = [] - - this.state.searchlist.forEach((item, index) => { - fields.push( - <Col span={6} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.field, {initialValue: item.initval })(<Input placeholder="" autoComplete="off" />)} - </Form.Item> - </Col> - ) - }) - - fields.push( - <Col span={6} style={{ whiteSpace: 'nowrap' }} key="actions"> - <Form.Item label={' '} colon={false}> - <Button type="primary" htmlType="submit"> - {this.props.dict['main.search']} - </Button> - <Button style={{ marginLeft: 8 }} onClick={this.handleReset}> - {this.props.dict['main.reset']} - </Button> - </Form.Item> - </Col> - ) - - return fields - } - - handleSearch = (e) => { - // 鍥炶溅鎴栫偣鍑绘悳绱� - e.preventDefault() - this.props.form.validateFields((err, values) => { - let searches = this.getFieldsValues(values) - this.props.refreshdata(searches) - }) - } - - handleReset = () => { - // 閲嶇疆 - this.props.form.resetFields() - this.props.form.validateFields((err, values) => { - let searches = this.getFieldsValues(values) - this.props.refreshdata(searches) - }) - } - - getFieldsValues = (values) => { - // 鑾峰彇鎼滅储鏉′欢鍊� - let search = [] - Object.keys(values).forEach(key => { - search.push({ - type: this.state.style[key], - key: key, - value: values[key].replace(/(^\s*|\s*$)/ig, ''), - match: this.state.match[key] - }) - }) - return search - } - - render() { - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 } - } - } - - return ( - <Form {...formItemLayout} className="verup-search-line" onSubmit={this.handleSearch}> - <Row gutter={24}>{this.getFields()}</Row> - </Form> - ) - } -} - -export default Form.create()(MainSearch) \ No newline at end of file diff --git a/src/tabviews/verupmanage/topSearch/index.scss b/src/tabviews/verupmanage/topSearch/index.scss deleted file mode 100644 index 35cfc73..0000000 --- a/src/tabviews/verupmanage/topSearch/index.scss +++ /dev/null @@ -1,26 +0,0 @@ -.verup-search-line { - padding: 0px 24px 20px; - border-bottom: 1px solid #efefef; - .ant-form-item { - display: flex; - margin-bottom: 10px; - } - .ant-form-item-control-wrapper { - flex: 1; - width: calc(100% - 100px); - } - .ant-form-item-label { - // width: 100px; - 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; - } -} \ No newline at end of file diff --git a/src/tabviews/zshare/actionList/changeuserbutton/index.jsx b/src/tabviews/zshare/actionList/changeuserbutton/index.jsx index a5735ca..0dee01e 100644 --- a/src/tabviews/zshare/actionList/changeuserbutton/index.jsx +++ b/src/tabviews/zshare/actionList/changeuserbutton/index.jsx @@ -19,7 +19,6 @@ btn: PropTypes.object, // 鎸夐挳 selectedData: PropTypes.any, // 瀛愯〃涓�夋嫨鏁版嵁 setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 - updateStatus: PropTypes.func, // 鎸夐挳鐘舵�佹洿鏂� } state = { @@ -165,6 +164,7 @@ return ( <Button type="link" + title={show === 'icon' ? btn.label : ''} loading={loading} style={btn.btnstyle} icon={show === 'text' ? '' : (btn.icon || '')} diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx index 3b18453..33ecd5d 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx @@ -23,7 +23,6 @@ Tab: PropTypes.any, // 濡傛灉褰撳墠鍏冪礌涓烘爣绛炬椂锛宼ab涓烘爣绛句俊鎭� btn: PropTypes.object, // 鎸夐挳 setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 - updateStatus: PropTypes.func, // 鎸夐挳鐘舵�佹洿鏂� } state = { @@ -145,7 +144,9 @@ loading: false }) - this.props.updateStatus('refresh', btn.execSuccess, btn) + if (btn.execSuccess !== 'never') { + MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn) + } } /** @@ -182,7 +183,9 @@ loading: false }) - this.props.updateStatus('refresh', btn.execError, btn) + if (btn.execError !== 'never') { + MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn) + } } /** @@ -410,6 +413,7 @@ 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 || ''))} diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index 10674f4..8da8de9 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -676,7 +676,9 @@ loading: false }) - this.props.updateStatus('refresh', btn.execSuccess, btn) + if (btn.execSuccess !== 'never') { + MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn) + } } /** @@ -713,7 +715,9 @@ loading: false }) - this.props.updateStatus('refresh', btn.execError, btn) + if (btn.execError !== 'never') { + MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn) + } } render() { @@ -733,6 +737,7 @@ return ( <Button type="link" + title={show === 'icon' ? btn.label : ''} loading={loading} style={btn.btnstyle} icon={show === 'text' ? '' : (show === 'icon' ? (btn.icon || 'download') : (btn.icon || ''))} diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx index e2913a1..217f87d 100644 --- a/src/tabviews/zshare/actionList/index.jsx +++ b/src/tabviews/zshare/actionList/index.jsx @@ -27,8 +27,7 @@ actions: PropTypes.array, // 鎸夐挳缁� columns: PropTypes.array, // 鏄剧ず鍒� setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 - ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� - refreshdata: PropTypes.func, // 鎵ц瀹屾垚鍚庢暟鎹埛鏂� + ContainerId: PropTypes.any // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� } state = { @@ -37,14 +36,6 @@ 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) => { @@ -65,7 +56,6 @@ position="toolbar" ContainerId={ContainerId} selectedData={selectedData} - updateStatus={this.updateStatus} /> ) } else if (item.OpenType === 'excelIn') { @@ -79,7 +69,6 @@ setting={setting} position="toolbar" selectedData={selectedData} - updateStatus={this.updateStatus} /> ) } else if (item.OpenType === 'excelOut') { @@ -92,7 +81,6 @@ btn={item} setting={setting} position="toolbar" - updateStatus={this.updateStatus} /> ) } else if (item.OpenType === 'popview') { @@ -107,7 +95,6 @@ setting={setting} position="toolbar" selectedData={selectedData} - updateStatus={this.updateStatus} /> ) } else if (item.OpenType === 'tab' || item.OpenType === 'blank') { @@ -120,7 +107,6 @@ setting={setting} position="toolbar" selectedData={selectedData} - updateStatus={this.updateStatus} /> ) } else if (item.OpenType === 'innerpage' || item.OpenType === 'outerpage') { @@ -132,7 +118,6 @@ setting={setting} position="toolbar" selectedData={selectedData} - updateStatus={this.updateStatus} /> ) } else if (item.OpenType === 'funcbutton') { @@ -146,7 +131,6 @@ setting={setting} position="toolbar" selectedData={selectedData} - updateStatus={this.updateStatus} /> ) } else if (item.funcType === 'print') { @@ -162,7 +146,6 @@ position="toolbar" ContainerId={ContainerId} selectedData={selectedData} - updateStatus={this.updateStatus} /> ) } diff --git a/src/tabviews/zshare/actionList/newpagebutton/index.jsx b/src/tabviews/zshare/actionList/newpagebutton/index.jsx index ee65494..f4e8d64 100644 --- a/src/tabviews/zshare/actionList/newpagebutton/index.jsx +++ b/src/tabviews/zshare/actionList/newpagebutton/index.jsx @@ -17,7 +17,6 @@ btn: PropTypes.object, // 鎸夐挳 selectedData: PropTypes.any, // 瀛愯〃涓�夋嫨鏁版嵁 setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 - updateStatus: PropTypes.func, // 鎸夐挳鐘舵�佹洿鏂� } state = { @@ -49,7 +48,6 @@ */ actionTrigger = (triggerId, record) => { const { setting, btn, selectedData } = this.props - const _this = this if (triggerId && btn.uuid !== triggerId) return @@ -128,10 +126,11 @@ 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) @@ -170,6 +169,7 @@ return ( <Button type="link" + title={show === 'icon' ? btn.label : ''} style={btn.btnstyle} icon={show === 'text' ? '' : (btn.icon || '')} onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index d6c03af..c5cb799 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -30,7 +30,6 @@ columns: PropTypes.any, // 瀛楁鍒� setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� - updateStatus: PropTypes.func, // 鎸夐挳鐘舵�佹洿鏂� } state = { @@ -725,7 +724,9 @@ this.sendMessage() } - this.props.updateStatus('refresh', btn.execSuccess, btn) + if (btn.execSuccess !== 'never') { + MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn) + } } sendMessage = () => { @@ -867,7 +868,9 @@ loading: false }) - this.props.updateStatus('refresh', btn.execError, btn) + if (btn.execError !== 'never') { + MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn) + } } /** @@ -1179,6 +1182,7 @@ 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 || '')} diff --git a/src/tabviews/zshare/actionList/popupbutton/index.jsx b/src/tabviews/zshare/actionList/popupbutton/index.jsx index 2a5c6fa..84db3ce 100644 --- a/src/tabviews/zshare/actionList/popupbutton/index.jsx +++ b/src/tabviews/zshare/actionList/popupbutton/index.jsx @@ -24,7 +24,6 @@ MenuID: PropTypes.string, // 鑿滃崟ID btn: PropTypes.object, // 鎸夐挳 setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 - updateStatus: PropTypes.func, // 鎸夐挳鐘舵�佹洿鏂� } state = { @@ -45,15 +44,47 @@ 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 瑙﹀彂鎸夐挳鎿嶄綔 */ @@ -115,12 +146,6 @@ }) } - // 鎿嶄綔鍚庡埛鏂颁富琛� - reloadtable = () => { - const { btn } = this.props - this.props.updateStatus('refresh', 'grid', btn) - } - /** * @description 寮圭獥鍏抽棴 */ @@ -132,7 +157,9 @@ loading: false }) - this.props.updateStatus('refresh', btn.popClose, btn) + if (btn.popClose !== 'never') { + MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.popClose, btn) + } } render() { @@ -149,13 +176,14 @@ >{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} @@ -166,15 +194,14 @@ ]} 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> ) diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx index 2ba39bf..e80dd27 100644 --- a/src/tabviews/zshare/actionList/printbutton/index.jsx +++ b/src/tabviews/zshare/actionList/printbutton/index.jsx @@ -30,7 +30,6 @@ btn: PropTypes.object, // 鎸夐挳 setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� - updateStatus: PropTypes.func, // 鎸夐挳鐘舵�佹洿鏂� } state = { @@ -956,7 +955,9 @@ loading: false }) - this.props.updateStatus('refresh', btn.execSuccess, btn) + if (btn.execSuccess !== 'never') { + MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn) + } } /** @@ -993,7 +994,9 @@ loading: false }) - this.props.updateStatus('refresh', btn.execError, btn) + if (btn.execError !== 'never') { + MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn) + } } /** @@ -1284,6 +1287,7 @@ 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 || '')} diff --git a/src/tabviews/zshare/actionList/tabbutton/index.jsx b/src/tabviews/zshare/actionList/tabbutton/index.jsx index 881a5b8..54e43b7 100644 --- a/src/tabviews/zshare/actionList/tabbutton/index.jsx +++ b/src/tabviews/zshare/actionList/tabbutton/index.jsx @@ -18,7 +18,6 @@ btn: PropTypes.object, // 鎸夐挳 selectedData: PropTypes.any, // 瀛愯〃涓�夋嫨鏁版嵁 setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 - updateStatus: PropTypes.any } state = { @@ -148,9 +147,7 @@ this.props.modifyTabview(tabs) }) - if (this.props.updateStatus) { - this.props.updateStatus('trigger') - } + MKEmitter.emit('openNewTab') } render() { @@ -168,6 +165,7 @@ return ( <Button type="link" + title={show === 'icon' ? btn.label : ''} style={btn.btnstyle} icon={show === 'text' ? '' : (btn.icon || '')} onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} diff --git a/src/tabviews/zshare/cardcomponent/index.jsx b/src/tabviews/zshare/cardcomponent/index.jsx index 824b554..4007fa6 100644 --- a/src/tabviews/zshare/cardcomponent/index.jsx +++ b/src/tabviews/zshare/cardcomponent/index.jsx @@ -30,7 +30,6 @@ data: PropTypes.object, // 鍗$墖鏁版嵁 selectKey: PropTypes.string, // 閫夋嫨鍗$墖鐨勫簭鍙� colMap: PropTypes.any, // 鏄剧ず鍒椾俊鎭紝鐢ㄤ簬璁剧疆鏍囪 - refreshdata: PropTypes.func, // 鎸夐挳鎿嶄綔鍚庢暟鎹埛鏂� switchCard: PropTypes.func // 鍗$墖鍒囨崲 } @@ -129,14 +128,14 @@ * @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} @@ -145,21 +144,19 @@ 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') { @@ -171,7 +168,6 @@ MenuID={MenuID} setting={setting} selectedData={[data]} - updateStatus={this.props.refreshdata} /> ) } else if (item.OpenType === 'innerpage' || item.OpenType === 'outerpage') { @@ -182,7 +178,6 @@ show={show} setting={setting} selectedData={[data]} - updateStatus={this.props.refreshdata} /> ) } else if (item.OpenType === 'funcbutton') { @@ -190,19 +185,18 @@ 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} @@ -210,7 +204,6 @@ setting={setting} selectedData={[data]} ContainerId={ContainerId} - updateStatus={this.props.refreshdata} /> ) } @@ -499,7 +492,6 @@ columns={this.props.columns} selectedData={[]} ContainerId={this.props.ContainerId} - updateStatus={this.props.refreshdata} /> </div> </Card> : null} @@ -521,7 +513,6 @@ tableId: PropTypes.string, loading: PropTypes.bool, data: PropTypes.array, - refreshdata: PropTypes.func, handleTableId: PropTypes.func } @@ -747,15 +738,6 @@ 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 @@ -781,7 +763,6 @@ show="icon" btn={action} setting={config.setting} - updateStatus={this.updateStatus} /> ) } else { @@ -793,7 +774,6 @@ show="icon" btn={action} setting={config.setting} - updateStatus={this.updateStatus} /> ) } @@ -817,7 +797,6 @@ setting={config.setting} ContainerId={ContainerId} switchCard={this.switchCard} - refreshdata={this.updateStatus} /> )) } @@ -834,7 +813,6 @@ setting={config.setting} ContainerId={ContainerId} switchCard={() => {}} - refreshdata={this.updateStatus} /> : null } {(loading || !card.insertAction) && (!data || data.length === 0) ? <Empty description={false}/> : null} diff --git a/src/tabviews/zshare/chartcomponent/index.jsx b/src/tabviews/zshare/chartcomponent/index.jsx index 2d24129..7aaa703 100644 --- a/src/tabviews/zshare/chartcomponent/index.jsx +++ b/src/tabviews/zshare/chartcomponent/index.jsx @@ -1091,7 +1091,6 @@ btn={item} show="icon" setting={config.setting} - updateStatus={() => {}} /> ) } else { @@ -1103,7 +1102,6 @@ btn={item} show="icon" setting={config.setting} - updateStatus={() => {}} /> ) } diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx index bb65378..0d1e6dd 100644 --- a/src/tabviews/zshare/normalTable/index.jsx +++ b/src/tabviews/zshare/normalTable/index.jsx @@ -29,7 +29,6 @@ pickup: PropTypes.any, // 鏁版嵁鏀惰捣 columns: PropTypes.array, // 琛ㄦ牸鍒� fields: PropTypes.array, // 缁勪欢瀛楁闆� - BID: PropTypes.any, // 涓昏〃Id ContainerId: PropTypes.any, // 鏍囩椤靛灞侷d BData: PropTypes.any, // 涓昏〃鏁版嵁 data: PropTypes.any, // 琛ㄦ牸鏁版嵁 @@ -38,7 +37,6 @@ refreshdata: PropTypes.func, // 琛ㄦ牸涓帓搴忓垪銆侀〉鐮佺殑鍙樺寲鏃跺埛鏂� handleTableId: PropTypes.func, // 鏁版嵁鍒囨崲 chgSelectData: PropTypes.func, // 鏁版嵁鍒囨崲 - refreshbyaction: PropTypes.func, // 鎸夐挳鎵ц瀹屾垚鍚庡埛鏂� } state = { @@ -209,12 +207,6 @@ return } MKEmitter.removeListener('resetTable', this.resetTable) - } - - updateStatus = (type, positon, btn) => { - if (type === 'refresh') { - this.props.refreshbyaction(positon, btn) - } } // 瀛楁閫忚 @@ -595,13 +587,12 @@ <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') { @@ -609,11 +600,10 @@ <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') { @@ -624,7 +614,6 @@ selectedData={[record]} MenuID={this.props.MenuID} setting={this.props.setting} - updateStatus={this.updateStatus} /> ) } else if (btn.OpenType === 'innerpage' || btn.OpenType === 'outerpage') { @@ -634,7 +623,6 @@ btn={btn} selectedData={[record]} setting={this.props.setting} - updateStatus={this.updateStatus} /> ) } diff --git a/src/tabviews/zshare/pageMessage/index.jsx b/src/tabviews/zshare/pageMessage/index.jsx new file mode 100644 index 0000000..908815c --- /dev/null +++ b/src/tabviews/zshare/pageMessage/index.jsx @@ -0,0 +1,29 @@ +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 \ No newline at end of file diff --git a/src/tabviews/zshare/pageMessage/index.scss b/src/tabviews/zshare/pageMessage/index.scss new file mode 100644 index 0000000..9388a99 --- /dev/null +++ b/src/tabviews/zshare/pageMessage/index.scss @@ -0,0 +1,46 @@ +.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; + } + } +} \ No newline at end of file diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index a813b51..eee1ad2 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -240,6 +240,7 @@ } else { config.uuid = MenuId config.MenuID = MenuId + config.Template = 'CustomPage' } if (MenuType === 'billPrint') { -- Gitblit v1.8.0