king
2023-12-24 ccac5187bd5f7e0a868a69d00b9672bec155bea6
2023-12-24
12个文件已修改
2个文件已删除
592 ■■■■■ 已修改文件
src/menu/components/form/dragtitle/card.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/group/normal-group/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/tabs/antv-tabs/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/tabs/paste/index.jsx 146 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/tabs/paste/index.scss 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/debug/index.jsx 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/pastecontroller/index.jsx 342 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/mob/components/tabs/antv-tabs/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/utils-custom.js 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/menudesign/index.jsx 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/menudesign/popview/index.jsx 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mobdesign/index.jsx 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mobdesign/popview/index.jsx 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/pcdesign/index.jsx 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/form/dragtitle/card.jsx
@@ -90,7 +90,7 @@
          <EditOutlined style={{color: '#1890ff'}} title="编辑"/>
        </NormalForm>
        <CopyComponent type="formgroup" card={card}/>
        <PasteForms config={card} updateConfig={(res) => pasteForm(res, id)} />
        <PasteForms config={card} update={(res) => pasteForm(res, id)} />
        <CloseOutlined className="close" type="close" onClick={close} />
      </div>
    } trigger="hover">
src/menu/components/group/normal-group/index.jsx
@@ -15,7 +15,7 @@
const NormalForm = asyncIconComponent(() => import('@/components/normalform'))
const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent'))
const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader'))
const PasteComponent = asyncIconComponent(() => import('@/menu/components/tabs/paste'))
const PasteController = asyncIconComponent(() => import('@/menu/pastecontroller'))
const GroupComponents = asyncComponent(() => import('../groupcomponents'))
class NormalGroup extends Component {
@@ -180,7 +180,7 @@
            </NormalForm>
            <CopyComponent type="group" card={group}/>
            <UngroupOutlined title="释放" style={group.components.length > 0 ? {color: '#32c5d2'} : {color: '#eeeeee', cursor: 'not-allowed'}} onClick={this.unGroup}/>
            <PasteComponent type="group" insert={this.insert} />
            <PasteController type="group" tab={group} insert={this.insert} />
            <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/>
            <DeleteOutlined className="close" title="delete" onClick={() => this.props.deletecomponent(group.uuid)} />
          </div>
src/menu/components/tabs/antv-tabs/index.jsx
@@ -16,7 +16,7 @@
const NormalForm = asyncIconComponent(() => import('@/components/normalform'))
const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent'))
const PasteComponent = asyncIconComponent(() => import('../paste'))
const PasteController = asyncIconComponent(() => import('@/menu/pastecontroller'))
const TabComponents = asyncComponent(() => import('../tabcomponents'))
const { TabPane } = Tabs
@@ -308,7 +308,7 @@
                  <NormalForm title="标签编辑" width={800} update={this.updateTab} getForms={() => this.getTabForms(tab)}>
                    <EditOutlined style={{color: '#1890ff'}} title="编辑"/>
                  </NormalForm>
                  <PasteComponent insert={(item) => this.insert(item, tab.uuid)} />
                  <PasteController type="tabs" tab={tab} insert={(item) => this.insert(item, tab.uuid)} />
                  <CloseOutlined className="close" onClick={() => this.delTab(tab)} />
                </div>
              } trigger="hover">
src/menu/components/tabs/paste/index.jsx
File was deleted
src/menu/components/tabs/paste/index.scss
src/menu/debug/index.jsx
@@ -1033,15 +1033,13 @@
        item.field.split(',').forEach((_field, index) => {
          let _key = _field.toLowerCase()
          let _val = ''
          let _fval = `'${_val}'`
  
          arr.push(_key)
          if (_key === 'bid') { // 表单中没有bid则使用系统bid变量
            _fval = '@BID@'
            _val = BID
          }
          arr.push(_key)
          _fieldValue.push(`${_key}=${_fval}`)
          _fieldValue.push(`${_key}='${_val}'`)
          _value.push(`${_labels[index] || ''}:${_val || ''}`)
        })
  
