king
2021-10-14 e41a64966b7832baffe96c21d1ea77ef6adb2905
src/menu/components/group/groupcomponents/index.jsx
@@ -6,6 +6,7 @@
import Utils from '@/utils/utils.js'
import MKEmitter from '@/utils/events.js'
import MenuUtils from '@/utils/utils-custom.js'
import Card from './card'
import './index.scss'
@@ -38,49 +39,16 @@
  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)
        })
      })
    }
    let uuids = MenuUtils.getDelButtonIds(card)
    confirm({
      title: `确定删除《${card.name}》吗?`,
      onOk() {
        MKEmitter.emit('delButtons', uuids)
        handleList({...config, components: cards.filter(item => item.uuid !== card.uuid)})
        if (uuids.length === 0) return
        MKEmitter.emit('delButtons', uuids)
      },
      onCancel() {}
    })
@@ -91,7 +59,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
      }
@@ -100,11 +68,21 @@
      let name = ''
      let names = {
        bar: '柱状图',
        chart: '图表',
        line: '折线图',
        tabs: '标签组',
        pie: '饼图',
        search: '搜索',
        table: '表格',
        group: '分组',
        editor: '富文本',
        code: '自定义',
        carousel: '轮播',
        form: '表单',
        dashboard: '仪表盘',
        scatter: '散点图',
        tree: '树形列表',
        balcony: '浮动卡',
        card: '卡片'
      }
      let i = 1