From 137fb8ea6af2789b3238b22bac31d80bced41dfe Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 28 七月 2021 11:39:39 +0800
Subject: [PATCH] 2021-07-28

---
 src/templates/sharecomponent/searchcomponent/index.jsx |   32 +++++++++++++++++++++++---------
 1 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/src/templates/sharecomponent/searchcomponent/index.jsx b/src/templates/sharecomponent/searchcomponent/index.jsx
index c17f639..44d9716 100644
--- a/src/templates/sharecomponent/searchcomponent/index.jsx
+++ b/src/templates/sharecomponent/searchcomponent/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Icon, Tooltip, Modal, notification } from 'antd'
+import { Icon, Tooltip, Modal, notification, Switch } from 'antd'
 import moment from 'moment'
 
 import Api from '@/api'
@@ -27,6 +27,7 @@
     searchlist: null,    // 鎼滅储鏉′欢闆�
     sqlVerifing: false,  // sql楠岃瘉涓�
     visible: false,      // 妯℃�佹鎺у埗
+    showField: false,
     card: null           // 缂栬緫涓厓绱�
   }
 
@@ -79,12 +80,14 @@
     let linkableFields = []
 
     searchlist.forEach(item => {
-      if (item.uuid !== card.uuid && (item.type === 'select' || item.type === 'link')) {
-        linkableFields.push({
-          value: item.field,
-          text: item.label
-        })
-      }
+      if (item.uuid === card.uuid) return
+      if (!['select', 'link', 'checkcard'].includes(item.type)) return
+      if (item.type === 'checkcard' && item.multiple === 'true') return
+      
+      linkableFields.push({
+        value: item.field,
+        text: item.label
+      })
     })
 
     this.setState({
@@ -187,7 +190,7 @@
         return
       }
 
-      if ((res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && res.resourceType === '1' && /\s/.test(res.dataSource)) {
+      if (['checkcard', 'select', 'multiselect', 'link'].includes(res.type) && res.resourceType === '1' && /\s/.test(res.dataSource)) {
         this.setState({
           sqlVerifing: true
         })
@@ -261,6 +264,15 @@
     })
   }
 
+  onFieldChange = () => {
+    const { showField } = this.state
+
+    this.setState({
+      showField: !showField
+    })
+  }
+
+
   /**
    * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊
    */
@@ -275,15 +287,17 @@
   }
 
   render() {
-    const { dict, searchlist, visible, sqlVerifing, card } = this.state
+    const { dict, searchlist, visible, sqlVerifing, card, showField } = this.state
 
     return (
       <div className={'model-table-search-list length' + searchlist.length}>
         <Tooltip placement="bottomLeft" overlayClassName="middle" title={dict['model.tooltip.search.guide']}>
           <Icon type="question-circle" />
         </Tooltip>
+        <Switch checkedChildren={dict['model.switch.open']} unCheckedChildren={dict['model.switch.close']} defaultChecked={showField} onChange={this.onFieldChange} />
         <DragElement
           list={searchlist}
+          showField={showField}
           handleList={this.handleList}
           handleMenu={this.handleSearch}
           deleteMenu={this.deleteElement}

--
Gitblit v1.8.0