From 145a6eb83133497b3863add21610ac6015e6533e Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 13 五月 2021 18:33:34 +0800 Subject: [PATCH] 2021-05-13 --- src/menu/components/chart/antv-bar/chartcompile/index.jsx | 2 src/tabviews/custom/components/chart/antv-scatter/index.jsx | 7 + src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx | 28 ++---- src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 108 ++++----------------------- src/menu/components/card/data-card/wrapsetting/settingform/index.jsx | 8 + src/menu/components/card/table-card/index.jsx | 2 src/tabviews/custom/components/chart/antv-bar-line/index.scss | 41 ---------- src/menu/datasource/verifycard/settingform/index.jsx | 16 ++-- src/tabviews/custom/components/card/data-card/index.jsx | 10 ++ src/menu/components/card/data-card/index.jsx | 12 +- 10 files changed, 60 insertions(+), 174 deletions(-) diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx index d29d195..2bd98ab 100644 --- a/src/menu/components/card/data-card/index.jsx +++ b/src/menu/components/card/data-card/index.jsx @@ -34,13 +34,13 @@ state = { dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, card: null, - ismob: sessionStorage.getItem('appType') === 'mob', + appType: sessionStorage.getItem('appType'), back: false } UNSAFE_componentWillMount () { const { card } = this.props - const { ismob } = this.state + const { appType } = this.state if (card.isNew) { let _card = { @@ -67,7 +67,7 @@ btnlog: [], subcards: [{ uuid: Utils.getuuid(), - setting: { width: ismob ? 24 : 6, type: 'simple'}, + setting: { width: appType === 'mob' ? 24 : 6, type: 'simple'}, style: { borderWidth: '1px', borderColor: '#e8e8e8', paddingTop: '15px', paddingBottom: '15px', paddingLeft: '15px', paddingRight: '15px', @@ -383,7 +383,7 @@ } render() { - const { card, ismob } = this.state + const { card, appType } = this.state let offset = 0 if (card.wrap.cardFloat && card.wrap.cardFloat !== 'left') { @@ -403,7 +403,7 @@ <NormalHeader defaultshow="hidden" config={card} updateComponent={this.updateComponent}/> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> - {!ismob ? <Icon className="plus" title="娣诲姞鎼滅储" onClick={this.addSearch} type="plus-circle" /> : null} + {appType !== 'mob' ? <Icon className="plus" title="娣诲姞鎼滅储" onClick={this.addSearch} type="plus-circle" /> : null} <Icon className="plus" title="娣诲姞鎸夐挳" onClick={this.addButton} type="plus-square" /> <WrapComponent config={card} updateConfig={this.updateComponent} /> <CopyComponent type="datacard" card={card}/> @@ -420,7 +420,7 @@ <ActionComponent config={card} setSubConfig={this.setSubConfig} updateaction={this.updateComponent}/> {card.subcards.map((subcard, index) => (<CardComponent key={subcard.uuid} offset={!index ? offset : 0} cards={card} card={subcard} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))} <div style={{clear: 'both'}}></div> - {card.wrap.pagestyle !== 'switch' && card.setting.laypage === 'true' ? <Pagination total={85} size="small" showTotal={total => `鍏� ${total} 鏉} pageSize={20} defaultCurrent={1}/> : null} + {card.wrap.pagestyle === 'page' && card.setting.laypage === 'true' ? <Pagination total={85} size="small" showTotal={total => `鍏� ${total} 鏉} pageSize={20} defaultCurrent={1}/> : null} </div> ) } diff --git a/src/menu/components/card/data-card/wrapsetting/settingform/index.jsx b/src/menu/components/card/data-card/wrapsetting/settingform/index.jsx index 8332207..3465f70 100644 --- a/src/menu/components/card/data-card/wrapsetting/settingform/index.jsx +++ b/src/menu/components/card/data-card/wrapsetting/settingform/index.jsx @@ -14,6 +14,7 @@ state = { roleList: [], + appType: sessionStorage.getItem('appType'), MenuType: '' } @@ -62,7 +63,7 @@ render() { const { wrap, config } = this.props const { getFieldDecorator } = this.props.form - const { roleList, MenuType } = this.state + const { roleList, MenuType, appType } = this.state const formItemLayout = { labelCol: { @@ -139,7 +140,7 @@ )} </Form.Item> </Col> : null} - {config.subtype === 'datacard' ? <Col span={12}> + {config.subtype === 'datacard' || (config.subtype === 'tablecard' && appType === 'mob') ? <Col span={12}> <Form.Item label={ <Tooltip placement="topLeft" title="鏁版嵁婧愪腑閫夋嫨鍒嗛〉鏃舵湁鏁堛��"> <Icon type="question-circle" /> @@ -151,7 +152,8 @@ })( <Radio.Group> <Radio value="page">椤电爜</Radio> - <Radio value="switch">宸﹀彸鍒囨崲</Radio> + {appType !== 'mob' ? <Radio value="switch">宸﹀彸鍒囨崲</Radio> : null} + {appType === 'mob' ? <Radio value="slide">婊戝姩鍔犺浇</Radio> : null} </Radio.Group> )} </Form.Item> diff --git a/src/menu/components/card/table-card/index.jsx b/src/menu/components/card/table-card/index.jsx index f38edf0..4d5b011 100644 --- a/src/menu/components/card/table-card/index.jsx +++ b/src/menu/components/card/table-card/index.jsx @@ -348,7 +348,7 @@ <div style={{minHeight: 'calc(100% - 90px)'}}> {card.subcards.map(subcard => (<CardComponent key={subcard.uuid} cards={card} card={subcard} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))} </div> - {card.setting.laypage === 'true' ? <Pagination size="small" total={50} /> : null} + {card.setting.laypage === 'true' && card.wrap.pagestyle !== 'slide' ? <Pagination size="small" total={50} /> : null} </div> ) } diff --git a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx index 7fdb7a9..21c83bb 100644 --- a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx @@ -8,11 +8,14 @@ * @param {object} card // 鍥捐〃瀵硅薄 */ export function getBaseForm (card) { - let isApp = sessionStorage.getItem('appType') === 'pc' + let appType = sessionStorage.getItem('appType') let menulist = null - if (isApp) { + if (appType === 'pc' || appType === 'mob') { menulist = sessionStorage.getItem('appMenus') + if (Array.isArray(card.linkmenu)) { + card.linkmenu = '' + } } else { menulist = sessionStorage.getItem('fstMenuList') } @@ -20,7 +23,7 @@ if (menulist) { try { menulist = JSON.parse(menulist) - if (isApp) { + if (appType === 'pc' || appType === 'mob') { menulist = menulist.map(item => { item.value = item.MenuID item.text = item.MenuName @@ -98,7 +101,7 @@ initVal: card.linkmenu || [], tooltip: '鍦ㄤ娇鐢ㄦ煴褰㈠浘涓旀湭鍚敤鑷畾涔夎缃椂鏈夋晥銆�', required: false, - forbid: isApp, + forbid: appType === 'pc' || appType === 'mob', options: menulist }, { @@ -108,7 +111,7 @@ initVal: card.linkmenu || '', tooltip: '鍙屽嚮楗煎浘锛屼細鎵撳紑鍏宠仈鐨勮彍鍗曘��', required: false, - forbid: !isApp, + forbid: !(appType === 'pc' || appType === 'mob'), options: menulist }, { @@ -117,7 +120,7 @@ label: '鎵撳紑鏂瑰紡', initVal: card.open || 'blank', required: false, - forbid: !isApp, + forbid: !(appType === 'pc' || appType === 'mob'), options: [ { value: 'blank', text: '鏂扮獥鍙�' }, { value: 'self', text: '褰撳墠绐楀彛' } @@ -165,7 +168,7 @@ key: 'datatype', label: '鏁版嵁绫诲瀷', initVal: card.datatype || 'query', - tooltip: '缁熻鍥捐〃閫傜敤浜庤〃鏍间笉鍒嗛〉锛屼笖鏁版嵁闇�瑕佽浆鎹�', + tooltip: '缁熻鍥捐〃閫傜敤浜庡睍绀烘暟鎹被鍨嬩负鍔ㄦ�佸�笺��', required: false, options: [ { value: 'query', text: Formdict['header.form.query'] }, @@ -352,17 +355,6 @@ value: 'polar', text: '鏋佸潗鏍�' }] - }, { - type: 'number', - key: 'InfoDefNumber', - label: '灞曠ず鏁�', - tooltip: '榛樿鏄剧ず绫诲瀷鏁伴噺', - min: 1, - max: 50, - decimal: 0, - initVal: card.InfoDefNumber || 5, - hidden: card.datatype !== 'statistics', - required: true }, { type: 'number', key: 'barSize', diff --git a/src/menu/components/chart/antv-bar/chartcompile/index.jsx b/src/menu/components/chart/antv-bar/chartcompile/index.jsx index db034f3..2a2d793 100644 --- a/src/menu/components/chart/antv-bar/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-bar/chartcompile/index.jsx @@ -181,7 +181,7 @@ formlist: formlist.map(item => { if (['Yaxis'].includes(item.key)) { item.hidden = val === 'statistics' - } else if (['InfoType', 'InfoValue', 'InfoDefNumber'].includes(item.key)) { + } else if (['InfoType', 'InfoValue'].includes(item.key)) { item.hidden = val !== 'statistics' } return item diff --git a/src/menu/datasource/verifycard/settingform/index.jsx b/src/menu/datasource/verifycard/settingform/index.jsx index 92b9ba9..c541954 100644 --- a/src/menu/datasource/verifycard/settingform/index.jsx +++ b/src/menu/datasource/verifycard/settingform/index.jsx @@ -340,7 +340,7 @@ </Radio.Group>)} </Form.Item> </Col> : null} - <Col span={8}> + {config.type !== 'navbar' ? <Col span={8}> <Form.Item label={ <Tooltip placement="topLeft" title={'璇ョ粍浠跺鏋滃彈鍏朵粬缁勪欢鎺у埗锛岃閫夐」鐩稿簲鐨勭粍浠讹紝娌℃湁鏃堕�夆�滄棤鈥濄��'}> <Icon type="question-circle" /> @@ -359,7 +359,7 @@ <Cascader options={modules} onChange={this.changeSupModule} expandTrigger="hover" placeholder="" /> )} </Form.Item> - </Col> + </Col> : null} {config.pageable ? <Col span={8}> <Form.Item label="鍒嗛〉"> {getFieldDecorator('laypage', { @@ -391,7 +391,7 @@ </Form.Item> </Col> : null} {/* 1銆佷笉鍒嗛〉涓斾笉瀛樺湪涓婄骇妯″潡 */} - {(!config.pageable || (config.pageable && laypage === 'false')) && (!supModule || supModule.length === 0 || supModule[0] === 'empty') ? <Col span={8}> + {config.type !== 'navbar' && (!config.pageable || (config.pageable && laypage === 'false')) && (!supModule || supModule.length === 0 || supModule[0] === 'empty') ? <Col span={8}> <Form.Item label={ <Tooltip placement="topLeft" title={'鍒濆鍖栧姞杞芥椂锛屾槸鍚︿笌鍏朵粬缁勪欢涓�鍚屽姞杞芥暟鎹紝娉細浠呭湪浣跨敤绯荤粺鍑芥暟锛屼笖鍒濆鍖栧姞杞芥暟鎹椂鏈夋晥锛屽垎椤佃姹傛椂鏃犳晥銆�'}> <Icon type="question-circle" /> @@ -408,7 +408,7 @@ )} </Form.Item> </Col> : null} - <Col span={8}> + {config.type !== 'navbar' ? <Col span={8}> <Form.Item label={ <Tooltip placement="topLeft" title={'浼樺厛浣跨敤鍚岀骇鐨勬悳绱㈡潯浠剁粍浠讹紝鍚岀骇鎼滅储涓嶅瓨鍦ㄦ椂锛屼緷娆″悜涓婇�夊彇锛屼笌褰撳墠缁勪欢鐨勬悳绱㈡潯浠朵竴鍚岀敤浣滄暟鎹繃婊わ紙褰撳墠缁勪欢鐨勬悳绱㈡潯浠朵紭鍏堬級銆�'}> <Icon type="question-circle" /> @@ -424,8 +424,8 @@ </Radio.Group> )} </Form.Item> - </Col> - {useMSearch === 'true' ? <Col span={8}> + </Col> : null} + {config.type !== 'navbar' && useMSearch === 'true' ? <Col span={8}> <Form.Item label={ <Tooltip placement="topLeft" title={'澶栧眰鎼滅储鏉′欢鏀瑰彉鏃讹紝鏄惁鍒锋柊褰撳墠缁勪欢鏁版嵁銆�'}> <Icon type="question-circle" /> @@ -442,7 +442,7 @@ )} </Form.Item> </Col> : null} - <Col span={8}> + {config.type !== 'navbar' ? <Col span={8}> <Form.Item label="鍒濆鍖栨暟鎹�"> {getFieldDecorator('onload', { initialValue: setting.onload || 'true' @@ -453,7 +453,7 @@ </Radio.Group> )} </Form.Item> - </Col> + </Col> : null} </Row> </Form> </div> diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index 9d2542e..1c56228 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -65,6 +65,7 @@ item.key = index item.$$uuid = item[_config.setting.primaryKey] || '' item.$$BID = BID || '' + item.$Index = index + 1 return item }) } @@ -125,6 +126,7 @@ item.key = index item.$$uuid = item[config.setting.primaryKey] || '' item.$$BID = BID || '' + item.$Index = index + 1 return item }) @@ -268,6 +270,11 @@ let result = await Api.genericInterface(param) if (result.status) { + let start = 1 + if (config.setting.laypage) { + start = config.setting.pageSize * (pageIndex - 1) + 1 + } + this.setState({ activeKey: '', selectKeys: [], @@ -276,6 +283,7 @@ item.key = index item.$$uuid = item[config.setting.primaryKey] || '' item.$$BID = BID || '' + item.$Index = index + start return item }), total: result.total, @@ -333,6 +341,7 @@ _data.key = item.key _data.$$uuid = _data[config.setting.primaryKey] || '' _data.$$BID = BID || '' + _data.$Index = item.$Index return _data } else { return item @@ -557,7 +566,6 @@ actions={config.action} columns={config.columns} selectedData={selectedData} - refreshdata={this.refreshbyaction} /> : null } <div className={`data-zoom ${config.wrap.cardType || ''} ${config.wrap.scale || ''}`}> 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 cdafdf7..a4f5a9e 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -4,7 +4,7 @@ import { Chart } from '@antv/g2' import { connect } from 'react-redux' import DataSet from '@antv/data-set' -import { Spin, Empty, Select, notification } from 'antd' +import { Spin, Empty, notification } from 'antd' import moment from 'moment' import asyncComponent from './asyncButtonComponent' @@ -42,9 +42,6 @@ search: null, // 鎼滅储鏉′欢 vFields: [], // 鏁板�煎瓧娈� vstFields: null, // 缁熻鏁版嵁鍊煎瓧娈典俊鎭� - chartData: [], // 鍥捐〃鏁版嵁 - chartFields: [], // 缁熻鍥捐〃鐢熸垚瀛楁闆� - selectFields: [], // 缁熻鍥捐〃閫夋嫨瀛楁 } UNSAFE_componentWillMount () { @@ -448,29 +445,11 @@ * @description 鏁版嵁棰勫鐞嗭紝缁熻鏁版嵁闇�瑕侀噸缃� */ handleData = () => { - const { data, plot } = this.state - - if (plot.datatype === 'statistics') { - let result = this.getStaticMsg(data) - - this.setState({ - chartData: result.data, - chartFields: result.chartFields, - selectFields: result.selectFields - }, () => { - let _element = document.getElementById(this.state.chartId) - if (_element) { - _element.innerHTML = '' - } - this.viewrender() - }) - } else { - let _element = document.getElementById(this.state.chartId) - if (_element) { - _element.innerHTML = '' - } - this.viewrender() + let _element = document.getElementById(this.state.chartId) + if (_element) { + _element.innerHTML = '' } + this.viewrender() } /** @@ -482,7 +461,7 @@ getdata = () => { const { data, plot, vFields } = this.state - if (!data) { + if (!data || data.length === 0) { this.setState({empty: true}) return [] } @@ -590,36 +569,30 @@ } /** - * @description 缁熻鏁版嵁棰勫鐞嗭紝鍔ㄦ�佺敓鎴愮粺璁″瓧娈靛苟杩涜鏁版嵁杞崲 + * @description 缁熻鏁版嵁棰勫鐞� */ - getStaticMsg = (data) => { - const { plot, vstFields } = this.state + getStaticMsg = () => { + const { plot, vstFields, data } = this.state let percent = false - let decimal = 0 + let decimal = vstFields ? vstFields.decimal : 0 if (plot.show === 'percent') { percent = true } - if (vstFields) { - decimal = vstFields.decimal - } - if (!data) { + if (!data || data.length === 0) { this.setState({empty: true}) - return {data: [], chartFields: [], selectFields: []} + return [] } let _data = [] let _cdata = fromJS(data).toJS() - let _chartFields = [] - let _selectFields = [] if (plot.repeat === 'average') { let _mdata = new Map() _cdata.forEach(item => { if (!item[plot.InfoType] || !item[plot.Xaxis]) return - _chartFields.push(item[plot.InfoType]) item.$uuid = item[plot.InfoType] + item[plot.Xaxis] if (typeof(item[plot.InfoValue]) !== 'number') { @@ -655,7 +628,6 @@ let _mdata = new Map() _cdata.forEach(item => { if (!item[plot.InfoType] || !item[plot.Xaxis]) return - _chartFields.push(item[plot.InfoType]) item.$uuid = item[plot.InfoType] + item[plot.Xaxis] @@ -689,7 +661,6 @@ let _mdata = new Map() _cdata.forEach(item => { if (!item[plot.InfoType] || !item[plot.Xaxis]) return - _chartFields.push(item[plot.InfoType]) item.$uuid = item[plot.InfoType] + item[plot.Xaxis] @@ -714,31 +685,8 @@ _data = [..._mdata.values()] } - _chartFields = Array.from(new Set(_chartFields)) - - if (plot.InfoDefNumber >= _chartFields.length) { - _selectFields = _chartFields - } else { - _selectFields = _chartFields.slice(0, plot.InfoDefNumber) - } - - return {data: _data, chartFields: _chartFields, selectFields: _selectFields} - } - - /** - * @description 鑾峰彇缁熻鍥捐〃灞曠ず鏁版嵁锛岄�氳繃閫夋嫨绫诲瀷绛涢�� - */ - getStaticData = () => { - const { plot, chartData, chartFields, selectFields } = this.state - - let _data = [] - if (selectFields.length === chartFields.length) { - _data = chartData - } else { - _data = chartData.filter(item => selectFields.includes(item[plot.InfoType])) - } - this.setState({empty: _data.length === 0}) + return _data } @@ -780,7 +728,7 @@ }) } - _data = this.getStaticData() + _data = this.getStaticMsg() } else { let data = this.getdata() @@ -1128,7 +1076,7 @@ }) } - _data = this.getStaticData() + _data = this.getStaticMsg() } else { let data = this.getdata() @@ -1386,19 +1334,6 @@ chart.render() } - /** - * @description 缁熻鍥捐〃锛岀粺璁$被鍨嬪垏鎹� - */ - handleChange = (val) => { - this.setState({selectFields: val}, () => { - let _element = document.getElementById(this.state.chartId) - if (_element) { - _element.innerHTML = '' - } - this.viewrender() - }) - } - refreshSearch = (list) => { this.setState({search: list}, () => { this.loadData() @@ -1406,7 +1341,7 @@ } render() { - const { config, loading, plot, empty, chartFields, selectFields, BID } = this.state + const { config, loading, empty, BID } = this.state return ( <div className="custom-line-chart-plot-box" style={config.style}> @@ -1442,17 +1377,6 @@ ) } })} - {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> <div className={'canvas' + (empty ? ' empty' : '')} id={this.state.chartId}></div> </div> 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 cd9f4ce..b912f22 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.scss +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.scss @@ -55,47 +55,6 @@ background: #ffffff; } } - > .ant-select { - width: 150px; - float: right; - position: relative; - z-index: 1; - .ant-select-selection { - min-height: 24px; - height: 28px; - li { - background: unset; - border: 0; - width: 99%; - padding: 0; - margin-right: 0; - cursor: pointer; - - .type-label { - overflow: hidden; - word-break: break-word; - white-space: nowrap; - text-overflow: ellipsis; - } - } - li + li { - margin-top: 0; - width: 1%; - opacity: 0; - } - } - } - > .ant-select.ant-select-focused { - .ant-select-selection { - li { - width: 50%; - } - li + li { - width: 49%; - opacity: 1; - } - } - } .g2-tooltip-list{ display: none; } diff --git a/src/tabviews/custom/components/chart/antv-scatter/index.jsx b/src/tabviews/custom/components/chart/antv-scatter/index.jsx index 516a6a1..ca5d510 100644 --- a/src/tabviews/custom/components/chart/antv-scatter/index.jsx +++ b/src/tabviews/custom/components/chart/antv-scatter/index.jsx @@ -7,14 +7,15 @@ import Api from '@/api' import Utils from '@/utils/utils.js' -import asyncComponent from './asyncButtonComponent' +import asyncComponent from '@/utils/asyncComponent' +import asyncBtnComponent from './asyncButtonComponent' import UtilsDM from '@/utils/utils-datamanage.js' import MKEmitter from '@/utils/events.js' import './index.scss' const NormalHeader = asyncComponent(() => import('@/tabviews/custom/components/share/normalheader')) -const ExcelOutButton = asyncComponent(() => import('@/tabviews/zshare/actionList/exceloutbutton')) -const ExcelInButton = asyncComponent(() => import('@/tabviews/zshare/actionList/excelInbutton')) +const ExcelOutButton = asyncBtnComponent(() => import('@/tabviews/zshare/actionList/exceloutbutton')) +const ExcelInButton = asyncBtnComponent(() => import('@/tabviews/zshare/actionList/excelInbutton')) class ScatterChart extends Component { static propTpyes = { -- Gitblit v1.8.0