From c98e45bfac25e9110ad0383faac54a54d98ea9d5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 18 十一月 2021 20:47:04 +0800
Subject: [PATCH] 2021-11-18

---
 src/templates/sharecomponent/columncomponent/dragcolumn/index.jsx |   71 ++++++++++++++++++++---------------
 1 files changed, 40 insertions(+), 31 deletions(-)

diff --git a/src/templates/sharecomponent/columncomponent/dragcolumn/index.jsx b/src/templates/sharecomponent/columncomponent/dragcolumn/index.jsx
index 3c608b0..1fa8a7c 100644
--- a/src/templates/sharecomponent/columncomponent/dragcolumn/index.jsx
+++ b/src/templates/sharecomponent/columncomponent/dragcolumn/index.jsx
@@ -2,14 +2,12 @@
 import { useDrop } from 'react-dnd'
 import { is, fromJS } from 'immutable'
 import update from 'immutability-helper'
-import { Icon } from 'antd'
+import { Icon, Popover } from 'antd'
 import Utils from '@/utils/utils.js'
 import Card from './card'
 import './index.scss'
 
-const Container = ({list, setting, gridBtn, showfield, placeholder, handleList, handleMenu, handleGridBtn, deleteMenu }) => {
-  let target = null
-
+const Container = ({list, setting, gridBtn, showfield, placeholder, handleList, handleMenu, handleGridBtn, deleteMenu, markMenu }) => {
   const [cards, setCards] = useState(list)
   const moveCard = (id, atIndex) => {
     const { card, index } = findCard(id)
@@ -31,6 +29,8 @@
 
   const editCard = id => {
     const { card } = findCard(id)
+    delete card.focus // 鍏煎鏃╂湡鐨勫悎骞跺垪
+
     handleMenu(card)
   }
   
@@ -39,9 +39,10 @@
     const { card } = findCard(id)
     deleteMenu(card)
   }
-
-  const hasDrop = (item) => {
-    target = item
+  
+  const markCard = id => {
+    const { card } = findCard(id)
+    markMenu(card)
   }
 
   const [, drop] = useDrop({
@@ -59,6 +60,7 @@
       newcard.label = 'label'
       newcard.field = ''
       newcard.Hide = 'false'
+      newcard.contrastType = 'static'
       newcard.IsSort = 'true'
       newcard.type = item.subType
       newcard.Width = 120
@@ -69,20 +71,19 @@
         newcard.order = 'vertical'
       }
       
-      let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0
-      if (target) {
-        targetId = target.uuid
+      let targetId = ''
+
+      if (item.dropTargetId) {
+        targetId = item.dropTargetId
+        delete item.dropTargetId
+      } else if (cards.length > 0) {
+        targetId = cards[cards.length - 1].uuid
       }
 
       const { index: overIndex } = findCard(`${targetId}`)
-      let targetIndex = overIndex
-
-      targetIndex++
-
-      const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] })
+      const _cards = update(cards, { $splice: [[overIndex + 1, 0, newcard]] })
 
       handleList(_cards, newcard)
-      target = null
     }
   })
 
@@ -90,17 +91,20 @@
   let _colCards = []
 
   // 杩囨护鍚堝苟鍒�
-    let _hideCol = []
+  let _hideCol = []
+
+  if (!showfield) {
     cards.forEach(col => {
       if (col.type === 'colspan' && col.sublist) {
         _hideCol.push(...col.sublist)
       }
     })
-    cards.forEach(col => {
-      if (_hideCol.includes(col.uuid)) return
+  }
+  cards.forEach(col => {
+    if (_hideCol.includes(col.uuid)) return
 
-      _colCards.push(col)
-    })
+    _colCards.push(col)
+  })
 
   // 鏄剧ず鍒楀垎琛�
   if (_colCards.length > 10) {
@@ -135,21 +139,26 @@
               moveCard={moveCard}
               editCard={editCard}
               delCard={delCard}
+              markCard={markCard}
               findCard={findCard}
-              hasDrop={hasDrop}
             />
           ))}
           {i === (columns.length - 1) && gridBtn && gridBtn.display ?
-            <div className="page-card" style={{flex: gridBtn.Width}}>
-              <div style={{cursor: 'default'}}>
-                <span className="ant-table-header-column">
-                  <div className="ant-table-column-sorters" title={gridBtn.label} style={{textAlign: gridBtn.Align}}>
-                    <span className="ant-table-column-title">{gridBtn.label}</span>
-                  </div>
-                </span>
+            <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
+              <div className="mk-popover-control">
+                <Icon className="edit" type="edit" onClick={handleGridBtn}/>
               </div>
-              <Icon className="edit" type="edit" onClick={handleGridBtn}/>
-            </div> : null
+            } trigger="hover">
+              <div className="page-card" style={{flex: gridBtn.Width}}>
+                <div style={{cursor: 'default'}}>
+                  <span className="ant-table-header-column">
+                    <div className="ant-table-column-sorters" title={gridBtn.label} style={{textAlign: gridBtn.Align}}>
+                      <span className="ant-table-column-title">{gridBtn.label}</span>
+                    </div>
+                  </span>
+                </div>
+              </div>
+            </Popover> : null
           }
         </div>
       ))}

--
Gitblit v1.8.0