src/menu/pastecontroller/index.jsx
@@ -1,7 +1,9 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { fromJS } from 'immutable'
import { Modal, Button, notification } from 'antd'
import { SnippetsOutlined } from '@ant-design/icons'
import md5 from 'md5'
import MenuUtils from '@/utils/utils-custom.js'
import asyncComponent from '@/utils/asyncComponent'
@@ -18,60 +20,264 @@
    visible: false
  }
  resetconfig = (item, appType) => {
  resetconfig = (item, appType, commonId) => {
    if (item.type === 'tabs') {
      item.uuid = MenuUtils.getuuid()
      item.uuid = md5(commonId + item.uuid)
      item.setting.name = (item.setting.name || '') + MenuUtils.getSignName()
      item.name = item.setting.name
      item.subtabs.forEach(tab => {
        tab.uuid = MenuUtils.getuuid()
        tab.uuid = md5(commonId + tab.uuid)
        if (appType !== 'mob') {
          tab.components = tab.components.filter(cell => cell.type !== 'menubar')
        }
        tab.components = tab.components.map(cell => {
          cell = this.resetconfig(cell, appType)
          cell = this.resetconfig(cell, appType, commonId)
          return cell
        })
      })
    } else if (item.type === 'group') {
      item.uuid = MenuUtils.getuuid()
      item.uuid = md5(commonId + item.uuid)
      item.setting.name = (item.setting.name || '') + MenuUtils.getSignName()
      item.name = item.setting.name
      item.components = item.components.map(cell => {
        cell = MenuUtils.resetComponentConfig(cell, appType)
        cell.uuid = md5(commonId + cell.uuid)
        cell = MenuUtils.resetComponentConfig(cell, appType, commonId)
        return cell
      })
    } else {
      item = MenuUtils.resetComponentConfig(item, appType)
      item.uuid = md5(commonId + item.uuid)
      item = MenuUtils.resetComponentConfig(item, appType, commonId)
    }
    return item
  }
  resetlink = (item, commonId) => {
    if (item.type === 'tabs') {
      item.subtabs.forEach(tab => {
        tab.components.forEach(cell => {
          this.resetlink(cell, commonId)
        })
      })
    } else if (item.type === 'group') {
      item.components.forEach(cell => {
        this.resetlink(cell, commonId)
      })
    } else {
      if (['card', 'carousel', 'timeline'].includes(item.type)) {
        item.subcards.forEach(card => {
          card.elements && card.elements.forEach(cell => {
            if (cell.eleType === 'button') {
              this.resetBtn(cell, commonId)
            }
          })
          card.backElements && card.backElements.forEach(cell => {
            if (cell.eleType === 'button') {
              this.resetBtn(cell, commonId)
            }
          })
        })
      } else if (item.type === 'balcony') {
        item.elements && item.elements.forEach(cell => {
          if (cell.eleType === 'button') {
            this.resetBtn(cell, commonId)
          }
        })
      } else if (item.type === 'table' && item.cols) {
        let loopCol = (cols) => {
          cols.forEach(col => {
            if (col.type === 'colspan' && col.subcols) {
              loopCol(col.subcols)
            } else if (col.type === 'custom' && col.elements) {
              col.elements.forEach(cell => {
                if (cell.eleType === 'button') {
                  this.resetBtn(cell, commonId)
                }
              })
            }
          })
        }
        loopCol(item.cols)
      } else if (item.type === 'form') {
        item.subcards.forEach(cell => {
          if (cell.subButton) {
            this.resetBtn(cell.subButton, commonId)
          }
        })
      }
      item.action && item.action.forEach(cell => {
        this.resetBtn(cell, commonId)
      })
      if (item.wrap && item.wrap.supType === 'multi') {
        if (item.setting && item.setting.supModule) {
          item.setting.supModule = ''
        }
        if (item.supNodes) {
          item.supNodes = item.supNodes.map(cell => {
            let id = cell.nodes[cell.nodes.length - 1]
            let _id = md5(commonId + id)
            if (this.modules[id] || this.modules[_id]) {
              cell.nodes = this.modules[id] || this.modules[_id]
              cell.componentId = cell.nodes[cell.nodes.length - 1]
              return cell
            }
            return null
          })
          item.supNodes = item.supNodes.filter(Boolean)
        }
        if (!item.supNodes || item.supNodes.length === 0) {
          item.wrap.supType = 'single'
          delete item.supNodes
        }
      }
      if (item.setting && item.setting.supModule && item.setting.supModule[0] !== 'empty') {
        let id = item.setting.supModule[item.setting.supModule.length - 1]
        let _id = md5(commonId + id)
        item.setting.supModule = this.modules[id] || this.modules[_id] || ''
      }
      if (item.wrap && item.wrap.supModule && item.wrap.supModule[0]) {
        let id = item.wrap.supModule[item.wrap.supModule.length - 1]
        let _id = md5(commonId + id)
        item.wrap.supModule = this.modules[id] || this.modules[_id] || ''
      }
    }
  }
  resetBtn (btn, commonId) {
    if (btn.switchTab && btn.switchTab.length > 0) {
      let id = btn.switchTab[btn.switchTab.length - 1]
      let _id = md5(commonId + id)
      btn.switchTab = this.modules[id] || this.modules[_id] || null
    }
    if (btn.anchors && btn.anchors.length > 0) {
      let id = btn.anchors[btn.anchors.length - 1]
      let _id = md5(commonId + id)
      btn.anchors = this.modules[id] || this.modules[_id] || null
    }
    if (btn.syncComponent && btn.syncComponent[0] === 'multiComponent' && btn.syncComponents) {
      btn.syncComponents = btn.syncComponents.map(m => {
        let id = m.syncComId[m.syncComId.length - 1]
        let _id = md5(commonId + id)
        return this.modules[id] || this.modules[_id] || null
      })
      btn.syncComponents = btn.syncComponents.filter(Boolean)
      if (btn.syncComponents.length === 0) {
        btn.syncComponent = null
        btn.syncComponents = null
      }
    } else if (btn.syncComponent && btn.syncComponent.length > 0) {
      let id = btn.syncComponent[btn.syncComponent.length - 1]
      let _id = md5(commonId + id)
      btn.syncComponent = this.modules[id] || this.modules[_id] || null
    }
  }
  resetmenu = (components, componentId, res) => {
    components.forEach(item => {
      if (item.type === 'tabs') {
        item.subtabs.forEach(tab => {
          if (tab.uuid === componentId) {
            tab.components.push(res)
          } else {
            this.resetmenu(tab.components, componentId, res)
          }
        })
      } else if (item.type === 'group' && item.uuid === componentId) {
        item.components.push(res)
      }
    })
  }
  getModules = (components, interfaces, sups = []) => {
    components.forEach(item => {
      this.modules[item.uuid] = [...sups, item.uuid]
      if (item.type === 'tabs') {
        item.subtabs.forEach(f_tab => {
          this.getModules(f_tab.components, null, [...sups, item.uuid, f_tab.uuid])
        })
      } else if (item.type === 'group') {
        item.components.forEach(cell => {
          this.modules[cell.uuid] = [...sups, item.uuid, cell.uuid]
        })
      }
    })
    if (interfaces && interfaces.length > 0) {
      interfaces.forEach(item => {
        this.modules[item.uuid] = [item.uuid]
      })
    }
  }
  pasteSubmit = () => {
    const { type, tab } = this.props
    let appType = sessionStorage.getItem('appType')
    // ['calendar', 'balcony', 'datacard', 'doublecard', 'propcard', 'tablecard', 'cardatacard', 'carpropcard', 'line', 'dashboard', 'antvG6', 'pie', 'scatter', 'antvX6', 'chart', 'sandbox', 'editor', 'simpleform', 'stepform', 'tabform', 'group', 'iframe', 'mainsearch', 'basetable', 'editable', 'normaltable', 'tabs', 'timeline', 'tree', 'menubar', 'singleSearch', 'topbar']
    let options = ['tabs', 'timeline', 'datacard', 'doublecard', 'propcard', 'cardatacard', 'carpropcard', 'simpleform', 'stepform', 'tabform', 'balcony', 'group', 'normaltable', 'tablecard', 'line', 'editor', 'pie', 'scatter', 'iframe', 'sandbox']
    let options = []
    if (appType === 'mob') {
      options.push('menubar', 'singleSearch')
      if (sessionStorage.getItem('editMenuType') !== 'popview') {
        options.push('topbar')
    let types = {
      topbar: '导航栏',
      singleSearch: '搜索',
      iframe: 'iframe',
      tabs: '标签页',
      group: '分组',
      menubar: '菜单栏',
      mainsearch: '搜索'
    }
    if (!type) {
      options = ['tabs', 'timeline', 'datacard', 'doublecard', 'propcard', 'cardatacard', 'carpropcard', 'simpleform', 'stepform', 'tabform', 'balcony', 'group', 'normaltable', 'tablecard', 'line', 'editor', 'pie', 'scatter', 'iframe', 'sandbox']
      if (appType === 'mob') {
        options.push('menubar', 'singleSearch')
        if (sessionStorage.getItem('editMenuType') !== 'popview') {
          options.push('topbar')
        }
      } else {
        options.push('editable', 'mainsearch', 'antvG6', 'antvX6', 'calendar', 'tree', 'dashboard', 'chart')
      }
    } else {
      options.push('editable', 'mainsearch', 'antvG6', 'antvX6', 'calendar', 'tree', 'dashboard', 'chart')
      if (appType === 'mob') {
        options = ['balcony', 'datacard', 'doublecard', 'propcard', 'tablecard', 'cardatacard', 'carpropcard', 'line', 'pie', 'scatter', 'sandbox', 'editor', 'simpleform', 'stepform', 'tabform', 'normaltable', 'timeline']
        if (type === 'tabs') {
          options.push('tabs', 'group', 'menubar')
        }
      } else {
        options = ['calendar', 'balcony', 'datacard', 'doublecard', 'propcard', 'tablecard', 'cardatacard', 'carpropcard', 'line', 'dashboard', 'antvG6', 'pie', 'scatter', 'antvX6', 'chart', 'sandbox', 'editor', 'simpleform', 'stepform', 'tabform', 'editable', 'normaltable', 'timeline', 'tree']
        if (type === 'tabs') {
          options.push('tabs', 'group', 'mainsearch')
        }
      }
    }
    this.pasteFormRef.handleConfirm().then(res => {
      if (res.copyType === 'basetable') {
        res.copyType = 'normaltable'
        res.subtype = 'normaltable'
      }
      if (!options.includes(res.copyType)) {
      if (!res.copyType) {
        notification.warning({
          top: 92,
          message: '配置信息格式错误!',
@@ -80,22 +286,116 @@
        return
      }
      res = this.resetconfig(res, appType)
      if (res.copyType === 'basetable') {
        res.copyType = 'normaltable'
        res.subtype = 'normaltable'
      }
      // delete res.copyType
      let menu = fromJS(window.GLOB.customMenu).toJS()
      if (!options.includes(res.copyType)) {
        if (type && types[res.copyType]) {
          notification.warning({
            top: 92,
            message: (type === 'group' ? '分组中' : '标签页中') + '不可添加《' + types[res.copyType] + '》组件!',
            duration: 5
          })
          return
        } else {
          notification.warning({
            top: 92,
            message: '配置信息格式错误!',
            duration: 5
          })
        }
        return
      } else if (appType === 'mob') {
        if (res.type === 'search') {
          if (menu.components.filter(card => card.type === 'topbar' && card.wrap.type !== 'navbar').length > 0) {
            notification.warning({
              top: 92,
              message: '导航栏使用了搜索,不可添加搜索组件!',
              duration: 5
            })
            return
          }
          if (menu.components.filter(card => card.type === 'search').length > 0) {
            notification.warning({
              top: 92,
              message: '搜索条件不可重复添加!',
              duration: 5
            })
            return
          }
        } else if (res.type === 'topbar') {
          if (menu.components.findIndex(m => m.type === 'topbar') > -1) {
            notification.warning({
              top: 92,
              message: '导航栏不可重复添加!',
              duration: 5
            })
            return
          }
        }
      } else if (res.type === 'search') {
        if (tab) {
          if (tab.components.findIndex(card => card.type === 'search') > -1) {
            notification.warning({
              top: 92,
              message: '搜索条件不可重复添加!',
              duration: 5
            })
            return
          }
        } else {
          if (menu.components.findIndex(m => m.type === 'search') > -1) {
            notification.warning({
              top: 92,
              message: '搜索条件不可重复添加!',
              duration: 5
            })
            return
          }
        }
      }
      delete res.copyType
      let commonId = MenuUtils.getuuid()
      res = this.resetconfig(res, appType, commonId)
      if (tab) {
        this.resetmenu(menu.components, tab.uuid, res)
      } else {
        menu.components.push(res)
      }
      this.modules = {}
      this.getModules(menu.components, menu.interfaces)
      this.resetlink(res, commonId)
      
      this.props.insert(res)
      this.setState({visible: false})
      notification.success({
        top: 92,
        message: '粘贴成功!',
        duration: 2
      })
    })
  }
  render() {
    const { type } = this.props
    const { visible } = this.state
    return (
      <>
        <Button style={{borderColor: '#40a9ff', color: '#40a9ff'}} onClick={() => {this.setState({visible: true})}}><SnippetsOutlined />粘贴</Button>
        {type ? <SnippetsOutlined style={{color: 'purple'}} onClick={() => {this.setState({visible: true})}} /> :
        <Button style={{borderColor: '#40a9ff', color: '#40a9ff'}} onClick={() => {this.setState({visible: true})}}><SnippetsOutlined />粘贴</Button>}
        <Modal
          title="粘贴"
          visible={visible}
src/mob/components/tabs/antv-tabs/index.jsx
@@ -16,7 +16,7 @@
const NormalForm = asyncIconComponent(() => import('@/components/normalform'))
const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent'))
const PasteComponent = asyncIconComponent(() => import('@/menu/components/tabs/paste'))
const PasteController = asyncIconComponent(() => import('@/menu/pastecontroller'))
const TabComponents = asyncComponent(() => import('../tabcomponents'))
const { TabPane } = Tabs
@@ -323,7 +323,7 @@
                  <NormalForm title="标签编辑" width={800} update={this.updateTab} getForms={() => this.getTabForms(tab)}>
                    <EditOutlined style={{color: '#1890ff'}} title="编辑"/>
                  </NormalForm>
                  <PasteComponent insert={(item) => this.insert(item, tab.uuid)} />
                  <PasteController type="tabs" tab={tab} insert={(item) => this.insert(item, tab.uuid)} />
                  <FontColorsOutlined className="style" title="调整样式" onClick={this.changeTabStyle}/>
                  <CloseOutlined className="close" onClick={() => this.delTab(tab)} />
                </div>
src/utils/utils-custom.js
@@ -728,7 +728,7 @@
  * @description 重置组件配置
  * @return {String}  item 组件信息
  */
  static resetComponentConfig = (item, appType) => {
  static resetComponentConfig = (item, appType, commonId) => {
    if (item.type === 'navbar') {
      return item
    }
@@ -736,9 +736,6 @@
    if (item.subtype === 'tablecard') { // 兼容
      item.type = 'card'
    }
    item.uuid = this.getuuid()
    let commonId = this.getuuid()
    // 重置组件名称
    let sign = this.getSignName()
@@ -961,20 +958,6 @@
        cell.uuid = this.getuuid()
        return cell
      })
    }
    if (item.setting && item.setting.supModule && item.setting.supModule[0] !== 'empty') {
      item.setting.supModule = ''
    }
    if (item.wrap && item.wrap.supType === 'multi') {
      item.wrap.supType = 'single'
      delete item.supNodes
    }
    if (item.wrap && item.wrap.supModule) {
      item.wrap.supModule = ''
    }
    if (item.wrap && item.wrap.doubleClick) {
src/views/menudesign/index.jsx
@@ -1135,12 +1135,6 @@
    this.setState({config})
    window.GLOB.customMenu = config
    notification.success({
      top: 92,
      message: '粘贴成功!',
      duration: 2
    })
  }
  changeSetting = () => {
src/views/menudesign/popview/index.jsx
@@ -246,12 +246,6 @@
    this.setState({config})
    window.GLOB.customMenu = config
    notification.success({
      top: 92,
      message: '粘贴成功!',
      duration: 2
    })
  }
  render () {
src/views/mobdesign/index.jsx
@@ -1858,49 +1858,14 @@
  insert = (item) => {
    let config = fromJS(this.state.config).toJS()
    if (item.type === 'search') {
      if (config.components.filter(card => card.type === 'topbar' && card.wrap.type !== 'navbar').length > 0) {
        notification.warning({
          top: 92,
          message: '导航栏使用了搜索,不可添加搜索组件!',
          duration: 5
        })
        return
      }
      if (config.components.filter(card => card.type === 'search').length > 0) {
        notification.warning({
          top: 92,
          message: '搜索条件不可重复添加!',
          duration: 5
        })
        return
      }
    }
    if (item.type === 'topbar') {
      if (config.components.findIndex(m => m.type === 'topbar') > -1) {
        notification.warning({
          top: 92,
          message: '导航栏不可重复添加!',
          duration: 5
        })
        return
      }
      if (!config.style.paddingTop) {
        config.style.paddingTop = '50px'
      }
    if (item.type === 'topbar' && !config.style.paddingTop) {
      config.style.paddingTop = '50px'
    }
    config.components.push(item)
    this.setState({config})
    window.GLOB.customMenu = config
    notification.success({
      top: 92,
      message: '粘贴成功!',
      duration: 2
    })
  }
  setHomeView = () => {
src/views/mobdesign/popview/index.jsx
@@ -248,12 +248,6 @@
    this.setState({config})
    window.GLOB.customMenu = config
    notification.success({
      top: 92,
      message: '粘贴成功!',
      duration: 2
    })
  }
  render () {
src/views/pcdesign/index.jsx
@@ -1550,12 +1550,6 @@
    this.setState({config})
    window.GLOB.customMenu = config
    notification.success({
      top: 92,
      message: '粘贴成功!',
      duration: 2
    })
  }
  setHomeView = () => {