From 41c55c1f103658b997f7a828a7067bdb228f1df0 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 04 十月 2022 23:35:10 +0800
Subject: [PATCH] 2022-10-04

---
 src/templates/zshare/editTable/index.jsx |   42 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/src/templates/zshare/editTable/index.jsx b/src/templates/zshare/editTable/index.jsx
index 0319a12..91e86e8 100644
--- a/src/templates/zshare/editTable/index.jsx
+++ b/src/templates/zshare/editTable/index.jsx
@@ -364,7 +364,47 @@
     let data = fromJS(this.state.data).toJS()
 
     this.pasteFormRef.handleConfirm().then(res => {
-      if (res.key !== type) {
+      if (res.copyType === 'columns' && type === 'datasourcefield') {
+        res.type = 'array'
+        res.data = []
+        res.columns.forEach(col => {
+          if (!col.field) return
+          if (col.type === 'number') {
+            let datatype = 'Int'
+            if (col.decimal) {
+              datatype = `Decimal(18,${col.decimal})`
+            }
+
+            res.data.push({
+              $index: res.data.length + 1,
+              datatype: datatype,
+              field: col.field,
+              decimal: col.decimal,
+              label: col.label,
+              type: 'number',
+              uuid: Utils.getuuid()
+            })
+          } else {
+            let datatype = 'Nvarchar(50)'
+            let fieldlength = 50
+            if (col.fieldlength && [10, 20, 50, 100, 256, 512, 1024, 2048].includes(col.fieldlength)) {
+              fieldlength = col.fieldlength
+              datatype = `Nvarchar(${fieldlength})`
+            }
+
+            res.data.push({
+              $index: res.data.length + 1,
+              datatype: datatype,
+              field: col.field,
+              fieldlength: fieldlength,
+              label: col.label,
+              type: 'text',
+              uuid: Utils.getuuid()
+            })
+          }
+
+        })
+      } else if (res.key !== type) {
         message.warning('閰嶇疆淇℃伅鏍煎紡閿欒锛�')
         return
       }

--
Gitblit v1.8.0