From 236fa30c934046d3b90d6345bb7749ab332eb2c9 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 12 十月 2021 23:29:18 +0800 Subject: [PATCH] 2021-10-12 --- src/templates/zshare/modalform/index.jsx | 14 +-- src/templates/zshare/unattended/settingform/index.scss | 0 src/templates/zshare/unattended/index.scss | 8 ++ src/templates/zshare/unattended/index.jsx | 74 ++++++++++++++++++ src/templates/zshare/unattended/settingform/index.jsx | 86 +++++++++++++++++++++ src/templates/comtableconfig/index.jsx | 2 6 files changed, 176 insertions(+), 8 deletions(-) diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 4eea89d..037c3d6 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -29,6 +29,7 @@ const Versions = asyncComponent(() => import('@/menu/versions')) const UrlFieldComponent = asyncComponent(() => import('@/menu/urlfieldcomponent')) const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) +const Unattended = asyncComponent(() => import('@/templates/zshare/unattended')) const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcomponent')) const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) @@ -1260,6 +1261,7 @@ </div> } bordered={false} extra={ <div> + <Unattended config={config} updateConfig={this.updateconfig}/> <Versions MenuId={menu.MenuID} open_edition={openEdition} updateConfig={this.refreshConfig}/> <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/> <EditComponent dict={this.state.dict} type="table" options={['search', 'form', 'action', 'columns']} config={this.state.config} MenuID={this.props.menu.MenuID} thawButtons={this.state.thawButtons} refresh={this.editConfig}/> diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx index 95db75a..a950131 100644 --- a/src/templates/zshare/modalform/index.jsx +++ b/src/templates/zshare/modalform/index.jsx @@ -616,14 +616,12 @@ ] })( <Radio.Group onChange={(e) => {this.onChange(e, item.key)}}> - { - item.options.map(option => { - return ( - <Radio key={option.value} value={option.value}>{option.text}</Radio> - ) - }) - } - </Radio.Group>, + {item.options.map(option => { + return ( + <Radio key={option.value} value={option.value}>{option.text}</Radio> + ) + })} + </Radio.Group> )} </Form.Item> </Col> diff --git a/src/templates/zshare/unattended/index.jsx b/src/templates/zshare/unattended/index.jsx new file mode 100644 index 0000000..3881333 --- /dev/null +++ b/src/templates/zshare/unattended/index.jsx @@ -0,0 +1,74 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { Modal, Button } from 'antd' + +import SettingForm from './settingform' +import './index.scss' + +class Unattended extends Component { + static propTpyes = { + config: PropTypes.object, + updateConfig: PropTypes.func + } + + state = { + visible: false, + actions: [], + autoMatic: null + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } + + trigger = () => { + const { config } = this.props + let actions = [] + + config.action.forEach(item => { + if (item.position !== 'toolbar') return + if (['pop', 'prompt', 'exec'].includes(item.OpenType) || (item.OpenType === 'funcbutton' && item.funcType === 'print')) { + actions.push(item) + } + }) + + this.setState({ + actions, + autoMatic: config.autoMatic || {enable: 'false'}, + visible: true + }) + } + + submit = () => { + // let config = fromJS(this.props.config).toJS() + + this.settingRef.handleConfirm().then(res => { + + }) + } + + render() { + const { visible, actions, autoMatic } = this.state + + return ( + <div style={{display: 'inline-block'}}> + <Button className="mk-border-purple" icon="user" onClick={this.trigger}>鏃犱汉鍊煎畧</Button> + <Modal + title="鏃犱汉鍊煎畧" + wrapClassName="unattended-field-modal" + visible={visible} + width={600} + maskClosable={false} + onOk={this.submit} + onCancel={() => { this.setState({ visible: false })}} + destroyOnClose + > + <SettingForm actions={actions} autoMatic={autoMatic} wrappedComponentRef={(inst) => this.settingRef = inst}/> + </Modal> + </div> + ) + } +} + +export default Unattended \ No newline at end of file diff --git a/src/templates/zshare/unattended/index.scss b/src/templates/zshare/unattended/index.scss new file mode 100644 index 0000000..262fc6d --- /dev/null +++ b/src/templates/zshare/unattended/index.scss @@ -0,0 +1,8 @@ +.unattended-field-modal { + .ant-modal { + top: 70px; + } + .ant-modal-body { + min-height: 150px; + } +} \ No newline at end of file diff --git a/src/templates/zshare/unattended/settingform/index.jsx b/src/templates/zshare/unattended/settingform/index.jsx new file mode 100644 index 0000000..5191f35 --- /dev/null +++ b/src/templates/zshare/unattended/settingform/index.jsx @@ -0,0 +1,86 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { Form, Row, Col, Tooltip, Icon, Select, Radio } from 'antd' + +// import './index.scss' + +class SettingForm extends Component { + static propTpyes = { + autoMatic: PropTypes.object, + actions: PropTypes.array + } + + state = {} + + handleConfirm = () => { + // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� + return new Promise((resolve, reject) => { + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + resolve(values) + } else { + reject(err) + } + }) + }) + } + + render() { + const { actions, autoMatic } = this.props + const { getFieldDecorator } = this.props.form + + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 8 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + } + } + + return ( + <Form {...formItemLayout}> + <Row gutter={24}> + <Col span={20}> + <Form.Item label="鏄惁鍚敤"> + {getFieldDecorator('enable', { + initialValue: autoMatic.enable, + })( + <Radio.Group> + <Radio value="true">鏄�</Radio> + <Radio value="false">鍚�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> + <Col span={20}> + <Form.Item label={ + <Tooltip placement="topLeft" title="鐢ㄤ簬鑷姩鎵ц鐨勬寜閽��"> + <Icon type="question-circle" style={{color: '#c49f47', marginRight: '3px'}} /> + 鎸夐挳 + </Tooltip> + }> + {getFieldDecorator('action', { + initialValue: autoMatic.action || '', + rules: [{ + required: true, + message: '璇烽�夋嫨鎵ц鎸夐挳锛�' + }] + })( + <Select> + {actions.map((option, i) => + <Select.Option key={i} value={option.uuid}>{option.label}</Select.Option> + )} + </Select> + )} + </Form.Item> + </Col> + </Row> + </Form> + ) + } +} + +export default Form.create()(SettingForm) \ No newline at end of file diff --git a/src/templates/zshare/unattended/settingform/index.scss b/src/templates/zshare/unattended/settingform/index.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/templates/zshare/unattended/settingform/index.scss -- Gitblit v1.8.0