From 3e168c2a5149f1a56e41cacf4eda95d10b497210 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 29 八月 2023 17:17:01 +0800
Subject: [PATCH] 2023-08-29

---
 src/tabviews/zshare/topSearch/index.jsx |   87 +++++++++++++++++++++++++++++++------------
 1 files changed, 63 insertions(+), 24 deletions(-)

diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx
index 11d86ec..9c97e94 100644
--- a/src/tabviews/zshare/topSearch/index.jsx
+++ b/src/tabviews/zshare/topSearch/index.jsx
@@ -114,22 +114,11 @@
 
       if (item.advanced && !forbid) {
         _setting.showAdv = true
+        if (!['group', 'check', 'switch'].includes(item.type)) {
+          item.signValue = true
+        }
       } else {
         item.advanced = false
-      }
-
-      if (item.advanced && item.initval) {
-        let val = item.initval
-        if (item.precision === 'hour') {
-          if (/,/ig.test(val)) {
-            val = val.split(',').map(m => m + ':00').join(',')
-          } else {
-            val = val + ':00'
-          }
-        }
-        if (['text', 'date', 'datemonth', 'dateweek', 'daterange'].includes(item.type)) {
-          advanceValues.push({field: item.field, type: item.type, label: item.label, value: val})
-        }
       }
 
       if (item.type === 'group') {
@@ -179,6 +168,29 @@
         if (item.type === 'checkcard' && item.multiple === 'dropdown' && item.resourceType === '0') {
           this.resetCheckcard(item)
         }
+      }
+
+      if (item.signValue && item.initval) {
+        let val = item.initval
+        if (item.precision === 'hour') {
+          if (/,/ig.test(val)) {
+            val = val.split(',').map(m => m + ':00').join(',')
+          } else {
+            val = val + ':00'
+          }
+        }
+
+        let text = val
+
+        if (item.type === 'select' || item.type === 'link' || item.type === 'radio') {
+          item.oriOptions.forEach(cell => {
+            if (cell.Value === val) {
+              text = cell.Text
+            }
+          })
+        }
+
+        advanceValues.push({field: item.field, type: item.type, label: item.label, value: val, text})
       }
 
       fieldMap.set(item.field, item)
@@ -621,7 +633,7 @@
       if (visible) {
         let advanceValues = []
         this.state.searchlist.forEach(item => {
-          if (!item.advanced) return
+          if (!item.signValue) return
     
           let val = this.record[item.field]
           if (val || val === 0) {
@@ -632,9 +644,18 @@
                 val = val + ':00'
               }
             }
-            if (['text', 'date', 'datemonth', 'dateweek', 'daterange'].includes(item.type)) {
-              advanceValues.push({field: item.field, type: item.type, label: item.label, value: val})
+
+            let text = val
+
+            if (item.type === 'select' || item.type === 'link' || item.type === 'radio') {
+              item.oriOptions.forEach(cell => {
+                if (cell.Value === val) {
+                  text = cell.Text
+                }
+              })
             }
+
+            advanceValues.push({field: item.field, type: item.type, label: item.label, value: val, text})
           }
         })
         this.setState({advanceValues})
@@ -720,7 +741,7 @@
       } else {
         record[item.field] = item.initval
       }
-      if (item.advanced && item.initval) {
+      if (item.signValue && item.initval) {
         let val = item.initval
         if (item.precision === 'hour') {
           if (/,/ig.test(val)) {
@@ -729,9 +750,18 @@
             val = val + ':00'
           }
         }
-        if (['text', 'date', 'datemonth', 'dateweek', 'daterange'].includes(item.type)) {
-          advanceValues.push({field: item.field, type: item.type, label: item.label, value: val})
+
+        let text = val
+
+        if (item.type === 'select' || item.type === 'link' || item.type === 'radio') {
+          item.oriOptions.forEach(cell => {
+            if (cell.Value === val) {
+              text = cell.Text
+            }
+          })
         }
+
+        advanceValues.push({field: item.field, type: item.type, label: item.label, value: val, text})
       }
 
       return item
@@ -835,7 +865,7 @@
 
     let advanceValues = []
     this.state.searchlist.forEach(item => {
-      if (!item.advanced) return
+      if (!item.signValue) return
 
       let val = this.record[item.field]
       if (val || val === 0) {
@@ -846,9 +876,18 @@
             val = val + ':00'
           }
         }
-        if (['text', 'date', 'datemonth', 'dateweek', 'daterange'].includes(item.type)) {
-          advanceValues.push({field: item.field, type: item.type, label: item.label, value: val})
+
+        let text = val
+
+        if (item.type === 'select' || item.type === 'link' || item.type === 'radio') {
+          item.oriOptions.forEach(cell => {
+            if (cell.Value === val) {
+              text = cell.Text
+            }
+          })
         }
+
+        advanceValues.push({field: item.field, type: item.type, label: item.label, value: val, text})
       }
     })
 
@@ -886,7 +925,7 @@
                 return (
                   <div key={index}>
                     <span>{item.label}: </span>
-                    <span className="advance-value">{item.value}</span>
+                    <span className="advance-value">{item.text}</span>
                     <CloseOutlined onClick={() => this.closeAdvanceForm(item)} />
                   </div>)
               })}

--
Gitblit v1.8.0