king
2022-04-26 5046d0d13dc6a8563b8e54e31913bc44cfa1072f
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>
    )
  }