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/templates/sharecomponent/searchcomponent/dragsearch/index.jsx |   75 +++++++++++++++++++++++--------------
 1 files changed, 46 insertions(+), 29 deletions(-)

diff --git a/src/templates/sharecomponent/searchcomponent/dragsearch/index.jsx b/src/templates/sharecomponent/searchcomponent/dragsearch/index.jsx
index c0907c6..9f92dd0 100644
--- a/src/templates/sharecomponent/searchcomponent/dragsearch/index.jsx
+++ b/src/templates/sharecomponent/searchcomponent/dragsearch/index.jsx
@@ -2,12 +2,14 @@
 import { useDrop } from 'react-dnd'
 import { is, fromJS } from 'immutable'
 import update from 'immutability-helper'
-import { Col, Button } from 'antd'
+import { Col, Button, Popover } from 'antd'
+import { EditOutlined } from '@ant-design/icons'
+
 import Utils from '@/utils/utils.js'
 import Card from './card'
 import './index.scss'
 
-const Container = ({list, show, showField, handleList, handleMenu, deleteMenu }) => {
+const Container = ({list, setting, handleList, handleMenu, deleteMenu, handleSetting }) => {
   const [cards, setCards] = useState(list)
   const moveCard = (id, atIndex) => {
     const { card, index } = findCard(id)
@@ -121,43 +123,58 @@
         targetId = cards[cards.length - 1].uuid
       }
 
-      const { index: overIndex } = findCard(`${targetId}`)
+      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)
     }
   })
 
-  let radio = 6
-  if (cards.length > 0) {
-    radio = cards[cards.length - 1].ratio || 6
-  }
+  let radio = setting.searchRatio || 6
+  let labelwidth = setting.searchLwidth !== undefined ? setting.searchLwidth : 33.3
+  let advanceType = setting.advanceType || 'modal'
 
   return (
     <div ref={drop} className="ant-row">
-      {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 && show !== 'false' ? <Col key="action" className="action" span={radio < 6 ? 6 : radio}>
+      {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 className={'mk-search-item-wrap action ' + (setting.show === 'false' ? 'hide-button' : '')} key="action" span={radio}>
         <div className="ant-row ant-form-item" style={{whiteSpace: 'nowrap', 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>
-            <Button style={{ marginLeft: 8 }}>閲嶇疆</Button>
-            <div style={{position: 'absolute', top: 0, bottom: 0, left: 0, right: 0}}></div>
-          </div>
+          <div className="ant-col ant-form-item-label" style={{width: labelwidth + '%'}}></div>
+          <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
+            <div className="mk-popover-control">
+              <EditOutlined className="edit" onClick={() => handleSetting()} />
+            </div>
+          } trigger="hover">
+            <div className="ant-col ant-form-item-control-wrapper">
+              <Button type="primary">鎼滅储</Button>
+              <Button style={{ marginLeft: 8 }}>閲嶇疆</Button>
+              <div style={{position: 'absolute', top: 0, bottom: 0, left: 0, right: 0}}></div>
+            </div>
+          </Popover>
         </div>
       </Col> : null}
       {cards.length === 0 ?

--
Gitblit v1.8.0