king
2025-04-21 f3d4db769ba9b51b799d981511a710fd443d0e08
src/pc/menushell/index.jsx
@@ -36,6 +36,25 @@
    setCards(_cards)
  }
  const unGroup = (id) => {
    let { card, index } = findCard(`${id}`)
    let components = [...card.components].map(item => {
      if (item.wrap) {
        item.wrap.width = card.width
        item.width = card.width
      } else if (item.plot) {
        item.plot.width = card.width
        item.width = card.width
      }
      return item
    })
    card.components = []
    const _cards = update(cards, { $splice: [[index, 1, card, ...components]] })
    handleList({...menu, components: _cards})
  }
  const deleteCard = (id) => {
    const { card } = findCard(id)
@@ -134,7 +153,6 @@
        config: item.config,
        width: item.width || 24,
        name: name,
        floor: 1,   // 组件的层级
        isNew: true // 新添加标志,用于初始化
      }
      
@@ -150,12 +168,48 @@
      const { index: overIndex } = findCard(`${targetId}`)
      const _cards = update(cards, { $splice: [[overIndex + 1, 0, newcard]] })
      if (style) {
        handleList({...menu, style, components: _cards})
      if (item.component === 'navbar') {
        let appMenus = sessionStorage.getItem('appViewList')
        if (appMenus) {
          try {
            appMenus = JSON.parse(appMenus)
            appMenus = appMenus.filter(item => item.keys_type === 'navbar')
          } catch (e) {
            appMenus = []
          }
        } else {
          appMenus = []
        }
        if (appMenus.length) {
          confirm({
            title: '如需使用当前应用中已有的菜单栏,请点击右侧关联菜单栏,如需新增请点确定。',
            onOk() {
              if (style) {
                handleList({...menu, style, components: _cards})
              } else {
                handleList({...menu, components: _cards})
              }
              setCards(_cards)
            },
            onCancel() {}
          })
        } else {
          if (style) {
            handleList({...menu, style, components: _cards})
          } else {
            handleList({...menu, components: _cards})
          }
          setCards(_cards)
        }
      } else {
        handleList({...menu, components: _cards})
        if (style) {
          handleList({...menu, style, components: _cards})
        } else {
          handleList({...menu, components: _cards})
        }
        setCards(_cards)
      }
      setCards(_cards)
    }
  })
@@ -173,6 +227,7 @@
            card={card}
            moveCard={moveCard}
            delCard={deleteCard}
            unGroup={unGroup}
            findCard={findCard}
            updateConfig={updateConfig}
          />