From 4b6a4e2f04f492d770573cf48ca52d4e748a086a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 18 十月 2021 18:30:50 +0800 Subject: [PATCH] 2021-10-18 --- src/tabviews/subtabtable/index.jsx | 144 ++++++++++++------------------------------------ 1 files changed, 36 insertions(+), 108 deletions(-) diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index c7b66d1..42a3497 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types' import {connect} from 'react-redux' import { is, fromJS } from 'immutable' -import { notification, Spin, Col, Row, Icon, Tabs} from 'antd' +import { notification, Spin} from 'antd' import Api from '@/api' import zhCN from '@/locales/zh-CN/main.js' @@ -10,7 +10,7 @@ import Utils from '@/utils/utils.js' import options from '@/store/options.js' import UtilsDM from '@/utils/utils-datamanage.js' -import { updateSubTable } from '@/utils/utils-update.js' +import { updateSubTabTable } from '@/utils/utils-update.js' import asyncComponent from '@/utils/asyncComponent' import asyncSpinComponent from '@/utils/asyncSpinComponent' import NotFount from '@/components/404' @@ -18,12 +18,9 @@ import './index.scss' -const { TabPane } = Tabs const SubSearch = asyncComponent(() => import('@/tabviews/zshare/topSearch')) const SubAction = asyncComponent(() => import('@/tabviews/zshare/actionList')) const SubTable = asyncSpinComponent(() => import('@/tabviews/zshare/normalTable')) -const CardComponent = asyncSpinComponent(() => import('@/tabviews/zshare/cardcomponent')) -const ChartComponent = asyncSpinComponent(() => import('@/tabviews/zshare/chartcomponent')) class SubTabModalTable extends Component { static propTpyes = { @@ -54,7 +51,6 @@ pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 orderBy: '', // 鎺掑簭 search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� - chartId: '', // 灞曞紑鍥捐〃ID statFields: [], // 鍚堣瀛楁 statFValue: [], // 鍚堣鍊� absFields: [], // 缁濆鍊煎瓧娈� @@ -112,7 +108,7 @@ let absFields = [] // 缁濆鍊煎瓧娈� // 鐗堟湰鍏煎 - config = updateSubTable(config) + config = updateSubTabTable(config) // 涓嶆敮鎸乫uncbutton銆乸opview 绫诲瀷鎸夐挳 let labels = [] @@ -157,19 +153,6 @@ return col }) - - // 瑙嗗浘鏉冮檺 - config.charts = config.charts.filter(item => { - if (item.Hide === 'true') return false - if (!item.blacklist || item.blacklist.length === 0) return true - return item.blacklist.filter(v => roleId.indexOf(v) > -1).length === 0 - }) - - if (config.charts.length <= 1) { - config.expand = true - } - - let chartId = config.charts[0] ? config.charts[0].uuid : '' // 1銆佺瓫閫夊瓧娈甸泦锛�2銆佽繃婊ら殣钘忓垪鍙婂悎骞跺垪涓殑瀛楁uuid config.columns.forEach(col => { @@ -302,7 +285,6 @@ this.setState({ loadingview: false, - chartId, config, absFields, statFields, @@ -496,8 +478,8 @@ param = UtilsDM.getCallBackQueryParams(setting, sql, errSql) - if (this.state.BID) { - param.BID = this.state.BID + if (this.props.BID) { + param.BID = this.props.BID } if (this.props.menuType === 'HS') { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉 @@ -665,7 +647,7 @@ * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� */ refreshbysearch = (searches) => { - MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 鍒楄〃閲嶇疆 + MKEmitter.emit('resetTable', this.props.Tab.uuid) // 鍒楄〃閲嶇疆 this.setState({ pageIndex: 1, search: searches @@ -700,14 +682,14 @@ */ reloadtable = (btn) => { if (!btn || btn.resetPageIndex !== 'false') { - MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 鍒楄〃閲嶇疆 + MKEmitter.emit('resetTable', this.props.Tab.uuid) // 鍒楄〃閲嶇疆 this.setState({ pageIndex: 1 }, () => { this.loadData() }) } else { - MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid, 'false') // 鍒楄〃閲嶇疆 + MKEmitter.emit('resetTable', this.props.Tab.uuid, 'false') // 鍒楄〃閲嶇疆 this.loadData() } @@ -757,13 +739,6 @@ MKEmitter.emit('refreshPopButton', this.props.Tab.uuid) } - /** - * @description 鍥捐〃瑙嗗浘鍒囨崲 - */ - changeChart = (uuid) => { - this.setState({chartId: uuid}) - } - UNSAFE_componentWillMount () { // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁 this.loadconfig() @@ -790,7 +765,7 @@ } render() { - const { config, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, chartId, selectedData } = this.state + const { config, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, selectedData } = this.state return ( <div className="subtabtable" id={'subtabtable' + this.props.MenuID}> @@ -798,80 +773,33 @@ {searchlist && searchlist.length ? <SubSearch BID={this.props.BID} setting={setting} searchlist={searchlist} menuType={this.props.menuType} refreshdata={this.refreshbysearch}/> : null } - {config ? <Row className="chart-view" gutter={16}> - {/* 瑙嗗浘缁� */} - {!config.expand ? <Tabs activeKey={chartId} onChange={this.changeChart}> - {config.charts.map(item => ( - <TabPane tab={<Icon type={item.icon} />} key={item.uuid}></TabPane> - ))} - </Tabs> : null} - {config.charts.map(item => { - if (!config.expand && chartId !== item.uuid) return null - - if (item.chartType === 'table') { - return ( - <Col span={item.width || 24} key={item.uuid}> - {config.charts.length > 1 ? <p className="chart-table chart-title">{item.title}</p> : null} - <div style={{minHeight: '25px'}}> - <SubAction - setting={setting} - actions={actions} - columns={columns} - BID={this.props.BID} - dict={this.state.dict} - BData={this.props.BData} - selectedData={selectedData} - MenuID={this.props.SupMenuID} - /> - </div> - <SubTable - tableId={this.props.Tab.uuid} - setting={setting} - columns={columns} - pageSize={pageSize} - data={this.state.data} - dict={this.state.dict} - BData={this.props.BData} - total={this.state.total} - MenuID={this.props.MenuID} - loading={this.state.loading} - refreshdata={this.refreshbytable} - statFValue={this.state.statFValue} - chgSelectData={this.changeSelectedData} - handleTableId={() => {}} - /> - </Col> - ) - } else if (item.chartType === 'card') { - return ( - <Col className="card-view" span={item.width} key={item.uuid}> - <CardComponent - tableId="" - plot={item} - config={config} - columns={columns} - BID={this.props.BID} - data={this.state.data} - BData={this.props.BData} - loading={this.state.loading} - handleTableId={() => {}} - /> - </Col> - ) - } else { - return ( - <Col span={item.width} key={item.uuid}> - <ChartComponent - plot={item} - config={config} - data={this.state.data} - loading={this.state.loading} - /> - </Col> - ) - } - })} - </Row> : null } + {config ? <div style={{minHeight: '25px'}}> + <SubAction + setting={setting} + actions={actions} + columns={columns} + BID={this.props.BID} + dict={this.state.dict} + BData={this.props.BData} + selectedData={selectedData} + MenuID={this.props.SupMenuID} + /> + </div> : null} + {config ? <SubTable + tableId={this.props.Tab.uuid} + setting={setting} + columns={columns} + pageSize={pageSize} + data={this.state.data} + dict={this.state.dict} + BData={this.props.BData} + total={this.state.total} + MenuID={this.props.MenuID} + loading={this.state.loading} + refreshdata={this.refreshbytable} + statFValue={this.state.statFValue} + chgSelectData={this.changeSelectedData} + /> : null} {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} </div> ) -- Gitblit v1.8.0