From c7aece35a62b6e91fd98a625bf0e53f64bfbd18d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 17 八月 2023 16:22:15 +0800
Subject: [PATCH] 2023-08-17

---
 src/tabviews/zshare/mutilform/index.jsx               |   29 ++++++++++++++
 src/templates/zshare/modalform/index.jsx              |   20 +++++++---
 src/tabviews/zshare/topSearch/index.jsx               |   16 ++++++--
 src/templates/zshare/formconfig.jsx                   |   26 +++++++++++++
 src/tabviews/zshare/actionList/normalbutton/index.jsx |    8 +++
 src/tabviews/zshare/mutilform/mkDatePicker/index.jsx  |    4 +-
 6 files changed, 90 insertions(+), 13 deletions(-)

diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index 7dfd165..f07a1dd 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -1226,7 +1226,13 @@
             if (Array.isArray(res.mk_ex_data) && res.mk_ex_data.length > 0) {
               let pices = res.mk_ex_data.map(item => {
                 item.$pice = true
-                item.$record = record
+                item.$record = {...record}
+
+                if (item.hasOwnProperty('mk_api_key')) {
+                  item.$record.mk_api_key = item.mk_api_key || record.mk_api_key || ''
+
+                  delete item.mk_api_key
+                }
                 return item
               })
               params = [...pices, ...params]
diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx
index 43ac759..33e80b9 100644
--- a/src/tabviews/zshare/mutilform/index.jsx
+++ b/src/tabviews/zshare/mutilform/index.jsx
@@ -213,6 +213,35 @@
         if (newval === '$empty' && item.initval) {
           newval = moment().subtract(item.initval, 'days').format(_format)
         }
+
+        if (item.minDate) {
+          if (item.minDate === 'custom') {
+            if (/^\d{4}-\d{2}-\d{2}$/.test(item.minDateField)) {
+              item.minDate = moment(item.minDateField).format('YYYY-MM-DD')
+            } else {
+              let val = data[item.minDateField.toLowerCase()]
+              item.minDate = val ? moment(val).format('YYYY-MM-DD') : ''
+            }
+
+            item.minDate = item.minDate === 'Invalid date' ? '' : item.minDate
+          } else {
+            item.minDate = moment().add(item.minDate, 'days').format('YYYY-MM-DD')
+          }
+        }
+        if (item.maxDate) {
+          if (item.maxDate === 'custom') {
+            if (/^\d{4}-\d{2}-\d{2}$/.test(item.maxDateField)) {
+              item.maxDate = moment(item.maxDateField).format('YYYY-MM-DD')
+            } else {
+              let val = data[item.maxDateField.toLowerCase()]
+              item.maxDate = val ? moment(val).format('YYYY-MM-DD') : ''
+            }
+
+            item.maxDate = item.maxDate === 'Invalid date' ? '' : item.maxDate
+          } else {
+            item.maxDate = moment().add(item.maxDate, 'days').format('YYYY-MM-DD')
+          }
+        }
       } else if (item.type === 'datemonth') {
         if (newval !== '$empty') {
           newval = moment(newval, 'YYYY-MM').format('YYYY-MM')
diff --git a/src/tabviews/zshare/mutilform/mkDatePicker/index.jsx b/src/tabviews/zshare/mutilform/mkDatePicker/index.jsx
index 6643b2b..0fe72ab 100644
--- a/src/tabviews/zshare/mutilform/mkDatePicker/index.jsx
+++ b/src/tabviews/zshare/mutilform/mkDatePicker/index.jsx
@@ -37,8 +37,8 @@
 
     this.state = {
       value,
-      minDate: config.minDate ? moment().add(config.minDate, 'days').startOf('day') : '',
-      maxDate: config.maxDate ? moment().add(config.maxDate, 'days').endOf('day') : '',
+      minDate: config.minDate ? moment(config.minDate).startOf('day') : '',
+      maxDate: config.maxDate ? moment(config.maxDate).endOf('day') : '',
       mode,
       format
     }
diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx
index c45413d..11d86ec 100644
--- a/src/tabviews/zshare/topSearch/index.jsx
+++ b/src/tabviews/zshare/topSearch/index.jsx
@@ -127,7 +127,9 @@
             val = val + ':00'
           }
         }
-        advanceValues.push({field: item.field, type: item.type, label: item.label, value: val})
+        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') {
@@ -630,7 +632,9 @@
                 val = val + ':00'
               }
             }
-            advanceValues.push({field: item.field, type: item.type, label: item.label, value: val})
+            if (['text', 'date', 'datemonth', 'dateweek', 'daterange'].includes(item.type)) {
+              advanceValues.push({field: item.field, type: item.type, label: item.label, value: val})
+            }
           }
         })
         this.setState({advanceValues})
@@ -725,7 +729,9 @@
             val = val + ':00'
           }
         }
-        advanceValues.push({field: item.field, type: item.type, label: item.label, value: val})
+        if (['text', 'date', 'datemonth', 'dateweek', 'daterange'].includes(item.type)) {
+          advanceValues.push({field: item.field, type: item.type, label: item.label, value: val})
+        }
       }
 
       return item
