From 0594fe8d97286a535177f8ba05972d0305fc7dee Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 17 二月 2020 14:15:58 +0800
Subject: [PATCH] 2020-02-17

---
 src/templates/comtableconfig/actionform/index.jsx    |   18 +-
 src/templates/tableshare/dragelement/card.jsx        |   19 +-
 src/tabviews/tableshare/excelin/index.jsx            |   58 +++---
 src/templates/tableshare/verifycard/index.jsx        |    6 
 src/templates/comtableconfig/index.jsx               |   82 ++++------
 src/templates/tableshare/verifycardexcelin/index.jsx |   89 ++++++-----
 src/templates/subtableconfig/index.jsx               |   82 ++++------
 src/templates/tableshare/formconfig.js               |    7 
 src/utils/utils.js                                   |   31 +--
 src/tabviews/tableshare/actionList/index.jsx         |   42 ++++-
 src/templates/subtableconfig/actionform/index.jsx    |   34 +++-
 11 files changed, 243 insertions(+), 225 deletions(-)

diff --git a/src/tabviews/tableshare/actionList/index.jsx b/src/tabviews/tableshare/actionList/index.jsx
index 77d8372..4b1444c 100644
--- a/src/tabviews/tableshare/actionList/index.jsx
+++ b/src/tabviews/tableshare/actionList/index.jsx
@@ -118,7 +118,12 @@
       this.refreshdata(item, 'excelOut')
     } else if (item.OpenType === 'excelIn') {
       if (item.verify && item.verify.sheet && item.verify.columns && item.verify.columns.length > 0) {
-        this.refs.excelIn.exceltrigger(item)
+        let primaryId = '' // 瀵煎叆鏃惰Id
+        if (item.Ot === 'requiredSgl') {
+          primaryId = data[0][setting.primaryKey] || ''
+        }
+
+        this.refs.excelIn.exceltrigger(item, primaryId)
       } else {
         notification.warning({
           top: 92,
@@ -791,19 +796,35 @@
     })
   }
 
-  getexceldata = (data, btn, errors) => {
-    if (errors && errors.length > 0) {
-      notification.warning({
-        top: 92,
-        message: errors.join(',') + '琛ㄥご璁剧疆閿欒锛�',
-        duration: 10
-      })
+  getexceldata = (data, btn, errors, primaryId) => {
+    if (errors) {
+      if (errors === 'notexit') {
+        notification.warning({
+          top: 92,
+          message: '宸ヤ綔琛ㄣ��' + btn.verify.sheet + '銆嬩笉瀛樺湪锛�',
+          duration: 10
+        })
+      } else if (errors === 'empty') {
+        notification.warning({
+          top: 92,
+          message: '宸ヤ綔琛ㄣ��' + btn.verify.sheet + '銆嬩负绌猴紒',
+          duration: 10
+        })
+      } else if (errors === 'headerError') {
+        notification.warning({
+          top: 92,
+          message: '宸ヤ綔琛ㄣ��' + btn.verify.sheet + '銆嬭〃澶磋缃敊璇紒',
+          duration: 10
+        })
+      }
+      
       return
     }
+
     if (!data || data.length === 0) {
       notification.warning({
         top: 92,
-        message: '鏈幏鍙栧埌excel鏁版嵁锛�',
+        message: '鏈幏鍙栧埌宸ヤ綔琛ㄣ��' + btn.verify.sheet + '銆嬫暟鎹紒',
         duration: 10
       })
       return
@@ -820,7 +841,8 @@
     }
 
     let param = {
-      BID: this.props.BID
+      BID: this.props.BID,
+      ID: primaryId
     }
 
     param.LText = Utils.formatOptions(result.sql)
diff --git a/src/tabviews/tableshare/excelin/index.jsx b/src/tabviews/tableshare/excelin/index.jsx
index d0906a8..4d015b2 100644
--- a/src/tabviews/tableshare/excelin/index.jsx
+++ b/src/tabviews/tableshare/excelin/index.jsx
@@ -13,13 +13,15 @@
 
   state = {
     excelbtn: null,
+    primaryId: '', // 琛孖d
     excelId: Utils.getuuid()
   }
 
-  exceltrigger = (item) => {
+  exceltrigger = (item, primaryId) => {
     const { excelId } = this.state
     this.setState({
-      excelbtn: item
+      excelbtn: item,
+      primaryId: primaryId
     })
 
     let _excelInput = document.getElementById(excelId + this.props.MenuID)
@@ -29,7 +31,7 @@
     }
   }
   onImportExcel = file => {
-    const { excelbtn } = this.state
+    const { excelbtn, primaryId } = this.state
 
     let columns = excelbtn.verify.columns.map(option => option.Column)
     let range = excelbtn.verify.range || 0
@@ -44,42 +46,40 @@
         // 浠ヤ簩杩涘埗娴佹柟寮忚鍙栧緱鍒版暣浠絜xcel琛ㄦ牸瀵硅薄
         const workbook = XLSX.read(result, { type: 'binary' })
 
-        let errors = []
-        if (range === 1) {
-          workbook.SheetNames.forEach(sheetname => {
-            if (workbook.Sheets.hasOwnProperty(sheetname)) {
-              let header = XLSX.utils.sheet_to_json(workbook.Sheets[sheetname], {header: columns})[0]
-              
-              if (!header) {
-                errors.push(sheetname)
-              } else {
-                let iserror = false
-                excelbtn.verify.columns.forEach(op => {
-                  if (header[op.Column] !== op.Text) {
-                    iserror = true
-                  }
-                })
+        let errors = null
 
-                if (iserror) {
-                  errors.push(sheetname)
-                }
+        if (!workbook.Sheets.hasOwnProperty(excelbtn.verify.sheet)) {
+          errors = 'notexit'
+        } else if (range === 1) {
+          let header = XLSX.utils.sheet_to_json(workbook.Sheets[excelbtn.verify.sheet], {header: columns})[0]
+          
+          if (!header) {
+            errors = 'empty'
+          } else {
+            let iserror = false
+            excelbtn.verify.columns.forEach(op => {
+              if (header[op.Column] !== op.Text) {
+                iserror = true
               }
+            })
+
+            if (iserror) {
+              errors = 'headerError'
             }
-          })
+          }
         }
 
         let data = []
 
-        workbook.SheetNames.forEach(sheetname => {
-          if (workbook.Sheets.hasOwnProperty(sheetname)) {
-            data = data.concat(XLSX.utils.sheet_to_json(workbook.Sheets[sheetname], {header: columns, range: (range)}))
-          }
-        })
+        if (!errors) {
+          data = XLSX.utils.sheet_to_json(workbook.Sheets[excelbtn.verify.sheet], {header: columns, range: (range)})
+        }
 
         // 鏈�缁堣幏鍙栧埌骞朵笖鏍煎紡鍖栧悗鐨� json 鏁版嵁
-        this.props.returndata(data, excelbtn, errors)
+        this.props.returndata(data, excelbtn, errors, primaryId)
         this.setState({
-          excelId: ''
+          excelId: '',
+          primaryId: ''
         }, () => {
           this.setState({
             excelId: Utils.getuuid()
diff --git a/src/templates/comtableconfig/actionform/index.jsx b/src/templates/comtableconfig/actionform/index.jsx
index a40a22c..158d78d 100644
--- a/src/templates/comtableconfig/actionform/index.jsx
+++ b/src/templates/comtableconfig/actionform/index.jsx
@@ -108,9 +108,9 @@
       }
     } else if (_opentype === 'excelIn') {    // 瀵煎叆瀵煎嚭
       if (_intertype === 'outer') {
-        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError']
+        _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError']
       } else {
-        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError']
+        _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError']
       }
     } else {
       if (_intertype === 'outer') {
@@ -131,7 +131,7 @@
         } else if (item.key === 'Ot') {
           if (_opentype === 'innerpage' || _position === 'grid') {
             item.options = this.state.reqOptionSgl
-          } else if (['outerpage', 'blank', 'tab', 'popview'].includes(_opentype)) {
+          } else if (['outerpage', 'blank', 'tab', 'popview', 'excelIn'].includes(_opentype)) {
             item.options = this.state.reqOptions
           } else {
             item.options = this.state.reqOptionsMutil
@@ -198,9 +198,9 @@
         }
       } else if (value === 'excelIn') {
         if (this.state.interType === 'outer') {
-          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError']
+          _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError']
         } else {
-          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError']
+          _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError']
         }
       } else {
         if (this.state.interType === 'inner') {
@@ -226,6 +226,9 @@
           } else if (['outerpage', 'blank', 'tab', 'popview'].includes(value)) {
             item.options = this.state.reqOptions
             _fieldval.Ot = 'requiredSgl'
+          } else if (value === 'excelIn') {
+            item.options = this.state.reqOptions
+            _fieldval.Ot = 'notRequired'
           } else {
             item.options = this.state.reqOptionsMutil
           }
@@ -306,9 +309,9 @@
         }
       } else if (openType === 'excelIn') {
         if (value === 'outer') {
-          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError']
+          _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError']
         } else {
-          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError']
+          _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError']
         }
       } else {
         if (value === 'inner') {
@@ -512,7 +515,6 @@
 
           if (values.OpenType === 'excelIn') {
             values.position = 'toolbar'
-            values.Ot = 'notRequired'
           } else if (values.OpenType === 'excelOut') {
             values.position = 'toolbar'
             values.Ot = 'notRequired'
diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx
index ea8f770..0b67ebd 100644
--- a/src/templates/comtableconfig/index.jsx
+++ b/src/templates/comtableconfig/index.jsx
@@ -1303,9 +1303,10 @@
   verifySubmit = () => {
     const { card } = this.state
     let config = JSON.parse(JSON.stringify(this.state.config))
-    let _verify = this.verifyRef.state.verify
-
+    
     if (card.OpenType !== 'excelIn') {
+      let _verify = this.verifyRef.state.verify
+
       if (_verify.default === 'false' && _verify.scripts.length === 0) {
         notification.warning({
           top: 92,
@@ -1314,57 +1315,38 @@
         })
         return
       }
-    } else if (card.OpenType === 'excelIn') {
-      let cols = _verify.columns.map(col => col.Column)
-      cols = Array.from(new Set(cols))
 
-      if (!_verify.sheet) {
-        notification.warning({
-          top: 92,
-          message: '璇疯缃鍏ヨ〃鍚�!',
-          duration: 10
-        })
-        return
-      } else if (_verify.columns.length === 0) {
-        notification.warning({
-          top: 92,
-          message: '璇疯缃瓻xcel鍒楀瓧娈�!',
-          duration: 10
-        })
-        return
-      } else if (_verify.columns.length > cols.length) {
-        notification.warning({
-          top: 92,
-          message: 'Excel鍒楀瓧娈靛悕锛屼笉鍙噸澶�!',
-          duration: 10
-        })
-        return
-      } else if (_verify.range === 1) {
-        let tEmptys = _verify.columns.filter(op => !op.Text)
-        if (tEmptys.length > 0) {
-          notification.warning({
-            top: 92,
-            message: '蹇界暐棣栬鏃讹紝浼氫娇鐢═ext鍊兼牎楠孍xcel棣栬鍐呭锛孴ext鍊间笌Excel琛ㄩ琛屽唴瀹圭浉鍚岋紝涓斿潎涓嶅彲涓虹┖锛�',
-            duration: 10
-          })
-          return
+      config.action = config.action.map(item => {
+        if (item.uuid === card.uuid) {
+          item.verify = _verify
         }
-      }  
+  
+        return item
+      })
+  
+      this.setState({
+        profileVisible: false,
+        config: config,
+        card: '',
+      })
+    } else if (card.OpenType === 'excelIn') {
+      this.verifyRef.handleConfirm().then(res => {
+        
+        config.action = config.action.map(item => {
+          if (item.uuid === card.uuid) {
+            item.verify = res
+          }
+    
+          return item
+        })
+    
+        this.setState({
+          profileVisible: false,
+          config: config,
+          card: '',
+        })
+      })
     }
-
-    config.action = config.action.map(item => {
-      if (item.uuid === card.uuid) {
-        item.verify = _verify
-      }
-
-      return item
-    })
-
-    this.setState({
-      profileVisible: false,
-      config: config,
-      card: '',
-    })
   }
 
   /**
diff --git a/src/templates/subtableconfig/actionform/index.jsx b/src/templates/subtableconfig/actionform/index.jsx
index c9bd789..f4eabb0 100644
--- a/src/templates/subtableconfig/actionform/index.jsx
+++ b/src/templates/subtableconfig/actionform/index.jsx
@@ -24,6 +24,13 @@
       value: 'requiredSgl',
       text: this.props.dict['header.form.requiredSgl']
     }],
+    reqOptions: [{
+      value: 'notRequired',
+      text: this.props.dict['header.form.notRequired']
+    }, {
+      value: 'requiredSgl',
+      text: this.props.dict['header.form.requiredSgl']
+    }],
     reqOptionsMutil: [{
       value: 'notRequired',
       text: this.props.dict['header.form.notRequired']
@@ -95,9 +102,9 @@
       }
     } else if (_opentype === 'excelIn') {
       if (_intertype === 'outer') {
-        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError']
+        _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError']
       } else {
-        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError']
+        _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError']
       }
     } else {
       if (_intertype === 'outer') {
@@ -116,7 +123,11 @@
         } else if (item.key === 'icon') {
           item.options = btnIcons
         } else if (item.key === 'Ot') {
-          item.options = this.state.reqOptionsMutil
+          if (_opentype === 'excelIn') {
+            item.options = this.state.reqOptions
+          } else {
+            item.options = this.state.reqOptionsMutil
+          }
         } else if (item.key === 'sqlType') {
           if (['prompt', 'exec'].includes(_opentype)) {
             item.options = this.state.deleteOptions
@@ -191,9 +202,9 @@
         }
       } else if (value === 'excelIn') {
         if (this.state.interType === 'outer') {
-          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError']
+          _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError']
         } else {
-          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError']
+          _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError']
         }
       } else {
         if (this.state.interType === 'inner') {
@@ -216,6 +227,9 @@
             if (this.state.position === 'grid') {
               item.options = this.state.reqOptionSgl
               item.initVal = 'requiredSgl'
+            } else if (value === 'excelIn') {
+              item.options = this.state.reqOptions
+              item.initVal = 'notRequired'
             } else {
               item.options = this.state.reqOptionsMutil
             }
@@ -232,7 +246,7 @@
           return item
         })
       }, () => {
-        if (['excelIn', 'excelOut'].includes(value)) return
+        if (['excelOut'].includes(value)) return
 
         this.setState({
           formlist: this.state.formlist.map(item => {
@@ -317,9 +331,9 @@
         }
       } else if (openType === 'excelIn') {
         if (value === 'outer') {
-          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError']
+          _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError']
         } else {
-          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError']
+          _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError']
         }
       } else {
         if (value === 'inner') {
@@ -513,7 +527,9 @@
           values.uuid = this.props.card.uuid
           values.verify = this.props.card.verify || null
 
-          if (values.OpenType === 'excelIn' || values.OpenType === 'excelOut') {
+          if (values.OpenType === 'excelIn') {
+            values.position = 'toolbar'
+          } else if (values.OpenType === 'excelOut') {
             values.position = 'toolbar'
             values.Ot = 'notRequired'
           } else if (values.OpenType === 'popview' && !values.linkTab) { // 娌℃湁鍏宠仈鏍囩锛堟柊寤烘椂锛夛紝鍒涘缓鏂版爣绛綢d
diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx
index be73f88..12ecf47 100644
--- a/src/templates/subtableconfig/index.jsx
+++ b/src/templates/subtableconfig/index.jsx
@@ -1123,9 +1123,10 @@
   verifySubmit = () => {
     const { card } = this.state
     let config = JSON.parse(JSON.stringify(this.state.config))
-    let _verify = this.verifyRef.state.verify
-
+    
     if (card.OpenType !== 'excelIn') {
+      let _verify = this.verifyRef.state.verify
+
       if (_verify.default === 'false' && _verify.scripts.length === 0) {
         notification.warning({
           top: 92,
@@ -1134,57 +1135,38 @@
         })
         return
       }
-    } else if (card.OpenType === 'excelIn') {
-      let cols = _verify.columns.map(col => col.Column)
-      cols = Array.from(new Set(cols))
 
-      if (!_verify.sheet) {
-        notification.warning({
-          top: 92,
-          message: '璇疯缃鍏ヨ〃鍚�!',
-          duration: 10
-        })
-        return
-      } else if (_verify.columns.length === 0) {
-        notification.warning({
-          top: 92,
-          message: '璇疯缃瓻xcel鍒楀瓧娈�!',
-          duration: 10
-        })
-        return
-      } else if (_verify.columns.length > cols.length) {
-        notification.warning({
-          top: 92,
-          message: 'Excel鍒楀瓧娈靛悕锛屼笉鍙噸澶�!',
-          duration: 10
-        })
-        return
-      } else if (_verify.range === 1) {
-        let tEmptys = _verify.columns.filter(op => !op.Text)
-        if (tEmptys.length > 0) {
-          notification.warning({
-            top: 92,
-            message: '蹇界暐棣栬鏃讹紝浼氫娇鐢═ext鍊兼牎楠孍xcel棣栬鍐呭锛孴ext鍊间笌Excel琛ㄩ琛屽唴瀹圭浉鍚岋紝涓斿潎涓嶅彲涓虹┖锛�',
-            duration: 10
-          })
-          return
+      config.action = config.action.map(item => {
+        if (item.uuid === card.uuid) {
+          item.verify = _verify
         }
-      }  
-    }
+  
+        return item
+      })
+  
+      this.setState({
+        profileVisible: false,
+        config: config,
+        card: ''
+      })
+    } else if (card.OpenType === 'excelIn') {
+      this.verifyRef.handleConfirm().then(res => {
+        
+        config.action = config.action.map(item => {
+          if (item.uuid === card.uuid) {
+            item.verify = res
+          }
     
-    config.action = config.action.map(item => {
-      if (item.uuid === card.uuid) {
-        item.verify = _verify
-      }
-
-      return item
-    })
-
-    this.setState({
-      profileVisible: false,
-      config: config,
-      card: ''
-    })
+          return item
+        })
+    
+        this.setState({
+          profileVisible: false,
+          config: config,
+          card: ''
+        })
+      })
+    }
   }
 
   /**
diff --git a/src/templates/tableshare/dragelement/card.jsx b/src/templates/tableshare/dragelement/card.jsx
index cb6963f..8e70cdc 100644
--- a/src/templates/tableshare/dragelement/card.jsx
+++ b/src/templates/tableshare/dragelement/card.jsx
@@ -75,6 +75,15 @@
     }
   }
 
+  let hasProfile = false
+  if (type === 'action') {
+    if (['pop', 'prompt', 'exec'].includes(card.OpenType) && card.intertype === 'inner' && !card.innerFunc) {
+      hasProfile = true
+    } else if (card.OpenType === 'excelIn') {
+      hasProfile = true
+    }
+  }
+
   return (
     <div className="page-card" style={type === 'columns' ? { flex: card.Width, opacity: opacity} : { opacity: opacity}}>
       <div ref={node => drag(drop(node))}>
@@ -134,12 +143,6 @@
             {showfield ?
               <div className="ant-table-column-fields">
                 <span className="ant-table-column-title">{card.type === 'colspan' ? card.subfield : card.field}</span>
-                {/* <span className="ant-table-column-title">
-                  {card.type === 'colspan' ?
-                    <Paragraph copyable>{card.subfield}</Paragraph> :
-                    <Paragraph copyable>{card.field}</Paragraph>
-                  }
-                </span> */}
               </div> : null
             }
           </span> : null
@@ -148,9 +151,7 @@
       <Icon className="edit" title="缂栬緫" type="edit" onClick={edit} />
       <Icon className="edit close" title="鍒犻櫎" type="close" onClick={del} />
       {type === 'action' ? <Icon className="edit copy" title="澶嶅埗" type="copy" onClick={copy} /> : null}
-      {type === 'action' && ['pop', 'prompt', 'exec', 'excelIn'].includes(card.OpenType) && card.intertype === 'inner' && !card.innerFunc ?
-        <Icon className="edit profile" title="鏍¢獙瑙勫垯" type="profile" onClick={profile} /> : null
-      }
+      {hasProfile ? <Icon className="edit profile" title="鏍¢獙瑙勫垯" type="profile" onClick={profile} /> : null}
     </div>
   )
 }
diff --git a/src/templates/tableshare/formconfig.js b/src/templates/tableshare/formconfig.js
index 89e0b96..77891d2 100644
--- a/src/templates/tableshare/formconfig.js
+++ b/src/templates/tableshare/formconfig.js
@@ -488,6 +488,13 @@
     },
     {
       type: 'text',
+      key: 'sheet',
+      label: Formdict['header.form.tablename'],
+      initVal: card.sheet || config.setting.tableName || '',
+      required: true
+    },
+    {
+      type: 'text',
       key: 'sql',
       label: Formdict['header.form.tablename'],
       initVal: card.sql || config.setting.tableName || '',
diff --git a/src/templates/tableshare/verifycard/index.jsx b/src/templates/tableshare/verifycard/index.jsx
index fff84eb..358d8b4 100644
--- a/src/templates/tableshare/verifycard/index.jsx
+++ b/src/templates/tableshare/verifycard/index.jsx
@@ -1133,7 +1133,7 @@
                 </Col>
                 <Col span={8}>
                   <Form.Item label={'鍋滅暀鏃堕棿'}>
-                    <InputNumber defaultValue={2} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'stime')}} />
+                    <InputNumber defaultValue={verify.stime || 2} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'stime')}} />
                   </Form.Item>
                 </Col>
               </Row>
@@ -1156,7 +1156,7 @@
                 </Col>
                 <Col span={8}>
                   <Form.Item label={'鍋滅暀鏃堕棿'}>
-                    <InputNumber defaultValue={15} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ntime')}} />
+                    <InputNumber defaultValue={verify.ntime || 15} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ntime')}} />
                   </Form.Item>
                 </Col>
               </Row>
@@ -1171,7 +1171,7 @@
                 </Col>
                 <Col span={8}>
                   <Form.Item label={'鍋滅暀鏃堕棿'}>
-                    <InputNumber defaultValue={15} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ftime')}} />
+                    <InputNumber defaultValue={verify.ftime || 15} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ftime')}} />
                   </Form.Item>
                 </Col>
               </Row>
diff --git a/src/templates/tableshare/verifycardexcelin/index.jsx b/src/templates/tableshare/verifycardexcelin/index.jsx
index cd13e2f..395a1eb 100644
--- a/src/templates/tableshare/verifycardexcelin/index.jsx
+++ b/src/templates/tableshare/verifycardexcelin/index.jsx
@@ -1,7 +1,6 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { Form, Tabs, Row, Col, Input, Button, Table, Popconfirm, Icon, notification, Modal, message, InputNumber } from 'antd'
-import { formRule } from '@/utils/option.js'
 
 import Utils from '@/utils/utils.js'
 
@@ -133,7 +132,7 @@
     this.setState({
       verify: {
         ..._verify,
-        sheet: _verify.sheet || '',
+        sheet: _verify.sheet || 'Sheet1',
         range: _verify.range || 0,
         columns: _verify.columns || [],
         scripts: _verify.scripts || []
@@ -272,38 +271,53 @@
     })
   }
 
-  sheetChange = (e) => {
+  handleConfirm = () => {
     const { verify } = this.state
+    // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
+    return new Promise((resolve, reject) => {
+      this.props.form.validateFieldsAndScroll((err, values) => {
+        if (!err) {
+          let _verify = {...verify, ...values}
 
-    this.setState({}, () => {
-      this.props.form.validateFields(['sheet'], (errors, values) => {
-        if (!errors) {
-          this.setState({
-            verify: {
-              ...verify,
-              ...values
+          let cols = _verify.columns.map(col => col.Column)
+          cols = Array.from(new Set(cols))
+
+          if (_verify.columns.length === 0) {
+            notification.warning({
+              top: 92,
+              message: '璇疯缃瓻xcel鍒楀瓧娈�!',
+              duration: 10
+            })
+            return
+          } else if (_verify.columns.length > cols.length) {
+            notification.warning({
+              top: 92,
+              message: 'Excel鍒楀瓧娈靛悕锛屼笉鍙噸澶�!',
+              duration: 10
+            })
+            return
+          } else if (_verify.range === 1) {
+            let tEmptys = _verify.columns.filter(op => !op.Text)
+            if (tEmptys.length > 0) {
+              notification.warning({
+                top: 92,
+                message: '蹇界暐棣栬鏃讹紝浼氫娇鐢═ext鍊兼牎楠孍xcel棣栬鍐呭锛孴ext鍊间笌Excel琛ㄩ琛屽唴瀹圭浉鍚岋紝涓斿潎涓嶅彲涓虹┖锛�',
+                duration: 10
+              })
+              return
             }
-          })
+          }
+          console.log(_verify)
+
+          resolve(_verify)
         } else {
-          this.setState({
-            verify: {
-              ...verify,
-              sheet: ''
-            }
+          notification.warning({
+            top: 92,
+            message: '璇疯缃瓻xcel琛ㄥ悕!',
+            duration: 10
           })
         }
       })
-    })
-  }
-  
-  rangeChange = (value) => {
-    const { verify } = this.state
-
-    this.setState({
-      verify: {
-        ...verify,
-        range: value || 0
-      }
     })
   }
 
@@ -365,28 +379,23 @@
             <Form {...formItemLayout}>
               <Row gutter={24}>
                 <Col span={8}>
-                  <Form.Item label={this.props.dict['header.form.tablename']}>
+                  <Form.Item label={'Excel琛ㄥ悕'}>
                     {getFieldDecorator('sheet', {
                       initialValue: verify.sheet || '',
                       rules: [
                         {
                           required: true,
                           message: this.props.dict['form.required.input'] + this.props.dict['header.form.tablename'] + '!'
-                        },
-                        {
-                          pattern: formRule.table.pattern,
-                          message: formRule.table.message
-                        }, {
-                          max: formRule.table.max,
-                          message: formRule.table.maxMessage
                         }
                       ]
-                    })(<Input placeholder="" autoComplete="off" onChange={this.sheetChange} />)}
+                    })(<Input placeholder="" autoComplete="off" />)}
                   </Form.Item>
                 </Col>
                 <Col span={8}>
                   <Form.Item label={'蹇界暐琛�'}>
-                    <InputNumber min={0} max={100} precision={0} defaultValue={0} onChange={this.rangeChange} />
+                    {getFieldDecorator('range', {
+                      initialValue: verify.range || 0
+                    })(<InputNumber min={0} max={100} precision={0} />)}
                   </Form.Item>
                 </Col>
               </Row>
@@ -437,7 +446,7 @@
                 </Col>
                 <Col span={8}>
                   <Form.Item label={'鍋滅暀鏃堕棿'}>
-                    <InputNumber defaultValue={2} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'stime')}} />
+                    <InputNumber defaultValue={verify.stime || 2} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'stime')}} />
                   </Form.Item>
                 </Col>
               </Row>
@@ -460,7 +469,7 @@
                 </Col>
                 <Col span={8}>
                   <Form.Item label={'鍋滅暀鏃堕棿'}>
-                    <InputNumber defaultValue={15} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ntime')}} />
+                    <InputNumber defaultValue={verify.ntime || 15} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ntime')}} />
                   </Form.Item>
                 </Col>
               </Row>
@@ -475,7 +484,7 @@
                 </Col>
                 <Col span={8}>
                   <Form.Item label={'鍋滅暀鏃堕棿'}>
-                    <InputNumber defaultValue={15} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ftime')}} />
+                    <InputNumber defaultValue={verify.ftime || 15} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ftime')}} />
                   </Form.Item>
                 </Col>
               </Row>
diff --git a/src/utils/utils.js b/src/utils/utils.js
index 9994fd0..ea8091e 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -451,6 +451,7 @@
 
     let errors = []
     let _topline = btn.range || 0
+    let upId = this.getuuid()
     let _Ltext = data.map((item, lindex) => {
       let vals = btn.columns.map((col, cindex) => {
         let val = item[col.Column] !== undefined ? item[col.Column] : ''
@@ -520,7 +521,7 @@
       let _lineIndex = '0000' + (lindex + 1) + '0'
       _lineIndex = _lineIndex.substring(_lineIndex.length - 6)
 
-      vals.push(`@upid+'${_lineIndex}' as jskey`)
+      vals.push(`'${upId + _lineIndex}' as jskey`)
 
       return `Select ${vals.join(',')}`
     })
@@ -540,22 +541,20 @@
 
       fields = fields.join(',')
 
-      _sql = `declare @${btn.sheet} table (${declarefields.join(',')},jskey nvarchar(50) )
-      Declare @UserName nvarchar(50),@FullName nvarchar(50) ,@upid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000)
+      _sql = `declare @${item.sheet} table (${declarefields.join(',')},jskey nvarchar(50) )
+      Declare @UserName nvarchar(50),@FullName nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000)
 
       Select  @ErrorCode='', @retmsg=''
       
       select @UserName=UserName,@FullName=FullName from SUsers where UID=@UserID@
       
-      set @upid='${this.getuuid()}'
-     
-      Insert into  @${btn.sheet} (${fields},jskey)
+      Insert into  @${item.sheet} (${fields},jskey)
       ${_Ltext}
 
-      Insert into ${btn.sheet} (${fields},createuserid,createuser,createstaff,bid,upid) 
-      Select ${fields},@userid@,@username,@fullname,@BID@,@upid From @${btn.sheet}
+      Insert into ${item.sheet} (${fields},createuserid,createuser,createstaff,bid) 
+      Select ${fields},@userid@,@username,@fullname,@BID@ From @${item.sheet}
 
-      Delete @${btn.sheet}
+      Delete @${item.sheet}
 
       aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg`
 
@@ -1288,24 +1287,22 @@
 
     fields = fields.join(',')
 
-    let _sql = `declare @${_verify.sheet} table (${declarefields.join(',')},jskey nvarchar(50) )
-      Declare @UserName nvarchar(50),@FullName nvarchar(50),@upid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000)
+    let _sql = `declare @${btn.sheet} table (${declarefields.join(',')},jskey nvarchar(50) )
+      Declare @UserName nvarchar(50),@FullName nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000)
       
       Select @ErrorCode='',@retmsg=''
 
       select @UserName=UserName,@FullName=FullName from SUsers where UID=@UserID@
       
-      set @upid='鏃堕棿鎴�'
-      
-      Insert into @${_verify.sheet} (${fields},jskey)
+      Insert into @${btn.sheet} (${fields},jskey)
 
       exec s_KeyWords_Replace 
       @LText=@LText, @BID=@BID,@LoginUID=@LoginUID,@SessionUid=@SessionUid,@UserID=@UserID,@ID=@ID
 
-      Insert into ${_verify.sheet} (${fields},createuserid,createuser,createstaff,bid,upid) 
-      Select ${fields},@userid@,@username,@fullname,@BID@,@upid From @${_verify.sheet}
+      Insert into ${btn.sheet} (${fields},createuserid,createuser,createstaff,bid) 
+      Select ${fields},@userid@,@username,@fullname,@BID@ From @${btn.sheet}
 
-      Delete @${_verify.sheet}
+      Delete @${btn.sheet}
       
       aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg`
 

--
Gitblit v1.8.0