From 07c005cf28acf74e3afde82122e4c53e1000d70c Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 12 六月 2023 12:06:18 +0800
Subject: [PATCH] Merge branch 'master' into positec

---
 src/menu/components/share/searchcomponent/dragsearch/card.jsx |   32 ++++++++++++++++++++------------
 1 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/src/menu/components/share/searchcomponent/dragsearch/card.jsx b/src/menu/components/share/searchcomponent/dragsearch/card.jsx
index f6f78e3..7c6754f 100644
--- a/src/menu/components/share/searchcomponent/dragsearch/card.jsx
+++ b/src/menu/components/share/searchcomponent/dragsearch/card.jsx
@@ -1,6 +1,6 @@
 import React from 'react'
 import { useDrag, useDrop } from 'react-dnd'
-import { Select, DatePicker, Input, Popover, Form } from 'antd'
+import { Select, DatePicker, Input, Popover, Form, Switch, Checkbox } from 'antd'
 import { EditOutlined, CopyOutlined, CloseOutlined } from '@ant-design/icons'
 import moment from 'moment'
 
@@ -21,17 +21,23 @@
   const [, drop] = useDrop({
     accept: 'search',
     canDrop: () => true,
-    drop: ({ id: draggedId }) => {
-      if (!draggedId || draggedId === id) return
-
-      const { index: originIndex } = findCard(draggedId)
-      if (originIndex === -1) return
-
-      const { index: overIndex } = findCard(id)
-      moveCard(draggedId, overIndex)
+    drop: (item) => {
+      const { id: draggedId, originalIndex } = item
+      
+      if (originalIndex === undefined) {
+        item.dropTargetId = id
+      } else {
+        if (!draggedId || draggedId === id) return
+  
+        const { index: originIndex } = findCard(draggedId)
+        if (originIndex === -1) return
+  
+        const { index: overIndex } = findCard(id)
+        moveCard(draggedId, overIndex)
+      }
     }
   })
-  const opacity = isDragging ? 0 : 1
+  const opacity = isDragging ? 0.5 : 1
 
   let _defaultValue = '' // 涓嬫媺鎼滅储銆佹椂闂磋寖鍥寸被鍨嬶紝鍒濆鍊奸渶瑕侀澶勭悊
 
@@ -101,6 +107,10 @@
     />
   } else if (card.type === 'group') {
     formItem = <DateGroup card={card} />
+  } else if (card.type === 'switch') {
+    formItem = (<Switch checkedChildren={card.openText || ''} unCheckedChildren={card.closeText || ''} style={{marginTop: '8px'}} checked={card.initval === card.openVal}/>)
+  } else if (card.type === 'check') {
+    formItem = <Checkbox style={{lineHeight: '36px'}} checked={card.initval === card.openVal}>{card.checkTip || ''}</Checkbox>
   }
 
   let labelwidth = card.labelwidth || 33.3
@@ -121,8 +131,6 @@
           <Form.Item
             labelCol={{style: {width: labelwidth + '%'}}}
             wrapperCol={{style: {width: (100 - labelwidth) + '%'}}}
-            // labelCol={{xs: { span: 24 }, sm: { span: 8 }}}
-            // wrapperCol = {{xs: { span: 24 }, sm: { span: 16 }}}
             label={card.labelShow !== 'false' ? card.label : ''}
             required={card.required === 'true'}
           >

--
Gitblit v1.8.0