From d1d9dc29318cb2a9a466246adff7b78fe36cf623 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 11 三月 2023 17:51:29 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/templates/zshare/editcomponent/index.jsx | 132 +++----------------------------------------- 1 files changed, 9 insertions(+), 123 deletions(-) diff --git a/src/templates/zshare/editcomponent/index.jsx b/src/templates/zshare/editcomponent/index.jsx index b5672d0..e1443e4 100644 --- a/src/templates/zshare/editcomponent/index.jsx +++ b/src/templates/zshare/editcomponent/index.jsx @@ -1,117 +1,23 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Modal, Spin, notification, Button } from 'antd' -import { UnlockOutlined, SnippetsOutlined } from '@ant-design/icons' +import { Modal, notification, Button } from 'antd' +import { SnippetsOutlined } from '@ant-design/icons' -import Api from '@/api' import Utils from '@/utils/utils.js' import PasteForm from '@/templates/zshare/pasteform' -import TransferForm from '@/templates/zshare/basetransferform' import MKEmitter from '@/utils/events.js' import './index.scss' class editComponent extends Component { static propTpyes = { options: PropTypes.array, - MenuID: PropTypes.any, config: PropTypes.object, - thawButtons: PropTypes.any, refresh: PropTypes.func } state = { - thawVisible: false, - thawbtnlist: null, - pasteVisible: false, - targetKeys: [] - } - - /** - * @description 瑙e喕鎸夐挳 - */ - handleThaw = () => { - const { MenuID } = this.props - - this.setState({ - thawVisible: true, - targetKeys: [] - }) - - Api.getSystemConfig({ - func: 'sPC_Get_FrozenMenu', - ParentID: MenuID, - TYPE: 40 - }).then(res => { - if (res.status) { - let _list = [] - - res.data.forEach(menu => { - let _conf = '' - - if (menu.ParentParam) { - try { - _conf = JSON.parse(window.decodeURIComponent(window.atob(menu.ParentParam))) - } catch (e) { - console.warn('Parse Failure') - _conf = '' - } - } - - if (_conf) { - _list.push({ - key: menu.MenuID, - title: menu.MenuName, - btnParam: _conf - }) - } - }) - - this.setState({ - thawbtnlist: _list - }) - } else { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - } - - /** - * @description 瑙e喕鎸夐挳鎻愪氦 - */ - thawBtnSubmit = () => { - const { thawButtons } = this.props - const { thawbtnlist, targetKeys } = this.state - let config = fromJS(this.props.config).toJS() - - if (targetKeys.length === 0) { - notification.warning({ - top: 92, - message: '璇烽�夋嫨瑙e喕鎸夐挳', - duration: 5 - }) - } else { - thawbtnlist.forEach(item => { - if (targetKeys.includes(item.key)) { - config.action.push(item.btnParam) - } - }) - - this.props.refresh({ - type: 'thaw', - thawButtons: [...thawButtons, ...targetKeys], - config: config - }) - - this.setState({ - thawVisible: false, - targetKeys: [] - }) - } + visible: false } pasteSubmit = () => { @@ -176,6 +82,8 @@ } this.props.plusFields([res]) + } else if (res.copyType === 'forms') { + this.props.plusFields(res, 'forms') } else { notification.warning({ top: 92, @@ -185,45 +93,23 @@ return } this.setState({ - pasteVisible: false + visible: false }) }) } - handleMenuClick = e => { - if (e.key === 'thaw') { - this.handleThaw() - } else if (e.key === 'paste') { - this.setState({pasteVisible: true}) - } - } - render() { - const { MenuID } = this.props - return ( <div style={{display: 'inline-block'}}> - {MenuID ? <Button className="mk-border-green" onClick={this.handleThaw}><UnlockOutlined /> 瑙e喕鎸夐挳</Button> : null} - <Button style={{borderColor: '#40a9ff', color: '#40a9ff'}} onClick={() => this.setState({pasteVisible: true})}><SnippetsOutlined /> 绮樿创</Button> - {/* 瑙e喕鎸夐挳妯℃�佹 */} - <Modal - title="瑙e喕鎸夐挳" - visible={this.state.thawVisible} - onOk={this.thawBtnSubmit} - onCancel={() => {this.setState({thawVisible: false, thawbtnlist: null, targetKeys: []})}} - destroyOnClose - > - {!this.state.thawbtnlist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} - {this.state.thawbtnlist && <TransferForm onChange={(vals) => this.setState({targetKeys: vals})} menulist={this.state.thawbtnlist}/>} - </Modal> + <Button style={{borderColor: '#40a9ff', color: '#40a9ff'}} onClick={() => this.setState({visible: true})}><SnippetsOutlined /> 绮樿创</Button> {/* 鎸夐挳閰嶇疆淇℃伅绮樿创澶嶅埗 */} <Modal title="绮樿创" - visible={this.state.pasteVisible} + visible={this.state.visible} width={600} maskClosable={false} onOk={this.pasteSubmit} - onCancel={() => {this.setState({pasteVisible: false})}} + onCancel={() => {this.setState({visible: false})}} destroyOnClose > <PasteForm wrappedComponentRef={(inst) => this.pasteFormRef = inst} inputSubmit={this.pasteSubmit}/> -- Gitblit v1.8.0