From 4590502dd26419fd190045d84fbf11eccb6093f7 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 07 五月 2022 15:53:12 +0800
Subject: [PATCH] 2022-05-07

---
 src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx |   54 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 53 insertions(+), 1 deletions(-)

diff --git a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx b/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx
index b87cf16..d8918a1 100644
--- a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx
+++ b/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx
@@ -294,7 +294,7 @@
       let param = {
         func: 's_debug_sql',
         exec_type: 'y',
-        LText: SettingUtils.getDebugSql(setting, _scripts, columns, Utils.getRegOptions(searches), config.calendar, config.urlFields)
+        LText: SettingUtils.getDebugSql(setting, _scripts, columns, this.getRegOptions(searches), config.calendar, config.urlFields)
       }
       param.LText = Utils.formatOptions(param.LText)
       param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
@@ -315,6 +315,58 @@
     }
   }
 
+  getRegOptions = (searches) => {
+    if (!searches || searches.length === 0) return []
+
+    let options = []
+    let fieldmap = new Map()
+    searches.forEach(search => {
+      let item = {
+        key: search.field,
+        value: '0'
+      }
+
+      if (fieldmap.has(item.key)) {
+        item.key = item.key + '1'
+      }
+
+      fieldmap.set(item.key, true)
+
+      if (search.type === 'group') {
+        options.push({
+          key: search.field,
+          value: '0'
+        })
+        options.push({
+          key: search.datefield,
+          value: '0'
+        })
+        options.push({
+          key: search.datefield + '1',
+          value: '0'
+        })
+        options.push(item)
+      } else if (['datemonth', 'dateweek', 'daterange'].includes(search.type)) {
+        options.push(item)
+        options.push({
+          key: item.key + '1',
+          value: '0'
+        })
+      } else if (search.type === 'text' || search.type === 'select') {
+        item.key.split(',').forEach(field => {
+          let cell = JSON.parse(JSON.stringify(item))
+          cell.key = field
+
+          options.push(cell)
+        })
+      } else {
+        options.push(item)
+      }
+    })
+
+    return options
+  }
+
   updatefields = (columns) => {
     this.setState({
       columns: columns

--
Gitblit v1.8.0