From 35450c747d7497642119afb5db3bbbeec63c9214 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 17 十月 2021 12:03:23 +0800 Subject: [PATCH] 2021-10-17 --- src/tabviews/zshare/automatic/index.jsx | 56 +++++++++++ src/templates/comtableconfig/menuform/index.jsx | 22 ++++ src/menu/components/share/clockcomponent/settingform/index.jsx | 11 +- src/tabviews/zshare/automatic/index.scss | 14 ++ src/views/mobdesign/menuform/index.jsx | 18 +++ src/views/pcdesign/menuform/index.jsx | 19 +++ src/tabviews/commontable/index.jsx | 18 +++ src/templates/subtableconfig/menuform/index.jsx | 4 src/templates/zshare/unattended/index.jsx | 2 src/templates/zshare/unattended/settingform/index.jsx | 83 +++++++++++++--- src/views/menudesign/menuform/index.jsx | 19 +++ 11 files changed, 241 insertions(+), 25 deletions(-) diff --git a/src/menu/components/share/clockcomponent/settingform/index.jsx b/src/menu/components/share/clockcomponent/settingform/index.jsx index dd4c146..22604e5 100644 --- a/src/menu/components/share/clockcomponent/settingform/index.jsx +++ b/src/menu/components/share/clockcomponent/settingform/index.jsx @@ -11,7 +11,8 @@ } state = { - clearField: this.props.config.clearField || '' + clearField: this.props.config.clearField || '', + timer: this.props.config.timer || '' } handleConfirm = () => { @@ -29,7 +30,7 @@ render() { const { config } = this.props - const { clearField } = this.state + const { clearField, timer } = this.state const { getFieldDecorator } = this.props.form const formItemLayout = { @@ -52,7 +53,7 @@ {getFieldDecorator('timer', { initialValue: config.timer || '' })( - <Select> + <Select onChange={(val) => this.setState({timer: val})}> <Select.Option value=""> 鏃� </Select.Option> <Select.Option value="5s"> 5绉� </Select.Option> <Select.Option value="15s"> 15绉� </Select.Option> @@ -67,7 +68,7 @@ )} </Form.Item> </Col> - {config.subtype === 'balcony' || config.subtype === 'propcard' ? <Col span={22}> + {(config.subtype === 'balcony' || config.subtype === 'propcard') && timer ? <Col span={22}> <Form.Item label={ <Tooltip placement="topLeft" title="鍙互鎸囧畾瀛楁鐢ㄤ簬鎺у埗瀹氭椂鍣ㄧ殑鍏抽棴銆�"> <Icon type="question-circle" style={{marginRight: '3px', color: '#c49f47'}} /> @@ -83,7 +84,7 @@ )} </Form.Item> </Col> : null} - {(config.subtype === 'balcony' || config.subtype === 'propcard') && clearField ? <Col span={22}> + {(config.subtype === 'balcony' || config.subtype === 'propcard') && clearField && timer ? <Col span={22}> <Form.Item label={ <Tooltip placement="topLeft" title="褰撳瓧娈靛�间笌鍏抽棴鍊肩浉绛夋椂锛屽叧闂畾鏃跺櫒锛屽涓�煎彲鐢ㄩ�楀彿鍒嗛殧銆�"> <Icon type="question-circle" style={{marginRight: '3px', color: '#c49f47'}} /> diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 712a9c5..d139bbc 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -26,6 +26,7 @@ const CardComponent = asyncSpinComponent(() => import('@/tabviews/zshare/cardcomponent')) const ChartComponent = asyncSpinComponent(() => import('@/tabviews/zshare/chartcomponent')) const PagemsgComponent = asyncComponent(() => import('@/tabviews/zshare/pageMessage')) +const AutoMatic = asyncComponent(() => import('@/tabviews/zshare/automatic')) const { TabPane } = Tabs @@ -66,7 +67,8 @@ statFValue: [], // 鍚堣鍊� absFields: [], // 缁濆鍊煎瓧娈� loadCustomApi: true, // 鍔犺浇澶栭儴璧勬簮 - hasReqFields: false + hasReqFields: false, + autoMatic: null } /** @@ -371,9 +373,20 @@ config.setting.selected = 'false' } + let autoMatic = null + if (config.autoMatic && config.autoMatic.enable === 'true') { + _actions.forEach(item => { + if (item.uuid === config.autoMatic.action && (['pop', 'prompt', 'exec'].includes(item.OpenType) || (item.OpenType === 'funcbutton' && item.funcType === 'print'))) { + autoMatic = config.autoMatic + config.setting.selected = 'false' + } + }) + } + this.setState({ loadingview: false, absFields, + autoMatic, chartId, config, statFields, @@ -1056,7 +1069,7 @@ render() { const { menuType } = this.props - const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, chartId, search, selectedData, shortcuts } = this.state + const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, chartId, search, selectedData, shortcuts, autoMatic } = this.state return ( <div className="commontable" id={this.state.ContainerId}> @@ -1171,6 +1184,7 @@ })} </Tabs>)) } + {menuType !== 'HS' && autoMatic ? <AutoMatic autoMatic={autoMatic} config={config} /> : null} {menuType !== 'HS' && window.GLOB.systemType !== 'production' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config} dict={this.state.dict} /> : null} {menuType !== 'HS' && shortcuts ? <SettingComponent config={config} dict={this.state.dict} shortcuts={shortcuts} permAction={this.props.permAction}/> : null} {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} diff --git a/src/tabviews/zshare/automatic/index.jsx b/src/tabviews/zshare/automatic/index.jsx new file mode 100644 index 0000000..f9117f8 --- /dev/null +++ b/src/tabviews/zshare/automatic/index.jsx @@ -0,0 +1,56 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { Button } from 'antd' + +// import MKEmitter from '@/utils/events.js' +import './index.scss' + +class AutoMatic extends Component { + static propTpyes = { + autoMatic: PropTypes.object, + config: PropTypes.object + } + + state = { + running: false, + line: 0 + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } + + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 + */ + componentWillUnmount () { + this.setState = () => { + return + } + } + + trigger = () => { + // const { config } = this.props + let running = !this.state.running + + // MKEmitter.emit('modifyTabs', config.MenuID, 0) + + this.setState({running: running}) + } + + render() { + const { running } = this.state + + return ( + <Button + icon={running ? 'pause' : 'forward'} + shape="circle" + className={'auto-matic ' + (window.GLOB.systemType === 'production' ? 'low' : '')} + onClick={this.trigger} + /> + ) + } +} + +export default AutoMatic \ No newline at end of file diff --git a/src/tabviews/zshare/automatic/index.scss b/src/tabviews/zshare/automatic/index.scss new file mode 100644 index 0000000..27e2e9c --- /dev/null +++ b/src/tabviews/zshare/automatic/index.scss @@ -0,0 +1,14 @@ +.auto-matic { + position: fixed; + z-index: 2; + bottom: 145px; + right: 20px; + width: 40px; + height: 40px; + .anticon-forward { + font-size: 20px; + } +} +.auto-matic.low { + bottom: 100px; +} diff --git a/src/templates/comtableconfig/menuform/index.jsx b/src/templates/comtableconfig/menuform/index.jsx index dd128de..6461cc3 100644 --- a/src/templates/comtableconfig/menuform/index.jsx +++ b/src/templates/comtableconfig/menuform/index.jsx @@ -5,6 +5,8 @@ import { formRule } from '@/utils/option.js' import './index.scss' +const { TextArea } = Input + class MainSearch extends Component { static propTpyes = { dict: PropTypes.object, // 瀛楀吀椤� @@ -78,6 +80,13 @@ if (value.length > 100) return this.setState({}, () => { this.props.updatemenu({...this.props.config, easyCode: value}) + }) + } + + changeRemark = (e) => { + let value = e.target.value || '' + this.setState({}, () => { + this.props.updatemenu({...this.props.config, Remark: value}) }) } @@ -217,6 +226,19 @@ }} /> </Form.Item> </Col> + <Col span={24}> + <Form.Item label="澶囨敞"> + {getFieldDecorator('Remark', { + initialValue: config.Remark || '', + rules: [ + { + max: 512, + message: '澶囨敞鏈�澶�512涓瓧绗︼紒' + } + ] + })(<TextArea rows={2} placeholder={''} onChange={this.changeRemark} />)} + </Form.Item> + </Col> </Row> </Form> ) diff --git a/src/templates/subtableconfig/menuform/index.jsx b/src/templates/subtableconfig/menuform/index.jsx index 263b518..bc95bde 100644 --- a/src/templates/subtableconfig/menuform/index.jsx +++ b/src/templates/subtableconfig/menuform/index.jsx @@ -5,6 +5,8 @@ import { formRule } from '@/utils/option.js' import './index.scss' +const { TextArea } = Input + class MainSearch extends Component { static propTpyes = { dict: PropTypes.object, // 瀛楀吀椤� @@ -102,7 +104,7 @@ message: formRule.input.message } ] - })(<Input placeholder="" autoComplete="off" onChange={this.changeRemark}/>)} + })(<TextArea rows={2} placeholder="" autoComplete="off" onChange={this.changeRemark}/>)} </Form.Item> </Col> </Row> diff --git a/src/templates/zshare/unattended/index.jsx b/src/templates/zshare/unattended/index.jsx index 48b6c50..1ed4f34 100644 --- a/src/templates/zshare/unattended/index.jsx +++ b/src/templates/zshare/unattended/index.jsx @@ -35,7 +35,7 @@ this.setState({ actions, - autoMatic: config.autoMatic || {enable: 'false', onFail: 'stop', action: ''}, + autoMatic: config.autoMatic || {enable: 'false', onFail: 'stop', onSuccess: 'stay', action: ''}, visible: true }) } diff --git a/src/templates/zshare/unattended/settingform/index.jsx b/src/templates/zshare/unattended/settingform/index.jsx index b023ff9..6549c4a 100644 --- a/src/templates/zshare/unattended/settingform/index.jsx +++ b/src/templates/zshare/unattended/settingform/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Tooltip, Icon, Select, Radio } from 'antd' +import { Form, Row, Col, Tooltip, Icon, Select, Radio, InputNumber } from 'antd' // import './index.scss' @@ -11,7 +11,8 @@ } state = { - enable: this.props.autoMatic.enable + enable: this.props.autoMatic.enable, + onFinish: this.props.autoMatic.onFinish || 'over' } handleConfirm = () => { @@ -30,7 +31,7 @@ render() { const { actions, autoMatic } = this.props const { getFieldDecorator } = this.props.form - const { enable } = this.state + const { enable, onFinish } = this.state const formItemLayout = { labelCol: { @@ -58,7 +59,7 @@ )} </Form.Item> </Col> - <Col span={20}> + {enable === 'true' ? <Col span={20}> <Form.Item label={ <Tooltip placement="topLeft" title="鐢ㄤ簬鑷姩鎵ц鐨勬寜閽��"> <Icon type="question-circle" style={{color: '#c49f47', marginRight: '3px'}} /> @@ -68,7 +69,7 @@ {getFieldDecorator('action', { initialValue: autoMatic.action || '', rules: [{ - required: enable === 'true', + required: true, message: '璇烽�夋嫨鎵ц鎸夐挳锛�' }] })( @@ -79,25 +80,75 @@ </Select> )} </Form.Item> - </Col> - <Col span={20}> + </Col> : null} + {enable === 'true' ? <Col span={20}> <Form.Item label={ - <Tooltip placement="topLeft" title="鎸夐挳鎵ц澶辫触鏃讹紝鍚庣画鐨勫鐞嗘柟寮忋��"> + <Tooltip placement="topLeft" title="鎸夐挳鎵ц鎴愬姛锛屽悗缁殑澶勭悊鏂瑰紡銆�"> <Icon type="question-circle" style={{color: '#c49f47', marginRight: '3px'}} /> - 鎶ラ敊鏃� + 鎴愬姛鍚� </Tooltip> }> - {getFieldDecorator('onFail', { - initialValue: autoMatic.onFail, + {getFieldDecorator('onSuccess', { + initialValue: autoMatic.onSuccess || 'stay', })( - <Radio.Group onChange={(e) => this.setState({enable: e.target.value})}> - <Radio value="stop">鍋滄</Radio> - <Radio value="skip">璺宠繃</Radio> - <Radio value="again">閲嶆柊鎵ц</Radio> + <Radio.Group> + <Radio value="stay">褰撳墠琛�</Radio> + <Radio value="next">涓嬩竴琛�</Radio> </Radio.Group> )} </Form.Item> - </Col> + </Col> : null} + {enable === 'true' ? <Col span={20}> + <Form.Item label={ + <Tooltip placement="topLeft" title="鎸夐挳鎵ц澶辫触鏃讹紝鍚庣画鐨勫鐞嗘柟寮忋��"> + <Icon type="question-circle" style={{color: '#c49f47', marginRight: '3px'}} /> + 澶辫触鍚� + </Tooltip> + }> + {getFieldDecorator('onFail', { + initialValue: autoMatic.onFail || 'stop', + })( + <Radio.Group> + <Radio value="stop">鍋滄</Radio> + <Radio value="next">涓嬩竴琛�</Radio> + <Radio value="stay">褰撳墠琛�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} + {enable === 'true' ? <Col span={20}> + <Form.Item label="瀹屾垚鍚�"> + {getFieldDecorator('onFinish', { + initialValue: autoMatic.onFinish || 'over', + })( + <Radio.Group onChange={(e) => this.setState({onFinish: e.target.value})}> + <Radio value="over">缁撴潫</Radio> + <Radio value="restart">閲嶆柊鍚姩</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} + {enable === 'true' && onFinish === 'restart' ? <Col span={20}> + <Form.Item label="鍚姩闂撮殧(s)"> + {getFieldDecorator('interval', { + initialValue: autoMatic.interval === 0 ? 0 : (autoMatic.interval || 600), + })( + <InputNumber style={{width: '100%'}} min={0} precision={0}/> + )} + </Form.Item> + </Col> : null} + {enable === 'true' && onFinish === 'restart' ? <Col span={20}> + <Form.Item label="閲嶅惎鏃�"> + {getFieldDecorator('restart', { + initialValue: autoMatic.restart || 'first', + })( + <Radio.Group> + <Radio value="first">绗竴琛�</Radio> + <Radio value="next">涓嬩竴琛�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} </Row> </Form> ) diff --git a/src/views/menudesign/menuform/index.jsx b/src/views/menudesign/menuform/index.jsx index 598a89e..2e62681 100644 --- a/src/views/menudesign/menuform/index.jsx +++ b/src/views/menudesign/menuform/index.jsx @@ -6,6 +6,8 @@ import options from '@/store/options.js' import './index.scss' +const { TextArea } = Input + class CustomMenuForm extends Component { static propTpyes = { dict: PropTypes.object, // 瀛楀吀椤� @@ -169,6 +171,10 @@ // 鍔╄鐮� changeEasyCode = (e) => { this.props.updateConfig({...this.props.config, easyCode: e.target.value}) + } + + changeRemark = (e) => { + this.props.updateConfig({...this.props.config, Remark: e.target.value}) } changeCacheDay = (val) => { @@ -357,6 +363,19 @@ }} /> </Form.Item> </Col> + <Col span={24}> + <Form.Item label="澶囨敞"> + {getFieldDecorator('Remark', { + initialValue: config.Remark || '', + rules: [ + { + max: 512, + message: '澶囨敞鏈�澶�512涓瓧绗︼紒' + } + ] + })(<TextArea rows={2} placeholder={''} onChange={this.changeRemark} />)} + </Form.Item> + </Col> </Row> </Form> ) diff --git a/src/views/mobdesign/menuform/index.jsx b/src/views/mobdesign/menuform/index.jsx index 5da1243..f053755 100644 --- a/src/views/mobdesign/menuform/index.jsx +++ b/src/views/mobdesign/menuform/index.jsx @@ -5,6 +5,7 @@ import asyncComponent from '@/utils/asyncComponent' import './index.scss' +const { TextArea } = Input const SourceComponent = asyncComponent(() => import('@/menu/components/share/sourcecomponent')) class CustomMenuForm extends Component { @@ -40,6 +41,10 @@ // 鑿滃崟鍙傛暟 changeNo = (e) => { this.props.updateConfig({...this.props.config, MenuNo: e.target.value}) + } + + changeRemark = (e) => { + this.props.updateConfig({...this.props.config, Remark: e.target.value}) } changeCacheDay = (val) => { @@ -199,6 +204,19 @@ )} </Form.Item> </Col> : null} + <Col span={24}> + <Form.Item label="澶囨敞"> + {getFieldDecorator('Remark', { + initialValue: config.Remark || '', + rules: [ + { + max: 512, + message: '澶囨敞鏈�澶�512涓瓧绗︼紒' + } + ] + })(<TextArea rows={2} placeholder={''} onChange={this.changeRemark} />)} + </Form.Item> + </Col> </Row> </Form> ) diff --git a/src/views/pcdesign/menuform/index.jsx b/src/views/pcdesign/menuform/index.jsx index 89b7c43..7a4c855 100644 --- a/src/views/pcdesign/menuform/index.jsx +++ b/src/views/pcdesign/menuform/index.jsx @@ -4,6 +4,8 @@ import './index.scss' +const { TextArea } = Input + class CustomMenuForm extends Component { static propTpyes = { dict: PropTypes.object, // 瀛楀吀椤� @@ -33,6 +35,10 @@ // 鑿滃崟鍙傛暟 changeNo = (e) => { this.props.updateConfig({...this.props.config, MenuNo: e.target.value}) + } + + changeRemark = (e) => { + this.props.updateConfig({...this.props.config, Remark: e.target.value}) } changeCacheDay = (val) => { @@ -163,6 +169,19 @@ )} </Form.Item> </Col> : null} + <Col span={24}> + <Form.Item label="澶囨敞"> + {getFieldDecorator('Remark', { + initialValue: config.Remark || '', + rules: [ + { + max: 512, + message: '澶囨敞鏈�澶�512涓瓧绗︼紒' + } + ] + })(<TextArea rows={2} placeholder={''} onChange={this.changeRemark} />)} + </Form.Item> + </Col> </Row> </Form> ) -- Gitblit v1.8.0