From cc23ebd63e2aec82db0a43965f4731789316fb78 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 22 七月 2021 09:25:19 +0800 Subject: [PATCH] 2021-07-22 --- src/pc/transfer/index.jsx | 96 ++++++++++++++++++++++++ src/pc/transfer/settingform/index.jsx | 69 +++++++++++++++++ src/pc/transfer/index.scss | 0 src/views/pcdesign/index.jsx | 2 src/menu/components/share/normalheader/index.jsx | 1 src/views/mobdesign/index.jsx | 2 src/pc/transfer/settingform/index.scss | 11 ++ src/views/menudesign/index.jsx | 24 +++-- 8 files changed, 195 insertions(+), 10 deletions(-) diff --git a/src/menu/components/share/normalheader/index.jsx b/src/menu/components/share/normalheader/index.jsx index 732d111..fca49ac 100644 --- a/src/menu/components/share/normalheader/index.jsx +++ b/src/menu/components/share/normalheader/index.jsx @@ -53,6 +53,7 @@ changeStyle = () => { const { config } = this.props + // MKEmitter.emit('changeStyle', [config.uuid, 'header'], ['font', 'height', 'border'], config.headerStyle) MKEmitter.emit('changeStyle', [config.uuid, 'header'], ['font', 'border'], config.headerStyle) } diff --git a/src/pc/transfer/index.jsx b/src/pc/transfer/index.jsx new file mode 100644 index 0000000..615c3b8 --- /dev/null +++ b/src/pc/transfer/index.jsx @@ -0,0 +1,96 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { Button, Modal, notification } from 'antd' +// import moment from 'moment' + +import zhCN from '@/locales/zh-CN/model.js' +import enUS from '@/locales/en-US/model.js' +// import Utils from '@/utils/utils.js' +import SettingForm from './settingform' +import Api from '@/api' +import './index.scss' + +class TransferWrap extends Component { + static propTpyes = { + MenuID: PropTypes.string + } + + state = { + dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + visible: false, + loading: false, + translist: [] + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } + + verifySubmit = () => { + this.verifyRef.handleConfirm().then(res => { + this.setState({ + // loading: true, + visible: false + }) + }) + } + + getTransList = () => { + let param = { + func: 's_get_sVersion', + dataM: 'Y', + PageSize: 9999, + PageIndex: 1, + OrderCol: 'ID desc' + } + + this.setState({ + visible: true, + loading: false + }) + + Api.getCloudConfig(param).then(result => { + if (result.status) { + this.setState({ + translist: result.data + }) + } else { + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + } + }) + } + + render () { + const { visible, dict, loading, translist } = this.state + + return ( + <div className="transfer-wrap"> + <Button icon="pull-request" className="mk-border-green" onClick={this.getTransList}>浼犺緭鍙�</Button> + <Modal + title="鍔犲叆浼犺緭鍙�" + visible={visible} + width={500} + maskClosable={false} + okText={dict['model.submit']} + onOk={this.verifySubmit} + onCancel={() => { this.setState({ visible: false }) }} + confirmLoading={loading} + destroyOnClose + > + <SettingForm + dict={dict} + translist={translist} + wrappedComponentRef={(inst) => this.verifyRef = inst} + /> + </Modal> + </div> + ) + } +} + +export default TransferWrap \ No newline at end of file diff --git a/src/pc/transfer/index.scss b/src/pc/transfer/index.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/pc/transfer/index.scss diff --git a/src/pc/transfer/settingform/index.jsx b/src/pc/transfer/settingform/index.jsx new file mode 100644 index 0000000..70bc505 --- /dev/null +++ b/src/pc/transfer/settingform/index.jsx @@ -0,0 +1,69 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { Form, Row, Col, Select } from 'antd' + +import './index.scss' + +class SettingForm extends Component { + static propTpyes = { + dict: PropTypes.object, + translist: PropTypes.array, + } + + state = {} + + handleConfirm = () => { + // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� + return new Promise((resolve, reject) => { + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + resolve(values) + } else { + reject(err) + } + }) + }) + } + + render() { + const { getFieldDecorator } = this.props.form + const { translist } = this.props + + 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('VersionName', { + initialValue: '', + rules: [{ + required: true, + message: '璇烽�夋嫨浼犺緭鍙凤紒' + }] + })( + <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}> + {translist.map(option => + <Select.Option key={option.VersionName} value={option.VersionName}>{option.ProgramName}</Select.Option> + )} + </Select> + )} + </Form.Item> + </Col> + </Row> + </Form> + ) + } +} + +export default Form.create()(SettingForm) \ No newline at end of file diff --git a/src/pc/transfer/settingform/index.scss b/src/pc/transfer/settingform/index.scss new file mode 100644 index 0000000..159130b --- /dev/null +++ b/src/pc/transfer/settingform/index.scss @@ -0,0 +1,11 @@ +.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/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index b162520..85e7fe4 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -68,7 +68,8 @@ config: null, popBtn: null, // 寮圭獥鏍囩椤� visible: false, - customComponents: [] + customComponents: [], + comloading: false } UNSAFE_componentWillMount() { @@ -203,10 +204,11 @@ }) this.setState({ - config: {...config, components: []} + config: {...config, components}, + comloading: true }, () => { this.setState({ - config: {...config, components: components} + comloading: false }) }) } @@ -656,7 +658,8 @@ if (res.status) { config.open_edition = res.open_edition || '' this.setState({ - oriConfig: fromJS(config).toJS() + config, + oriConfig: fromJS(config).toJS(), }) if (btnParam.LText) { @@ -774,10 +777,10 @@ copyButtons: [], thawButtons: [], menuloading: false, - config: {...config, components: []} + comloading: true }, () => { this.setState({ - config: {...this.state.config, components: this.state.oriConfig.components} + comloading: false }) }) notification.success({ @@ -902,10 +905,11 @@ resetConfig = (config) => { this.setState({ - config: {...config, components: []} + config, + comloading: true }, () => { this.setState({ - config: config + comloading: false }) }) window.GLOB.customMenu = config @@ -921,7 +925,7 @@ } render () { - const { activeKey, MenuType, popBtn, visible, dict, MenuId, config, ParentId, MenuName, MenuNo, menuloading, customComponents } = this.state + const { activeKey, comloading, MenuType, popBtn, visible, dict, MenuId, config, ParentId, MenuName, MenuNo, menuloading, customComponents } = this.state return ( <ConfigProvider locale={_locale}> @@ -990,7 +994,7 @@ <Button type="default" onClick={this.closeView}>鍏抽棴</Button> </div> } style={{ width: '100%' }}> - {config && config.components ? <MenuShell menu={config} handleList={this.updateConfig} /> : null} + {config && !comloading ? <MenuShell menu={config} handleList={this.updateConfig} /> : null} </Card> </div> </div> diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index f5a888a..8638eb2 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -26,6 +26,7 @@ const MenuForm = asyncComponent(() => import('./menuform')) const MobShell = asyncComponent(() => import('@/mob/mobshell')) const CreateView = asyncComponent(() => import('@/pc/createview')) +const Transfer = asyncComponent(() => import('@/pc/transfer')) const SourceWrap = asyncComponent(() => import('@/mob/modulesource')) const BgController = asyncComponent(() => import('@/pc/bgcontroller')) const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) @@ -1559,6 +1560,7 @@ <Button className="mk-border-green" icon="home" onClick={this.setHomeView}>璁句负棣栭〉</Button> <Button className="mk-border-danger" icon="redo" onClick={this.refreshView}>寮哄埗鍒锋柊</Button> <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> + <Transfer MenuID={MenuId} /> <Button type="default" onClick={this.closeView}>鍏抽棴</Button> </div> <div className={'menu-body menu-view' + (menuloading ? 'saving' : '')}> diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index 0e00352..a2d3b12 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -23,6 +23,7 @@ const { confirm } = Modal const MenuForm = asyncComponent(() => import('./menuform')) +const Transfer = asyncComponent(() => import('@/pc/transfer')) const MenuShell = asyncComponent(() => import('@/pc/menushell')) const SourceWrap = asyncComponent(() => import('@/pc/modulesource')) const CreateView = asyncComponent(() => import('@/pc/createview')) @@ -1561,6 +1562,7 @@ <Button className="mk-border-green" icon="home" onClick={this.setHomeView}>璁句负棣栭〉</Button> <Button className="mk-border-danger" icon="redo" onClick={this.refreshView}>寮哄埗鍒锋柊</Button> <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> + <Transfer MenuID={MenuId} /> <Button type="default" onClick={this.closeView}>鍏抽棴</Button> </div> <div className={'menu-body menu-view' + (menuloading ? 'saving' : '')}> -- Gitblit v1.8.0