@@ -840,7 +846,9 @@
             val = val + ':00'
           }
         }
-        advanceValues.push({field: item.field, type: item.type, label: item.label, value: val})
+        if (['text', 'date', 'datemonth', 'dateweek', 'daterange'].includes(item.type)) {
+          advanceValues.push({field: item.field, type: item.type, label: item.label, value: val})
+        }
       }
     })
 
diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx
index ee46093..313c909 100644
--- a/src/templates/zshare/formconfig.jsx
+++ b/src/templates/zshare/formconfig.jsx
@@ -3068,7 +3068,20 @@
       }, {
         value: '-90',
         text: '鍓�90澶�'
+      }, {
+        value: 'custom',
+        text: '鑷畾涔�'
       }]
+    },
+    {
+      type: 'text',
+      key: 'minDateField',
+      label: '鏈�灏忓�硷紙瀛楁锛�',
+      initVal: card.minDateField || '',
+      tooltip: '鏈�灏忓�煎搴斿瓧娈碉紝涔熷彲鑷畾涔夊浐瀹氬�硷紝鏍煎紡涓篩YYY-MM-DD銆�',
+      required: true,
+      readonly: false,
+      options: columns
     },
     {
       type: 'select',
@@ -3118,9 +3131,22 @@
       }, {
         value: '-90',
         text: '鍓�90澶�'
+      }, {
+        value: 'custom',
+        text: '鑷畾涔�'
       }]
     },
     {
+      type: 'text',
+      key: 'maxDateField',
+      label: '鏈�澶у�硷紙瀛楁锛�',
+      initVal: card.maxDateField || '',
+      tooltip: '鏈�澶у�煎搴斿瓧娈碉紝涔熷彲鑷畾涔夊浐瀹氬�硷紝鏍煎紡涓篩YYY-MM-DD銆�',
+      required: true,
+      readonly: false,
+      options: columns
+    },
+    {
       type: 'radio',
       key: 'precision',
       label: '绮剧‘搴�',
diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx
index b49f28b..c6c2a7b 100644
--- a/src/templates/zshare/modalform/index.jsx
+++ b/src/templates/zshare/modalform/index.jsx
@@ -32,7 +32,7 @@
   check: ['initval', 'openVal', 'closeVal', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom', 'checkTip'],
   date: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'place', 'marginTop', 'marginBottom', 'minDate', 'maxDate', 'precision'],
   datemonth: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'place', 'marginTop', 'marginBottom'],
-  datetime: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'marginTop', 'marginBottom', 'minDate', 'maxDate'],
+  // datetime: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'marginTop', 'marginBottom', 'minDate', 'maxDate'],
   textarea: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'span', 'labelwidth', 'maxRows', 'encryption', 'interception', 'tooltip', 'extra', 'place', 'count', 'placeholder', 'marginTop', 'marginBottom'],
   cascader: ['readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'place', 'splitline', 'marginTop', 'marginBottom', 'separator'],
   color: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'colorType', 'extra', 'marginTop', 'marginBottom'],
@@ -222,7 +222,7 @@
         }
       } else {
         shows.push('fieldlength', 'checkAll')
-        reTooltip.initval = '娣诲姞澶氫釜鍒濆鍊艰浣跨敤閫楀彿鍒嗛殧銆�'
+        reTooltip.initval = '娣诲姞澶氫釜鍒濆鍊艰浣跨敤閫楀彿鍒嗛殧銆�' 
       }
 
       shows.push('linkField')
@@ -234,9 +234,17 @@
       if (this.record.readonly === 'true' && this.record.hidden !== 'true') {
         shows.push('unchecked')
       }
-    } else if (['date', 'datemonth', 'datetime'].includes(type)) {
+    } else if (['date', 'datemonth'].includes(type)) {
       reOptions.initval = dateOptions[type]
       reTypes.initval = 'select'
+      if (type === 'date') {
+        if (this.record.minDate === 'custom') {
+          shows.push('minDateField')
+        }
+        if (this.record.maxDate === 'custom') {
+          shows.push('maxDateField')
+        }
+      }
     } else if (type === 'switch' || type === 'check') {
       reOptions.initval = [
         {value: true, text: '寮�'},
@@ -588,7 +596,7 @@
     this.props.form.setFieldsValue({dataSource: resource})
   }
 
-  complete = (key, option) => {
+  complete = (option) => {
     let label = option.props.label
 
     this.props.form.setFieldsValue({label: label})
@@ -642,13 +650,13 @@
           })
         }
 
-        if (item.key === 'field' && item.options && item.options.length > 0) {
+        if (['field', 'minDateField', 'maxDateField'].includes(item.key) && item.options && item.options.length > 0) {
           content = <AutoComplete
             dataSource={item.options.map((cell) => <AutoComplete.Option label={cell.label} value={cell.field} key={cell.uuid}>
               {cell.field}
             </AutoComplete.Option>)}
             filterOption={(input, option) => option.props.children.indexOf(input) > -1}
-            onSelect={this.complete}
+            onSelect={(val, option) => item.key === 'field' && this.complete(option)}
             placeholder=""
           >
             <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />

--
Gitblit v1.8.0