From 8d7c3eed8bdac1e77c8de90a3227d801708c358e Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 15 五月 2023 21:12:56 +0800
Subject: [PATCH] 2023-05-15

---
 src/templates/zshare/modalform/index.jsx |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx
index 043f984..4c6d8f7 100644
--- a/src/templates/zshare/modalform/index.jsx
+++ b/src/templates/zshare/modalform/index.jsx
@@ -29,6 +29,7 @@
   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'],
+  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'],
@@ -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
       }
@@ -808,6 +809,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 +870,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({
@@ -877,6 +926,8 @@
                 return m
               })
 
+              values.options = this.transferCard(values.options)
+
               let type = values.type
               if (values.linkField) {
                 type = 'link'

--
Gitblit v1.8.0