From 2f3b614bb34f5e2865e91c949712f5ee5e8a18f2 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 08 十一月 2023 21:43:52 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/menu/components/table/base-table/index.jsx |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/menu/components/table/base-table/index.jsx b/src/menu/components/table/base-table/index.jsx
index e301f10..95759e2 100644
--- a/src/menu/components/table/base-table/index.jsx
+++ b/src/menu/components/table/base-table/index.jsx
@@ -247,6 +247,8 @@
     res.drawerPlacement = card.wrap.drawerPlacement || 'right'
     res.searchRatio = card.wrap.searchRatio || 6
     res.searchLwidth = card.wrap.searchLwidth !== undefined ? card.wrap.searchLwidth : 33.3
+    res.borderRadius = card.wrap.borderRadius || 0
+    res.resetContrl = card.wrap.resetContrl || 'init'
 
     this.updateComponent({...card, wrap: res})
   }
@@ -257,12 +259,23 @@
     config.cols.forEach(col => {
       if (!col.field) return
       if (['text', 'picture', 'video', 'textarea'].includes(col.type)) {
+        let datatype = `Nvarchar(${col.fieldlength || 50})`
+        let type = 'text'
+
+        if (col.type === 'text') {
+          if (col.textFormat === 'YYYY-MM-DD') {
+            datatype = 'date'
+          } else if (col.textFormat === 'YYYY-MM-DD HH:mm:ss') {
+            datatype = 'datetime'
+          }
+        }
+
         config.columns.push({
-          datatype: `Nvarchar(${col.fieldlength || 50})`,
+          datatype: datatype,
           field: col.field,
           fieldlength: col.fieldlength || 50,
           label: col.label,
-          type: 'text',
+          type: type,
           uuid: col.uuid
         })
       } else if (col.type === 'link') {
@@ -306,6 +319,14 @@
       config.absFields = null
     }
 
+    if (!config.setting.primaryKey && config.columns.length > 0) {
+      config.columns.forEach(col => {
+        if (col.field.toLowerCase() === 'id') {
+          config.setting.primaryKey = col.field
+        }
+      })
+    }
+
     this.updateComponent(config)
   }
 

--
Gitblit v1.8.0