From 8e003c1a94d26cc4d477e7aa03593ccb4d7e6c61 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 11 十月 2024 17:47:40 +0800
Subject: [PATCH] 2024-10-11

---
 src/templates/comtableconfig/updatetable/index.jsx |   42 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/src/templates/comtableconfig/updatetable/index.jsx b/src/templates/comtableconfig/updatetable/index.jsx
index ed03667..f61593a 100644
--- a/src/templates/comtableconfig/updatetable/index.jsx
+++ b/src/templates/comtableconfig/updatetable/index.jsx
@@ -29,7 +29,7 @@
 
   trigger = () => {
     const { config } = this.props
-    const _this = this
+    const that = this
 
     if (!config.enabled) {
       notification.warning({
@@ -45,7 +45,7 @@
       content: '',
       onOk() {
         return new Promise(resolve => {
-          _this.execUpdate(resolve)
+          that.execUpdate(resolve)
         })
       },
       onCancel() {}
@@ -429,6 +429,40 @@
   
                 if (_LongParam) {
                   _LongParam.uuid = item.uuid
+
+                  if (_LongParam.fields && _LongParam.fields.length === 0 && _LongParam.groups && _LongParam.groups.length > 0) {
+                    _LongParam.groups.forEach(group => {
+                      if (group.sublist && group.sublist.length > 0) {
+                        _LongParam.fields.push({
+                          uuid: Utils.getuuid(),
+                          label: group.label,
+                          field: '',
+                          type: 'split'
+                        })
+                        _LongParam.fields.push(...group.sublist)
+                      }
+                    })
+                  }
+
+                  let span = _LongParam.setting && _LongParam.setting.cols ? (24 / _LongParam.setting.cols) : 12
+                  if (![24, 12, 8].includes(span)) {
+                    span = 12
+                  }
+
+                  if (_LongParam.fields) {
+                    _LongParam.fields = _LongParam.fields.map(n => {
+                      if (!n.span && n.type !== 'split') {
+                        if (['textarea', 'hint', 'checkcard', 'brafteditor'].includes(n.type)) {
+                          n.span = 24
+                        } else {
+                          n.span = span
+                        }
+                      }
+
+                      return n
+                    })
+                  }
+
                   resolve(_LongParam)
                 } else {
                   resolve({uuid: item.uuid, $empty: true})
@@ -577,7 +611,7 @@
 
   saveConfig = (_resolve, _config, errors) => {
     let err = errors.join('锛�')
-    let _this = this
+    let that = this
 
     if (err) {
       _resolve()
@@ -586,7 +620,7 @@
         content: '',
         onOk() {
           return new Promise(resolve => {
-            _this.saveNewMenu(resolve, _config)
+            that.saveNewMenu(resolve, _config)
           })
         },
         onCancel() {}

--
Gitblit v1.8.0