From 09e0de52a398dd08a0dc3f4b43e4589d211e9c27 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 30 十二月 2021 12:44:45 +0800
Subject: [PATCH] 2021-12-30

---
 src/tabviews/zshare/topSearch/index.jsx |   36 +++++++++++++++++++++++++-----------
 1 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx
index 8cbca63..8f02a8b 100644
--- a/src/tabviews/zshare/topSearch/index.jsx
+++ b/src/tabviews/zshare/topSearch/index.jsx
@@ -16,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'))
@@ -95,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})
       }
@@ -131,7 +132,8 @@
           item.options.unshift({
             key: Utils.getuuid(),
             Value: '',
-            Text: this.state.dict['main.all']
+            Text: '鍏ㄩ儴',
+            ParentID: ''
           })
         }
 
@@ -165,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) {
@@ -388,7 +390,7 @@
             _item = {..._item, ...cell}
           }
 
-          if (item.type === 'link') {
+          if (item.linkField) {
             _item.ParentID = cell[item.linkField]
           }
 
@@ -398,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
       }
 
@@ -426,7 +428,9 @@
         this.handleSubmit()
       }, 1000)
     } else {
-      this.handleSubmit()
+      setTimeout(() => {
+        this.handleSubmit()
+      }, 10)
     }
   }
 
@@ -435,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() {
@@ -469,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) {
@@ -520,7 +534,7 @@
     this.setState({}, () => {
       this.props.form.validateFields((err, values) => {
         if (err) return
-  
+
         let { searches, error } = this.getFieldsValues(values)
   
         if (error) {

--
Gitblit v1.8.0