From 0227c25e4ed573d3095ada3f9c9a4ba5f18b0de5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 20 一月 2021 10:53:01 +0800 Subject: [PATCH] 2021-01-20 --- src/menu/components/share/actioncomponent/index.jsx | 92 +++++++++++----------------------------------- 1 files changed, 22 insertions(+), 70 deletions(-) diff --git a/src/menu/components/share/actioncomponent/index.jsx b/src/menu/components/share/actioncomponent/index.jsx index a56e70d..3c62910 100644 --- a/src/menu/components/share/actioncomponent/index.jsx +++ b/src/menu/components/share/actioncomponent/index.jsx @@ -9,18 +9,20 @@ import zhCN from '@/locales/zh-CN/model.js' import enUS from '@/locales/en-US/model.js' import { getActionForm } from './formconfig' +import asyncSpinComponent from '@/utils/asyncSpinComponent' import MKEmitter from '@/utils/events.js' import ActionForm from './actionform' -import VerifyCard from '@/templates/zshare/verifycard' +import MenuUtils from '@/menu/utils/menuUtils.js' import CreateFunc from '@/templates/zshare/createfunc' -import VerifyPrint from '@/templates/sharecomponent/actioncomponent/verifyprint' -import VerifyExcelIn from '@/templates/sharecomponent/actioncomponent/verifyexcelin' -import VerifyExcelOut from '@/templates/sharecomponent/actioncomponent/verifyexcelout' import DragElement from './dragaction' import './index.scss' const { confirm } = Modal +const VerifyCard = asyncSpinComponent(() => import('@/templates/zshare/verifycard')) +const VerifyPrint = asyncSpinComponent(() => import('@/templates/sharecomponent/actioncomponent/verifyprint')) +const VerifyExcelIn = asyncSpinComponent(() => import('@/templates/sharecomponent/actioncomponent/verifyexcelin')) +const VerifyExcelOut = asyncSpinComponent(() => import('@/templates/sharecomponent/actioncomponent/verifyexcelout')) class ActionComponent extends Component { static propTpyes = { @@ -58,7 +60,6 @@ */ UNSAFE_componentWillReceiveProps (nextProps) { const { actionlist } = this.state - if (!is(fromJS(nextProps.config.action), fromJS(this.props.config.action)) && !is(fromJS(nextProps.config.action), fromJS(actionlist))) { this.setState({actionlist: fromJS(nextProps.config.action).toJS()}) } @@ -83,7 +84,7 @@ const { config } = this.props const { card, actionlist } = this.state - if (comIds.length !== 2 || comIds[0] !== config.uuid || comIds[1] === 'header') return + if (comIds[0] !== config.uuid || comIds[1] !== 'actionlist') return let _card = fromJS(card).toJS() _card.btnstyle = style @@ -110,7 +111,7 @@ card: element }) - MKEmitter.emit('changeStyle', [config.uuid, element.uuid], options, _style) + MKEmitter.emit('changeStyle', [config.uuid, 'actionlist', element.uuid], options, _style) } addButton = (cardId, element) => { @@ -136,57 +137,6 @@ this.props.updateaction({...config, action: list}) }) } - } - - getModules = (components, selfId) => { - let modules = components.map(item => { - if (item.uuid === selfId) { - return { - children: null - } - } else if (item.format) { - return { - value: item.uuid, - label: item.name - } - } else if (item.type === 'tabs') { - let _item = { - value: item.uuid, - label: item.name, - children: item.subtabs.map(f_tab => { - let subItem = { - value: f_tab.uuid, - label: f_tab.label, - children: this.getModules(f_tab.components, selfId) - } - - if (!subItem.children || subItem.children.length === 0) { - return {children: null} - } - return subItem - }) - } - - _item.children = _item.children.filter(t => t.children !== null) - - if (_item.children.length === 0) { - return {children: null} - } - - return _item - } else { - return { - children: null - } - } - }) - - modules = modules.filter(mod => mod.children !== null) - - if (modules.length === 0) { - return null - } - return modules } /** @@ -223,7 +173,7 @@ menulist = [] } - let modules = this.getModules(menu.components, config.uuid) + let modules = MenuUtils.getSubModules(menu.components, config.uuid) this.setState({ visible: true, @@ -279,10 +229,10 @@ if (btn.class !== item.class || btn.show !== item.show || !btn.btnstyle.color) { if (btn.show === 'link' || btn.show === 'icon') { btn.btnstyle.color = color[btn.class] - btn.btnstyle.background = 'transparent' + btn.btnstyle.backgroundColor = 'transparent' } else { btn.btnstyle.color = '#ffffff' - btn.btnstyle.background = color[btn.class] + btn.btnstyle.backgroundColor = color[btn.class] } } return btn @@ -294,7 +244,7 @@ if (labelrepet) { notification.warning({ top: 92, - message: this.state.dict['model.name.exist'] + ' !', + message: '鍚嶇О宸插瓨鍦�!', duration: 5 }) return @@ -324,19 +274,19 @@ _actionlist = _actionlist.filter(item => item.uuid !== card.uuid) - let delButtons = sessionStorage.getItem('delButtons') - try { - delButtons = JSON.parse(delButtons) - delButtons.push(card.uuid) - } catch { - delButtons = [card.uuid] + if (!card.origin) { + MKEmitter.emit('delButtons', [card.uuid]) } - sessionStorage.setItem('delButtons', JSON.stringify(delButtons)) + + let btnlog = config.btnlog || [] + if (card.OpenType === 'popview' || card.verify || card.modal) { + btnlog.push(card) + } _this.setState({ actionlist: _actionlist }, () => { - _this.props.updateaction({...config, action: _actionlist}) + _this.props.updateaction({...config, action: _actionlist, btnlog}) }) }, onCancel() {} @@ -454,6 +404,8 @@ * @description 鎸夐挳鍙屽嚮瑙﹀彂瀛愰厤缃� */ btnDoubleClick = (element) => { + if (sessionStorage.getItem('style-control') && sessionStorage.getItem('style-control') !== 'false') return + if (element.OpenType === 'pop' || element.OpenType === 'popview') { this.props.setSubConfig(element) } else { -- Gitblit v1.8.0