From f9816a4078fdba44115c69025d9982997f23b484 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 29 四月 2024 16:00:49 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/menu/datasource/verifycard/index.jsx |   51 ++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 42 insertions(+), 9 deletions(-)

diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx
index ceabb28..b31ecfd 100644
--- a/src/menu/datasource/verifycard/index.jsx
+++ b/src/menu/datasource/verifycard/index.jsx
@@ -48,6 +48,7 @@
     systemScripts: [],
     median: {},
     visible: false,
+    editLineId: '',
     pvisible: false,
     reload: false,
     script: null,
@@ -677,7 +678,8 @@
       if (config.subtype === 'dualdatacard') {
         _columns = [...columns, ...subColumns]
       }
-      let r = SettingUtils.getDebugSql(setting, _scripts, _columns, searches, config.type)
+
+      let r = SettingUtils.getDebugSql(setting, _scripts, _columns, searches, config.subtype)
 
       let _debugId = md5(r.sql)
       
@@ -809,7 +811,9 @@
       return
     }
 
+    let editLineId = ''
     if (script) {
+      editLineId = script.uuid
       _scripts = _scripts.map(item => {
         if (script.uuid === item.uuid) {
           item.sql = scriptValue
@@ -824,10 +828,11 @@
         status: 'true'
       }
 
+      editLineId = _script.uuid
       _scripts.push(_script)
     }
 
-    this.setState({loading: true})
+    this.setState({loading: true, editLineId})
 
     this.sqlverify(() => {this.setState({scripts: _scripts, script: null, scriptValue: '', loading: false})}, () => {this.setState({loading: false})}, 'script', _scripts)
   }
@@ -954,7 +959,8 @@
   }
 
   copyColumns = () => {
-    const { columns } = this.state
+    const { columns, setting } = this.state
+
     let m = []
     let n = []
     let s = []
@@ -978,8 +984,29 @@
     }
 
     let oInput = document.createElement('input')
-    oInput.value = `/*${m.join(',')}*/
-      ${n.join(',')}`
+    oInput.value = `create table #${setting.tableName || 'tb'}
+    (${m.join(',')},sort_id INT IDENTITY(1,1))
+    insert into #${setting.tableName || 'tb'}
+    (${n.join(',')})
+    select ${n.join(',')}
+    from ${setting.dataresource ? `(${setting.dataresource.replace(/\n/g, ' ')}) tb` : setting.tableName || 'tb'}
+    order by @orderBy@
+    
+    declare @mk_total int
+    set @mk_total = 0
+      
+    select @mk_total = count(1) from #${setting.tableName || 'tb'}
+      declare @pageIndex_top int 
+      set @pageIndex_top=(@pageIndex@-1)*@pageSize@ 
+      
+      if @mk_total > @pageIndex@*@pageSize@
+        delete #${setting.tableName || 'tb'} where sort_id > @pageIndex@*@pageSize@ 
+      
+      if @pageIndex_top > 0
+        delete #${setting.tableName || 'tb'} where sort_id <= @pageIndex_top
+
+    drop table #${setting.tableName || 'tb'}`
+
     document.body.appendChild(oInput)
     oInput.select()
     document.execCommand('Copy')
@@ -1106,7 +1133,7 @@
 
   render() {
     const { config } = this.props
-    const { columns, subColumns, median, setting, scripts, colColumns, scriptsColumns, activeKey, loading, searches, defaultsql, visible, pvisible, reload, script, scriptValue, searchKey } = this.state
+    const { columns, subColumns, median, setting, scripts, colColumns, scriptsColumns, activeKey, loading, searches, defaultsql, visible, pvisible, reload, script, scriptValue, searchKey, editLineId } = this.state
 
     return (
       <div className="model-data-source-wrap">
@@ -1130,7 +1157,7 @@
               wrappedComponentRef={(inst) => this.settingForm = inst}
             /> : null}
           </TabPane>
-          {config.subtype !== 'basetable' ? <TabPane tab={
+          {!['basetable', 'invoice', 'invTable'].includes(config.subtype) ? <TabPane tab={
             <span>
               瀛楁闆�
               {columns.length ? <span className="count-tip">{columns.length}</span> : null}
@@ -1186,7 +1213,7 @@
                 })
                 return
               }
-              this.setState({visible: true, script: null, scriptValue: ''})
+              this.setState({visible: true, script: null, scriptValue: '', editLineId: ''})
             }}/> : null}
             <CustomScriptsForm
               type={config.type}
@@ -1236,8 +1263,14 @@
                   </div>
                 )
               } else {
+                let sign = ''
+                if (script && script.uuid === item.uuid) {
+                  sign = 'active'
+                } else if (editLineId === item.uuid) {
+                  sign = 'edited'
+                }
                 return (
-                  <div className={'script-item ' + (script && script.uuid === item.uuid ? 'active' : '') } key={item.uuid}>
+                  <div className={'script-item ' + sign} key={item.uuid}>
                     <div style={{cursor: 'pointer'}} onClick={() => {
                       this.setState({script: item, scriptValue: item.sql})
                     }}>

--
Gitblit v1.8.0