king
2023-06-28 f07c42a322f41e14ef5b1bf8f2fd66fc5d338cdd
src/menu/components/group/groupcomponents/index.jsx
@@ -5,7 +5,6 @@
import { Empty, Modal } from 'antd'
import Utils from '@/utils/utils.js'
import MKEmitter from '@/utils/events.js'
import Card from './card'
import './index.scss'
@@ -38,48 +37,9 @@
  const deleteCard = (id) => {
    const { card } = findCard(id)
    let uuids = []
    if (card.action && card.action.length) {
      card.action.forEach(act => {
        if (!act.origin) {
          uuids.push(act.uuid)
        }
      })
    }
    if (card.type === 'card') {
      card.subcards.forEach(_card => {
        _card.elements && _card.elements.forEach(cell => {
          if (cell.eleType === 'button') {
            uuids.push(cell.uuid)
          }
        })
        _card.backElements && _card.backElements.forEach(cell => {
          if (cell.eleType === 'button') {
            uuids.push(cell.uuid)
          }
        })
      })
    } else if (card.type === 'table' && card.subtype === 'tablecard') {
      card.subcards.forEach(_card => {
        _card.elements && _card.elements.forEach(cell => {
          if (cell.eleType === 'button') {
            uuids.push(cell.uuid)
          }
        })
      })
    } else if (card.type === 'table' && card.subtype === 'normaltable') {
      card.cols && card.cols.forEach(col => {
        if (col.type !== 'action') return
        col.elements && col.elements.forEach(cell => {
          uuids.push(cell.uuid)
        })
      })
    }
    confirm({
      title: `确定删除《${card.name}》吗?`,
      onOk() {
        MKEmitter.emit('delButtons', uuids)
        handleList({...config, components: cards.filter(item => item.uuid !== card.uuid)})
      },
      onCancel() {}
@@ -91,7 +51,7 @@
    drop(item) {
      if (item.hasOwnProperty('originalIndex') || item.added) {
        return
      } else if (item.component === 'tabs' || item.component === 'search' || item.component === 'group') { // 分组中不可添加标签页或搜索
      } else if (['login', 'navbar', 'topbar', 'tabs', 'search', 'group', 'menubar'].includes(item.component)) {
        return
      }
@@ -99,7 +59,8 @@
      let name = ''
      let names = {
        bbar: '柱状图',
        bar: '柱状图',
        chart: '图表',
        line: '折线图',
        tabs: '标签组',
        pie: '饼图',
@@ -113,6 +74,10 @@
        dashboard: '仪表盘',
        scatter: '散点图',
        tree: '树形列表',
        balcony: '浮动卡',
        timeline: '时间轴',
        antvG6: '树图',
        antvX6: '流程图',
        card: '卡片'
      }
      let i = 1
@@ -127,15 +92,11 @@
      
      let newcard = {
        uuid: Utils.getuuid(),
        tabId: config.uuid,
        parentId: config.parentId,
        type: item.component,
        subtype: item.subtype,
        config: item.config,
        width: item.width || 24,
        dataName: Utils.getdataName(),
        name: name,
        floor: config.floor || 1, // 组件的层级
        isNew: true               // 新添加标志,用于初始化
      }