From 4de0acf2a232ae29f2b5bd7bb2ee61a238c5d2d0 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 24 十月 2023 17:31:55 +0800
Subject: [PATCH] 2023-10-24

---
 src/menu/components/table/base-table/columns/editColumn/formconfig.jsx |   97 +++++++++++++++++++++++++++++++++---------------
 1 files changed, 66 insertions(+), 31 deletions(-)

diff --git a/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx
index 29bf27a..afb5789 100644
--- a/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx
+++ b/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx
@@ -33,6 +33,12 @@
     value: 'number',
     text: '鏁板瓧'
   }, {
+    value: 'custom',
+    text: '鑷畾涔夊垪'
+  }, {
+    value: 'formula',
+    text: '鍏紡'
+  }, {
     value: 'picture',
     text: '鍥剧墖'
   }, {
@@ -45,24 +51,16 @@
     value: 'textarea',
     text: '澶氳鏂囨湰'
   }, {
-    value: 'custom',
-    text: '鑷畾涔夊垪'
-  }, {
     value: 'colspan',
     text: '鍚堝苟鍒�'
-  }, {
-    value: 'formula',
-    text: '鍏紡'
   }, {
     value: 'index',
     text: '搴忓彿'
   }]
 
-  if (!card.isSub) {
-    options.push({
-      value: 'action',
-      text: '鎿嶄綔'
-    })
+  let decimal = card.decimal === undefined ? 0 : card.decimal
+  if (card.type === 'formula' && typeof(card.decimal) !== 'number') {
+    decimal = ''
   }
 
   return [
@@ -71,7 +69,11 @@
       key: 'label',
       label: '鍒楀ご鏂囧瓧',
       initVal: card.label,
-      required: true
+      required: true,
+      rules: [{
+        max: 100,
+        message: '鏈�澶�100涓瓧绗︺��'
+      }]
     },
     {
       type: 'select',
@@ -87,14 +89,25 @@
       label: '瀛楁',
       initVal: card.field,
       required: true,
-      options: card.isSub ? fields : []
+      options: card.isSub ? fields : [],
+      rules: [{
+        pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/ig,
+        message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶃�佹眽瀛椾互鍙奯'
+      }, {
+        max: 100,
+        message: '鏈�澶�100涓瓧绗︺��'
+      }]
     },
     {
       type: 'text',
       key: 'nameField',
       label: '鍚嶇О瀛楁',
       initVal: card.nameField || '',
-      required: false
+      required: false,
+      rules: [{
+        max: 100,
+        message: '鏈�澶�100涓瓧绗︺��'
+      }]
     },
     {
       type: 'number',
@@ -138,7 +151,7 @@
       type: 'radio',
       key: 'IsSort',
       label: '鎺掑簭',
-      initVal: card.IsSort || (card.isSub ? 'false' : 'true'),
+      initVal: card.IsSort || (card.isSub || card.type === 'custom' ? 'false' : 'true'),
       required: true,
       options: [{
         value: 'true',
@@ -146,6 +159,32 @@
       }, {
         value: 'false',
         text: '鍚�'
+      }]
+    },
+    {
+      type: 'select',
+      key: 'sortField',
+      label: '鎺掑簭瀛楁',
+      initVal: card.sortField || '',
+      required: true,
+      options: fields
+    },
+    {
+      type: 'radio',
+      key: 'eval',
+      label: '瑙f瀽鏂瑰紡',
+      initVal: card.eval || 'false',
+      tooltip: '褰撳叕寮忓唴瀹规秹鍙婅绠楁椂璇烽�夋嫨鈥滆绠椻�濓紝褰撳叕寮忓唴瀹逛负瀛楁鎷兼帴鏃惰閫夋嫨鈥滃瓧娈垫浛鎹⑩�濓紝浣跨敤鍑芥暟鏃跺叆鍙備负data锛堟暟缁勶級銆�',
+      required: false,
+      options: [{
+        value: 'false',
+        text: '瀛楁鏇挎崲'
+      }, {
+        value: 'true',
+        text: '璁$畻'
+      }, {
+        value: 'func',
+        text: '鍑芥暟'
       }]
     },
     {
@@ -214,7 +253,7 @@
         value: 'false',
         text: '鍚�'
       }],
-      forbid: card.isSub
+      forbid: card.isSub || card.sum !== 'true'
     },
     {
       type: 'number',
@@ -231,7 +270,7 @@
       max: 18,
       decimal: 0,
       label: '灏忔暟浣�',
-      initVal: card.decimal === undefined ? 0 : card.decimal,
+      initVal: decimal,
       required: !card.isSub
     },
     {
@@ -280,7 +319,11 @@
       label: '鍓嶇紑',
       initVal: card.prefix || '',
       required: false,
-      readonly: false
+      readonly: false,
+      rules: [{
+        max: 100,
+        message: '鏈�澶�100涓瓧绗︺��'
+      }]
     },
     {
       type: 'text',
@@ -288,7 +331,11 @@
       label: '鍚庣紑',
       initVal: card.postfix || '',
       required: false,
-      readonly: false
+      readonly: false,
+      rules: [{
+        max: 100,
+        message: '鏈�澶�100涓瓧绗︺��'
+      }]
     },
     {
       type: 'number',
@@ -390,18 +437,6 @@
       initVal: card.linkfields || [],
       required: false,
       options: fields,
-    },
-    {
-      type: 'radio',
-      key: 'eval',
-      label: '瑙f瀽',
-      initVal: card.eval || 'true',
-      tooltip: '褰撳叕寮忓唴瀹规秹鍙婅绠楁椂璇烽�夋嫨鈥滄槸鈥濓紝褰撳叕寮忓唴瀹逛负瀛楁鎷兼帴鏃惰閫夋嫨鈥滃惁鈥濄��',
-      required: false,
-      options: [
-        { value: 'true', text: '鏄�' },
-        { value: 'false', text: '鍚�' }
-      ]
     },
     {
       type: 'textarea',

--
Gitblit v1.8.0