From 0bff15b120b3e3ff1f1c3d2ce4d9aa8d3ad3917e Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 06 十一月 2020 13:49:44 +0800 Subject: [PATCH] 2020-11-06 --- src/menu/components/chart/antv-bar/chartcompile/index.jsx | 5 src/utils/utils-datamanage.js | 28 ++ src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx | 11 + src/menu/components/card/cardcomponent/settingform/index.jsx | 19 + src/menu/components/card/table-card/index.jsx | 59 ++++- src/menu/components/search/main-search/wrapsetting/settingform/index.jsx | 35 +++ src/menu/components/card/prop-card/index.scss | 2 src/menu/components/card/cardcellcomponent/elementform/index.jsx | 2 src/tabviews/calendar/index.jsx | 14 + src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 13 + src/menu/components/chart/antv-bar/index.jsx | 2 src/menu/components/card/data-card/index.scss | 2 src/menu/menushell/card.jsx | 3 src/menu/components/tabs/tabsetting/index.jsx | 3 src/menu/components/card/data-card/wrapsetting/index.jsx | 5 src/tabviews/custom/components/card/data-card/index.scss | 2 src/tabviews/custom/components/card/data-card/index.jsx | 2 src/utils/utils.js | 2 src/menu/components/card/table-card/index.scss | 8 src/tabviews/custom/components/card/prop-card/index.scss | 2 src/tabviews/custom/components/card/prop-card/index.jsx | 6 src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx | 11 + src/tabviews/custom/components/share/tabtransfer/index.jsx | 28 +- src/menu/stylecontroller/index.jsx | 2 src/menu/components/chart/antv-pie/chartcompile/index.jsx | 9 src/templates/zshare/verifycard/index.jsx | 16 + src/assets/mobimg/table-card.png | 0 src/menu/components/tabs/tablabelform/index.jsx | 14 + src/menu/components/card/cardcomponent/index.jsx | 1 src/menu/components/card/data-card/index.jsx | 4 src/menu/components/chart/antv-pie/index.jsx | 2 src/menu/components/search/main-search/index.jsx | 13 /dev/null | 11 - src/menu/modelsource/option.jsx | 2 src/menu/components/search/main-search/wrapsetting/index.jsx | 3 src/tabviews/custom/index.jsx | 115 +++++++--- src/menu/components/card/data-card/wrapsetting/settingform/index.jsx | 47 ++++ src/menu/components/card/prop-card/index.jsx | 5 src/templates/zshare/customscript/index.jsx | 2 src/menu/components/tabs/tabcomponents/card.jsx | 3 src/menu/components/tabs/antv-tabs/index.jsx | 18 + src/menu/components/tabs/tabsetting/settingform/index.jsx | 32 ++ src/templates/sharecomponent/searchcomponent/searchform/index.jsx | 2 43 files changed, 411 insertions(+), 154 deletions(-) diff --git a/src/assets/mobimg/table-card.png b/src/assets/mobimg/table-card.png new file mode 100644 index 0000000..386283e --- /dev/null +++ b/src/assets/mobimg/table-card.png Binary files differ diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx index a98f0b7..25862b9 100644 --- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx +++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx @@ -228,7 +228,7 @@ message: this.props.dict['form.required.input'] + item.label + '!' } ] - })(<InputNumber min={item.min || 0} max={item.max || 10000} precision={item.precision || 0} />)} + })(<InputNumber min={item.min || 0} max={item.max || 10000} precision={item.precision || 0} onPressEnter={this.handleSubmit} />)} </Form.Item> </Col> ) diff --git a/src/menu/components/card/cardcomponent/index.jsx b/src/menu/components/card/cardcomponent/index.jsx index 1753712..63637d4 100644 --- a/src/menu/components/card/cardcomponent/index.jsx +++ b/src/menu/components/card/cardcomponent/index.jsx @@ -246,6 +246,7 @@ dict={dict} cards={cards} setting={card.setting} + inputSubmit={this.settingSubmit} wrappedComponentRef={(inst) => this.settingRef = inst} /> </Modal> diff --git a/src/menu/components/card/cardcomponent/settingform/index.jsx b/src/menu/components/card/cardcomponent/settingform/index.jsx index d9ae1fb..6e52747 100644 --- a/src/menu/components/card/cardcomponent/settingform/index.jsx +++ b/src/menu/components/card/cardcomponent/settingform/index.jsx @@ -6,9 +6,10 @@ class SettingForm extends Component { static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� - cards: PropTypes.object, // 鍗$墖闆� - setting: PropTypes.object, // 鏁版嵁婧愰厤缃� + dict: PropTypes.object, // 瀛楀吀椤� + cards: PropTypes.object, // 鍗$墖闆� + setting: PropTypes.object, // 鏁版嵁婧愰厤缃� + inputSubmit: PropTypes.func // 鍥炶溅浜嬩欢 } state = { @@ -26,6 +27,14 @@ } }) }) + } + + handleSubmit = (e) => { + e.preventDefault() + + if (this.props.inputSubmit) { + this.props.inputSubmit() + } } render() { @@ -62,7 +71,7 @@ message: this.props.dict['form.required.input'] + '瀹藉害!' } ] - })(<InputNumber min={1} max={24} precision={0} />)} + })(<InputNumber min={1} max={24} precision={0} onPressEnter={this.handleSubmit}/>)} </Form.Item> </Col> <Col span={12}> @@ -108,7 +117,7 @@ }> {getFieldDecorator('primaryId', { initialValue: setting.primaryId || '' - })(<Input placeholder="" autoComplete="off" />)} + })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit}/>)} </Form.Item> </Col> : null} </Row> diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx index 1b161aa..385a1c5 100644 --- a/src/menu/components/card/data-card/index.jsx +++ b/src/menu/components/card/data-card/index.jsx @@ -189,10 +189,10 @@ const { card } = this.state return ( - <div className="menu-data-card-edit-box" style={card.style}> + <div className="menu-data-card-edit-box" style={{...card.style, minHeight: card.wrap.minHeight}}> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> - <WrapComponent config={card} updateConfig={this.updateComponent} /> + <WrapComponent sysRoles={this.props.menu.sysRoles} config={card} updateConfig={this.updateComponent} /> <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> <Icon className="close" title="鍒犻櫎缁勪欢" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent} /> diff --git a/src/menu/components/card/data-card/index.scss b/src/menu/components/card/data-card/index.scss index d6ce6a3..c7faaf7 100644 --- a/src/menu/components/card/data-card/index.scss +++ b/src/menu/components/card/data-card/index.scss @@ -5,7 +5,7 @@ background-position: center center; background-repeat: no-repeat; background-size: cover; - min-height: 20px; + min-height: 100px; .card-control { position: absolute; diff --git a/src/menu/components/card/data-card/wrapsetting/index.jsx b/src/menu/components/card/data-card/wrapsetting/index.jsx index 81632e9..167d2ce 100644 --- a/src/menu/components/card/data-card/wrapsetting/index.jsx +++ b/src/menu/components/card/data-card/wrapsetting/index.jsx @@ -11,6 +11,7 @@ class DataSource extends Component { static propTpyes = { config: PropTypes.any, + sysRoles: PropTypes.array, updateConfig: PropTypes.func } @@ -50,7 +51,7 @@ } render () { - const { config } = this.props + const { config, sysRoles } = this.props const { visible, dict, wrap } = this.state return ( @@ -71,6 +72,8 @@ dict={dict} wrap={wrap} config={config} + sysRoles={sysRoles || []} + inputSubmit={this.verifySubmit} wrappedComponentRef={(inst) => this.verifyRef = inst} /> </Modal> 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 863b152..c495e78 100644 --- a/src/menu/components/card/data-card/wrapsetting/settingform/index.jsx +++ b/src/menu/components/card/data-card/wrapsetting/settingform/index.jsx @@ -1,14 +1,16 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Radio, Tooltip, Icon, InputNumber } from 'antd' +import { Form, Row, Col, Input, Radio, Tooltip, Icon, InputNumber, Select } from 'antd' import './index.scss' class SettingForm extends Component { static propTpyes = { + sysRoles: PropTypes.array, // 瑙掕壊鍒楄〃 dict: PropTypes.object, // 瀛楀吀椤� config: PropTypes.object, // 鍗$墖琛屼俊鎭� wrap: PropTypes.object, // 鏁版嵁婧愰厤缃� + inputSubmit: PropTypes.func // 鍥炶溅浜嬩欢 } handleConfirm = () => { @@ -24,8 +26,16 @@ }) } + handleSubmit = (e) => { + e.preventDefault() + + if (this.props.inputSubmit) { + this.props.inputSubmit() + } + } + render() { - const { wrap, config } = this.props + const { wrap, config, sysRoles } = this.props const { getFieldDecorator } = this.props.form const formItemLayout = { @@ -58,7 +68,7 @@ message: this.props.dict['form.required.input'] + '缁勪欢鍚嶇О!' } ] - })(<Input placeholder={''} autoComplete="off" />)} + })(<Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit} />)} </Form.Item> </Col> <Col span={12}> @@ -76,7 +86,7 @@ message: this.props.dict['form.required.input'] + '瀹藉害!' } ] - })(<InputNumber min={1} max={24} precision={0} />)} + })(<InputNumber min={1} max={24} precision={0} onPressEnter={this.handleSubmit} />)} </Form.Item> </Col> {config.subtype === 'propcard' ? <Col span={12}> @@ -130,6 +140,35 @@ )} </Form.Item> </Col> + <Col span={12}> + <Form.Item label={ + <Tooltip placement="topLeft" title="鍗$墖澶栬竟妗嗙殑鏈�灏忛珮搴︼紝鎺у埗鏁版嵁鍔犺浇鏃剁粍浠剁殑鍗犱綅銆�"> + <Icon type="question-circle" /> + 鏈�灏忛珮搴� + </Tooltip> + }> + {getFieldDecorator('minHeight', { + initialValue: wrap.minHeight || 100 + })(<InputNumber min={20} max={2000} precision={0} onPressEnter={this.handleSubmit} />)} + </Form.Item> + </Col> + <Col span={12}> + <Form.Item label="榛戝悕鍗�"> + {getFieldDecorator('blacklist', { + initialValue: wrap.blacklist || [] + })( + <Select + showSearch + mode="multiple" + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + > + {sysRoles.map(option => + <Select.Option key={option.uuid} value={option.value}>{option.text}</Select.Option> + )} + </Select> + )} + </Form.Item> + </Col> </Row> </Form> </div> diff --git a/src/menu/components/card/prop-card/index.jsx b/src/menu/components/card/prop-card/index.jsx index 9fe9948..61cdf4a 100644 --- a/src/menu/components/card/prop-card/index.jsx +++ b/src/menu/components/card/prop-card/index.jsx @@ -222,12 +222,13 @@ render() { const { card } = this.state + return ( - <div className="menu-prop-card-edit-box" style={card.style}> + <div className="menu-prop-card-edit-box" style={{...card.style, minHeight: card.wrap.minHeight}}> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> <Icon className="plus" title="娣诲姞鍗$墖" onClick={this.addCard} type="plus" /> - <WrapComponent config={card} updateConfig={this.updateComponent} /> + <WrapComponent config={card} sysRoles={this.props.menu.sysRoles} updateConfig={this.updateComponent} /> <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> <Icon className="close" title="鍒犻櫎缁勪欢" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null} diff --git a/src/menu/components/card/prop-card/index.scss b/src/menu/components/card/prop-card/index.scss index 7c8800b..2e1b614 100644 --- a/src/menu/components/card/prop-card/index.scss +++ b/src/menu/components/card/prop-card/index.scss @@ -5,7 +5,7 @@ background-position: center center; background-repeat: no-repeat; background-size: cover; - min-height: 20px; + min-height: 100px; .card-control { position: absolute; diff --git a/src/menu/components/card/table-card/index.jsx b/src/menu/components/card/table-card/index.jsx index 1b161aa..bd2e425 100644 --- a/src/menu/components/card/table-card/index.jsx +++ b/src/menu/components/card/table-card/index.jsx @@ -14,7 +14,7 @@ import './index.scss' const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) -const WrapComponent = asyncIconComponent(() => import('./wrapsetting')) +const WrapComponent = asyncIconComponent(() => import('../data-card/wrapsetting')) const CardComponent = asyncComponent(() => import('../cardcomponent')) const { confirm } = Modal @@ -46,24 +46,18 @@ elem.uuid = Utils.getuuid() return elem }) - scard.backElements = scard.backElements.map(elem => { - elem.uuid = Utils.getuuid() - return elem - }) return scard }) } else { subcards = [{ uuid: Utils.getuuid(), - setting: { width: 6, type: 'simple'}, + setting: { width: 24, type: 'simple'}, style: { borderWidth: '1px', borderColor: '#e8e8e8', paddingTop: '15px', paddingBottom: '15px', paddingLeft: '15px', paddingRight: '15px', marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px' }, - backStyle: {}, - elements: [], - backElements: [] + elements: [] }] } @@ -73,15 +67,15 @@ floor: card.floor, tabId: card.tabId || '', parentId: card.parentId || '', - format: 'array', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 - pageable: true, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� - switchable: true, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� + format: 'array', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 + pageable: true, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� + switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� dataName: card.dataName || '', - width: 24, + width: 12, name: card.name, subtype: card.subtype, setting: { interType: 'system' }, - wrap: { name: card.name, width: 24, addable: 'false', switch: 'false' }, + wrap: { name: card.name, width: 12, addable: 'false', switch: 'false', datatype: 'dynamic' }, style: { marginLeft: '0px', marginRight: '0px', marginTop: '8px', marginBottom: '8px' }, columns: [], scripts: [], @@ -185,23 +179,52 @@ this.props.updateConfig(_card) } + addCard = () => { + let card = fromJS(this.state.card).toJS() + + let newcard = { + uuid: Utils.getuuid(), + setting: { width: 6, type: 'simple'}, + style: { + borderWidth: '1px', borderColor: '#e8e8e8', + paddingTop: '15px', paddingBottom: '15px', paddingLeft: '15px', paddingRight: '15px', + marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px' + }, + elements: [] + } + + if (card.subcards.length > 0) { + newcard = fromJS(card.subcards[card.subcards.length - 1]).toJS() + newcard.uuid = Utils.getuuid() + newcard.elements = newcard.elements.map(elem => { + elem.uuid = Utils.getuuid() + return elem + }) + } + + card.subcards.push(newcard) + + this.setState({card}) + this.props.updateConfig(card) + } + render() { const { card } = this.state return ( - <div className="menu-data-card-edit-box" style={card.style}> + <div className="menu-prop-card-edit-box" style={{...card.style, minHeight: card.wrap.minHeight}}> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> - <WrapComponent config={card} updateConfig={this.updateComponent} /> + <Icon className="plus" title="娣诲姞鍗$墖" onClick={this.addCard} type="plus" /> + <WrapComponent config={card} sysRoles={this.props.menu.sysRoles} updateConfig={this.updateComponent} /> <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> <Icon className="close" title="鍒犻櫎缁勪欢" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> - <SettingComponent config={card} updateConfig={this.updateComponent} /> + {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null} </div> } trigger="hover"> <Icon type="tool" /> </Popover> {card.subcards.map(subcard => (<CardComponent key={subcard.uuid} cards={card} card={subcard} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))} - {card.wrap.addable === 'true' ? <div className="card-add-button"><Icon type="plus" /></div> : null} </div> ) } diff --git a/src/menu/components/card/table-card/index.scss b/src/menu/components/card/table-card/index.scss index d6ce6a3..2e1b614 100644 --- a/src/menu/components/card/table-card/index.scss +++ b/src/menu/components/card/table-card/index.scss @@ -1,11 +1,11 @@ -.menu-data-card-edit-box { +.menu-prop-card-edit-box { position: relative; box-sizing: border-box; background: #ffffff; background-position: center center; background-repeat: no-repeat; background-size: cover; - min-height: 20px; + min-height: 100px; .card-control { position: absolute; @@ -65,11 +65,11 @@ } } } -.menu-data-card-edit-box::after { +.menu-prop-card-edit-box::after { display: block; content: ' '; clear: both; } -.menu-data-card-edit-box:hover { +.menu-prop-card-edit-box:hover { box-shadow: 0px 0px 2px #e8e8e8; } diff --git a/src/menu/components/card/table-card/wrapsetting/index.jsx b/src/menu/components/card/table-card/wrapsetting/index.jsx deleted file mode 100644 index 81632e9..0000000 --- a/src/menu/components/card/table-card/wrapsetting/index.jsx +++ /dev/null @@ -1,82 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { Icon, Modal } from 'antd' - -import zhCN from '@/locales/zh-CN/model.js' -import enUS from '@/locales/en-US/model.js' -import SettingForm from './settingform' -import './index.scss' - -class DataSource extends Component { - static propTpyes = { - config: PropTypes.any, - updateConfig: PropTypes.func - } - - state = { - dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, - visible: false, - wrap: null - } - - UNSAFE_componentWillMount () { - const { config } = this.props - - this.setState({wrap: fromJS(config.wrap).toJS()}) - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) - } - - editDataSource = () => { - this.setState({ - visible: true - }) - } - - verifySubmit = () => { - const { config } = this.props - - this.verifyRef.handleConfirm().then(res => { - - this.setState({ - wrap: res, - visible: false - }) - this.props.updateConfig({...config, wrap: res}) - }) - } - - render () { - const { config } = this.props - const { visible, dict, wrap } = this.state - - return ( - <div className="model-menu-setting-wrap"> - <Icon type="edit" onClick={() => this.editDataSource()} /> - <Modal - wrapClassName="popview-modal" - title={'鍗$墖璁剧疆'} - visible={visible} - width={700} - maskClosable={false} - okText={dict['model.submit']} - onOk={this.verifySubmit} - onCancel={() => { this.setState({ visible: false }) }} - destroyOnClose - > - <SettingForm - dict={dict} - wrap={wrap} - config={config} - wrappedComponentRef={(inst) => this.verifyRef = inst} - /> - </Modal> - </div> - ) - } -} - -export default DataSource \ No newline at end of file diff --git a/src/menu/components/card/table-card/wrapsetting/index.scss b/src/menu/components/card/table-card/wrapsetting/index.scss deleted file mode 100644 index 04372e6..0000000 --- a/src/menu/components/card/table-card/wrapsetting/index.scss +++ /dev/null @@ -1,7 +0,0 @@ -.model-menu-setting-wrap { - display: inline-block; - - >.anticon-edit { - color: #1890ff; - } -} \ No newline at end of file diff --git a/src/menu/components/card/table-card/wrapsetting/settingform/index.jsx b/src/menu/components/card/table-card/wrapsetting/settingform/index.jsx deleted file mode 100644 index 863b152..0000000 --- a/src/menu/components/card/table-card/wrapsetting/settingform/index.jsx +++ /dev/null @@ -1,140 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Radio, Tooltip, Icon, InputNumber } from 'antd' - -import './index.scss' - -class SettingForm extends Component { - static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� - config: PropTypes.object, // 鍗$墖琛屼俊鎭� - wrap: PropTypes.object, // 鏁版嵁婧愰厤缃� - } - - handleConfirm = () => { - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - resolve(values) - } else { - reject(err) - } - }) - }) - } - - render() { - const { wrap, config } = this.props - const { getFieldDecorator } = this.props.form - - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 } - } - } - - return ( - <div className="model-menu-setting-form"> - <Form {...formItemLayout}> - <Row gutter={24}> - <Col span={12}> - <Form.Item label={ - <Tooltip placement="topLeft" title="鐢ㄤ簬缁勪欢闂寸殑鍖哄垎銆�"> - <Icon type="question-circle" /> - 缁勪欢鍚嶇О - </Tooltip> - }> - {getFieldDecorator('name', { - initialValue: wrap.name, - rules: [ - { - required: true, - message: this.props.dict['form.required.input'] + '缁勪欢鍚嶇О!' - } - ] - })(<Input placeholder={''} autoComplete="off" />)} - </Form.Item> - </Col> - <Col span={12}> - <Form.Item label={ - <Tooltip placement="topLeft" title="鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��"> - <Icon type="question-circle" /> - 瀹藉害 - </Tooltip> - }> - {getFieldDecorator('width', { - initialValue: wrap.width || 24, - rules: [ - { - required: true, - message: this.props.dict['form.required.input'] + '瀹藉害!' - } - ] - })(<InputNumber min={1} max={24} precision={0} />)} - </Form.Item> - </Col> - {config.subtype === 'propcard' ? <Col span={12}> - <Form.Item label={ - <Tooltip placement="topLeft" title="閫夋嫨闈欐�佸�硷紝鏃犻渶閰嶇疆鏁版嵁婧愩��"> - <Icon type="question-circle" /> - 鏁版嵁鏉ユ簮 - </Tooltip> - }> - {getFieldDecorator('datatype', { - initialValue: wrap.datatype || 'dynamic' - })( - <Radio.Group> - <Radio value="dynamic">鍔ㄦ��</Radio> - <Radio value="static">闈欐��</Radio> - </Radio.Group> - )} - </Form.Item> - </Col> : null} - {config.subtype === 'datacard' ? <Col span={12}> - <Form.Item label={ - <Tooltip placement="topLeft" title="閫夋嫨鍚湁娣诲姞鎸夐挳鏃讹紝璇峰畬鍠勬寜閽厤缃俊鎭��"> - <Icon type="question-circle" /> - 娣诲姞鎸夐挳 - </Tooltip> - }> - {getFieldDecorator('addable', { - initialValue: wrap.addable || 'false' - })( - <Radio.Group> - <Radio value="true">鏈�</Radio> - <Radio value="false">鏃�</Radio> - </Radio.Group> - )} - </Form.Item> - </Col> : null} - <Col span={12}> - <Form.Item label={ - <Tooltip placement="topLeft" title="閫夋嫨鍗$墖鍒囨崲鏃讹紝鍙悜鍏朵粬缁勪欢浼犻�掍富閿�笺��"> - <Icon type="question-circle" /> - 鏄惁鍒囨崲 - </Tooltip> - }> - {getFieldDecorator('switch', { - initialValue: wrap.switch || 'false' - })( - <Radio.Group> - <Radio value="true">鏄�</Radio> - <Radio value="false">鍚�</Radio> - </Radio.Group> - )} - </Form.Item> - </Col> - </Row> - </Form> - </div> - ) - } -} - -export default Form.create()(SettingForm) \ No newline at end of file diff --git a/src/menu/components/card/table-card/wrapsetting/settingform/index.scss b/src/menu/components/card/table-card/wrapsetting/settingform/index.scss deleted file mode 100644 index 159130b..0000000 --- a/src/menu/components/card/table-card/wrapsetting/settingform/index.scss +++ /dev/null @@ -1,11 +0,0 @@ -.model-menu-setting-form { - position: relative; - - .anticon-question-circle { - color: #c49f47; - margin-right: 3px; - } - .ant-input-number { - width: 100%; - } -} \ No newline at end of file diff --git a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx index 98682dc..4bc2436 100644 --- a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx @@ -8,8 +8,9 @@ * @param {object} card // 鍥捐〃瀵硅薄 * @param {Array} columns // 鏄剧ず鍒� */ -export function getBarOrLineChartOptionForm (card, columns) { +export function getBarOrLineChartOptionForm (card, columns, sysRoles = []) { let shapes = [] + let _sysRoles = sysRoles.map(item => ({...item, field: item.value, label: item.text})) if (card.chartType === 'line') { shapes = [ @@ -301,6 +302,14 @@ value: 'white', text: '鐧借壊' }] + }, { + type: 'select', + key: 'blacklist', + label: '榛戝悕鍗�', + initVal: card.blacklist || [], + multi: true, + required: false, + options: _sysRoles } ] } diff --git a/src/menu/components/chart/antv-bar/chartcompile/index.jsx b/src/menu/components/chart/antv-bar/chartcompile/index.jsx index e7295d0..813701b 100644 --- a/src/menu/components/chart/antv-bar/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-bar/chartcompile/index.jsx @@ -14,6 +14,7 @@ static propTpyes = { dict: PropTypes.object, plot: PropTypes.object, + sysRoles: PropTypes.array, config: PropTypes.object, plotchange: PropTypes.func } @@ -66,7 +67,7 @@ } showDrawer = () => { - const { config } = this.props + const { config, sysRoles } = this.props let fieldName = {} config.columns.forEach(col => { @@ -81,7 +82,7 @@ disabled: config.plot.datatype === 'statistics', fieldName: fieldName, plot: fromJS(config.plot).toJS(), - formlist: getBarOrLineChartOptionForm(config.plot, config.columns, config.setting) + formlist: getBarOrLineChartOptionForm(config.plot, config.columns, sysRoles) }) } diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx index 41cfc59..23333cf 100644 --- a/src/menu/components/chart/antv-bar/index.jsx +++ b/src/menu/components/chart/antv-bar/index.jsx @@ -751,7 +751,7 @@ <div className="mk-popover-control"> <Icon className="plus" title="娣诲姞鎼滅储" onClick={this.addSearch} type="plus-circle" /> <Icon className="plus" title="娣诲姞鎸夐挳" onClick={this.addButton} type="plus-square" /> - <ChartCompileForm config={card} dict={this.state.dict} plotchange={this.updateComponent}/> + <ChartCompileForm config={card} sysRoles={this.props.menu.sysRoles} dict={this.state.dict} plotchange={this.updateComponent}/> <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> <Icon className="close" title="delete" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent}/> diff --git a/src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx index cd488d3..72807d9 100644 --- a/src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx @@ -8,9 +8,10 @@ * @param {object} card // 鍥捐〃瀵硅薄 * @param {Array} columns // 鏄剧ず鍒� */ -export function getPieChartOptionForm (card, columns) { +export function getPieChartOptionForm (card, columns, sysRoles = []) { let xfields = columns.filter(item => /^Nvarchar/ig.test(item.datatype)) let yfields = columns.filter(item => /^(Int|Decimal)/ig.test(item.datatype)) + let _sysRoles = sysRoles.map(item => ({...item, field: item.value, label: item.text})) return [ { @@ -196,6 +197,14 @@ value: 'white', text: '鐧借壊' }] + }, { + type: 'select', + key: 'blacklist', + label: '榛戝悕鍗�', + initVal: card.blacklist || [], + multi: true, + required: false, + options: _sysRoles } ] } diff --git a/src/menu/components/chart/antv-pie/chartcompile/index.jsx b/src/menu/components/chart/antv-pie/chartcompile/index.jsx index 88c9d4e..da4c13c 100644 --- a/src/menu/components/chart/antv-pie/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-pie/chartcompile/index.jsx @@ -11,6 +11,7 @@ static propTpyes = { dict: PropTypes.object, plot: PropTypes.object, + sysRoles: PropTypes.array, config: PropTypes.object, plotchange: PropTypes.func } @@ -22,12 +23,12 @@ } showDrawer = () => { - const { config } = this.props + const { config, sysRoles } = this.props this.setState({ visible: true, plot: fromJS(config.plot).toJS(), - formlist: getPieChartOptionForm(config.plot, config.columns, config.setting) + formlist: getPieChartOptionForm(config.plot, config.columns, sysRoles) }) } @@ -82,7 +83,7 @@ message: this.props.dict['form.required.input'] + item.label + '!' } ] - })(<Input placeholder="" autoComplete="off" disabled={item.readonly}/>)} + })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.onSubmit}/>)} </Form.Item> </Col> ) @@ -103,7 +104,7 @@ message: this.props.dict['form.required.input'] + item.label + '!' } ] - })(<InputNumber min={item.min} max={item.max} precision={item.decimal} />)} + })(<InputNumber min={item.min} max={item.max} precision={item.decimal} onPressEnter={this.onSubmit}/>)} </Form.Item> </Col> ) diff --git a/src/menu/components/chart/antv-pie/index.jsx b/src/menu/components/chart/antv-pie/index.jsx index 5829643..e36b9d6 100644 --- a/src/menu/components/chart/antv-pie/index.jsx +++ b/src/menu/components/chart/antv-pie/index.jsx @@ -427,7 +427,7 @@ <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> <Icon className="plus" title="娣诲姞鎼滅储" onClick={this.addSearch} type="plus-circle" /> - <ChartCompileForm config={card} dict={this.state.dict} plotchange={this.updateComponent}/> + <ChartCompileForm config={card} sysRoles={this.props.menu.sysRoles} dict={this.state.dict} plotchange={this.updateComponent}/> <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> <Icon className="close" title="delete" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent}/> diff --git a/src/menu/components/search/main-search/index.jsx b/src/menu/components/search/main-search/index.jsx index 7a700dc..bbf5a34 100644 --- a/src/menu/components/search/main-search/index.jsx +++ b/src/menu/components/search/main-search/index.jsx @@ -25,13 +25,7 @@ static propTpyes = { card: PropTypes.object, updateConfig: PropTypes.func, - deletecomponent: PropTypes.func, - - menu: PropTypes.object, // 褰撳墠鑿滃崟淇℃伅 - config: PropTypes.object, // 閰嶇疆淇℃伅 - pasteContent: PropTypes.object, // 绮樿创閰嶇疆淇℃伅 - sysRoles: PropTypes.array, // 瑙掕壊鍒楄〃锛岄粦鍚嶅崟 - updatesearch: PropTypes.func // 鏇存柊 + deletecomponent: PropTypes.func } state = { @@ -148,6 +142,7 @@ * @description 鎼滅储鏉′欢缂栬緫锛岃幏鍙栨悳绱㈡潯浠惰〃鍗曚俊鎭� */ handleSearch = (cell) => { + const { menu } = this.props const { card } = this.state let linkableFields = [] @@ -163,7 +158,7 @@ this.setState({ visible: true, editcard: cell, - formlist: getSearchForm(cell, this.props.sysRoles, linkableFields) + formlist: getSearchForm(cell, menu.sysRoles, linkableFields) }) } @@ -358,7 +353,7 @@ <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> <Icon className="plus" title="娣诲姞" onClick={this.addSearch} type="plus" /> - <WrapComponent config={card} updateConfig={this.updateComponent}/> + <WrapComponent config={card} sysRoles={this.props.menu.sysRoles} updateConfig={this.updateComponent}/> <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> <Icon className="close" title="delete" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> </div> diff --git a/src/menu/components/search/main-search/wrapsetting/index.jsx b/src/menu/components/search/main-search/wrapsetting/index.jsx index 20d7868..f2bc03d 100644 --- a/src/menu/components/search/main-search/wrapsetting/index.jsx +++ b/src/menu/components/search/main-search/wrapsetting/index.jsx @@ -10,6 +10,7 @@ class DataSource extends Component { static propTpyes = { + sysRoles: PropTypes.any, // 瑙掕壊鍒楄〃 config: PropTypes.any, updateConfig: PropTypes.func } @@ -69,6 +70,8 @@ <SettingForm dict={dict} wrap={wrap} + sysRoles={this.props.sysRoles || []} + inputSubmit={this.verifySubmit} wrappedComponentRef={(inst) => this.verifyRef = inst} /> </Modal> diff --git a/src/menu/components/search/main-search/wrapsetting/settingform/index.jsx b/src/menu/components/search/main-search/wrapsetting/settingform/index.jsx index 8da73d0..330e44f 100644 --- a/src/menu/components/search/main-search/wrapsetting/settingform/index.jsx +++ b/src/menu/components/search/main-search/wrapsetting/settingform/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Tooltip, Icon, InputNumber } from 'antd' +import { Form, Row, Col, Input, Tooltip, Icon, InputNumber, Select } from 'antd' import './index.scss' @@ -8,6 +8,8 @@ static propTpyes = { dict: PropTypes.object, // 瀛楀吀椤� wrap: PropTypes.object, // 鏁版嵁婧愰厤缃� + sysRoles: PropTypes.array, // 瑙掕壊鍒楄〃 + inputSubmit: PropTypes.func // 鍥炶溅浜嬩欢 } handleConfirm = () => { @@ -23,8 +25,16 @@ }) } + handleSubmit = (e) => { + e.preventDefault() + + if (this.props.inputSubmit) { + this.props.inputSubmit() + } + } + render() { - const { wrap } = this.props + const { wrap, sysRoles } = this.props const { getFieldDecorator } = this.props.form const formItemLayout = { @@ -57,7 +67,7 @@ message: this.props.dict['form.required.input'] + '缁勪欢鍚嶇О!' } ] - })(<Input placeholder={''} autoComplete="off" />)} + })(<Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit}/>)} </Form.Item> </Col> <Col span={12}> @@ -75,7 +85,24 @@ message: this.props.dict['form.required.input'] + '瀹藉害!' } ] - })(<InputNumber min={1} max={24} precision={0} />)} + })(<InputNumber min={1} max={24} precision={0} onPressEnter={this.handleSubmit}/>)} + </Form.Item> + </Col> + <Col span={12}> + <Form.Item label="榛戝悕鍗�"> + {getFieldDecorator('blacklist', { + initialValue: wrap.blacklist || [] + })( + <Select + showSearch + mode="multiple" + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + > + {sysRoles.map(option => + <Select.Option key={option.uuid} value={option.value}>{option.text}</Select.Option> + )} + </Select> + )} </Form.Item> </Col> </Row> diff --git a/src/menu/components/tabs/antv-tabs/index.jsx b/src/menu/components/tabs/antv-tabs/index.jsx index a32e8fb..b17d53f 100644 --- a/src/menu/components/tabs/antv-tabs/index.jsx +++ b/src/menu/components/tabs/antv-tabs/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 { Tabs, Icon, Popover, Modal } from 'antd' @@ -19,7 +20,7 @@ const { TabPane } = Tabs const { confirm } = Modal -class antvBarLineChart extends Component { +class antvTabs extends Component { static propTpyes = { tabs: PropTypes.object, deletecomponent: PropTypes.func, @@ -251,7 +252,7 @@ <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> <Icon className="plus" title="娣诲姞鏍囩" type="plus" onClick={this.tabAdd} /> - <SettingComponent config={tabs} updateConfig={this.updateComponent} /> + <SettingComponent config={tabs} sysRoles={this.props.menu.sysRoles} updateConfig={this.updateComponent} /> <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> <Icon className="close" title="delete" type="delete" onClick={() => this.props.deletecomponent(tabs.uuid)} /> </div> @@ -275,6 +276,7 @@ <TabLabelComponent dict={dict} tab={editab} + inputSubmit={this.tabLabelSubmit} wrappedComponentRef={(inst) => this.tabLabelRef = inst} /> </Modal> @@ -283,4 +285,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)(antvTabs) \ No newline at end of file diff --git a/src/menu/components/tabs/tabcomponents/card.jsx b/src/menu/components/tabs/tabcomponents/card.jsx index 944956a..e7aff3f 100644 --- a/src/menu/components/tabs/tabcomponents/card.jsx +++ b/src/menu/components/tabs/tabcomponents/card.jsx @@ -10,6 +10,7 @@ const AntvTabs = asyncComponent(() => import('@/menu/components/tabs/antv-tabs')) const DataCard = asyncComponent(() => import('@/menu/components/card/data-card')) const PropCard = asyncComponent(() => import('@/menu/components/card/prop-card')) +const TableCard = asyncComponent(() => import('@/menu/components/card/table-card')) const Card = ({ id, card, moveCard, findCard, delCard, updateConfig }) => { const originalIndex = findCard(id).index @@ -57,6 +58,8 @@ return (<DataCard card={card} updateConfig={updateConfig} deletecomponent={delCard} />) } else if (card.type === 'card' && card.subtype === 'propcard') { return (<PropCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) + } else if (card.type === 'card' && card.subtype === 'tablecard') { + return (<TableCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } } diff --git a/src/menu/components/tabs/tablabelform/index.jsx b/src/menu/components/tabs/tablabelform/index.jsx index dedf405..3a63a0d 100644 --- a/src/menu/components/tabs/tablabelform/index.jsx +++ b/src/menu/components/tabs/tablabelform/index.jsx @@ -7,8 +7,9 @@ class SettingForm extends Component { static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� - tab: PropTypes.object, // 鏁版嵁婧愰厤缃� + dict: PropTypes.object, // 瀛楀吀椤� + tab: PropTypes.object, // 鏁版嵁婧愰厤缃� + inputSubmit: PropTypes.func // 鍥炶溅浜嬩欢 } state = {} @@ -30,6 +31,13 @@ }) } + handleSubmit = (e) => { + e.preventDefault() + + if (this.props.inputSubmit) { + this.props.inputSubmit() + } + } render() { const { tab } = this.props @@ -59,7 +67,7 @@ message: this.props.dict['form.required.input'] + '鍚嶇О!' } ] - })(<Input placeholder={''} autoComplete="off" />)} + })(<Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit} />)} </Form.Item> </Col> <Col span={24}> diff --git a/src/menu/components/tabs/tabsetting/index.jsx b/src/menu/components/tabs/tabsetting/index.jsx index 489bba4..956e4b0 100644 --- a/src/menu/components/tabs/tabsetting/index.jsx +++ b/src/menu/components/tabs/tabsetting/index.jsx @@ -11,6 +11,7 @@ class DataSource extends Component { static propTpyes = { config: PropTypes.any, + sysRoles: PropTypes.any, // 瑙掕壊鍒楄〃 updateConfig: PropTypes.func } @@ -69,6 +70,8 @@ <SettingForm dict={dict} setting={setting} + sysRoles={this.props.sysRoles || []} + inputSubmit={this.verifySubmit} wrappedComponentRef={(inst) => this.verifyRef = inst} /> </Modal> diff --git a/src/menu/components/tabs/tabsetting/settingform/index.jsx b/src/menu/components/tabs/tabsetting/settingform/index.jsx index 76976c4..818ea3f 100644 --- a/src/menu/components/tabs/tabsetting/settingform/index.jsx +++ b/src/menu/components/tabs/tabsetting/settingform/index.jsx @@ -8,6 +8,8 @@ static propTpyes = { dict: PropTypes.object, // 瀛楀吀椤� setting: PropTypes.object, // 鏁版嵁婧愰厤缃� + sysRoles: PropTypes.array, // 瑙掕壊鍒楄〃 + inputSubmit: PropTypes.func // 鍥炶溅浜嬩欢 } state = {} @@ -29,9 +31,16 @@ }) } + handleSubmit = (e) => { + e.preventDefault() + + if (this.props.inputSubmit) { + this.props.inputSubmit() + } + } render() { - const { setting } = this.props + const { setting, sysRoles } = this.props const { getFieldDecorator } = this.props.form const formItemLayout = { @@ -64,7 +73,7 @@ message: this.props.dict['form.required.input'] + '缁勪欢鍚嶇О!' } ] - })(<Input placeholder={''} autoComplete="off" />)} + })(<Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit}/>)} </Form.Item> </Col> <Col span={12}> @@ -82,7 +91,7 @@ message: this.props.dict['form.required.input'] + '瀹藉害!' } ] - })(<InputNumber min={1} max={24} precision={0} />)} + })(<InputNumber min={1} max={24} precision={0} onPressEnter={this.handleSubmit}/>)} </Form.Item> </Col> <Col span={12}> @@ -116,6 +125,23 @@ )} </Form.Item> </Col> + <Col span={12}> + <Form.Item label="榛戝悕鍗�"> + {getFieldDecorator('blacklist', { + initialValue: setting.blacklist || [] + })( + <Select + showSearch + mode="multiple" + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + > + {sysRoles.map(option => + <Select.Option key={option.uuid} value={option.value}>{option.text}</Select.Option> + )} + </Select> + )} + </Form.Item> + </Col> </Row> </Form> </div> diff --git a/src/menu/menushell/card.jsx b/src/menu/menushell/card.jsx index fa98607..445cae5 100644 --- a/src/menu/menushell/card.jsx +++ b/src/menu/menushell/card.jsx @@ -10,6 +10,7 @@ const AntvTabs = asyncComponent(() => import('@/menu/components/tabs/antv-tabs')) const DataCard = asyncComponent(() => import('@/menu/components/card/data-card')) const PropCard = asyncComponent(() => import('@/menu/components/card/prop-card')) +const TableCard = asyncComponent(() => import('@/menu/components/card/table-card')) const Card = ({ id, card, moveCard, findCard, delCard, updateConfig }) => { const originalIndex = findCard(id).index @@ -53,6 +54,8 @@ return (<DataCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } else if (card.type === 'card' && card.subtype === 'propcard') { return (<PropCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) + } else if (card.type === 'card' && card.subtype === 'tablecard') { + return (<TableCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } } diff --git a/src/menu/modelsource/option.jsx b/src/menu/modelsource/option.jsx index 259a40d..6764d0f 100644 --- a/src/menu/modelsource/option.jsx +++ b/src/menu/modelsource/option.jsx @@ -7,6 +7,7 @@ import tabs from '@/assets/mobimg/tabs.png' import card1 from '@/assets/mobimg/card1.png' import card2 from '@/assets/mobimg/card2.png' +import TableCard from '@/assets/mobimg/table-card.png' import Pie from '@/assets/mobimg/pie.png' import Pie1 from '@/assets/mobimg/ring.png' import Pie2 from '@/assets/mobimg/nightingale.png' @@ -20,6 +21,7 @@ { type: 'menu', url: Mainsearch, component: 'search', subtype: 'mainsearch', title: '鎼滅储鏉′欢', width: 24 }, { type: 'menu', url: card1, component: 'card', subtype: 'datacard', title: '鏁版嵁鍗�', config: `[{"uuid":"160135809128212dm7i29fim9ksto9od","setting":{"width":6},"style":{"paddingTop":"15px","marginTop":"4px","paddingRight":"15px","marginRight":"8px","marginLeft":"8px","backgroundColor":"rgba(255, 255, 255, 1)","borderColor":"#e8e8e8","paddingLeft":"15px","marginBottom":"4px","borderWidth":"1px","paddingBottom":"10px"},"backStyle":{},"elements":[{"datatype":"static","width":12,"marks":null,"height":1,"value":"鍏冲崟","style":{},"prefix":"","postfix":"","format":"","eleType":"text","uuid":"160231860159931untbea62sgokunc5s"},{"datatype":"dynamic","width":12,"marks":null,"style":{"color":"rgba(250, 219, 20, 1)","textAlign":"right"},"btnstyle":{},"eleType":"icon","icon":"question-circle","field":"nvarchar2","uuid":"1602318768361nv8ql4t47sgcsn88b0u"},{"datatype":"static","width":24,"marks":null,"height":1,"innerHeight":36,"value":"100","style":{"fontSize":"24px","fontWeight":"500","color":"rgba(0, 0, 0, 1)"},"prefix":"","btnstyle":{},"postfix":"","format":"","eleType":"text","uuid":"1602318817884v70gtgb65ubnm8mbcvv"},{"color":"#1890ff","width":24,"marks":null,"maxValue":100,"style":{"color":"rgba(250, 140, 22, 1)","paddingTop":"20px","paddingBottom":"10px"},"btnstyle":{},"eleType":"slider","field":"int1","uuid":"16023188871233rkktuvpp1h077igrsu"},{"eleType":"splitline","width":24,"color":"#e8e8e8","uuid":"1602320017038n31bk9o831ggug0tu0b","marks":null,"style":{"marginTop":"10px","marginBottom":"10px"},"btnstyle":{}},{"datatype":"static","width":12,"marks":null,"height":1,"value":"100","style":{"marginTop":"6px"},"prefix":"鍏冲崟","btnstyle":{},"postfix":"","format":"","eleType":"text","uuid":"1602320061243drd7lf3agvn04kgr175"}],"backElements":[]}]` }, { type: 'menu', url: card2, component: 'card', subtype: 'propcard', title: '灞炴�у崱', config: `[{"uuid":"1603681387259qaqf1127f72esmtchge","setting":{"width":6,"type":"simple"},"style":{"paddingTop":"15px","marginTop":"8px","paddingRight":"15px","marginRight":"8px","marginLeft":"8px","borderColor":"#e8e8e8","paddingLeft":"15px","marginBottom":"8px","borderWidth":"1px","paddingBottom":"15px"},"backStyle":{},"elements":[{"datatype":"static","width":12,"marks":null,"height":1,"value":"瓒呮椂宸ュ崟","style":{"color":"rgba(67, 67, 67, 0.51)"},"prefix":"","postfix":"","format":"","eleType":"text","uuid":"1603681402945qnkgm7q8cng65evn5ev"},{"eleType":"icon","datatype":"static","width":12,"icon":"question-circle","tooltip":"瓒呮椂宸ュ崟","uuid":"1603681473384i2crkbtofg4pu76k06a","marks":null,"style":{"textAlign":"right","color":"rgba(250, 219, 20, 1)"}},{"datatype":"static","width":24,"marks":null,"height":1,"innerHeight":36,"value":"100","style":{"fontSize":"24px","color":"rgba(0, 0, 0, 1)"},"prefix":"","postfix":"","format":"","eleType":"number","uuid":"1603681539870d704ufqf98kc6t7537t"},{"color":"rgba(250, 219, 20, 1)","datatype":"static","width":24,"marks":null,"maxValue":100,"value":50,"style":{"paddingTop":"10px","paddingBottom":"10px"},"eleType":"slider","uuid":"1603683067556mvupau0odvrtv45u7o8"},{"eleType":"splitline","width":24,"color":"#e8e8e8","uuid":"1603683117981t9k55k8an430fuppmci","marks":null,"style":{"paddingTop":"5px","paddingBottom":"5px"}},{"datatype":"static","width":12,"marks":null,"height":1,"value":"100","style":{"color":"rgba(0, 0, 0, 0.65)","marginTop":"10px"},"prefix":"瓒呮椂宸ュ崟 ","postfix":"","format":"","eleType":"text","uuid":"1603683136553uvsmkfohkft9idbfkhu"}],"backElements":[]}]` }, + { type: 'menu', url: TableCard, component: 'card', subtype: 'tablecard', title: '琛ㄦ牸' }, { type: 'menu', url: line, component: 'line', subtype: 'line', title: '鎶樼嚎鍥�' }, { type: 'menu', url: line1, component: 'line', subtype: 'line1', title: '闃舵鎶樼嚎鍥�' }, { type: 'menu', url: bar, component: 'bar', subtype: 'bar', title: '鏌辩姸鍥�' }, diff --git a/src/menu/stylecontroller/index.jsx b/src/menu/stylecontroller/index.jsx index 3d6a28e..c84c183 100644 --- a/src/menu/stylecontroller/index.jsx +++ b/src/menu/stylecontroller/index.jsx @@ -597,7 +597,7 @@ </Collapse> : null} </Form> <div style={{textAlign: 'right'}}> - <Button type="link" style={{color: '#ffffff', marginTop: '20px'}} onClick={this.onCloseDrawer}>鍏抽棴</Button> + <Button style={{margin: '30px 10px 0px 0px'}} onClick={this.onCloseDrawer}>鍏抽棴</Button> </div> </div> </Drawer> diff --git a/src/tabviews/calendar/index.jsx b/src/tabviews/calendar/index.jsx index ab6760a..7813ad9 100644 --- a/src/tabviews/calendar/index.jsx +++ b/src/tabviews/calendar/index.jsx @@ -332,6 +332,13 @@ let regoptions = null if (setting.queryType === 'statistics' || param.custom_script) { let allSearch = Utils.getAllSearchOptions(search) + let userName = sessionStorage.getItem('User_Name') || '' + let fullName = sessionStorage.getItem('Full_Name') || '' + + if (sessionStorage.getItem('isEditState') === 'true') { + userName = sessionStorage.getItem('CloudUserName') || '' + fullName = sessionStorage.getItem('CloudFullName') || '' + } regoptions = allSearch.map(item => { return { @@ -339,6 +346,13 @@ value: `'${item.value}'` } }) + regoptions.push({ + reg: new RegExp('@userName@', 'ig'), + value: userName + }, { + reg: new RegExp('@fullName@', 'ig'), + value: fullName + }) } if (config.calendar.refresh === 'true' && regoptions) { diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index 92ad980..4ac800b 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -229,7 +229,7 @@ } return ( - <div className="custom-data-card-box" style={config.style}> + <div className="custom-data-card-box" style={{...config.style, minHeight: config.wrap.minHeight}}> {loading ? <div className="loading-mask"> <div className="ant-spin-blur"></div> diff --git a/src/tabviews/custom/components/card/data-card/index.scss b/src/tabviews/custom/components/card/data-card/index.scss index bb60e73..9f7d929 100644 --- a/src/tabviews/custom/components/card/data-card/index.scss +++ b/src/tabviews/custom/components/card/data-card/index.scss @@ -3,7 +3,7 @@ background-position: center center; background-repeat: no-repeat; background-size: cover; - min-height: 20px; + min-height: 100px; display: flex; position: relative; diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index d43b9d6..765774e 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -109,9 +109,7 @@ _data = nextProps.data[config.dataName] || [] } - this.setState({sync: false, loading: false, data: _data}, () => { - this.handleData() - }) + this.setState({sync: false, loading: false, data: _data}) } else if (!is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { if (config.wrap.datatype !== 'static' && config.setting.syncRefresh === 'true') { this.setState({}, () => { @@ -206,7 +204,7 @@ const { config, loading, data, activeKey } = this.state return ( - <div className="custom-prop-card-box" style={config.style}> + <div className="custom-prop-card-box" style={{...config.style, minHeight: config.wrap.minHeight}}> {loading ? <div className="loading-mask"> <div className="ant-spin-blur"></div> diff --git a/src/tabviews/custom/components/card/prop-card/index.scss b/src/tabviews/custom/components/card/prop-card/index.scss index 6ba2875..b03d482 100644 --- a/src/tabviews/custom/components/card/prop-card/index.scss +++ b/src/tabviews/custom/components/card/prop-card/index.scss @@ -3,7 +3,7 @@ background-position: center center; background-repeat: no-repeat; background-size: cover; - min-height: 20px; + min-height: 100px; position: relative; .card-row-list::after { diff --git a/src/tabviews/custom/components/share/tabtransfer/index.jsx b/src/tabviews/custom/components/share/tabtransfer/index.jsx index ffa91e7..a923413 100644 --- a/src/tabviews/custom/components/share/tabtransfer/index.jsx +++ b/src/tabviews/custom/components/share/tabtransfer/index.jsx @@ -258,22 +258,18 @@ <AntvTabs config={item} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> </Col> ) - } else if (item.type === 'card') { - if (item.subtype === 'datacard') { - return ( - <Col span={item.width} key={item.uuid}> - <DataCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> - </Col> - ) - } else if (item.subtype === 'propcard') { - return ( - <Col span={item.width} key={item.uuid}> - <PropCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> - </Col> - ) - } else { - return null - } + } else if (item.type === 'card' && item.subtype === 'datacard') { + return ( + <Col span={item.width} key={item.uuid}> + <DataCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + </Col> + ) + } else if (item.type === 'card' && item.subtype === 'propcard') { + return ( + <Col span={item.width} key={item.uuid}> + <PropCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + </Col> + ) } else { return null } diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 73a4d2b..0cc3646 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -106,37 +106,42 @@ return } + // 鏉冮檺杩囨护 + if (this.props.menuType !== 'HS') { + config.components = this.filterComponent(config.components) + } + // 鑾峰彇涓绘悳绱㈡潯浠� let mainSearch = [] config.components.forEach(component => { - if (component.type === 'search') { - component.search = component.search.map(item => { - item.oriInitval = item.initval - if (['text', 'select', 'link'].includes(item.type) && param) { - if (param.searchkey === item.field) { - item.initval = param.searchval - } else if (param.BID && item.field.toLowerCase() === 'bid') { - item.initval = param.BID - } else if (param.data && param.data[item.field]) { - item.initval = param.data[item.field] - } + if (component.type !== 'search') return + + component.search = component.search.map(item => { + item.oriInitval = item.initval + if (['text', 'select', 'link'].includes(item.type) && param) { + if (param.searchkey === item.field) { + item.initval = param.searchval + } else if (param.BID && item.field.toLowerCase() === 'bid') { + item.initval = param.BID + } else if (param.data && param.data[item.field]) { + item.initval = param.data[item.field] } + } - if (!item.blacklist || item.blacklist.length === 0) return item + if (!item.blacklist || item.blacklist.length === 0) return item - let _black = item.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0) { - item.Hide = 'true' - } - - return item + let _black = item.blacklist.filter(v => { + return this.props.permRoles.indexOf(v) !== -1 }) - mainSearch = Utils.initMainSearch(component.search) - } + if (_black.length > 0) { + item.Hide = 'true' + } + + return item + }) + + mainSearch = Utils.initMainSearch(component.search) }) let params = [] @@ -162,6 +167,42 @@ duration: 5 }) } + } + + filterComponent = (components) => { + return components.filter(item => { + if (item.type === 'tabs') { + if (item.setting.blacklist && item.setting.blacklist.length > 0) { + let _black = item.setting.blacklist.filter(v => { + return this.props.permRoles.indexOf(v) !== -1 + }) + + if (_black.length > 0) return false + } + + item.subtabs = item.subtabs.map(tab => { + tab.components = this.filterComponent(tab.components) + return tab + }) + } else if (item.type === 'pie' || item.type === 'bar' || item.type === 'line') { + if (item.plot.blacklist && item.plot.blacklist.length > 0) { + let _black = item.plot.blacklist.filter(v => { + return this.props.permRoles.indexOf(v) !== -1 + }) + + if (_black.length > 0) return false + } + } else { + if (item.wrap.blacklist && item.wrap.blacklist.length > 0) { + let _black = item.wrap.blacklist.filter(v => { + return this.props.permRoles.indexOf(v) !== -1 + }) + + if (_black.length > 0) return false + } + } + return true + }) } // 鏍煎紡鍖栭粯璁よ缃� @@ -443,22 +484,18 @@ <AntvTabs config={item} BID={BID} mainSearch={mainSearch} /> </Col> ) - } else if (item.type === 'card') { - if (item.subtype === 'datacard') { - return ( - <Col span={item.width} key={item.uuid}> - <DataCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> - </Col> - ) - } else if (item.subtype === 'propcard') { - return ( - <Col span={item.width} key={item.uuid}> - <PropCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> - </Col> - ) - } else { - return null - } + } else if (item.type === 'card' && item.subtype === 'datacard') { + return ( + <Col span={item.width} key={item.uuid}> + <DataCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + </Col> + ) + } else if (item.type === 'card' && item.subtype === 'propcard') { + return ( + <Col span={item.width} key={item.uuid}> + <PropCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + </Col> + ) } else { return null } diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index 030e799..1c24be0 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -558,6 +558,13 @@ let regoptions = null if (setting.queryType === 'statistics' || param.custom_script) { let allSearch = Utils.getAllSearchOptions(search) + let userName = sessionStorage.getItem('User_Name') || '' + let fullName = sessionStorage.getItem('Full_Name') || '' + + if (sessionStorage.getItem('isEditState') === 'true') { + userName = sessionStorage.getItem('CloudUserName') || '' + fullName = sessionStorage.getItem('CloudFullName') || '' + } regoptions = allSearch.map(item => { return { @@ -567,6 +574,12 @@ }) regoptions.push({ + reg: new RegExp('@userName@', 'ig'), + value: userName + }, { + reg: new RegExp('@fullName@', 'ig'), + value: fullName + }, { reg: new RegExp('@orderBy@', 'ig'), value: orderBy }, { diff --git a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx index 708b052..5fdbdb7 100644 --- a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx @@ -381,7 +381,7 @@ message: this.props.dict['form.required.input'] + item.label + '!' } ] - })(<InputNumber min={item.min} max={item.max} precision={0} />)} + })(<InputNumber min={item.min} max={item.max} precision={0} onPressEnter={this.handleSubmit}/>)} </Form.Item> </Col> ) diff --git a/src/templates/zshare/customscript/index.jsx b/src/templates/zshare/customscript/index.jsx index c4c411f..5d2b774 100644 --- a/src/templates/zshare/customscript/index.jsx +++ b/src/templates/zshare/customscript/index.jsx @@ -386,7 +386,7 @@ </Col> <Col span={24} className="sqlfield"> <Form.Item label={'鍙敤瀛楁'}> - id, bid, loginuid, sessionuid, userid, appkey, time_id, orderBy{setting.laypage === 'true' ? ', pageSize, pageIndex': ''}{usefulFields ? ', ' + usefulFields : ''} + id, bid, loginuid, sessionuid, userid, username, fullname, appkey, time_id, orderBy{setting.laypage === 'true' ? ', pageSize, pageIndex': ''}{usefulFields ? ', ' + usefulFields : ''} </Form.Item> </Col> <Col span={10} className="quick-add"> diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 99662d8..427775d 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -523,6 +523,8 @@ } resolve(_fields) }) + } else { + resolve(_fields) } }).then(_fields => { let _usefulfields = ['BID', 'ID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'UserName', 'FullName', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode'] @@ -568,12 +570,11 @@ } }) - if (!hasBid) { // 琛ㄥ崟涓鍔燘ID + if (!hasBid && (card.sqlType === 'insert' || card.sqlType === 'insertOrUpdate')) { // 琛ㄥ崟涓鍔燘ID _fields.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' }) fieldArr.push('bid') _declare.push(`@bid nvarchar(50)`) _select.push(`@bid=''`) - } let hasColumn = false @@ -646,7 +647,12 @@ if (!item.field) return keys.push(item.field.toLowerCase()) - values.push('@' + item.field) + + if (item.field.toLowerCase() === 'bid' && item.uuid === 'BID') { + values.push('@BID@') + } else { + values.push('@' + item.field) + } }) if (config.setting.primaryKey && !keys.includes(config.setting.primaryKey.toLowerCase())) { @@ -674,7 +680,7 @@ values = values.join(', ') _insertsql = `insert into ${card.sql} (${keys}) select ${values};` } - + if (card.sqlType === 'update' || card.sqlType === 'audit' || card.sqlType === 'insertOrUpdate') { let _form = [] let _arr = [] @@ -734,7 +740,7 @@ ${_updatesql} end ` - } else if (card.sqlType === 'LogicDelete') { + } else if (card.sqlType === 'LogicDelete' || card.sqlType === 'custom') { _defaultsql = `update ${card.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid@ where ${config.setting.primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` } else if (card.sqlType === 'delete') { let _msg = '' diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js index 15e098a..d214736 100644 --- a/src/utils/utils-datamanage.js +++ b/src/utils/utils-datamanage.js @@ -86,7 +86,7 @@ arr_field: arrFields, default_sql: setting.execute ? 'true' : 'false' } - + let _dataresource = setting.dataresource let _customScript = '' @@ -99,6 +99,13 @@ let regoptions = null if (setting.queryType === 'statistics' || _customScript) { let allSearch = Utils.getAllSearchOptions(search) + let userName = sessionStorage.getItem('User_Name') || '' + let fullName = sessionStorage.getItem('Full_Name') || '' + + if (sessionStorage.getItem('isEditState') === 'true') { + userName = sessionStorage.getItem('CloudUserName') || '' + fullName = sessionStorage.getItem('CloudFullName') || '' + } regoptions = allSearch.map(item => { return { @@ -107,6 +114,12 @@ } }) regoptions.push({ + reg: new RegExp('@userName@', 'ig'), + value: userName + }, { + reg: new RegExp('@fullName@', 'ig'), + value: fullName + }, { reg: new RegExp('@orderBy@', 'ig'), value: orderBy }, { @@ -207,6 +220,13 @@ let regoptions = null if (setting.queryType === 'statistics' || _customScript) { let allSearch = Utils.getAllSearchOptions(search) + let userName = sessionStorage.getItem('User_Name') || '' + let fullName = sessionStorage.getItem('Full_Name') || '' + + if (sessionStorage.getItem('isEditState') === 'true') { + userName = sessionStorage.getItem('CloudUserName') || '' + fullName = sessionStorage.getItem('CloudFullName') || '' + } regoptions = allSearch.map(item => { return { @@ -215,6 +235,12 @@ } }) regoptions.push({ + reg: new RegExp('@userName@', 'ig'), + value: userName + }, { + reg: new RegExp('@fullName@', 'ig'), + value: fullName + }, { reg: new RegExp('@orderBy@', 'ig'), value: orderBy }, { diff --git a/src/utils/utils.js b/src/utils/utils.js index 7e970f3..8df4de7 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -697,7 +697,7 @@ if (item.orderBy) { sql = `select ${item.type === 'checkcard' ? 'top 20' : ''} ${arrfield} from (select distinct ${arrfield},${item.orderBy} as orderfield from ${_datasource} ) a order by orderfield ${item.orderType}` } else { - sql = `select ${item.type === 'checkcard' ? 'top 20' : ''} ${arrfield} from (select distinct ${arrfield} from ${_datasource})` + sql = `select ${item.type === 'checkcard' ? 'top 20' : ''} ${arrfield} from (select distinct ${arrfield} from ${_datasource}) a` } return { -- Gitblit v1.8.0