From 920e94fc5483b081b3d43c86df8f56d838f2f14d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 06 一月 2024 22:07:15 +0800
Subject: [PATCH] 2024-01-06

---
 src/templates/sharecomponent/searchcomponent/searchform/index.jsx |   46 ++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx
index 5dbb18b..21a7065 100644
--- a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx
+++ b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx
@@ -240,6 +240,10 @@
       }
       shows.push('linkField')
       reRequired.linkField = false
+    } else if (type === 'daterange') {
+      if (this.record.initval) {
+        shows.push('dateShift')
+      }
     }
 
     if (dateOptions.hasOwnProperty(type)) { // 鏍规嵁鎼滅储鏉′欢绫诲瀷锛岄�夋嫨鍒濆鍊肩殑绫诲瀷鍙婃暟鎹�
@@ -252,6 +256,7 @@
       reTypes.initval = 'text'
     }
 
+    reTooltip.match = ''
     if (type === 'text') {
       reOptions.match = matchReg.class1
     } else if (type === 'multiselect') {
@@ -263,7 +268,8 @@
     } else if (type === 'date') {
       reOptions.match = matchReg.class4
     } else if (type === 'datemonth') {
-      reOptions.match = matchReg.class5
+      reTooltip.match = '鍖归厤妯″紡涓� between 鏃讹紝鎼滅储鏉′欢涓哄ぇ浜庢湀鍒濆皬浜庢湀鏈紝鍖归厤妯″紡涓� = 鏃讹紝鎼滅储鏉′欢涓虹瓑浜庡綋鍓嶆湀锛圷YYY-MM锛夈��'
+      reOptions.match = matchReg.class6
     } else if (type === 'dateweek' || type === 'daterange' || type === 'range') {
       reOptions.match = matchReg.class5
     } else if (type === 'checkcard') {
@@ -284,6 +290,25 @@
     } else if (type === 'group') {
       reTooltip.field = '鏌ヨ鏁版嵁鏃讹紙鑷畾涔夎剼鏈垨缁熻鏁版嵁婧愶級锛岀被鍨嬪瓧娈靛皢鐢ㄤ綔鏇挎崲鑴氭湰涓殑 @瀛楁@ 锛岀被鍨嬪瓧娈靛搴斿�间负锛氭棩 -> day锛涘懆 -> week锛涙湀 -> month锛涘 -> quarter锛涘勾 -> year锛涜嚜瀹氫箟 -> customized'
       reLabel.field = '绫诲瀷瀛楁'
+    }
+
+    reTooltip.initval = ''
+    if (type === 'select') {
+      if (this.record.resourceType === '0') {
+        reTooltip.initval = '鍒濆鍊煎簲涓烘暟鎹殑Value鍊硷紝鍙娇鐢ˊusername@銆丂fullName@'
+      } else if (this.record.resourceType === '1') {
+        reTooltip.initval = '鍒濆鍊煎簲涓恒�婂�悸峰瓧娈点�嬬殑鍊硷紝鍙娇鐢ˊusername@銆丂fullName@銆�$first銆傛敞锛氫娇鐢�$first鏃讹紝鎼滅储鏉′欢搴斾负蹇呭~銆�'
+      }
+    } else if (type === 'link') {
+      if (this.record.resourceType === '0') {
+        reTooltip.initval = '鍒濆鍊煎簲涓烘暟鎹殑Value鍊笺��'
+      } else if (this.record.resourceType === '1') {
+        reTooltip.initval = '鍒濆鍊煎簲涓恒�婂�悸峰瓧娈点�嬬殑鍊硷紝鍙娇鐢�$first銆傛敞锛氫娇鐢�$first鏃讹紝鎼滅储鏉′欢搴斾负蹇呭~銆�'
+      }
+    } else if (type === 'text') {
+      reTooltip.initval = '鍙娇鐢ˊusername@銆丂fullName@銆�'
+    } else if (type === 'range') {
+      reTooltip.initval = '浣跨敤閫楀彿鎷兼帴锛屼緥濡� 3,10'
     }
 
     return {
@@ -488,7 +513,7 @@
         rules = [
           { required: item.required, message: '璇疯緭鍏�' + item.label + '!' }
         ]
-        if (item.key === 'field' || item.key === 'datefield') {
+        if (item.key === 'field' || item.key === 'datefield' || item.key === 'dateShift') {
           rules.push({
             pattern: (type === 'text' || type === 'select' || type === 'daterange') ? formRule.field.multipattern : formRule.field.pattern,
             message: formRule.field.message
@@ -688,6 +713,23 @@
             values.field = values.field.join(',')
           }
 
+          if (['select', 'link'].includes(values.type)) {
+            if (values.resourceType === '1') {
+              if (/\$first/.test(values.initval) && values.initval.replace(/\s/g, '') === '$first') {
+                values.initval = '$first'
+              }
+
+              if (values.initval === '$first' && values.required !== 'true') {
+                notification.warning({
+                  top: 92,
+                  message: '浣跨敤$first鏃讹紝鎼滅储鏉′欢搴斾负蹇呭~锛�',
+                  duration: 5
+                })
+                return
+              }
+            }
+          }
+
           // 涓嬫媺鑿滃崟鎴栬仈鍔ㄨ彍鍗�
           if (['multiselect', 'select', 'link', 'radio'].includes(values.type)) {
             if (values.resourceType === '0') {

--
Gitblit v1.8.0