From 2f95e9ca3984bba9bfe602596c2401e98e84f323 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 25 五月 2021 10:49:10 +0800 Subject: [PATCH] 2021-05-25 --- src/menu/components/table/normal-table/wrapsetting/index.jsx | 2 src/tabviews/zshare/actionList/popupbutton/index.jsx | 4 src/menu/components/card/cardcellcomponent/index.scss | 4 src/tabviews/custom/components/table/normal-table/index.jsx | 89 ++++++++++++----- src/menu/components/card/cardcomponent/index.jsx | 17 ++ src/menu/pastecontroller/index.jsx | 3 src/templates/sharecomponent/searchcomponent/dragsearch/index.jsx | 2 src/tabviews/zshare/actionList/excelInbutton/index.jsx | 2 src/tabviews/zshare/actionList/printbutton/index.jsx | 4 src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 2 src/menu/components/card/cardcomponent/pastecomponent/index.jsx | 77 +++++++++++++++ src/tabviews/custom/components/share/normalTable/index.jsx | 4 src/menu/components/table/normal-table/wrapsetting/settingform/index.jsx | 12 ++ src/tabviews/custom/components/card/cardcellList/index.scss | 4 src/tabviews/zshare/actionList/normalbutton/index.jsx | 4 src/menu/components/table/normal-table/columns/index.jsx | 39 +++++++ src/tabviews/custom/components/table/normal-table/index.scss | 28 +++++ src/menu/components/card/cardcomponent/pastecomponent/index.scss | 0 18 files changed, 254 insertions(+), 43 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/index.scss b/src/menu/components/card/cardcellcomponent/index.scss index e6d351c..6ad726c 100644 --- a/src/menu/components/card/cardcellcomponent/index.scss +++ b/src/menu/components/card/cardcellcomponent/index.scss @@ -16,6 +16,10 @@ cursor: pointer; } + .ant-btn { + padding: 0; + } + .card-button-cell { float: left; button { diff --git a/src/menu/components/card/cardcomponent/index.jsx b/src/menu/components/card/cardcomponent/index.jsx index 515c67b..2069058 100644 --- a/src/menu/components/card/cardcomponent/index.jsx +++ b/src/menu/components/card/cardcomponent/index.jsx @@ -15,6 +15,7 @@ const CardCellComponent = asyncComponent(() => import('../cardcellcomponent')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) +const PasteComponent = asyncIconComponent(() => import('./pastecomponent')) class CardBoxComponent extends Component { static propTpyes = { @@ -88,7 +89,7 @@ this.props.updateElement(_card) } - updateCard = (elements) => { + updateCard = (elements, type) => { const { card, side } = this.state let _card = {} @@ -99,9 +100,16 @@ _card = {...card, elements: elements} } - this.setState({ - card: _card - }) + if (type === 'paste') { + this.setState({ + card: _card, + elements: fromJS(elements).toJS() + }) + } else { + this.setState({ + card: _card + }) + } this.props.updateElement(_card) } @@ -246,6 +254,7 @@ <Icon className="plus" title="娣诲姞鎸夐挳" onClick={this.addButton} type="plus-square" /> <Icon className="edit" title="缂栬緫" type="edit" onClick={() => this.setState({settingVisible: true})} /> <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={ <div className="mk-popover-control"> diff --git a/src/menu/components/card/cardcomponent/pastecomponent/index.jsx b/src/menu/components/card/cardcomponent/pastecomponent/index.jsx new file mode 100644 index 0000000..bc98b34 --- /dev/null +++ b/src/menu/components/card/cardcomponent/pastecomponent/index.jsx @@ -0,0 +1,77 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { fromJS } from 'immutable' +import { Icon, Modal, notification } from 'antd' + +import Utils from '@/utils/utils.js' +import MKEmitter from '@/utils/events.js' +import asyncComponent from '@/utils/asyncComponent' +import './index.scss' + +const PasteForm = asyncComponent(() => import('@/templates/zshare/pasteform')) + +class PasteController extends Component { + static propTpyes = { + config: PropTypes.object, // 缁勪欢閰嶇疆 + updateConfig: PropTypes.func + } + + state = { + visible: false + } + + handleMenuClick = () => { + this.setState({visible: true}) + } + + pasteSubmit = () => { + const { options, elements } = this.props + this.pasteFormRef.handleConfirm().then(res => { + if (!options.includes(res.copyType)) { + notification.warning({ top: 92, message: '閰嶇疆淇℃伅鏍煎紡閿欒锛�', duration: 5 }) + return + } + + let _uuid = Utils.getuuid() + if (res.copyType === 'action' && res.OpenType === 'popview') { + let _cell = fromJS(res).toJS() + _cell.$originUuid = res.uuid + _cell.uuid = _uuid + MKEmitter.emit('copyButtons', [_cell]) + } + res.uuid = _uuid + + this.props.updateConfig([...elements, res]) + this.setState({visible: false}) + + notification.success({ + top: 92, + message: '绮樿创鎴愬姛锛�', + duration: 2 + }) + }) + } + + render() { + const { visible } = this.state + + return ( + <div style={{display: 'inline-block'}}> + <Icon type="snippets" style={{color: 'purple'}} onClick={() => {this.setState({visible: true})}} /> + <Modal + title="绮樿创" + visible={visible} + width={600} + maskClosable={false} + onOk={this.pasteSubmit} + onCancel={() => {this.setState({visible: false})}} + destroyOnClose + > + <PasteForm wrappedComponentRef={(inst) => this.pasteFormRef = inst} inputSubmit={this.pasteSubmit}/> + </Modal> + </div> + ) + } +} + +export default PasteController \ No newline at end of file diff --git a/src/menu/components/card/cardcomponent/pastecomponent/index.scss b/src/menu/components/card/cardcomponent/pastecomponent/index.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/menu/components/card/cardcomponent/pastecomponent/index.scss diff --git a/src/menu/components/table/normal-table/columns/index.jsx b/src/menu/components/table/normal-table/columns/index.jsx index eefeb09..338f763 100644 --- a/src/menu/components/table/normal-table/columns/index.jsx +++ b/src/menu/components/table/normal-table/columns/index.jsx @@ -49,7 +49,7 @@ } render() { - const { connectDragSource, connectDropTarget, moveCol, addElement, updateCol, editColumn, deleteCol, index, column, align, fields, children, ...restProps } = this.props + const { connectDragSource, connectDropTarget, moveCol, addElement, updateCol, editColumn, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props if (index !== undefined) { return connectDragSource( @@ -60,6 +60,7 @@ <Icon className="plus" title="娣诲姞" type="plus" onClick={() => this.props.addElement(column)} /> : null } <Icon className="edit" title="缂栬緫" type="edit" onClick={() => this.props.editColumn(column)} /> + {column && column.type === 'custom' ? <Icon className="style" title="璋冩暣鏍峰紡" onClick={() => this.props.changeStyle(column)} type="font-colors" /> : null} <Icon className="close" title="鍒犻櫎" type="delete" onClick={this.deleteCol} /> {column && ['text', 'number'].includes(column.type) ? <MarkColumn columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } </div> @@ -143,7 +144,7 @@ if (column && column.type === 'custom') { return ( - <td style={{padding: 0, minWidth: column.Width || 100}} className={className}> + <td style={{padding: 0, minWidth: column.Width || 100, ...(column.style || {})}} className={className}> <CardCellComponent cards={config} cardCell={column} elements={column.elements} updateElement={this.updateCard}/> </td> ) @@ -183,6 +184,7 @@ refresh: false, // 寮哄埗鍒锋柊 columns: [], fields: [], + editStyleCard: null, lineMarks: [] } @@ -343,6 +345,24 @@ this.updateCol(col) } + changeStyle = (col) => { + this.setState({ + editStyleCard: fromJS(col).toJS() + }) + + MKEmitter.emit('changeStyle', [col.uuid], ['font', 'padding'], col.style || {}) + } + + getStyle = (comIds, style) => { + const { editStyleCard } = this.state + + if (!editStyleCard || comIds[0] !== editStyleCard.uuid || comIds.length !== 1) return + + let _card = {...editStyleCard, style} + + this.updateCol(_card) + } + cancelCol = () => { const { card } = this.state @@ -435,6 +455,7 @@ updateCol: this.updateCol, addElement: this.addElement, editColumn: this.editColumn, + changeStyle: this.changeStyle, deleteCol: this.deleteCol, }), children: col.subcols && col.subcols.length ? this.handlecolumns(col.subcols, fields, config, true) : null, @@ -482,6 +503,20 @@ }) } + componentDidMount () { + MKEmitter.addListener('submitStyle', this.getStyle) + } + + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 + */ + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('submitStyle', this.getStyle) + } + render() { const { config } = this.props const { fields, card, lineMarks, dict, tableId } = this.state diff --git a/src/menu/components/table/normal-table/wrapsetting/index.jsx b/src/menu/components/table/normal-table/wrapsetting/index.jsx index be1ea1b..d5772f8 100644 --- a/src/menu/components/table/normal-table/wrapsetting/index.jsx +++ b/src/menu/components/table/normal-table/wrapsetting/index.jsx @@ -60,7 +60,7 @@ wrapClassName="popview-modal" title="琛ㄦ牸璁剧疆" visible={visible} - width={700} + width={750} maskClosable={false} okText={dict['model.submit']} onOk={this.verifySubmit} diff --git a/src/menu/components/table/normal-table/wrapsetting/settingform/index.jsx b/src/menu/components/table/normal-table/wrapsetting/settingform/index.jsx index 2b0ca0d..36b6bd9 100644 --- a/src/menu/components/table/normal-table/wrapsetting/settingform/index.jsx +++ b/src/menu/components/table/normal-table/wrapsetting/settingform/index.jsx @@ -136,6 +136,18 @@ )} </Form.Item> </Col> + {appType !== 'mob' ? <Col span={12}> + <Form.Item label="鍙敹璧�"> + {getFieldDecorator('collapse', { + initialValue: wrap.collapse || 'false' + })( + <Radio.Group> + <Radio key="true" value="true"> 鏄� </Radio> + <Radio key="false" value="false"> 鍚� </Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} <Col span={12}> <Form.Item label="琛ㄦ牸澶у皬"> {getFieldDecorator('size', { diff --git a/src/menu/pastecontroller/index.jsx b/src/menu/pastecontroller/index.jsx index 2e11635..71a6a8e 100644 --- a/src/menu/pastecontroller/index.jsx +++ b/src/menu/pastecontroller/index.jsx @@ -177,6 +177,9 @@ return cell }) } + if (item.setting && item.setting.supModule) { + item.setting.supModule = '' + } return item } diff --git a/src/tabviews/custom/components/card/cardcellList/index.scss b/src/tabviews/custom/components/card/cardcellList/index.scss index 5573905..dc5bab5 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.scss +++ b/src/tabviews/custom/components/card/cardcellList/index.scss @@ -1,7 +1,9 @@ .card-cell-list { position: relative; - + .ant-btn { + padding: 0; + } .ant-mk-text { font-style: inherit; font-weight: inherit; diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index 2d53eb5..2d53f40 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -350,6 +350,10 @@ ) } else if (col.type === 'custom') { style.padding = '0px' + if (col.style) { + style = {...style, ...col.style} + } + resProps.children = ( <CardCellComponent data={record} cards={config} elements={col.elements}/> ) diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index c147e6f..2547788 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types' import {connect} from 'react-redux' import { is, fromJS } from 'immutable' -import { notification } from 'antd' +import { notification, Collapse } from 'antd' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -18,6 +18,8 @@ const MainAction = asyncComponent(() => import('@/tabviews/zshare/actionList')) const MainTable = asyncComponent(() => import('@/tabviews/custom/components/share/normalTable')) const NormalHeader = asyncComponent(() => import('@/tabviews/custom/components/share/normalheader')) + +const { Panel } = Collapse class NormalTable extends Component { static propTpyes = { @@ -101,6 +103,10 @@ } if (setting.fontSize) { setting.style.fontSize = setting.fontSize + } + + if (_config.wrap.collapse === 'true') { + _config.wrap.title = _config.wrap.title || ' ' } this.setState({ @@ -553,33 +559,64 @@ return ( <div className="custom-normal-table" style={config.style}> - <NormalHeader config={config}/> - {searchlist && searchlist.length ? - <MainSearch BID={BID} setting={config.wrap} searchlist={searchlist} menuType={this.props.menuType} refreshdata={this.refreshbysearch}/> : null - } - <MainAction - BID={BID} - setting={setting} - actions={actions} - BData={this.state.BData} - columns={config.columns} - selectedData={selectedData} - /> - <div className={'main-table-box ' + (!actions || actions.length === 0 ? 'no-action' : '')}> - <MainTable + {config.wrap.collapse === 'true' ? <Collapse bordered={false} defaultActiveKey="1" expandIconPosition="right"> + <Panel forceRender={true} header={<NormalHeader config={config}/>} key="1"> + {searchlist && searchlist.length ? + <MainSearch BID={BID} setting={config.wrap} searchlist={searchlist} menuType={this.props.menuType} refreshdata={this.refreshbysearch}/> : null + } + <MainAction + BID={BID} + setting={setting} + actions={actions} + BData={this.state.BData} + columns={config.columns} + selectedData={selectedData} + /> + <div className={'main-table-box ' + (!actions || actions.length === 0 ? 'no-action' : '')}> + <MainTable + setting={setting} + columns={columns} + MenuID={config.uuid} + data={this.state.data} + fields={config.columns} + total={this.state.total} + lineMarks={config.lineMarks} + loading={this.state.loading} + refreshdata={this.refreshbytable} + statFValue={this.state.statFValue} + chgSelectData={(selects) => this.setState({selectedData: selects})} + /> + </div> + </Panel> + </Collapse> : <> + <NormalHeader config={config}/> + {searchlist && searchlist.length ? + <MainSearch BID={BID} setting={config.wrap} searchlist={searchlist} menuType={this.props.menuType} refreshdata={this.refreshbysearch}/> : null + } + <MainAction + BID={BID} setting={setting} - columns={columns} - MenuID={config.uuid} - data={this.state.data} - fields={config.columns} - total={this.state.total} - lineMarks={config.lineMarks} - loading={this.state.loading} - refreshdata={this.refreshbytable} - statFValue={this.state.statFValue} - chgSelectData={(selects) => this.setState({selectedData: selects})} + actions={actions} + BData={this.state.BData} + columns={config.columns} + selectedData={selectedData} /> - </div> + <div className={'main-table-box ' + (!actions || actions.length === 0 ? 'no-action' : '')}> + <MainTable + setting={setting} + columns={columns} + MenuID={config.uuid} + data={this.state.data} + fields={config.columns} + total={this.state.total} + lineMarks={config.lineMarks} + loading={this.state.loading} + refreshdata={this.refreshbytable} + statFValue={this.state.statFValue} + chgSelectData={(selects) => this.setState({selectedData: selects})} + /> + </div> + </>} </div> ) } diff --git a/src/tabviews/custom/components/table/normal-table/index.scss b/src/tabviews/custom/components/table/normal-table/index.scss index 05a3b2e..1207f33 100644 --- a/src/tabviews/custom/components/table/normal-table/index.scss +++ b/src/tabviews/custom/components/table/normal-table/index.scss @@ -60,4 +60,32 @@ float: right; } } + .ant-collapse { + background-color: transparent; + border-radius: 0px; + > .ant-collapse-item { + border: 0; + >.ant-collapse-header { + padding: 0; + .normal-header { + padding-right: 40px; + } + } + } + .ant-collapse-item:last-child > .ant-collapse-content { + border-radius: 0; + .ant-collapse-content-box { + padding: 0; + >.button-list.toolbar-button { + padding: 0; + line-height: 55px; + padding-right: 60px; + button { + margin-right: 0px; + margin-bottom: 0px; + } + } + } + } + } } \ No newline at end of file diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx index 988d6f9..1d3ea4f 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx @@ -74,7 +74,7 @@ if ((triggerId && btn.uuid !== triggerId) || loading) return - if (Tab && Tab.supMenu && !BID) { + if (((Tab && Tab.supMenu) || setting.supModule) && !BID) { notification.warning({ top: 92, message: '闇�瑕佷笂绾т富閿�硷紒', diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index 2988149..ee93358 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -78,7 +78,7 @@ if ((triggerId && btn.uuid !== triggerId) || loading) return - if (Tab && Tab.supMenu && !BID) { + if (((Tab && Tab.supMenu) || setting.supModule) && !BID) { notification.warning({ top: 92, message: '闇�瑕佷笂绾т富閿�硷紒', diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index de07156..1f73411 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -99,12 +99,12 @@ * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ actionTrigger = (triggerId, record) => { - const { Tab, BID, btn, selectedData } = this.props + const { Tab, BID, btn, selectedData, setting } = this.props const { loading } = this.state if ((triggerId && btn.uuid !== triggerId) || loading) return - if (Tab && Tab.supMenu && !BID) { + if (((Tab && Tab.supMenu) || setting.supModule) && !BID) { notification.warning({ top: 92, message: '闇�瑕佷笂绾т富閿�硷紒', diff --git a/src/tabviews/zshare/actionList/popupbutton/index.jsx b/src/tabviews/zshare/actionList/popupbutton/index.jsx index d50814f..8861cad 100644 --- a/src/tabviews/zshare/actionList/popupbutton/index.jsx +++ b/src/tabviews/zshare/actionList/popupbutton/index.jsx @@ -94,7 +94,7 @@ if ((triggerId && btn.uuid !== triggerId) || loading) return - if (Tab && Tab.supMenu && !BID) { + if (((Tab && Tab.supMenu) || setting.supModule) && !BID) { notification.warning({ top: 92, message: '闇�瑕佷笂绾т富閿�硷紒', @@ -197,7 +197,7 @@ BID={popData ? primaryId : this.props.BID} BData={popData || this.props.BData} /> : null} - {btn.$view === 'CustomPage' ? <CustomPage Tab={btn} MenuID={btn.uuid} param={{BID: (popData ? primaryId : this.props.BID), data: (popData || this.props.BData)}} /> : null} + {btn.$view === 'CustomPage' ? <CustomPage Tab={btn} MenuID={btn.uuid} param={{$BID: (popData ? primaryId : this.props.BID), ...(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 0117190..3b79606 100644 --- a/src/tabviews/zshare/actionList/printbutton/index.jsx +++ b/src/tabviews/zshare/actionList/printbutton/index.jsx @@ -81,12 +81,12 @@ * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ actionTrigger = (triggerId, record) => { - const { Tab, BID, btn, selectedData } = this.props + const { Tab, BID, btn, selectedData, setting } = this.props const { loading } = this.state if ((triggerId && btn.uuid !== triggerId) || loading) return - if (Tab && Tab.supMenu && !BID) { + if (((Tab && Tab.supMenu) || setting.supModule) && !BID) { notification.warning({ top: 92, message: '闇�瑕佷笂绾т富閿�硷紒', diff --git a/src/templates/sharecomponent/searchcomponent/dragsearch/index.jsx b/src/templates/sharecomponent/searchcomponent/dragsearch/index.jsx index c152207..fa82c21 100644 --- a/src/templates/sharecomponent/searchcomponent/dragsearch/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/dragsearch/index.jsx @@ -140,7 +140,7 @@ </Col> ))} {cards.length > 0 ? <Col key="action" className="action" span={6}> - <div className="ant-row ant-form-item" style={{lineHeight: '40px', height: '55px', marginBottom: 0}}> + <div className="ant-row ant-form-item" style={{whiteSpace: 'nowrap', lineHeight: '40px', height: '55px', marginBottom: 0}}> <div className="ant-col ant-form-item-label ant-col-xs-24 ant-col-sm-8"> </div> <div className="ant-col ant-form-item-control-wrapper ant-col-xs-24 ant-col-sm-16"> -- Gitblit v1.8.0