From 5046d0d13dc6a8563b8e54e31913bc44cfa1072f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 26 四月 2022 19:23:18 +0800 Subject: [PATCH] 2022-04-26 --- src/templates/modalconfig/index.jsx | 28 +++++++++++++++++++++++++++- 1 files changed, 27 insertions(+), 1 deletions(-) diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index 6b01727..7e56c2c 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -20,6 +20,7 @@ import asyncComponent from '@/utils/asyncComponent' import { BaseConfig, SearchItems } from './source' import { updateForm } from '@/utils/utils-update.js' +import MKEmitter from '@/utils/events.js' import './index.scss' const { Panel } = Collapse @@ -28,6 +29,7 @@ const Versions = asyncComponent(() => import('@/menu/versions')) const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) +const StyleController = asyncComponent(() => import('@/menu/stylecontroller')) const ModalForm = asyncComponent(() => import('@/templates/zshare/modalform')) const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) const DragElement = asyncComponent(() => import('./dragelement')) @@ -129,6 +131,7 @@ } componentDidMount() { + MKEmitter.addListener('submitStyle', this.getStyle) document.onkeydown = (event) => { let e = event || window.event let keyCode = e.keyCode || e.which || e.charCode @@ -161,6 +164,7 @@ * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 */ componentWillUnmount () { + MKEmitter.removeListener('submitStyle', this.getStyle) this.setState = () => { return } @@ -187,6 +191,24 @@ } this.props.handleView(param) + } + + getStyle = (comIds, style) => { + const { config } = this.state + + if (comIds[0] !== 'form') return + + let Index = config.fields.findIndex(n => n.uuid === comIds[1]) + + if (Index === -1) return + + let _config = fromJS(config).toJS() + + _config.fields[Index].style = style + + this.setState({ + config: _config + }) } /** @@ -362,6 +384,9 @@ } if (item.uuid === res.uuid) { + if (item.style) { + res.style = item.style + } return res } else { return item @@ -805,7 +830,7 @@ <Modal title={dict['model.edit']} visible={this.state.visible} - width={850} + width={950} maskClosable={false} onCancel={this.editModalCancel} onOk={this.handleSubmit} @@ -852,6 +877,7 @@ > {dict['header.menu.config.placeholder']} </Modal> + <StyleController /> </div> ) } -- Gitblit v1.8.0