From 423ca1c5d4e4cc7eba9e12125e74f47f5756f967 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 24 六月 2021 17:29:59 +0800 Subject: [PATCH] 2021-06-24 --- src/tabviews/custom/components/chart/antv-dashboard/index.scss | 4 + src/tabviews/custom/components/chart/antv-dashboard/index.jsx | 24 ++++- src/tabviews/custom/components/chart/antv-scatter/index.scss | 4 + src/menu/components/card/cardcellcomponent/index.jsx | 2 src/menu/components/card/table-card/index.jsx | 22 +++++ src/tabviews/custom/components/chart/antv-bar-line/index.scss | 4 + src/menu/components/share/actioncomponent/formconfig.jsx | 22 +++++ src/menu/components/card/cardcomponent/index.jsx | 8 +- src/tabviews/custom/components/chart/antv-pie/index.scss | 4 + src/menu/components/card/data-card/index.jsx | 24 +++++ src/menu/components/share/actioncomponent/index.jsx | 2 src/menu/components/card/table-card/cardcomponent/settingform/index.jsx | 1 src/menu/components/share/actioncomponent/actionform/index.jsx | 3 src/menu/components/card/table-card/cardcomponent/index.jsx | 8 ++ src/menu/components/chart/antv-dashboard/index.jsx | 8 +- src/tabviews/custom/components/tree/antd-tree/index.scss | 4 + src/tabviews/custom/components/card/data-card/index.jsx | 49 +++++++++-- src/templates/sharecomponent/searchcomponent/searchform/index.jsx | 2 18 files changed, 161 insertions(+), 34 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index 3f1b073..03b0d4e 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -288,7 +288,7 @@ this.setState({ actvisible: true, card: card, - formlist: getActionForm(card, functip, cards.setting, usefulFields, 'card', menulist, modules, cards.columns) + formlist: getActionForm(card, functip, cards, usefulFields, 'card', menulist, modules) }) } diff --git a/src/menu/components/card/cardcomponent/index.jsx b/src/menu/components/card/cardcomponent/index.jsx index 9d50255..af376d8 100644 --- a/src/menu/components/card/cardcomponent/index.jsx +++ b/src/menu/components/card/cardcomponent/index.jsx @@ -264,14 +264,14 @@ <CopyComponent type="cardcell" card={card}/> <PasteComponent elements={elements} options={['action', 'customCardElement']} updateConfig={(list) => this.updateCard(list, 'paste')} /> <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> - {cards.subtype === 'propcard' ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> - <Icon className="plus" title="宸︾Щ" type="arrow-left" onClick={() => this.props.move(card, 'left')} /> - <Icon className="close" title="鍙崇Щ" type="arrow-right" onClick={() => this.props.move(card, 'right')} /> + <Icon className="plus" title="鍓嶇Щ" type="arrow-left" onClick={() => this.props.move(card, 'left')} /> + <Icon className="close" title="鍚庣Щ" type="arrow-right" onClick={() => this.props.move(card, 'right')} /> </div> } trigger="hover" getPopupContainer={() => document.getElementById(card.uuid + 'swap')}> <Icon type="swap" id={card.uuid + 'swap'}/> - </Popover> : null} + </Popover> {cards.subtype === 'propcard' || card.$cardType === 'extendCard' ? <Icon className="close" title="鍒犻櫎鍗$墖" type="delete" onClick={() => this.props.deleteElement(card)} /> : null} {card.setting.type === 'multi' ? <Switch size="small" onClick={this.changeSide} defaultChecked /> : null} </div> diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx index 5850270..9a7931d 100644 --- a/src/menu/components/card/data-card/index.jsx +++ b/src/menu/components/card/data-card/index.jsx @@ -404,6 +404,26 @@ this.props.updateConfig(card) } + move = (item, direction) => { + let card = fromJS(this.state.card).toJS() + + let dragIndex = card.subcards.findIndex(c => c.uuid === item.uuid) + let hoverIndex = null + + if (direction === 'left') { + hoverIndex = dragIndex - 1 + } else { + hoverIndex = dragIndex + 1 + } + + if (hoverIndex === -1 || hoverIndex === card.subcards.length) return + + card.subcards.splice(hoverIndex, 0, ...card.subcards.splice(dragIndex, 1)) + + this.setState({card}) + this.props.updateConfig(card) + } + clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() @@ -447,8 +467,8 @@ } trigger="hover"> <Icon type="tool" /> </Popover> - <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}/>))} + <ActionComponent config={card} type="datacard" setSubConfig={this.setSubConfig} updateaction={this.updateComponent}/> + {card.subcards.map((subcard, index) => (<CardComponent key={subcard.uuid} offset={!index ? offset : 0} cards={card} card={subcard} move={this.move} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))} <div style={{clear: 'both'}}></div> {card.wrap.pagestyle === 'page' && card.setting.laypage === 'true' && appType !== 'mob' ? <Pagination total={85} size="small" showTotal={total => `鍏� ${total} 鏉} pageSize={20} defaultCurrent={1}/> : null} {card.wrap.pagestyle === 'page' && card.setting.laypage === 'true' && appType === 'mob' ? <MobPagination /> : null} diff --git a/src/menu/components/card/table-card/cardcomponent/index.jsx b/src/menu/components/card/table-card/cardcomponent/index.jsx index 2fe0400..a46143b 100644 --- a/src/menu/components/card/table-card/cardcomponent/index.jsx +++ b/src/menu/components/card/table-card/cardcomponent/index.jsx @@ -177,6 +177,14 @@ <Icon className="edit" title="缂栬緫" type="edit" onClick={() => this.setState({settingVisible: true})} /> <CopyComponent type="cardcell" card={card}/> <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> + <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + <div className="mk-popover-control"> + <Icon className="plus" title="鍓嶇Щ" type="arrow-left" onClick={() => this.props.move(card, 'left')} /> + <Icon className="close" title="鍚庣Щ" type="arrow-right" onClick={() => this.props.move(card, 'right')} /> + </div> + } trigger="hover" getPopupContainer={() => document.getElementById(card.uuid + 'swap')}> + <Icon type="swap" id={card.uuid + 'swap'}/> + </Popover> <Icon className="close" title="鍒犻櫎鍗$墖" type="delete" onClick={() => this.props.deleteElement(card)} /> </div> } trigger="hover"> diff --git a/src/menu/components/card/table-card/cardcomponent/settingform/index.jsx b/src/menu/components/card/table-card/cardcomponent/settingform/index.jsx index ba0dcf4..c4054ef 100644 --- a/src/menu/components/card/table-card/cardcomponent/settingform/index.jsx +++ b/src/menu/components/card/table-card/cardcomponent/settingform/index.jsx @@ -90,6 +90,7 @@ {option.label} </Select.Option> )} + <Select.Option key={'index'} value={'$Index'}>搴忓彿锛堝墠绔級</Select.Option> </Select> )} </Form.Item> diff --git a/src/menu/components/card/table-card/index.jsx b/src/menu/components/card/table-card/index.jsx index 9a848be..c9eb392 100644 --- a/src/menu/components/card/table-card/index.jsx +++ b/src/menu/components/card/table-card/index.jsx @@ -316,6 +316,26 @@ } } + move = (item, direction) => { + let card = fromJS(this.state.card).toJS() + + let dragIndex = card.subcards.findIndex(c => c.uuid === item.uuid) + let hoverIndex = null + + if (direction === 'left') { + hoverIndex = dragIndex - 1 + } else { + hoverIndex = dragIndex + 1 + } + + if (hoverIndex === -1 || hoverIndex === card.subcards.length) return + + card.subcards.splice(hoverIndex, 0, ...card.subcards.splice(dragIndex, 1)) + + this.setState({card}) + this.props.updateConfig(card) + } + clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() @@ -347,7 +367,7 @@ <Icon type="tool" /> </Popover> <div style={{minHeight: 'calc(100% - 90px)'}}> - {card.subcards.map(subcard => (<CardComponent key={subcard.uuid} cards={card} card={subcard} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))} + {card.subcards.map(subcard => (<CardComponent key={subcard.uuid} cards={card} card={subcard} updateElement={this.updateCard} move={this.move} deleteElement={this.deleteCard}/>))} </div> {card.setting.laypage === 'true' && card.wrap.pagestyle !== 'slide' && appType !== 'mob' ? <Pagination size="small" total={50} /> : null} {card.setting.laypage === 'true' && card.wrap.pagestyle !== 'slide' && appType === 'mob' ? <MobPagination /> : null} diff --git a/src/menu/components/chart/antv-dashboard/index.jsx b/src/menu/components/chart/antv-dashboard/index.jsx index cc59f86..54f8e71 100644 --- a/src/menu/components/chart/antv-dashboard/index.jsx +++ b/src/menu/components/chart/antv-dashboard/index.jsx @@ -319,10 +319,10 @@ getdata = () => { const { card } = this.state - const data = []; - const val = (Math.random() * card.plot.maxValue).toFixed(1); - data.push({ value: +val }); - return data; + const data = [] + const val = (Math.random() * card.plot.maxValue).toFixed(1) + data.push({ value: +val }) + return data } dashboardrender = () => { diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index a4060b9..c33e8c4 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -192,6 +192,9 @@ if (_Ot !== 'notRequired' && _opentype !== 'excelOut') { _options.push('controlField', 'controlVal') } + if (_Ot === 'requiredSgl' && ['pop', 'prompt', 'exec'].includes(_opentype)) { + _options.push('swipe') + } return _options } diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 16301bc..c2231a5 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -11,7 +11,9 @@ * @param {*} usefulFields 瀛樺偍杩囩▼鍙敤鐨勫紑濮嬪瓧娈� * @param {*} type 鎸夐挳绫诲瀷锛岀敤浜庡尯鍒嗗彲閫夌殑鎵撳紑鏂瑰紡 */ -export function getActionForm (card, functip, setting, usefulFields, type, menulist = [], modules = [], columns = []) { +export function getActionForm (card, functip, config, usefulFields, type, menulist = [], modules = []) { + let setting = config.setting || {} + let columns = config.columns || [] let appMenus = [] let opentypes = [ { @@ -444,6 +446,24 @@ }] }, { + type: 'radio', + key: 'swipe', + label: "婊戝姩鏄剧ず", + initVal: card.swipe || 'false', + required: false, + forbid: (type !== 'datacard' || sessionStorage.getItem('appType') !== 'mob'), + options: [{ + value: 'false', + text: '鍚�' + }, { + value: 'left', + text: '宸︽粦' + }, { + value: 'right', + text: '鍙虫粦' + }] + }, + { type: 'select', key: 'icon', label: Formdict['model.icon'], diff --git a/src/menu/components/share/actioncomponent/index.jsx b/src/menu/components/share/actioncomponent/index.jsx index 43dabb7..2865861 100644 --- a/src/menu/components/share/actioncomponent/index.jsx +++ b/src/menu/components/share/actioncomponent/index.jsx @@ -187,7 +187,7 @@ this.setState({ visible: true, card: card, - formlist: getActionForm(card, functip, config.setting, usefulFields, this.props.type, menulist, modules, config.columns) + formlist: getActionForm(card, functip, config, usefulFields, this.props.type, menulist, modules) }) } diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index 90e0085..5f29f7b 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -40,14 +40,20 @@ sync: false, // 鏄惁缁熶竴璇锋眰鏁版嵁 card: null, // 鍗$墖璁剧疆 data: null, // 鏁版嵁 - total: null + total: null, + precards: [], + nextcards: [], } UNSAFE_componentWillMount () { const { data, initdata, BID } = this.props let _config = fromJS(this.props.config).toJS() - _config.subcards = _config.subcards.map(item => { + let _card = null + let precards = [] + let nextcards = [] + + _config.subcards.forEach(item => { item.setting.$click = '' if (item.setting.click === 'button') { if (item.elements.filter(ele => ele.eleType === 'button').length < 2) { @@ -55,10 +61,18 @@ } item.setting.click = '' } - return item + + if (item.$cardType !== 'extendCard') { + _card = item + } else if (!_card) { + precards.push(item) + } else { + nextcards.push(item) + } }) - let _card = _config.subcards.shift() + _config.subcards = null + let _cols = new Map() let _data = null @@ -74,11 +88,16 @@ if (_config.wrap.cardFloat && _config.wrap.cardFloat !== 'left') { let _width = 0 - _config.subcards.forEach(card => { + precards.forEach(card => { + _width += card.setting.width + }) + nextcards.forEach(card => { _width += card.setting.width }) _config.$offset = _width + } else { + _config.wrap.cardFloat = null } if (_data) { @@ -109,6 +128,8 @@ }) this.setState({ + precards, + nextcards, sync: _sync, data: _data, BID: BID || '', @@ -574,7 +595,7 @@ } render() { - const { config, loading, data, pageIndex, total, card, activeKey, BID, BData, selectedData, selectKeys } = this.state + const { config, precards, nextcards, loading, data, pageIndex, total, card, activeKey, BID, BData, selectedData, selectKeys } = this.state let _total = 0 let switchable = false @@ -584,7 +605,7 @@ } let offset = 0 - if (config.wrap.cardFloat && config.wrap.cardFloat !== 'left') { + if (config.wrap.cardFloat) { let length = data ? data.length : 0 if (card.setting.width * length + config.$offset < 24) { offset = 24 - card.setting.width * length - config.$offset @@ -616,19 +637,25 @@ <div className={`data-zoom ${config.wrap.cardType || ''} ${config.wrap.scale || ''}`}> {switchable ? <div className={'prev-page ' + (pageIndex === 1 ? 'disabled' : '')} onClick={this.prevPage}><div><div><img src={preImg} alt=""/></div></div></div> : null} <Row className="card-row-list"> + {offset ? <Col span={offset} style={{height: '10px'}}> </Col> : null} + {precards.map((item, index) => ( + <Col key={'pre' + index} className={item.setting.$click} span={item.setting.width || 6}> + <CardItem card={item} cards={config} data={{$$BID: BID, $$type: 'extendCard'}}/> + </Col> + ))} {data && data.map((item, index) => ( - <Col className={(activeKey === index ? ' active' : (selectKeys.indexOf(index) > -1 ? ' selected' : '')) + (card.setting.$click ? ' pointer' : '') + card.setting.$click} key={index} span={card.setting.width} offset={!index ? offset : 0} onClick={() => {this.changeCard(index, item)}}> + <Col className={(activeKey === index ? ' active' : (selectKeys.indexOf(index) > -1 ? ' selected' : '')) + (card.setting.$click ? ' pointer' : '') + card.setting.$click} key={index} span={card.setting.width} onClick={() => {this.changeCard(index, item)}}> <CardItem card={card} cards={config} data={item}/> </Col> ))} - {config.subcards.map((item, index) => ( - <Col key={'mk' + index} className={item.setting.$click} span={item.setting.width || 6} offset={(!data || data.length === 0) ? offset : 0}> + {nextcards.map((item, index) => ( + <Col key={'next' + index} className={item.setting.$click} span={item.setting.width || 6}> <CardItem card={item} cards={config} data={{$$BID: BID, $$type: 'extendCard'}}/> </Col> ))} </Row> {switchable ? <div className={'prev-page ' + (total <= _total ? 'disabled' : '')} onClick={this.nextPage}><div><div><img src={nextImg} alt=""/></div></div></div> : null} - {config.subcards.length === 0 && (!data || data.length === 0) ? <Empty description={false}/> : null} + {precards.length === 0 && nextcards.length === 0 && (!data || data.length === 0) ? <Empty description={false}/> : null} </div> {config.wrap.pagestyle !== 'switch' && config.setting.laypage && data ? <Pagination size="small" total={total} showTotal={t => `鍏� ${t} 鏉} pageSize={config.setting.pageSize} onChange={this.changePageIndex} current={pageIndex}/> : null} </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 a3afbfc..714a088 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.scss +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.scss @@ -46,6 +46,10 @@ top: 0; right: 0px; bottom: 0px; + display: flex; + align-items: center; + justify-content: center; + text-align: justify; z-index: 1; .ant-spin-blur { diff --git a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx index 6fcdc2f..21eb35b 100644 --- a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx +++ b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx @@ -68,7 +68,7 @@ title: '', // 缁勪欢鏍囬 sync: false, // 鏄惁缁熶竴璇锋眰鏁版嵁 plot: null, // 鍥捐〃璁剧疆 - data: null, // 鏁版嵁 + data: {}, // 鏁版嵁 } UNSAFE_componentWillMount () { @@ -302,7 +302,7 @@ if (config.subtype === 'ratioboard') { data = result.data || [] } else { - let data = {} + data = {} if (result.data && result.data[0] && result.data[0].hasOwnProperty(config.plot.valueField)) { data.value = result.data[0][config.plot.valueField] } @@ -363,7 +363,6 @@ ratioboardrender = () => { const { plot, chartId } = this.state - const data = this.getratiodata() const chart = new Chart({ @@ -458,8 +457,19 @@ const { plot, chartId, data } = this.state let _data = fromJS(data).toJS() - if (_data.value && _data.value > plot.maxValue) { - _data.value = plot.maxValue + + if (_data.hasOwnProperty('value')) { + if (_data.value === '' || _data.value === null) { + delete _data.value + } else { + _data.value = +_data.value + + if (isNaN(_data.value)) { + delete _data.value + } else if (_data.value > plot.maxValue) { + _data.value = plot.maxValue + } + } } const chart = new Chart({ @@ -468,7 +478,7 @@ height: plot.height, padding: [0, 0, 0, 0], }) - chart.data([_data]); + chart.data([_data]) chart.scale('value', { min: 0, max: plot.maxValue, @@ -480,7 +490,7 @@ radius: 0.75, }) - chart.axis('1', false); + chart.axis('1', false) chart.axis('value', { line: null, label: { diff --git a/src/tabviews/custom/components/chart/antv-dashboard/index.scss b/src/tabviews/custom/components/chart/antv-dashboard/index.scss index c619cd6..d9f3566 100644 --- a/src/tabviews/custom/components/chart/antv-dashboard/index.scss +++ b/src/tabviews/custom/components/chart/antv-dashboard/index.scss @@ -46,6 +46,10 @@ top: 0; right: 0px; bottom: 0px; + display: flex; + align-items: center; + justify-content: center; + text-align: justify; z-index: 1; .ant-spin-blur { diff --git a/src/tabviews/custom/components/chart/antv-pie/index.scss b/src/tabviews/custom/components/chart/antv-pie/index.scss index e7c1be6..3360ffe 100644 --- a/src/tabviews/custom/components/chart/antv-pie/index.scss +++ b/src/tabviews/custom/components/chart/antv-pie/index.scss @@ -46,6 +46,10 @@ top: 0; right: 0px; bottom: 0px; + display: flex; + align-items: center; + justify-content: center; + text-align: justify; z-index: 1; .ant-spin-blur { diff --git a/src/tabviews/custom/components/chart/antv-scatter/index.scss b/src/tabviews/custom/components/chart/antv-scatter/index.scss index 25ffcaa..c9ad16c 100644 --- a/src/tabviews/custom/components/chart/antv-scatter/index.scss +++ b/src/tabviews/custom/components/chart/antv-scatter/index.scss @@ -46,6 +46,10 @@ top: 0; right: 0px; bottom: 0px; + display: flex; + align-items: center; + justify-content: center; + text-align: justify; z-index: 1; .ant-spin-blur { diff --git a/src/tabviews/custom/components/tree/antd-tree/index.scss b/src/tabviews/custom/components/tree/antd-tree/index.scss index 413cf1c..13f499c 100644 --- a/src/tabviews/custom/components/tree/antd-tree/index.scss +++ b/src/tabviews/custom/components/tree/antd-tree/index.scss @@ -80,6 +80,10 @@ top: 0; right: 0px; bottom: 0px; + display: flex; + align-items: center; + justify-content: center; + text-align: justify; z-index: 1; .ant-spin-blur { diff --git a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx index 8a4b9f2..4ea9001 100644 --- a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx @@ -624,8 +624,6 @@ values.options = [] } - console.log(values) - if (isvalid) { ['linkField', 'valueField', 'valueText', 'orderBy'].forEach(item => { if (values[item]) { -- Gitblit v1.8.0