| | |
| | | {field: 'broadcast', values: ['dynamic', 'public']}, |
| | | {field: 'supModule', values: ['static']}, |
| | | {field: 'publicId', values: ['public']}, |
| | | {field: 'emptyExec', values: ['dynamic', 'public']}, |
| | | ], |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | |
| | | {field: 'checkAll', values: ['checkbox']}, |
| | | {field: 'selected', values: ['radio', 'checkbox']}, |
| | | {field: 'selStyle', values: ['radio', 'checkbox']}, |
| | | // {field: 'priKeyType', values: ['radio', 'checkbox']}, |
| | | {field: 'pickup', values: ['radio', 'checkbox']}, |
| | | ], |
| | | forbid: subtype === 'tablecard' |
| | | }, |
| | |
| | | {value: 'right', label: '右对齐'}, |
| | | ], |
| | | forbid: subtype === 'tablecard' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'pickup', |
| | | label: '收起开关', |
| | | initval: wrap.pickup || 'false', |
| | | tooltip: '数据卡右上角会显示收起开关。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'false', label: '无'}, |
| | | {value: 'true', label: '有'}, |
| | | ], |
| | | forbid: subtype !== 'datacard' || appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | tooltip: '数据更新时自动执行按钮。注:此按钮执行成功后谨慎选择刷新项,避免造成循环执行。', |
| | | required: false, |
| | | options: buttons, |
| | | forbid: subtype !== 'propcard' |
| | | forbid: subtype !== 'propcard', |
| | | controlFields: [ |
| | | {field: 'emptyExec', notNull: true}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'emptyExec', |
| | | label: '空值执行', |
| | | initval: wrap.emptyExec || 'true', |
| | | tooltip: '当查询数据为空时,自动执行按钮是否执行。', |
| | | required: false, |
| | | forbid: subtype !== 'propcard', |
| | | options: [ |
| | | {value: 'true', label: '是'}, |
| | | {value: 'false', label: '否'}, |
| | | ], |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | controlFields: [ |
| | | {field: 'selected', values: ['radio', 'checkbox']}, |
| | | {field: 'selStyle', values: ['radio', 'checkbox']}, |
| | | {field: 'pickup', values: ['radio', 'checkbox']}, |
| | | ], |
| | | }, |
| | | { |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'pickup', |
| | | label: '收起开关', |
| | | initval: wrap.pickup || 'false', |
| | | tooltip: '数据卡右上角会显示收起开关。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'false', label: '无'}, |
| | | {value: 'true', label: '有'}, |
| | | ], |
| | | forbid: appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'parity', |
| | | label: '奇偶背景', |
| | | initval: wrap.parity || 'false', |
| | |
| | | |
| | | let _debugId = md5(r.sql) |
| | | |
| | | if (r.custompage && _columns.findIndex(col => col.field === 'mk_total') === -1) { |
| | | Modal.warning({ |
| | | title: `数据源或自定义脚本中使用自定义分页排序时,请在字段集中添加 mk_total。`, |
| | | okText: '知道了', |
| | | onOk: () => { |
| | | reject() |
| | | } |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (debugId === _debugId) { |
| | | resolve() |
| | | return |
| | |
| | | }) |
| | | } |
| | | |
| | | if (!tail) { |
| | | if (!tail && setting.order) { |
| | | let keys = setting.order.replace(/\s+(asc|desc)/ig, '').replace(/\s+/g, '') |
| | | keys.split(',').forEach(field => { |
| | | if (new RegExp(`'${field}'`).test(result.message)) { |
| | |
| | | }) |
| | | } |
| | | |
| | | return { error, sql, errors: errors.join(';') } |
| | | return { error, sql, errors: errors.join(';'), custompage } |
| | | } |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Spin, Empty, notification, message, Row, Col, Pagination, Modal } from 'antd' |
| | | import { Spin, Empty, notification, message, Row, Col, Pagination, Modal, Switch } from 'antd' |
| | | import { DownOutlined } from '@ant-design/icons' |
| | | |
| | | import Api from '@/api' |
| | |
| | | selectedData: [], |
| | | loading: false, |
| | | card: null, |
| | | data: null, |
| | | data: [], |
| | | total: null, |
| | | precards: [], |
| | | nextcards: [], |
| | | selected: 'false', |
| | | supNodes: [], |
| | | supComs: null |
| | | supComs: null, |
| | | pickup: false |
| | | } |
| | | |
| | | loaded = false |
| | |
| | | _config.wrap.scale = _config.wrap.scale === 'true' ? 'scale' : '' |
| | | _config.wrap.layout = (_config.wrap.layout || 'grid') + '-layout float-' + (_config.wrap.cardFloat || 'left') |
| | | |
| | | _config.wrap.wrapClass = `${_config.wrap.selStyle} ${_config.wrap.cardType || ''} ${_config.wrap.scale}` |
| | | _config.wrap.wrapClass = `${_config.wrap.selStyle} ${_config.wrap.cardType || ''} ${_config.wrap.scale}` |
| | | |
| | | let pageOptions = ['10', '25', '50', '100', '500', '1000'] |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | let _data = null |
| | | let _data = [] |
| | | if (_config.setting.sync === 'true') { |
| | | _config.setting.onload = 'false' |
| | | |
| | |
| | | checkTopLine = (id) => { |
| | | const { config, data, selected } = this.state |
| | | |
| | | if (!data || data.length === 0) { |
| | | if (data.length === 0) { |
| | | this.setState({ |
| | | activeKey: '', |
| | | selectKeys: [], |
| | |
| | | const { config, data, selectedData } = this.state |
| | | |
| | | if (config.wrap.cardType !== 'checkbox') return |
| | | if (!data || data.length === 0) return |
| | | if (data.length === 0) return |
| | | |
| | | if (selectedData.length === 0 || selectedData.length < data.length) { |
| | | let index = '' |
| | |
| | | selectedData: [], |
| | | data: data, |
| | | total: total, |
| | | pickup: false, |
| | | loading: false |
| | | }) |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { config, precards, nextcards, loading, data, pageIndex, pageSize, total, card, activeKey, BID, BData, selectedData, selectKeys } = this.state |
| | | pickupChange = () => { |
| | | this.setState({ |
| | | pickup: !this.state.pickup |
| | | }) |
| | | } |
| | | |
| | | if (config.wrap.empty === 'hidden' && (!data || data.length === 0)) return null |
| | | render() { |
| | | const { config, precards, nextcards, loading, pageIndex, pageSize, total, card, activeKey, BID, BData, selectedData, selectKeys, pickup } = this.state |
| | | |
| | | let data = this.state.data |
| | | |
| | | if (config.wrap.empty === 'hidden' && data.length === 0) return null |
| | | |
| | | let _total = 0 |
| | | let switchable = false |
| | | if (config.wrap.pagestyle === 'switch' && total > pageSize && data) { |
| | | if (config.wrap.pagestyle === 'switch' && total > pageSize) { |
| | | _total = pageSize * pageIndex |
| | | switchable = true |
| | | } |
| | |
| | | if (config.$extend) { |
| | | extendData = {$$BID: BID, $$BData: BData, $$selectedData: selectedData, $$type: 'extendCard'} |
| | | |
| | | if (data && data[0]) { |
| | | if (data[0]) { |
| | | if (selectedData[0]) { |
| | | extendData = {...extendData, ...selectedData[0]} |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | if (pickup) { |
| | | data = data.filter(item => selectKeys.includes(item.key)) |
| | | } |
| | | |
| | | return ( |
| | | <div className="custom-data-card-box" id={'anchor' + config.uuid} style={config.style}> |
| | | {loading ? |
| | | <div className="loading-mask"> |
| | | {data ? <div className="ant-spin-blur"></div> : null} |
| | | {data.length ? <div className="ant-spin-blur"></div> : null} |
| | | <Spin /> |
| | | </div> : null |
| | | } |
| | |
| | | selectedData={selectedData} |
| | | /> : null |
| | | } |
| | | {config.wrap.pickup === 'true' && this.state.data.length > 0 ? <div className="pickup-wrap"><Switch title="收起" checkedChildren="开" unCheckedChildren="关" checked={pickup} onChange={this.pickupChange} /></div> : null} |
| | | <div className={`data-zoom ${config.wrap.wrapClass}`}> |
| | | {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 ' + config.wrap.layout}> |
| | |
| | | </CardItem>} |
| | | </Col> |
| | | ))} |
| | | {data && data.map((item, index) => { |
| | | {data.map((item, index) => { |
| | | let className = 'mk-card ' |
| | | if (config.wrap.parity === 'true') { |
| | | if (index % 2 === 1) { |
| | |
| | | } |
| | | if (item.$disabled) { |
| | | className = 'mk-disabled' |
| | | } else if (activeKey === index) { |
| | | } else if (activeKey === item.key) { |
| | | className += 'active' |
| | | } else if (selectKeys.indexOf(index) > -1) { |
| | | } else if (selectKeys.indexOf(item.key) > -1) { |
| | | className += 'selected' |
| | | } |
| | | |
| | | return ( |
| | | <Col className={className} key={index} style={card.wStyle} span={card.setting.width}> |
| | | <CardItem card={card} cards={config} data={item} onClick={() => {this.changeCard(index, item)}}> |
| | | <CardItem card={card} cards={config} data={item} onClick={() => {this.changeCard(item.key, item)}}> |
| | | <span className="circle-select"></span> |
| | | </CardItem> |
| | | </Col> |
| | |
| | | </Row> |
| | | {switchable ? <div className={'prev-page ' + (total <= _total ? 'disabled' : '')} onClick={this.nextPage}><div><div><img src={nextImg} alt=""/></div></div></div> : null} |
| | | </div> |
| | | {config.$empty && (!data || data.length === 0) ? <Empty description={false}/> : null} |
| | | {config.wrap.pagestyle === 'page' && data ? <Pagination size="small" total={total} showTotal={(t, range) => total > 0 ? `${range[0]}-${range[1]} 共 ${total} 条` : `共 ${total} 条`} pageSize={pageSize} showSizeChanger={true} pageSizeOptions={this.state.pageOptions} onChange={this.changePageIndex} onShowSizeChange={this.pageSizeChange} current={pageIndex}/> : null} |
| | | {config.wrap.pagestyle === 'more' && data && data.length > 0 ? <div className={'mk-more' + (pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>查看更多<DownOutlined/></div> : null} |
| | | {config.$empty && data.length === 0 ? <Empty description={false}/> : null} |
| | | {config.wrap.pagestyle === 'page' ? <Pagination size="small" total={total} showTotal={(t, range) => total > 0 ? `${range[0]}-${range[1]} 共 ${total} 条` : `共 ${total} 条`} pageSize={pageSize} showSizeChanger={true} pageSizeOptions={this.state.pageOptions} onChange={this.changePageIndex} onShowSizeChange={this.pageSizeChange} current={pageIndex}/> : null} |
| | | {config.wrap.pagestyle === 'more' && data.length > 0 ? <div className={'mk-more' + (pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>查看更多<DownOutlined/></div> : null} |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | min-height: 20px; |
| | | overflow-y: auto; |
| | | |
| | | .pickup-wrap { |
| | | float: right; |
| | | button { |
| | | margin-top: 3px; |
| | | } |
| | | } |
| | | .pickup-wrap + div { |
| | | clear: both; |
| | | } |
| | | .button-list + .pickup-wrap { |
| | | position: relative; |
| | | button { |
| | | position: absolute; |
| | | bottom: 0; |
| | | right: 0; |
| | | } |
| | | } |
| | | .data-zoom { |
| | | display: flex; |
| | | position: relative; |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Spin, Empty, notification, Row, Col, Pagination, Modal } from 'antd' |
| | | import { Spin, Empty, notification, Row, Col, Pagination, Modal, Switch } from 'antd' |
| | | import { DownOutlined, UpOutlined, PlusSquareOutlined, MinusSquareOutlined } from '@ant-design/icons' |
| | | |
| | | import Api from '@/api' |
| | |
| | | selectedData: [], // 选中数据,用于工具栏按钮 |
| | | loading: false, // 数据加载状态 |
| | | card: null, // 卡片设置 |
| | | data: null, // 数据 |
| | | data: [], // 数据 |
| | | total: null, |
| | | precards: [], |
| | | nextcards: [], |
| | |
| | | opens: [], |
| | | wrapStyle: null, |
| | | subcard: null, |
| | | subconfig: null |
| | | subconfig: null, |
| | | pickup: false |
| | | } |
| | | |
| | | loaded = false |
| | |
| | | const { config, data, selected, card } = this.state |
| | | let _opens = [...this.state.opens] |
| | | |
| | | if (!data || data.length === 0) { |
| | | if (data.length === 0) { |
| | | this.setState({ |
| | | activeKey: '', |
| | | selectKeys: [], |
| | |
| | | const { config, data, selectedData } = this.state |
| | | |
| | | if (config.wrap.cardType !== 'checkbox') return |
| | | if (!data || data.length === 0) return |
| | | if (data.length === 0) return |
| | | |
| | | if (selectedData.length === 0 || selectedData.length < data.length) { |
| | | let index = '' |
| | |
| | | selectedData: [], |
| | | data: data, |
| | | total: total, |
| | | pickup: false, |
| | | loading: false |
| | | }) |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { config, precards, nextcards, loading, data, pageIndex, pageSize, total, card, activeKey, BID, BData, selectedData, selectKeys, subcard, subconfig, wrapStyle, opens } = this.state |
| | | pickupChange = () => { |
| | | this.setState({ |
| | | pickup: !this.state.pickup |
| | | }) |
| | | } |
| | | |
| | | if (config.wrap.empty === 'hidden' && (!data || data.length === 0)) return null |
| | | render() { |
| | | const { config, precards, nextcards, loading, pageIndex, pageSize, total, card, activeKey, BID, BData, selectedData, selectKeys, subcard, subconfig, wrapStyle, opens, pickup } = this.state |
| | | |
| | | let data = this.state.data |
| | | |
| | | if (config.wrap.empty === 'hidden' && data.length === 0) return null |
| | | |
| | | let extendData = null |
| | | |
| | | if (config.$extend) { |
| | | extendData = {$$BID: BID, $$BData: BData, $$selectedData: selectedData, $$type: 'extendCard'} |
| | | |
| | | if (data && data[0]) { |
| | | if (data[0]) { |
| | | if (selectedData[0]) { |
| | | extendData = {...extendData, ...selectedData[0]} |
| | | } else { |
| | |
| | | mainBox = 'flex-card ' |
| | | } |
| | | |
| | | if (pickup) { |
| | | data = data.filter(item => selectKeys.includes(item.key)) |
| | | } |
| | | |
| | | return ( |
| | | <div className="double-data-card-box" id={'anchor' + config.uuid} style={config.style}> |
| | | {loading ? |
| | | <div className="loading-mask"> |
| | | {data ? <div className="ant-spin-blur"></div> : null} |
| | | {data.length ? <div className="ant-spin-blur"></div> : null} |
| | | <Spin /> |
| | | </div> : null |
| | | } |
| | |
| | | selectedData={selectedData} |
| | | /> : null |
| | | } |
| | | {config.wrap.pickup === 'true' && this.state.data.length > 0 ? <div className="pickup-wrap"><Switch title="收起" checkedChildren="开" unCheckedChildren="关" checked={pickup} onChange={this.pickupChange} /></div> : null} |
| | | <div className={config.wrap.zoomStyle ? 'data-zoom-box' : ''} style={config.wrap.zoomStyle}> |
| | | <div className={`data-zoom ${config.wrap.wrapClass}`} style={config.wrap.minWidth ? {minWidth: config.wrap.minWidth} : null}> |
| | | <Row className={'card-row-list '}> |
| | |
| | | </CardItem>} |
| | | </Col> |
| | | ))} |
| | | {data && data.map((item, index) => { |
| | | {data.map((item, index) => { |
| | | let className = 'card-item-wrap mk-card ' + mainBox |
| | | let subClass = 'mk-unfold' |
| | | let unfold = true |
| | | |
| | | if (item.$disabled) { |
| | | className = 'card-item-wrap mk-disabled ' + mainBox |
| | | } else if (activeKey === index) { |
| | | } else if (activeKey === item.key) { |
| | | className += 'active' |
| | | } else if (selectKeys.indexOf(index) > -1) { |
| | | } else if (selectKeys.indexOf(item.key) > -1) { |
| | | className += 'selected' |
| | | } |
| | | |
| | |
| | | subClass = 'mk-disabled' |
| | | unfold = false |
| | | } else { |
| | | subClass = opens.indexOf(index) > -1 ? 'mk-unfold' : 'mk-collapse' |
| | | unfold = opens.indexOf(index) > -1 |
| | | subClass = opens.indexOf(item.key) > -1 ? 'mk-unfold' : 'mk-collapse' |
| | | unfold = opens.indexOf(item.key) > -1 |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <Col key={index} span={card.setting.width} style={card.wStyle}> |
| | | <div className={className} style={wrapStyle}> |
| | | <CardItem card={card} cards={config} data={item} onDoubleClick={() => this.onDoubleClick(index, subClass)} onClick={() => {this.changeCard(index, item, subClass)}}> |
| | | <CardItem card={card} cards={config} data={item} onDoubleClick={() => this.onDoubleClick(item.key, subClass)} onClick={() => {this.changeCard(item.key, item, subClass)}}> |
| | | <span className="circle-select"></span> |
| | | {card.setting.controlIcon === 'left' ? (!unfold ? <PlusSquareOutlined className={subClass} onClick={(e) => this.changeUnfold(e, index, subClass)}/> : <MinusSquareOutlined className={subClass} onClick={(e) => this.changeUnfold(e, index, subClass)}/>) : null} |
| | | {card.setting.controlIcon === 'right' ? <UpOutlined className={subClass} onClick={(e) => this.changeUnfold(e, index, subClass)}/> : null} |
| | | {card.setting.controlIcon === 'left' ? (!unfold ? <PlusSquareOutlined className={subClass} onClick={(e) => this.changeUnfold(e, item.key, subClass)}/> : <MinusSquareOutlined className={subClass} onClick={(e) => this.changeUnfold(e, item.key, subClass)}/>) : null} |
| | | {card.setting.controlIcon === 'right' ? <UpOutlined className={subClass} onClick={(e) => this.changeUnfold(e, item.key, subClass)}/> : null} |
| | | </CardItem> |
| | | <div className={'sub-card-wrap ' + subClass + (config.wrap.parity === 'true' ? ' mk-parity-bg' : '')} onClick={() => this.changeSubCard(item)}> |
| | | {item.children.map((cell, index) => <Col key={'sub' + index} span={subcard.setting.width || 24}> |
| | |
| | | ))} |
| | | </Row> |
| | | </div> |
| | | {config.$empty && (!data || data.length === 0) ? <Empty description={false}/> : null} |
| | | {config.$empty && data.length === 0 ? <Empty description={false}/> : null} |
| | | </div> |
| | | {config.wrap.pagestyle === 'page' && data ? <Pagination size="small" total={total} showTotal={(t, range) => total > 0 ? `${range[0]}-${range[1]} 共 ${total} 条` : `共 ${total} 条`} pageSize={pageSize} showSizeChanger={true} pageSizeOptions={this.state.pageOptions} onChange={this.changePageIndex} onShowSizeChange={this.pageSizeChange} current={pageIndex}/> : null} |
| | | {config.wrap.pagestyle === 'more' && data && data.length > 0 ? <div className={'mk-more' + (pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>查看更多<DownOutlined/></div> : null} |
| | | {config.wrap.pagestyle === 'page' ? <Pagination size="small" total={total} showTotal={(t, range) => total > 0 ? `${range[0]}-${range[1]} 共 ${total} 条` : `共 ${total} 条`} pageSize={pageSize} showSizeChanger={true} pageSizeOptions={this.state.pageOptions} onChange={this.changePageIndex} onShowSizeChange={this.pageSizeChange} current={pageIndex}/> : null} |
| | | {config.wrap.pagestyle === 'more' && data.length > 0 ? <div className={'mk-more' + (pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>查看更多<DownOutlined/></div> : null} |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | min-height: 20px; |
| | | overflow-y: auto; |
| | | |
| | | .pickup-wrap { |
| | | float: right; |
| | | button { |
| | | margin-top: 3px; |
| | | } |
| | | } |
| | | .pickup-wrap + div { |
| | | clear: both; |
| | | } |
| | | .button-list + .pickup-wrap { |
| | | position: relative; |
| | | button { |
| | | position: absolute; |
| | | bottom: 0; |
| | | right: 0; |
| | | } |
| | | } |
| | | .data-zoom { |
| | | display: flex; |
| | | position: relative; |
| | |
| | | border-color: #ffffff; |
| | | transform: rotate(45deg); |
| | | } |
| | | |
| | | .data-zoom.check.square { |
| | | .circle-select { |
| | | border-radius: 0!important; |
| | |
| | | autoExec = (times) => { |
| | | const { config, data } = this.state |
| | | |
| | | if (!config.wrap.autoExec) return |
| | | if (!config.wrap.autoExec || (config.wrap.emptyExec === 'false' && data.$$empty)) return |
| | | |
| | | let btn = document.getElementById('button' + config.wrap.autoExec) |
| | | |
| | |
| | | ratio = ratio + 'vw' |
| | | } |
| | | return <Modal |
| | | wrapClassName={'popview-modal ' + (!btn.$view ? '' : 'custom-popview ') + (btn.popshow || '')} |
| | | wrapClassName={`popview-modal popview-${btn.uuid} ` + (!btn.$view ? '' : 'custom-popview ') + (btn.popshow || '')} |
| | | title={btn.label} |
| | | width={ratio} |
| | | maskClosable={btn.clickouter === 'close'} |
| | |
| | | return ( |
| | | <Drawer |
| | | title={btn.label} |
| | | className={!btn.$view ? 'table-drawer-popview' : 'custom-drawer-popview' } |
| | | className={!btn.$view ? 'table-drawer-popview' : 'custom-drawer-popview popview-' + btn.uuid} |
| | | width={width} |
| | | height={height} |
| | | maskClosable={btn.clickouter === 'close'} |