From 46f79b491173d284a4900d19e7aecf7509481438 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 21 一月 2022 17:21:25 +0800
Subject: [PATCH] 2022-01-21

---
 src/tabviews/zshare/topSearch/index.jsx |   41 ++++++++++++++++++++++++++++-------------
 1 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx
index cbb6432..8f02a8b 100644
--- a/src/tabviews/zshare/topSearch/index.jsx
+++ b/src/tabviews/zshare/topSearch/index.jsx
@@ -1,7 +1,8 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Form, Row, Col, Button, notification, Modal, Icon } from 'antd'
+import { Form, Row, Col, Button, notification, Modal } from 'antd'
+import { CloseOutlined } from '@ant-design/icons'
 import moment from 'moment'
 
 import Api from '@/api'
@@ -15,7 +16,7 @@
 import './index.scss'
 
 const MutilForm = asyncSpinComponent(() => import('./advanceform'))
-const MKCheckCard = asyncComponent(() => import('@/tabviews/zshare/mutilform/checkCard'))
+const MKCheckCard = asyncComponent(() => import('@/tabviews/zshare/mutilform/mkCheckCard'))
 const MKSelect = asyncComponent(() => import('./mkSelect'))
 const DateGroup = asyncComponent(() => import('./dategroup'))
 const MKDatePicker = asyncComponent(() => import('./mkDatePicker'))
@@ -94,7 +95,8 @@
     }
 
     _searchlist.forEach(item => {
-      if (item.type === 'link') {
+      // if (item.type === 'link') {
+      if (item.linkField) {
         linkFields[item.linkField] = linkFields[item.linkField] || []
         linkFields[item.linkField].push({field: item.field, uuid: item.uuid})
       }
@@ -130,7 +132,8 @@
           item.options.unshift({
             key: Utils.getuuid(),
             Value: '',
-            Text: this.state.dict['main.all']
+            Text: '鍏ㄩ儴',
+            ParentID: ''
           })
         }
 
@@ -164,11 +167,11 @@
     let _list = _searchlist.map(item => {
       if (item.hidden) return item
 
-      if (linkFields[item.field]) {
+      if (linkFields[item.field] && (item.type === 'select' || item.type === 'link' || (item.type === 'checkcard' && item.multiple !== 'true'))) {
         item.linkFields = linkFields[item.field]
       }
 
-      if (item.type === 'link') {
+      if (item.linkField) {
         let supItem = fieldMap.get(item.linkField)
         
         if (!supItem) {
@@ -387,7 +390,7 @@
             _item = {..._item, ...cell}
           }
 
-          if (item.type === 'link') {
+          if (item.linkField) {
             _item.ParentID = cell[item.linkField]
           }
 
@@ -397,13 +400,13 @@
         item.oriOptions = [...item.oriOptions, ...options]
       }
 
-      if (item.type === 'link') {
+      if (item.linkField) {
         if (item.supInitVal) {
           item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal || option.Value === '')
         } else {
           item.options = item.oriOptions
         }
-      } else if (item.type === 'select' || item.type === 'multiselect' || item.type === 'checkcard') {
+      } else if (item.oriOptions) {
         item.options = item.oriOptions
       }
 
@@ -425,7 +428,9 @@
         this.handleSubmit()
       }, 1000)
     } else {
-      this.handleSubmit()
+      setTimeout(() => {
+        this.handleSubmit()
+      }, 10)
     }
   }
 
@@ -434,6 +439,16 @@
     this.record[item.field] = type
 
     this.handleSubmit()
+  }
+
+  cardChange = (val, item) => {
+    this.record[item.field] = val
+
+    if (!item.linkFields) {
+      setTimeout(() => {
+        this.handleSubmit()
+      }, 10)
+    }
   }
 
   getFields() {
@@ -468,7 +483,7 @@
         content = <DateGroup position={index} config={item} onChange={(val, type) => this.dateGroupChange(val, type, item)} />
       } else if (item.type === 'checkcard') {
         className = 'checkcard'
-        content = <MKCheckCard card={item} onChange={this.handleSubmit} />
+        content = <MKCheckCard config={item} onChange={(val) => this.cardChange(val, item)} />
       }
 
       if (content) {
@@ -519,7 +534,7 @@
     this.setState({}, () => {
       this.props.form.validateFields((err, values) => {
         if (err) return
-  
+
         let { searches, error } = this.getFieldsValues(values)
   
         if (error) {
@@ -708,7 +723,7 @@
                   <div key={index}>
                     <span>{item.label}: </span>
                     <span className="advance-value">{item.value}</span>
-                    <Icon type="close" onClick={() => this.closeAdvanceForm(item)} />
+                    <CloseOutlined onClick={() => this.closeAdvanceForm(item)} />
                   </div>)
               })}
             </div> : null}

--
Gitblit v1.8.0