king
2021-08-04 c5a378919ea922fd3216e70d9c5479edfe0d7178
src/menu/components/card/balcony/index.jsx
@@ -8,12 +8,14 @@
import { resetStyle } from '@/utils/utils-custom.js'
import MKEmitter from '@/utils/events.js'
import Utils from '@/utils/utils.js'
import MenuUtils from '@/utils/utils-custom.js'
import { balconyWrapForm } from './options'
import zhCN from '@/locales/zh-CN/model.js'
import enUS from '@/locales/en-US/model.js'
import './index.scss'
const SettingComponent = asyncIconComponent(() => import('@/menu/datasource'))
const WrapComponent = asyncIconComponent(() => import('./wrapsetting'))
const NormalForm = asyncIconComponent(() => import('@/components/normalform'))
const CardCellComponent = asyncComponent(() => import('../cardcellcomponent'))
const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent'))
const PasteComponent = asyncIconComponent(() => import('@/components/paste'))
@@ -204,6 +206,43 @@
    resolve({status: true})
  }
  getWrapForms = () => {
    const { wrap } = this.state.card
    let modules = MenuUtils.getLinkModules(fromJS(window.GLOB.customMenu).toJS().components) || []
    let supmodules = MenuUtils.getSupModules(fromJS(window.GLOB.customMenu).toJS().components, '') || []
    let roleList = sessionStorage.getItem('sysRoles')
    if (roleList) {
      try {
        roleList = JSON.parse(roleList)
      } catch {
        roleList = []
      }
    } else {
      roleList = []
    }
    return fromJS(balconyWrapForm).toJS().map(item => {
      item.initval = wrap[item.field] || item.initval
      if (item.field === 'blacklist') {
        item.options = roleList
      } else if (item.field === 'syncModule') {
        item.options = modules
      } else if (item.field === 'supModule') {
        item.options = supmodules
      }
      return item
    })
  }
  updateWrap = (res) => {
    delete res.quick
    this.updateComponent({...this.state.card, wrap: res})
  }
  render() {
    const { card } = this.state
@@ -215,7 +254,9 @@
          <div className="mk-popover-control">
            <Icon className="plus" title="添加元素" onClick={this.addElement} type="plus" />
            <Icon className="plus" title="添加按钮" onClick={this.addButton} type="plus-square" />
            <WrapComponent config={card} updateConfig={this.updateComponent} />
            <NormalForm title="卡片设置" width={800} update={this.updateWrap} getForms={this.getWrapForms}>
              <Icon type="edit" style={{color: '#1890ff'}} title="编辑"/>
            </NormalForm>
            <CopyComponent type="balcony" card={card}/>
            <PasteComponent options={['action', 'customCardElement']} updateConfig={this.pasteComponent} />
            <Icon className="style" title="调整样式" onClick={this.changeStyle} type="font-colors" />