| | |
| | | import React, {Component} from 'react' |
| | | import React, { Component } from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Modal, notification } from 'antd' |
| | | import { SnippetsOutlined } from '@ant-design/icons' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import MenuUtils from '@/utils/utils-custom.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | |
| | | const PasteForm = asyncComponent(() => import('@/templates/zshare/pasteform')) |
| | |
| | | visible: false |
| | | } |
| | | |
| | | handleMenuClick = () => { |
| | | this.setState({visible: true}) |
| | | resetconfig = (item, appType) => { |
| | | if (item.copyType === 'action') { |
| | | MenuUtils.resetBtn(item, item.uuid) |
| | | } else if (item.copyType === 'cardcell') { |
| | | item.setting = item.setting || {} |
| | | item.setting.width = item.setting.width || 6 |
| | | delete item.$cardType |
| | | |
| | | if (item.elements) { |
| | | item.elements = item.elements.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | | |
| | | if (cell.eleType === 'button') { |
| | | MenuUtils.resetBtn(cell, item.uuid) |
| | | } |
| | | return cell |
| | | }) |
| | | if (appType === 'mob') { |
| | | item.elements = item.elements.filter(cell => { |
| | | if (cell.eleType === 'button' && ['excelIn', 'tab'].includes(cell.OpenType)) { |
| | | return false |
| | | } |
| | | return true |
| | | }) |
| | | } |
| | | } |
| | | if (appType === 'mob') { |
| | | item.backElements = [] |
| | | } else if (item.backElements) { |
| | | item.backElements = item.backElements.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | | |
| | | if (cell.eleType === 'button') { |
| | | MenuUtils.resetBtn(cell, item.uuid) |
| | | } |
| | | return cell |
| | | }) |
| | | } |
| | | } |
| | | |
| | | return item |
| | | } |
| | | |
| | | pasteSubmit = () => { |
| | |
| | | notification.warning({ top: 92, message: '配置信息格式错误!', duration: 5 }) |
| | | return |
| | | } |
| | | |
| | | let appType = sessionStorage.getItem('appType') |
| | | res.uuid = Utils.getuuid() |
| | | |
| | | res = this.resetconfig(res, appType) |
| | | |
| | | this.props.updateConfig(res, (result) => { |
| | | if (result.status) { |
| | | notification.success({ |
| | |
| | | }) |
| | | this.setState({visible: false}) |
| | | } else { |
| | | notification.success({ |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 2 |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |