| | |
| | | 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 = { |
| | |
| | | */ |
| | | 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()}) |
| | | } |
| | |
| | | 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 |
| | |
| | | card: element |
| | | }) |
| | | |
| | | MKEmitter.emit('changeStyle', [config.uuid, element.uuid], options, _style) |
| | | MKEmitter.emit('changeStyle', [config.uuid, 'actionlist', element.uuid], options, _style) |
| | | } |
| | | |
| | | addButton = (cardId, element) => { |
| | |
| | | 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 |
| | | } |
| | | |
| | | /** |
| | |
| | | menulist = [] |
| | | } |
| | | |
| | | let modules = this.getModules(menu.components, config.uuid) |
| | | let modules = MenuUtils.getSubModules(menu.components, config.uuid) |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | |
| | | 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 |
| | |
| | | if (labelrepet) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['model.name.exist'] + ' !', |
| | | message: '名称已存在!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | |
| | | |
| | | _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() {} |
| | |
| | | * @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 { |