king
2021-01-15 455bdae0e5e1d9f66a552f74707f825c8b49ee5a
2021-01-15
7个文件已修改
102 ■■■■■ 已修改文件
src/api/index.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/index.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/card/prop-card/index.jsx 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/share/usercomponent/index.jsx 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/share/usercomponent/settingform/index.jsx 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/popview/index.jsx 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/menudesign/index.jsx 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/index.js
@@ -70,9 +70,6 @@
  }
}
window.GLOB.CacheMap = new Map()     // 缓存配置信息
window.GLOB.UserCacheMap = new Map() // 缓存用户自定义设置
axios.interceptors.response.use((response) => {
  if (response.data.ErrCode === 'LoginError') {
    if (window.debugger === true) {
src/index.js
@@ -224,6 +224,9 @@
      value: GLOB
    })
    window.GLOB.CacheMap = new Map()     // 缓存配置信息
    window.GLOB.UserCacheMap = new Map() // 缓存用户自定义设置
    render(Route)
  })
src/menu/components/card/prop-card/index.jsx
@@ -19,6 +19,7 @@
const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent'))
const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent'))
const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent'))
const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent'))
const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader'))
const { confirm } = Modal
@@ -40,37 +41,6 @@
    const { card } = this.props
    if (card.isNew) {
      let subcards = null
      if (card.config) {
        subcards = JSON.parse(card.config)
        subcards = subcards.map(scard => {
          scard.uuid = Utils.getuuid()
          scard.elements = scard.elements.map(elem => {
            elem.uuid = Utils.getuuid()
            return elem
          })
          scard.backElements = scard.backElements.map(elem => {
            elem.uuid = Utils.getuuid()
            return elem
          })
          return scard
        })
      } else {
        subcards = [{
          uuid: Utils.getuuid(),
          setting: { width: 6, type: 'simple'},
          style: {
            borderWidth: '1px', borderColor: '#e8e8e8',
            paddingTop: '15px', paddingBottom: '15px', paddingLeft: '15px', paddingRight: '15px',
            marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px'
          },
          backStyle: {},
          elements: [],
          backElements: []
        }]
      }
      let _card = {
        uuid: card.uuid,
        type: card.type,
@@ -90,8 +60,49 @@
        headerStyle: { fontSize: '16px', borderBottomWidth: '1px', borderBottomColor: '#e8e8e8' },
        columns: [],
        scripts: [],
        subcards: subcards,
        subcards: [{
          uuid: Utils.getuuid(),
          setting: { width: 6, type: 'simple'},
          style: {
            borderWidth: '1px', borderColor: '#e8e8e8',
            paddingTop: '15px', paddingBottom: '15px', paddingLeft: '15px', paddingRight: '15px',
            marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px'
          },
          backStyle: {},
          elements: [],
          backElements: []
        }],
        btnlog: [],
      }
      if (card.config) {
        let config = fromJS(card.config).toJS()
        _card.setting = config.setting
        _card.wrap = config.wrap
        _card.style = config.style
        _card.headerStyle = config.headerStyle
        _card.subcards = config.subcards.map(scard => {
          scard.uuid = Utils.getuuid()
          scard.elements = scard.elements.map(elem => {
            elem.uuid = Utils.getuuid()
            return elem
          })
          scard.backElements = scard.backElements.map(elem => {
            elem.uuid = Utils.getuuid()
            return elem
          })
          return scard
        })
        _card.columns = config.columns.map(col => {
          col.uuid = Utils.getuuid()
          return col
        })
        _card.scripts = config.scripts.map(col => {
          col.uuid = Utils.getuuid()
          return col
        })
      }
      this.setState({
        card: _card
@@ -378,6 +389,7 @@
            <PasteComponent config={card} options={['cardcell']} updateConfig={this.updateComponent} />
            <Icon className="style" title="调整样式" onClick={this.changeStyle} type="font-colors" />
            <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} />
            <UserComponent config={card}/>
            <Icon className="close" title="删除组件" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} />
            {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null}
            {card.wrap.datatype === 'static' ? <Icon style={{color: '#eeeeee', cursor: 'not-allowed'}} type="setting"/> : null}
src/menu/components/share/usercomponent/index.jsx
@@ -21,7 +21,8 @@
  state = {
    dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    visible: false,
    loading: false
    loading: false,
    name: ''
  }
  shouldComponentUpdate (nextProps, nextState) {
@@ -29,9 +30,12 @@
  }
  trigger = () => {
    const { config } = this.props
    this.setState({
      visible: true,
      loading: false
      loading: false,
      name: window.GLOB.UserComponentMap.get(config.uuid) || config.name || ''
    })
  }
@@ -91,7 +95,7 @@
  }
  render () {
    const { visible, dict, loading } = this.state
    const { visible, dict, loading, name } = this.state
    return (
      <div className="user-component-wrap">
@@ -107,7 +111,7 @@
          onCancel={this.cancel}
          destroyOnClose
        >
          <UserForm dict={dict} inputSubmit={this.submit} wrappedComponentRef={(inst) => this.verifyRef = inst}/>
          <UserForm dict={dict} name={name} inputSubmit={this.submit} wrappedComponentRef={(inst) => this.verifyRef = inst}/>
        </Modal>
      </div>
    )
src/menu/components/share/usercomponent/settingform/index.jsx
@@ -7,6 +7,7 @@
class SettingForm extends Component {
  static propTpyes = {
    dict: PropTypes.object,       // 字典项
    name: PropTypes.string,       // 组件名称
    inputSubmit: PropTypes.func   // 回车事件
  }
@@ -63,7 +64,7 @@
                </Tooltip>
              }>
                {getFieldDecorator('name', {
                  initialValue: '',
                  initialValue: this.props.name || '',
                  rules: [
                    {
                      required: true,
src/menu/popview/index.jsx
@@ -104,7 +104,9 @@
          if (!config || !item.c_name) return
          window.GLOB.UserComponentMap.set(item.c_id, item.c_name)
          coms.push({
            uuid: item.c_id,
            type: 'menu',
            title: item.c_name,
            url: item.images,
src/views/menudesign/index.jsx
@@ -43,6 +43,7 @@
sessionStorage.setItem('isEditState', 'true')
sessionStorage.setItem('editMenuType', 'menu') // 编辑菜单类型
document.body.className = ''
window.GLOB.UserComponentMap = new Map() // 缓存用户自定义组件
class MenuDesign extends Component {
  state = {
@@ -136,7 +137,9 @@
          if (!config || !item.c_name) return
          window.GLOB.UserComponentMap.set(item.c_id, item.c_name)
          coms.push({
            uuid: item.c_id,
            type: 'menu',
            title: item.c_name,
            url: item.images,