From 5944c2832820a8bfa86e3efb5085f5a2463897f9 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 22 九月 2020 09:14:49 +0800 Subject: [PATCH] 2020-09-22 --- src/components/tabview/index.scss | 4 src/utils/utils-datamanage.js | 8 src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 48 +++-- src/tabviews/custom/components/chart/antv-bar-line/index.scss | 16 + src/tabviews/custom/components/tabs/antv-tabs/index.jsx | 70 ++++++++ src/tabviews/zshare/normalTable/index.jsx | 2 src/tabviews/subtabtable/index.scss | 3 src/menu/actioncomponent/index.jsx | 16 + src/menu/datasource/index.jsx | 17 + src/menu/components/chart/antv-bar/index.jsx | 20 +- src/menu/components/tabs/tabcomponents/index.jsx | 3 src/store/action.js | 8 + src/menu/searchcomponent/index.jsx | 17 + src/menu/menushell/card.jsx | 6 src/tabviews/subtable/index.jsx | 7 src/tabviews/subtabtable/index.jsx | 7 src/tabviews/commontable/index.jsx | 7 src/views/menudesign/index.jsx | 31 ++- src/tabviews/subtable/index.scss | 4 src/tabviews/custom/components/share/tabtransfer/index.jsx | 59 +++++++ src/store/reducer.js | 12 + src/tabviews/home/index.scss | 2 src/store/action-type.js | 3 src/tabviews/custom/components/tabs/antv-tabs/index.scss | 4 src/tabviews/custom/components/share/tabtransfer/index.scss | 41 +++++ src/tabviews/custom/index.jsx | 8 + src/menu/components/tabs/tabcomponents/card.jsx | 6 src/menu/components/tabs/antv-tabs/index.jsx | 4 src/menu/menushell/index.jsx | 1 29 files changed, 359 insertions(+), 75 deletions(-) diff --git a/src/components/tabview/index.scss b/src/components/tabview/index.scss index b791f43..0971fa4 100644 --- a/src/components/tabview/index.scss +++ b/src/components/tabview/index.scss @@ -6,6 +6,7 @@ width: 100%; height: 100%; > .ant-tabs { + height: 100%; > .ant-tabs-bar { // 鍘婚櫎鏍囩椤礹eader涓巆ontent涔嬮棿鐨勯棿闅� margin-bottom: 0; .ant-tabs-tab { @@ -53,6 +54,9 @@ } } } + >.ant-tabs-content { + height: 100%; + } } .ant-tabs .ant-tabs-top-content.ant-tabs-content-animated { transition: margin-left 0s cubic-bezier(0.645, 0.045, 0.355, 1); diff --git a/src/menu/actioncomponent/index.jsx b/src/menu/actioncomponent/index.jsx index a1073ac..2e1b8b1 100644 --- a/src/menu/actioncomponent/index.jsx +++ b/src/menu/actioncomponent/index.jsx @@ -1,5 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' +import {connect} from 'react-redux' import { is, fromJS } from 'immutable' import { Modal, notification, Button } from 'antd' import moment from 'moment' @@ -26,7 +27,6 @@ class ActionComponent extends Component { static propTpyes = { type: PropTypes.string, // 鑿滃崟绫诲瀷锛屼富琛ㄦ垨瀛愯〃 - menu: PropTypes.object, // 鑿滃崟淇℃伅锛堣彍鍗昳d锛岃彍鍗曞弬鏁帮紝鑿滃崟鍚嶇О锛� config: PropTypes.object, // 鑿滃崟閰嶇疆淇℃伅 tabs: PropTypes.array, // 鎵�鏈夋爣绛� setSubConfig: PropTypes.func, // 璁剧疆瀛愰厤缃俊鎭� @@ -877,7 +877,7 @@ } shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + return !is(fromJS(this.props.config), fromJS(nextProps.config)) || !is(fromJS(this.state), fromJS(nextState)) } /** @@ -982,4 +982,14 @@ } } -export default ActionComponent \ No newline at end of file +const mapStateToProps = (state) => { + return { + menu: state.customMenu + } +} + +const mapDispatchToProps = () => { + return {} +} + +export default connect(mapStateToProps, mapDispatchToProps)(ActionComponent) \ No newline at end of file diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx index c16378f..0a3e071 100644 --- a/src/menu/components/chart/antv-bar/index.jsx +++ b/src/menu/components/chart/antv-bar/index.jsx @@ -1,5 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' +import {connect} from 'react-redux' import { is, fromJS } from 'immutable' import { Chart } from '@antv/g2' import DataSet from '@antv/data-set' @@ -19,7 +20,6 @@ class antvBarLineChart extends Component { static propTpyes = { - menu: PropTypes.object, card: PropTypes.object, updateConfig: PropTypes.func, } @@ -548,28 +548,22 @@ render() { const { card } = this.state - const { menu } = this.props return ( <div className="menu-line-chart-edit-box" style={{height: card.setting.height || 400}}> <SettingComponent config={card} - menu={menu} updateConfig={this.updateComponent} /> <div className="chart-header"> <span className="chart-title">{card.setting.title || ''}</span> <SearchComponent - menu={menu} config={card} - sysRoles={menu.sysRoles} - optionLibs={null} updatesearch={this.updateComponent} /> </div> <ActionComponent type="chart" - menu={menu} config={card} tabs={[]} // setSubConfig={(_btn) => this.setSubConfig(_btn, 'button')} @@ -586,4 +580,14 @@ } } -export default antvBarLineChart \ No newline at end of file +const mapStateToProps = (state) => { + return { + menu: state.customMenu + } +} + +const mapDispatchToProps = () => { + return {} +} + +export default connect(mapStateToProps, mapDispatchToProps)(antvBarLineChart) \ No newline at end of file diff --git a/src/menu/components/tabs/antv-tabs/index.jsx b/src/menu/components/tabs/antv-tabs/index.jsx index c36136a..57a8cb1 100644 --- a/src/menu/components/tabs/antv-tabs/index.jsx +++ b/src/menu/components/tabs/antv-tabs/index.jsx @@ -20,7 +20,6 @@ class antvBarLineChart extends Component { static propTpyes = { - menu: PropTypes.object, tabs: PropTypes.object, updateConfig: PropTypes.func, } @@ -197,7 +196,6 @@ } render() { - const { menu } = this.props const { tabs, dict, labelvisible, editab } = this.state return ( @@ -217,7 +215,7 @@ <span>{tab.icon ? <Icon type={tab.icon} /> : null}{tab.label}</span> </Popover> } key={tab.uuid}> - <TabComponents menu={menu} config={tab} handleList={this.updateTabComponent} deleteCard={this.deleteCard} /> + <TabComponents config={tab} handleList={this.updateTabComponent} deleteCard={this.deleteCard} /> </TabPane> ))} <TabPane className="tab-add" disabled tab={<Icon onClick={this.tabAdd} type="plus" />} key="add"></TabPane> diff --git a/src/menu/components/tabs/tabcomponents/card.jsx b/src/menu/components/tabs/tabcomponents/card.jsx index b8cdee2..01a5e6b 100644 --- a/src/menu/components/tabs/tabcomponents/card.jsx +++ b/src/menu/components/tabs/tabcomponents/card.jsx @@ -8,7 +8,7 @@ const AntvBar = asyncComponent(() => import('@/menu/components/chart/antv-bar')) const AntvTabs = asyncComponent(() => import('@/menu/components/tabs/antv-tabs')) -const Card = ({ id, menu, card, moveCard, findCard, delCard, hasDrop, updateConfig }) => { +const Card = ({ id, card, moveCard, findCard, delCard, hasDrop, updateConfig }) => { const originalIndex = findCard(id).index const [{ isDragging }, drag] = useDrag({ item: { type: 'menu', id, originalIndex, floor: card.floor }, @@ -38,9 +38,9 @@ const getCardComponent = () => { if (card.type === 'bar' || card.type === 'line') { - return (<AntvBar menu={menu} card={card} updateConfig={updateConfig} />) + return (<AntvBar card={card} updateConfig={updateConfig} />) } else if (card.type === 'tabs') { - return (<AntvTabs menu={menu} tabs={card} updateConfig={updateConfig} />) + return (<AntvTabs tabs={card} updateConfig={updateConfig} />) } } diff --git a/src/menu/components/tabs/tabcomponents/index.jsx b/src/menu/components/tabs/tabcomponents/index.jsx index 14b4604..62d2cb7 100644 --- a/src/menu/components/tabs/tabcomponents/index.jsx +++ b/src/menu/components/tabs/tabcomponents/index.jsx @@ -10,7 +10,7 @@ const { confirm } = Modal -const Container = ({menu, config, handleList }) => { +const Container = ({ config, handleList }) => { let target = null const [cards, setCards] = useState(config.components) @@ -138,7 +138,6 @@ <Card id={card.uuid} key={card.uuid} - menu={menu} config={config} card={card} moveCard={moveCard} diff --git a/src/menu/datasource/index.jsx b/src/menu/datasource/index.jsx index 28735f2..6e4bdeb 100644 --- a/src/menu/datasource/index.jsx +++ b/src/menu/datasource/index.jsx @@ -1,5 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' +import {connect} from 'react-redux' import { is, fromJS } from 'immutable' import { Icon, Modal } from 'antd' @@ -11,7 +12,6 @@ class DataSource extends Component { static propTpyes = { config: PropTypes.any, - menu: PropTypes.object, updateConfig: PropTypes.func } @@ -27,10 +27,11 @@ const { config } = this.props this.setState({setting: fromJS(config.setting).toJS()}) + this.props.updateConfig(config) // 瑙﹀彂鑿滃崟淇℃伅鏇存柊 } shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + return !is(fromJS(this.state), fromJS(nextState)) } editDataSource = () => { @@ -84,4 +85,14 @@ } } -export default DataSource \ No newline at end of file +const mapStateToProps = (state) => { + return { + menu: state.customMenu + } +} + +const mapDispatchToProps = () => { + return {} +} + +export default connect(mapStateToProps, mapDispatchToProps)(DataSource) \ No newline at end of file diff --git a/src/menu/menushell/card.jsx b/src/menu/menushell/card.jsx index ed095af..ddda757 100644 --- a/src/menu/menushell/card.jsx +++ b/src/menu/menushell/card.jsx @@ -8,7 +8,7 @@ const AntvBar = asyncComponent(() => import('@/menu/components/chart/antv-bar')) const AntvTabs = asyncComponent(() => import('@/menu/components/tabs/antv-tabs')) -const Card = ({ id, menu, card, moveCard, findCard, delCard, hasDrop, doubleClickCard, updateConfig }) => { +const Card = ({ id, card, moveCard, findCard, delCard, hasDrop, doubleClickCard, updateConfig }) => { const originalIndex = findCard(id).index const [{ isDragging }, drag] = useDrag({ item: { type: 'menu', id, originalIndex, floor: card.floor }, @@ -38,9 +38,9 @@ const getCardComponent = () => { if (card.type === 'bar' || card.type === 'line') { - return (<AntvBar menu={menu} card={card} updateConfig={updateConfig} />) + return (<AntvBar card={card} updateConfig={updateConfig} />) } else if (card.type === 'tabs') { - return (<AntvTabs menu={menu} tabs={card} updateConfig={updateConfig} />) + return (<AntvTabs tabs={card} updateConfig={updateConfig} />) } } diff --git a/src/menu/menushell/index.jsx b/src/menu/menushell/index.jsx index 79a1223..9e4929f 100644 --- a/src/menu/menushell/index.jsx +++ b/src/menu/menushell/index.jsx @@ -128,7 +128,6 @@ <Card id={card.uuid} key={card.uuid} - menu={menu} card={card} moveCard={moveCard} delCard={deleteCard} diff --git a/src/menu/searchcomponent/index.jsx b/src/menu/searchcomponent/index.jsx index f498a71..7dd780a 100644 --- a/src/menu/searchcomponent/index.jsx +++ b/src/menu/searchcomponent/index.jsx @@ -1,6 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' +import {connect} from 'react-redux' import { Modal, notification } from 'antd' import moment from 'moment' @@ -19,7 +20,7 @@ class SearchComponent extends Component { static propTpyes = { config: PropTypes.object, // 閰嶇疆淇℃伅 - sysRoles: PropTypes.array, // 瑙掕壊鍒楄〃锛岄粦鍚嶅崟 + // optionLibs: PropTypes.any, // 涓嬫媺瀛楀吀 updatesearch: PropTypes.func // 鏇存柊 } @@ -86,7 +87,7 @@ this.setState({ visible: true, card: card, - formlist: getSearchForm(card, this.props.sysRoles, linkableFields) + formlist: getSearchForm(card, this.props.menu.sysRoles, linkableFields) }) } @@ -304,4 +305,14 @@ } } -export default SearchComponent \ No newline at end of file +const mapStateToProps = (state) => { + return { + menu: state.customMenu + } +} + +const mapDispatchToProps = () => { + return {} +} + +export default connect(mapStateToProps, mapDispatchToProps)(SearchComponent) \ No newline at end of file diff --git a/src/store/action-type.js b/src/store/action-type.js index 5f37a43..5f7fdb2 100644 --- a/src/store/action-type.js +++ b/src/store/action-type.js @@ -40,5 +40,8 @@ // 淇敼鏁版嵁鏉冮檺 export const MODIFY_DATAMANAGER = 'MODIFY_DATAMANAGER' +// 淇敼鑷畾涔夎彍鍗� +export const MODIFY_CUSTOMMENU = 'MODIFY_CUSTOMMENU' + // 閫�鍑� export const LOGOUT = 'LOGOUT' \ No newline at end of file diff --git a/src/store/action.js b/src/store/action.js index 9f18fc6..4ed50ec 100644 --- a/src/store/action.js +++ b/src/store/action.js @@ -112,6 +112,14 @@ } } +// 淇敼鑷畾涔夎彍鍗� +export const modifyCustomMenu = (customMenu) => { + return { + type: user.MODIFY_CUSTOMMENU, + customMenu: customMenu + } +} + // 閫�鍑洪噸缃� export const logout = () => { return { diff --git a/src/store/reducer.js b/src/store/reducer.js index 397dba2..6899168 100644 --- a/src/store/reducer.js +++ b/src/store/reducer.js @@ -31,7 +31,8 @@ permFuncField: [], // 绯荤粺妯″潡 sysRoles: [], // 绯荤粺瑙掕壊鍒楄〃 dataManager: false, // 鏁版嵁绠$悊鍛� - memberLevel: _level // 浼氬憳绛夌骇 + memberLevel: _level, // 浼氬憳绛夌骇 + customMenu: null // 缂栬緫涓殑鑿滃崟锛堣嚜瀹氫箟椤甸潰锛� } // 鐢ㄦ埛娑堟伅 @@ -141,6 +142,12 @@ ...state, dataManager: action.dataManager } + case Type.MODIFY_CUSTOMMENU: + // 淇敼鑷畾涔夎彍鍗曚俊鎭� + return { + ...state, + customMenu: action.customMenu + } case Type.LOGOUT: return { selectedMainMenu: '', @@ -154,7 +161,8 @@ permAction: {}, permFuncField: [], sysRoles: [], - permMenus: {} + permMenus: {}, + customMenu: null } default: return state diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index d3c1c80..e03963f 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -597,7 +597,12 @@ if (_data) { statFields.forEach(item => { if (_data[item.field] || _data[item.field] === 0) { - values.push({label: item.label, value: _data[item.field]}) + let val = +_data[item.field] + if (isNaN(val)) { + val = 0 + } + val = val.toFixed(item.decimal) + values.push({label: item.label, value: val}) } }) } 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 c74f855..6334862 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -43,7 +43,8 @@ chartData: [], // 鍥捐〃鏁版嵁 chartFields: [], // 缁熻鍥捐〃鐢熸垚瀛楁闆� selectFields: [], // 缁熻鍥捐〃閫夋嫨瀛楁 - percentFields: [] // 璁剧疆涓虹櫨鍒嗘瘮鐨勫瓧娈碉紝tooltip鏃跺鍔�% + percentFields: [], // 璁剧疆涓虹櫨鍒嗘瘮鐨勫瓧娈碉紝tooltip鏃跺鍔�% + showHeader: false // 瀛樺湪鏍囬銆佹悳绱€�佹垨缁熻鏁版嵁鏃舵樉绀� } UNSAFE_componentWillMount () { @@ -100,6 +101,11 @@ }) } + let showHeader = false + if (config.setting.title || _config.plot.datatype === 'statistics') { + showHeader = true + } + this.setState({ config: _config, data: _data, @@ -110,7 +116,8 @@ plot: _config.plot, sync: _sync, title: config.setting.title, - search: Utils.initMainSearch(config.search) + search: Utils.initMainSearch(config.search), + showHeader }, () => { if (config.setting.sync !== 'true') { this.loadData() @@ -200,11 +207,10 @@ let result = await Api.genericInterface(param) if (result.status) { this.setState({ - data: result.data.map((item, index) => { - item.key = index - return item - }), + data: result.data, loading: false + }, () => { + this.handleData() }) } else { this.setState({ @@ -1017,29 +1023,31 @@ render() { const { BID } = this.props - const { config, loading, title, plot, empty, chartFields, selectFields } = this.state + const { showHeader, config, loading, title, plot, empty, chartFields, selectFields } = this.state return ( <div className="custom-line-chart-plot-box"> - {/* <searchLine /> */} - {title ? <p className="chart-title">{title}</p> : null} {loading ? <div className="loading-mask"> <div className="ant-spin-blur"></div> <Spin /> </div> : null } - {plot.datatype === 'statistics' && chartFields.length > 0 ? <Select - mode="multiple" - showSearch - showArrow={true} - value={selectFields} - onChange={this.handleChange} - maxTagCount={0} - maxTagPlaceholder={(option) => <div className="type-label">{option.join('銆�')}</div>} - > - {chartFields.map((item, i) => <Select.Option key={i} value={item}>{item}</Select.Option>)} - </Select> : null} + {showHeader ? <div className="chart-header"> + <span className="chart-title">{title}</span> + {/* <searchLine /> */} + {plot.datatype === 'statistics' && chartFields.length > 0 ? <Select + mode="multiple" + showSearch + showArrow={true} + value={selectFields} + onChange={this.handleChange} + maxTagCount={0} + maxTagPlaceholder={(option) => <div className="type-label">{option.join('銆�')}</div>} + > + {chartFields.map((item, i) => <Select.Option key={i} value={item}>{item}</Select.Option>)} + </Select> : null} + </div> : null} <div className="canvas-wrap"> <div className={'chart-action ' + (plot.title ? 'with-title' : '')}> {config.action.map(item => { diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.scss b/src/tabviews/custom/components/chart/antv-bar-line/index.scss index 41ff98b..1adc0c8 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.scss +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.scss @@ -1,10 +1,22 @@ .custom-line-chart-plot-box { margin-bottom: 30px; + + > .chart-header { + height: 45px; + border-bottom: 1px solid #e8e8e8; + overflow: hidden; + + .chart-title { + font-size: 16px; + float: left; + line-height: 45px; + margin-left: 10px; + } + } .canvas-wrap { margin: 0 0px; position: relative; - border-top: 1px solid transparent; .chart-action { position: absolute; top: 2px; @@ -18,7 +30,7 @@ .canvas { margin: 0; - border: 1px solid #e8e8e8; + // border: 1px solid #e8e8e8; padding: 25px 15px; } .canvas.empty { diff --git a/src/tabviews/custom/components/share/tabtransfer/index.jsx b/src/tabviews/custom/components/share/tabtransfer/index.jsx new file mode 100644 index 0000000..3832ad2 --- /dev/null +++ b/src/tabviews/custom/components/share/tabtransfer/index.jsx @@ -0,0 +1,59 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +// import { fromJS } from 'immutable' +import { Row, Col, Empty } from 'antd' + +import asyncSpinComponent from '@/utils/asyncSpinComponent' +import './index.scss' + +// 閫氱敤缁勪欢 +const AntvBarAndLine = asyncSpinComponent(() => import('@/tabviews/custom/components/chart/antv-bar-line')) +const AntvTabs = asyncSpinComponent(() => import('@/tabviews/custom/components/tabs/antv-tabs')) + +class MainSearch extends Component { + static propTpyes = { + BID: PropTypes.any, // 鐖剁骇Id + config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 + mainSearch: PropTypes.any, // 鍏ㄥ眬鎼滅储鏉′欢 + menuType: PropTypes.any, // 鑿滃崟绫诲瀷 + dataManager: PropTypes.any, // 鏁版嵁鏉冮檺 + } + + state = {} + + UNSAFE_componentWillMount () { + + } + + getComponents = () => { + const { menuType, dataManager, BID, mainSearch, config } = this.props + + if (!config || !config.components || config.components.length === 0) return (<Empty description={false} />) + + return config.components.map(item => { + if (item.type === 'bar' || item.type === 'line') { + return ( + <Col span={item.setting.span} key={item.uuid}> + <AntvBarAndLine config={item} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + </Col> + ) + } else if (item.type === 'tabs') { + return ( + <Col span={item.setting.span} key={item.uuid}> + <AntvTabs config={item} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + </Col> + ) + } else { + return null + } + }) + } + + render() { + return ( + <Row gutter={8}>{this.getComponents()}</Row> + ) + } +} + +export default MainSearch \ No newline at end of file diff --git a/src/tabviews/custom/components/share/tabtransfer/index.scss b/src/tabviews/custom/components/share/tabtransfer/index.scss new file mode 100644 index 0000000..ee84ed1 --- /dev/null +++ b/src/tabviews/custom/components/share/tabtransfer/index.scss @@ -0,0 +1,41 @@ +.ant-advanced-search-form.top-search { + padding: 0px 24px 10px; + border-bottom: 1px solid #efefef; + .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 { + // 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; + } + .group-required { + label::before { + display: inline-block; + margin-right: 4px; + color: #f5222d; + font-size: 14px; + font-family: SimSun, sans-serif; + line-height: 1; + content: '*'; + } + } +} \ No newline at end of file diff --git a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx new file mode 100644 index 0000000..2ef9f4a --- /dev/null +++ b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx @@ -0,0 +1,70 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { Tabs, Icon } from 'antd' + +import asyncComponent from '@/utils/asyncComponent' + +import zhCN from '@/locales/zh-CN/model.js' +import enUS from '@/locales/en-US/model.js' +import './index.scss' + +const TabTransfer = asyncComponent(() => import('../../share/tabtransfer')) + +const { TabPane } = Tabs + +class antvBarLineChart extends Component { + static propTpyes = { + BID: PropTypes.any, // 鐖剁骇Id + config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 + mainSearch: PropTypes.any, // 鍏ㄥ眬鎼滅储鏉′欢 + menuType: PropTypes.any, // 鑿滃崟绫诲瀷 + dataManager: PropTypes.any, // 鏁版嵁鏉冮檺 + } + + state = { + dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + tabs: null + } + + UNSAFE_componentWillMount () { + const { config } = this.props + this.setState({ + tabs: config + }) + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } + + componentDidMount () {} + + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 + */ + componentWillUnmount () { + this.setState = () => { + return + } + } + + render() { + const { BID, mainSearch, menuType, dataManager } = this.props + const { tabs } = this.state + + return ( + <div className="menu-antv-tabs-wrap"> + <Tabs defaultActiveKey="1" tabPosition={tabs.setting.position} type={tabs.setting.tabStyle}> + {tabs.subtabs.map(tab => ( + <TabPane tab={<span>{tab.icon ? <Icon type={tab.icon} /> : null}{tab.label}</span>} key={tab.uuid}> + <TabTransfer config={tab} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager}/> + </TabPane> + ))} + </Tabs> + </div> + ) + } +} + +export default antvBarLineChart \ No newline at end of file diff --git a/src/tabviews/custom/components/tabs/antv-tabs/index.scss b/src/tabviews/custom/components/tabs/antv-tabs/index.scss new file mode 100644 index 0000000..c9a8b6c --- /dev/null +++ b/src/tabviews/custom/components/tabs/antv-tabs/index.scss @@ -0,0 +1,4 @@ +.menu-antv-tabs-wrap { + position: relative; + box-sizing: border-box; +} diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 01d96fd..73c9e71 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -18,6 +18,7 @@ // 閫氱敤缁勪欢 const AntvBarAndLine = asyncSpinComponent(() => import('./components/chart/antv-bar-line')) +const AntvTabs = asyncSpinComponent(() => import('./components/tabs/antv-tabs')) class NormalTable extends Component { static propTpyes = { @@ -296,6 +297,7 @@ * @description 涓昏〃鏁版嵁鍔犺浇 */ loadmaindata = (params) => { + if (!params || params.length === 0) return let LText_field = [] let LText = params.map((item, index) => { let _sql = item.sql @@ -442,6 +444,12 @@ <AntvBarAndLine config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> </Col> ) + } else if (item.type === 'tabs') { + return ( + <Col span={item.setting.span} key={item.uuid}> + <AntvTabs config={item} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + </Col> + ) } else { return null } diff --git a/src/tabviews/home/index.scss b/src/tabviews/home/index.scss index a9d740b..7b5e8bf 100644 --- a/src/tabviews/home/index.scss +++ b/src/tabviews/home/index.scss @@ -2,7 +2,7 @@ position: relative; width: 100%; min-height: calc(100vh - 92px); - // min-height: 100vh; + height: 100%; background: #f0f2f5; padding: 24px; .ant-row-flex { diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 5f57a90..f7108a0 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -511,7 +511,12 @@ if (_data) { statFields.forEach(item => { if (_data[item.field] || _data[item.field] === 0) { - values.push({label: item.label, value: _data[item.field]}) + let val = +_data[item.field] + if (isNaN(val)) { + val = 0 + } + val = val.toFixed(item.decimal) + values.push({label: item.label, value: val}) } }) } diff --git a/src/tabviews/subtable/index.scss b/src/tabviews/subtable/index.scss index 193ee27..911db01 100644 --- a/src/tabviews/subtable/index.scss +++ b/src/tabviews/subtable/index.scss @@ -57,6 +57,10 @@ .normal-data-table { padding: 0px; + + .normal-table-footer.pagination { + bottom: 10px; + } } .box404 { padding-top: 30px; diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index 26635f0..fddcf6d 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -401,7 +401,12 @@ if (_data) { statFields.forEach(item => { if (_data[item.field] || _data[item.field] === 0) { - values.push({label: item.label, value: _data[item.field]}) + let val = +_data[item.field] + if (isNaN(val)) { + val = 0 + } + val = val.toFixed(item.decimal) + values.push({label: item.label, value: val}) } }) } diff --git a/src/tabviews/subtabtable/index.scss b/src/tabviews/subtabtable/index.scss index 9f9a722..19a1a4e 100644 --- a/src/tabviews/subtabtable/index.scss +++ b/src/tabviews/subtabtable/index.scss @@ -5,9 +5,6 @@ > .top-search { padding: 0 0px 10px; } - .normal-data-table { - padding: 0 0 30px; - } .box404 { padding-top: 30px; } diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx index 44063b1..c97cbdd 100644 --- a/src/tabviews/zshare/normalTable/index.jsx +++ b/src/tabviews/zshare/normalTable/index.jsx @@ -1000,7 +1000,7 @@ } let _pagination = false - if (setting.laypage) { + if (setting.laypage !== 'false' && setting.laypage !== false) { _pagination = { current: this.state.pageIndex, pageSize: this.state.pageSize, diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js index ebfef57..15e098a 100644 --- a/src/utils/utils-datamanage.js +++ b/src/utils/utils-datamanage.js @@ -187,7 +187,7 @@ /** * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼ sPC_Get_TableData 鍚堣鍊肩殑鍙傛暟 */ - static getStatQueryDataParams (setting, statFields, search, orderBy, pageIndex, pageSize, menuType, dataManager) { + static getStatQueryDataParams (setting, statFields, search, orderBy, BID, menuType, dataManager) { let param = { func: 'sPC_Get_TableData', obj_name: 'data', @@ -243,7 +243,7 @@ }) } - let LText = ` select ${statFields.map(col => `sum(${col.field}) as ${col.field}`).join(',')} from ${_dataresource} ${_search} ` + let LText = ` select ${statFields.map(col => `isnull(sum(${col.field}),0) as ${col.field}`).join(',')} from ${_dataresource} ${_search} ` if (_customScript) { LText = `${LText} @@ -269,6 +269,10 @@ param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } + if (BID) { + param.BID = BID + } + // 鏁版嵁绠$悊鏉冮檺 if (dataManager) { param.dataM = 'Y' diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index 5a1e50b..9a53d95 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -13,6 +13,7 @@ import antdEnUS from 'antd/es/locale/en_US' import antdZhCN from 'antd/es/locale/zh_CN' import asyncComponent from '@/utils/asyncComponent' +import { modifyCustomMenu } from '@/store/action' import './index.scss' @@ -250,17 +251,19 @@ _permFuncField = _permFuncField.sort() } - this.setState({ - config: {...this.state.config, sysRoles: _sysRoles, permFuncField: _permFuncField} - }) + let config = {...this.state.config, sysRoles: _sysRoles, permFuncField: _permFuncField} + + this.setState({config}) + this.props.modifyCustomMenu(config) } }) } initMenuList = (msg) => { - this.setState({ - config: {...this.state.config, ...msg} - }) + let config = {...this.state.config, ...msg} + + this.setState({config}) + this.props.modifyCustomMenu(config) } editCard = (element) => { @@ -322,6 +325,8 @@ this.setState({ config: config }) + + this.props.modifyCustomMenu(config) } /** @@ -333,12 +338,12 @@ config.tableFields = fields ? fields : tableFields this.setState({ - config: config, - tableFields: fields ? fields : tableFields + tableFields: fields ? fields : tableFields, + config }) - } - + this.props.modifyCustomMenu(config) + } render () { const { activeKey, dict, MenuId, config } = this.state @@ -403,8 +408,10 @@ return {} } -const mapDispatchToProps = () => { - return {} +const mapDispatchToProps = (dispatch) => { + return { + modifyCustomMenu: (customMenu) => dispatch(modifyCustomMenu(customMenu)) + } } export default connect(mapStateToProps, mapDispatchToProps)(MenuDesign) \ No newline at end of file -- Gitblit v1.8.0