From cb9ade2afd2a367ad767bc605ab7086c695dd010 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 09 十二月 2022 15:53:32 +0800
Subject: [PATCH] 2022-12-09

---
 src/menu/components/search/main-search/dragsearch/index.jsx |  109 ++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 76 insertions(+), 33 deletions(-)

diff --git a/src/menu/components/search/main-search/dragsearch/index.jsx b/src/menu/components/search/main-search/dragsearch/index.jsx
index 0d48039..5da648f 100644
--- a/src/menu/components/search/main-search/dragsearch/index.jsx
+++ b/src/menu/components/search/main-search/dragsearch/index.jsx
@@ -7,7 +7,7 @@
 import Card from './card'
 import './index.scss'
 
-const Container = ({list, showField, handleList, handleMenu, deleteMenu }) => {
+const Container = ({list, setting, handleList, handleMenu, deleteMenu }) => {
   const [cards, setCards] = useState(list)
   const moveCard = (id, atIndex) => {
     const { card, index } = findCard(id)
@@ -81,45 +81,88 @@
 
   const [, drop] = useDrop({
     accept: 'search',
-    drop() {}
+    drop(item) {
+      if (item.hasOwnProperty('originalIndex')) {
+        return
+      }
+
+      let newcard = {}
+      newcard.uuid = Utils.getuuid()
+      newcard.focus = true
+
+      newcard.label = 'label'
+      newcard.initval = ''
+      newcard.type = item.subType
+      newcard.resourceType = '0'
+      newcard.options = []
+      newcard.orderType = 'asc'
+      
+      let _match = 'like'
+      if (item.subType === 'select' || item.subType === 'link' || item.subType === 'checkcard') {
+        _match = '='
+      } else if (item.subType === 'date' || item.subType === 'datemonth') {
+        _match = '>='
+      } else if (item.subType === 'dateweek' || item.subType === 'daterange') {
+        _match = 'between'
+      } else if (item.subType === 'group') {
+        _match = 'between'
+        newcard.items = ['day', 'week', 'month', 'quarter', 'year', 'customized']
+      }
+      
+      newcard.match = _match
+
+      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, card } = findCard(`${targetId}`)
+
+      if (card) {
+        newcard.ratio = card.ratio || 6
+        newcard.labelwidth = card.labelwidth || 33.3
+      }
+
+      const _cards = update(cards, { $splice: [[overIndex + 1, 0, newcard]] })
+
+      handleList(_cards, newcard)
+    }
   })
 
-  const appType = sessionStorage.getItem('appType')
+  let labelwidth = setting.searchLwidth !== undefined ? setting.searchLwidth : 33.3
+  let advanceType = setting.advanceType || 'modal'
 
   return (
     <div ref={drop} className="ant-row">
-      {cards.length > 0 ? <Col key="preaction" className="action pre-action" span={6}>
+      {cards.map(card => {
+        let _ratio = card.ratio || 6
+        if (card.advanced === 'true' && advanceType !== 'pulldown') {
+          _ratio = 6
+        }
+        return (
+          <Col className="mk-search-item-wrap" key={card.uuid} span={_ratio}>
+            <Card
+              id={`${card.uuid}`}
+              card={card}
+              moveCard={moveCard}
+              copyCard={copyCard}
+              editCard={editCard}
+              delCard={delCard}
+              findCard={findCard}
+            />
+          </Col>
+        )
+      })}
+      {cards.length > 0 ? <Col key="nextaction" className={'mk-search-item-wrap action' + (setting.show === 'false' ? ' hide-button' : '')} span={setting.searchRatio || 6}>
         <div className="ant-row ant-form-item" style={{lineHeight: '40px', height: '55px', marginBottom: 0}}>
-          <div className="ant-col ant-form-item-label ant-col-xs-24 ant-col-sm-8">
-          </div>
-          <div className="ant-col ant-form-item-control-wrapper ant-col-xs-24 ant-col-sm-16">
+        <div className="ant-col ant-form-item-label" style={{width: labelwidth + '%'}}></div>
+          <div className="ant-col ant-form-item-control-wrapper" style={{whiteSpace: 'nowrap'}}>
             <Button type="primary">鎼滅储</Button>
-            {appType !== 'mob' ? <Button style={{ marginLeft: 8 }}>閲嶇疆</Button> : null}
-            <div style={{position: 'absolute', top: 0, bottom: 0, left: 0, right: 0}}></div>
-          </div>
-        </div>
-      </Col> : null}
-      {cards.map(card => (
-        <Col key={card.uuid} span={card.ratio || 6}>
-          <Card
-            id={`${card.uuid}`}
-            card={card}
-            showField={showField}
-            moveCard={moveCard}
-            copyCard={copyCard}
-            editCard={editCard}
-            delCard={delCard}
-            findCard={findCard}
-          />
-        </Col>
-      ))}
-      {cards.length > 0 ? <Col key="nextaction" className="action next-action" span={6}>
-        <div className="ant-row ant-form-item" style={{lineHeight: '40px', height: '55px', marginBottom: 0}}>
-          <div className="ant-col ant-form-item-label ant-col-xs-24 ant-col-sm-8">
-          </div>
-          <div className="ant-col ant-form-item-control-wrapper ant-col-xs-24 ant-col-sm-16">
-            <Button type="primary">鎼滅储</Button>
-            {appType !== 'mob' ? <Button style={{ marginLeft: 8 }}>閲嶇疆</Button> : null}
+            <Button style={{ marginLeft: 8 }}>閲嶇疆</Button>
             <div style={{position: 'absolute', top: 0, bottom: 0, left: 0, right: 0}}></div>
           </div>
         </div>

--
Gitblit v1.8.0