From 74e5d38d9a0e94421ceceea37c4677e5b57364ba Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 14 十月 2022 00:33:18 +0800
Subject: [PATCH] 2022-10-14

---
 src/menu/tableshell/card.jsx |   34 +++++-----------------------------
 1 files changed, 5 insertions(+), 29 deletions(-)

diff --git a/src/menu/tableshell/card.jsx b/src/menu/tableshell/card.jsx
index aa6116e..0015811 100644
--- a/src/menu/tableshell/card.jsx
+++ b/src/menu/tableshell/card.jsx
@@ -1,5 +1,5 @@
 import React from 'react'
-import { useDrag, useDrop } from 'react-dnd'
+import { useDrop } from 'react-dnd'
 
 import asyncComponent from '@/utils/asyncComponent'
 import './index.scss'
@@ -7,48 +7,24 @@
 const AntvTabs = asyncComponent(() => import('@/menu/components/tabs/antv-tabs'))
 const BaseTable = asyncComponent(() => import('@/menu/components/table/base-table'))
 
-const Card = ({ id, card, moveCard, findCard, delCard, updateConfig }) => {
-  const originalIndex = findCard(id).index
-  const [{ isDragging }, drag] = useDrag({
-    item: { type: 'menu', id, originalIndex },
-    collect: monitor => ({
-      isDragging: monitor.isDragging(),
-    }),
-  })
+const Card = ({ id, card, delCard, updateConfig }) => {
   const [, drop] = useDrop({
     accept: 'menu',
     canDrop: () => true,
     drop: (item) => {
-      const { id: draggedId, originalIndex } = item
-      if (originalIndex === undefined) {
-        item.dropTargetId = id
-      } else if (draggedId) {
-        if (draggedId === id) return
-        const { index: originIndex } = findCard(draggedId)
-
-        if (originIndex === -1) return
-
-        const { index: overIndex } = findCard(id)
-
-        moveCard(draggedId, overIndex)
-      }
+      item.dropTargetId = id
     }
   })
 
-  let style = { opacity: 1}
-  if (isDragging) {
-    style = { opacity: 0.3}
-  }
-
   const getCardComponent = () => {
     if (card.type === 'table') {
-      return (<BaseTable card={card} updateConfig={updateConfig} deletecomponent={delCard}/>)
+      return (<BaseTable card={card} updateConfig={updateConfig}/>)
     } else if (card.type === 'tabs') {
       return (<AntvTabs tabs={card} updateConfig={updateConfig} deletecomponent={delCard}/>)
     }
   }
   return (
-    <div className={'ant-col mk-component-card ant-col-' + (card.width || 24)} ref={node => drag(drop(node))} style={style}>
+    <div className={'ant-col mk-component-card ant-col-' + (card.width || 24)} ref={node => drop(node)}>
       {getCardComponent()}
     </div>
   )

--
Gitblit v1.8.0