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

---
 src/templates/zshare/modalform/index.jsx |   74 ++++++++++++++++++++++++++++++++-----
 1 files changed, 64 insertions(+), 10 deletions(-)

diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx
index 9e82b99..b49f28b 100644
--- a/src/templates/zshare/modalform/index.jsx
+++ b/src/templates/zshare/modalform/index.jsx
@@ -19,16 +19,17 @@
 const MkEditIcon = asyncComponent(() => import('@/components/mkIcon'))
 
 const modalTypeOptions = {
-  text: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'regular', 'interception', 'span', 'labelwidth', 'encryption', 'tooltip', 'extra', 'enter', 'cursor', 'scan', 'splitline', 'placeholder', 'place', 'marginTop', 'marginBottom', 'lenControl', 'inputType'],
+  text: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'regular', 'interception', 'span', 'labelwidth', 'encryption', 'tooltip', 'extra', 'enter', 'cursor', 'scan', 'splitline', 'placeholder', 'place', 'marginTop', 'marginBottom', 'lenControl', 'inputType', 'constant'],
   number: ['initval', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'enter', 'cursor', 'splitline', 'place', 'marginTop', 'marginBottom'],
-  select: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'setAll', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'place', 'emptyText', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom'],
+  select: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'setAll', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'place', 'emptyText', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom', 'pickerMode'],
   checkbox: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'place', 'splitline', 'arrange', 'marginTop', 'marginBottom'],
   radio: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'place', 'setAll', 'emptyText', 'splitline', 'arrange', 'marginTop', 'marginBottom'],
   checkcard: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'span', 'labelwidth', 'display', 'tooltip', 'extra', 'place', 'width', 'multiple', 'splitline', 'marginTop', 'marginBottom'],
   multiselect: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'marginTop', 'marginBottom', 'dropdown'],
-  link: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'setAll', 'linkField', 'linkSubField', 'span', 'place', 'labelwidth', 'tooltip', 'extra', 'emptyText', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom'],
+  link: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'setAll', 'linkField', 'linkSubField', 'span', 'place', 'labelwidth', 'tooltip', 'extra', 'emptyText', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom', 'pickerMode'],
   fileupload: ['readonly', 'required', 'readin', 'fieldlength', 'maxfile', 'fileType', 'span', 'labelwidth', 'tooltip', 'extra', 'compress', 'miniSet', 'splitline', 'marginTop', 'marginBottom', 'maxSize'],
-  switch: ['initval', 'openVal', 'closeVal', 'openText', 'closeText', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom'],
+  switch: ['initval', 'openVal', 'closeVal', 'openText', 'closeText', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'linkSubField', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom'],
+  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'],
@@ -203,9 +204,9 @@
       } else {
         reRequired.fields = true
         if (this.record.resourceType === '0') {        // 鑷畾涔夎祫婧�
-          shows.push('options', 'fields', 'selectStyle')
+          shows.push('options', 'fields', 'selectStyle', 'border')
         } else if (this.record.resourceType === '1') { // 鏁版嵁婧�
-          shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'disableField', 'database', 'selectStyle')
+          shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'disableField', 'database', 'selectStyle', 'border')
         }
         if (this.record.selectStyle === 'custom') {
           shows.push('backgroundColor')
@@ -220,7 +221,7 @@
           shows.push('decimal')
         }
       } else {
-        shows.push('fieldlength')
+        shows.push('fieldlength', 'checkAll')
         reTooltip.initval = '娣诲姞澶氫釜鍒濆鍊艰浣跨敤閫楀彿鍒嗛殧銆�'
       }
 
@@ -236,7 +237,7 @@
     } else if (['date', 'datemonth', 'datetime'].includes(type)) {
       reOptions.initval = dateOptions[type]
       reTypes.initval = 'select'
-    } else if (type === 'switch') {
+    } else if (type === 'switch' || type === 'check') {
       reOptions.initval = [
         {value: true, text: '寮�'},
         {value: false, text: '鍏�'}
@@ -370,7 +371,7 @@
       if (value === 'number' || value === 'rate') {
         this.record.initval = 0
         _fieldval.initval = 0
-      } else if (value === 'switch') {
+      } else if (value === 'switch' || value === 'check') {
         this.record.initval = false
         _fieldval.initval = false
       }
@@ -726,6 +727,9 @@
         if (this.record.type === 'select' || this.record.type === 'link') {
           extra = <span className="add-resource-empty" onClick={this.handleEmpty}>绌�</span>
         }
+        if (item.placeholder) {
+          extra = <><span className="resource-public-var">{item.placeholder}</span>{extra}</>
+        }
 
         content = <CodeMirror />
       } else if (item.type === 'textarea') {
@@ -808,6 +812,52 @@
     return fields
   }
 
+  transfer = (options) => {
+    if (options.length === 0) return options
+
+    let isNumber = true
+    options.forEach(item => {
+      if (!/^([0-9]|[1-9]\d{0,2})$/.test(item.Value)) {
+        isNumber = false
+      }
+    })
+
+    if (isNumber) {
+      return options.map(item => {
+        item.Value = +item.Value
+        return item
+      })
+    } else {
+      return options.map(item => {
+        item.Value = item.Value + ''
+        return item
+      })
+    }
+  }
+
+  transferCard = (options) => {
+    if (options.length === 0) return options
+
+    let isNumber = true
+    options.forEach(item => {
+      if (!/^([0-9]|[1-9]\d{0,2})$/.test(item.$value)) {
+        isNumber = false
+      }
+    })
+
+    if (isNumber) {
+      return options.map(item => {
+        item.$value = +item.$value
+        return item
+      })
+    } else {
+      return options.map(item => {
+        item.$value = item.$value + ''
+        return item
+      })
+    }
+  }
+
   handleConfirm = () => {
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
     return new Promise((resolve, reject) => {
@@ -823,6 +873,8 @@
               if (values.type === 'radio' && values.linkField) {
                 type = 'link'
               }
+
+              values.options = this.transfer(values.options)
 
               if (values.options.filter(op => op.Text === '').length > 0) {
                 notification.warning({
@@ -876,6 +928,8 @@
                 })
                 return m
               })
+
+              values.options = this.transferCard(values.options)
 
               let type = values.type
               if (values.linkField) {
@@ -932,7 +986,7 @@
 
           ['linkField', 'valueField', 'valueText', 'orderBy'].forEach(item => {
             if (values[item]) {
-              values[item] = values[item].replace(/\s*|\t*|\v*|\r*/ig, '')
+              values[item] = values[item].replace(/\s+|\t+|\v+|\r+/ig, '')
             }
           })
 

--
Gitblit v1.8.0