From dbc911dbb044895f98a49ef69ef5a5800a4aba3e Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 15 九月 2024 20:26:39 +0800 Subject: [PATCH] 2024-09-15 --- src/menu/components/table/base-table/index.jsx | 27 +++++++++++++++++++++++---- 1 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/menu/components/table/base-table/index.jsx b/src/menu/components/table/base-table/index.jsx index c05c3d4..4b4394e 100644 --- a/src/menu/components/table/base-table/index.jsx +++ b/src/menu/components/table/base-table/index.jsx @@ -219,7 +219,7 @@ getWrapForms = () => { const { wrap, action, columns, cols } = this.state.card - let _actions = [...action] + let _actions = [] cols.forEach(col => { if (col.type === 'custom') { @@ -231,7 +231,7 @@ } }) - return getWrapForm(wrap, _actions, columns) + return getWrapForm(wrap, _actions, columns, action) } updateWrap = (res) => { @@ -259,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') { @@ -308,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