From 89a8bfae913e3b702bf16d6d5bc6818ba6501267 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 08 九月 2023 20:23:12 +0800
Subject: [PATCH] 2023-09-08

---
 src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx |  117 ++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 80 insertions(+), 37 deletions(-)

diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
index cb4990f..c834b60 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
@@ -388,48 +388,91 @@
     const { verify } = this.state
 
     let _columns = JSON.parse(JSON.stringify(verify.columns))
-
-    let _cols = _columns.map(col => col.Column)
+    let _cols = _columns.map(col => col.Column.toLowerCase())
+    let names = {$up: false}
 
     columns.forEach(col => {
-      if (col.field && !_cols.includes(col.field)) {
-        let _type = 'Nvarchar(50)'
-        let _limit = '50'
-        if (col.type === 'number' && !col.decimal) {
-          _type = 'Int'
-          _limit = ''
-        } else if (col.type === 'number') {
-          _type = 'Decimal(18,' + col.decimal + ')'
-          _limit = col.decimal
-        }
-
-        let _cell = {
-          uuid: col.uuid,
-          Column: col.field,
-          Text: col.label,
-          type: _type,
-          limit: _limit,
-          import: 'true',
-          required: 'true'
-        }
-
-        if (_type !== 'Nvarchar(50)') {
-          _cell.min = 0
-          _cell.max = 999999
-        }
-
-        _columns.push(_cell)
+      if (!col.field) return
+      if (_cols.includes(col.field.toLowerCase())) {
+        names.$up = true
+        names[col.field.toLowerCase()] = col.label
+        return
       }
+
+      let _type = 'Nvarchar(50)'
+      let _limit = '50'
+      if (col.type === 'number' && !col.decimal) {
+        _type = 'Int'
+        _limit = ''
+      } else if (col.type === 'number') {
+        _type = 'Decimal(18,' + col.decimal + ')'
+        _limit = col.decimal
+      }
+
+      let _cell = {
+        uuid: col.uuid,
+        Column: col.field,
+        Text: col.label,
+        type: _type,
+        limit: _limit,
+        import: 'true',
+        required: 'true'
+      }
+
+      if (_type !== 'Nvarchar(50)') {
+        _cell.min = 0
+        _cell.max = 999999
+      }
+
+      _columns.push(_cell)
     })
 
-    this.setState({
-      verify: {
-        ...verify,
-        columns: _columns
-      }
-    }, () => {
-      this.resetUniqueColumns()
-    })
+    if (names.$up) {
+      const that = this
+
+      confirm({
+        content: '閮ㄥ垎瀛楁鍚嶇О涓庢樉绀哄垪涓嶄竴鑷达紝鏄惁鏇存柊锛�',
+        onOk() {
+          _columns = _columns.map(item => {
+            let key = item.Column.toLowerCase()
+
+            if (names[key]) {
+              item.Text = names[key]
+            }
+
+            return item
+          })
+
+          that.setState({
+            verify: {
+              ...verify,
+              columns: _columns
+            }
+          }, () => {
+            that.resetUniqueColumns()
+          })
+        },
+        onCancel() {
+          that.setState({
+            verify: {
+              ...verify,
+              columns: _columns
+            }
+          }, () => {
+            that.resetUniqueColumns()
+          })
+        }
+      })
+    } else {
+      this.setState({
+        verify: {
+          ...verify,
+          columns: _columns
+        }
+      }, () => {
+        this.resetUniqueColumns()
+      })
+    }
   }
 
   clearField = () => {

--
Gitblit v1.8.0