From ae46c8e640ed64abd7605b289554377e0cdc0cb7 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 04 十月 2023 22:10:30 +0800
Subject: [PATCH] 2023-10-04

---
 src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx |  169 +++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 105 insertions(+), 64 deletions(-)

diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
index a99543e..6555fcc 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
@@ -3,7 +3,6 @@
 import { fromJS } from 'immutable'
 import { Form, Tabs, Row, Col, Button, notification, Modal, message, InputNumber, Spin, Typography, Popconfirm } from 'antd'
 import { EditOutlined, StopOutlined, CheckCircleOutlined, SwapOutlined, DeleteOutlined } from '@ant-design/icons'
-import moment from 'moment'
 import md5 from 'md5'
 
 import Api from '@/api'
@@ -86,7 +85,9 @@
         editable: true,
         required: false,
         width: '12%',
-        render: (text) => {
+        render: (text, record) => {
+          if (record.type !== 'number') return ''
+
           if (text === 'true') {
             return '鏄�'
           } else {
@@ -106,7 +107,8 @@
         max: 18,
         editable: true,
         required: false,
-        width: '12%'
+        width: '12%',
+        render: (text, record) => record.type === 'number' ? text : ''
       },
       {
         title: '瀵煎嚭',
@@ -164,7 +166,7 @@
         width: '10%',
         render: (text, record) => {
           if (record.position === 'back') {
-            return <span style={{color: 'orange'}}>鍚庣疆</span>
+            return <span style={{color: '#1890ff'}}>鍚庣疆</span>
           } else {
             return <span style={{color: '#26C281'}}>鍓嶇疆</span>
           }
@@ -234,6 +236,13 @@
         }
       }
 
+      if (col.type !== 'number') {
+        col.decimal = ''
+        col.abs = 'false'
+      } else {
+        col.abs = col.abs || 'false'
+      }
+
       return col
     })
 
@@ -300,54 +309,47 @@
 
       searches = search
     } else {
-      let search = []
-  
+      searches = fromJS(config.search || []).toJS()
+
       if (config.setting && config.setting.useMSearch === 'true' && window.GLOB.customMenu) {
         let menu = fromJS(window.GLOB.customMenu).toJS()
-        let _search = null
-        let filterComponent = (box) => {
+        let filterComponent = (box, mainSearch) => {
           box.components.forEach(item => {
-            if (_search) return
-    
-            if (item.type === 'search') {
-              box.slist = [...box.slist, item.search]
-            } else if (item.uuid === config.uuid) {
-              _search = box.slist.pop()
+            if (item.type !== 'search') return
+            mainSearch = item.search
+          })
+          let has = false
+          box.components.forEach(item => {
+            if (item.uuid === config.uuid) {
+              has = true
             } else if (item.type === 'group') {
               item.components.forEach(m => {
                 if (m.uuid !== config.uuid) return
-                _search = box.slist.pop()
-              })
-            } else if (item.type === 'tabs') {
-              item.subtabs.forEach(tab => {
-                tab.slist = [...box.slist]
-                filterComponent(tab)
+                has = true
               })
             }
           })
-        }
-        menu.slist = []
-        filterComponent(menu)
-    
-        if (_search) {
-          search = _search
-        } else {
-          menu.components.forEach(item => {
-            if (item.type !== 'search') return
-            search = item.search
-          })
-        }
-      }
-  
-      searches = fromJS(config.search || []).toJS()
-  
-      if (search.length > 0) {
-        let keys = searches.map(item => (item.field ? item.field.toLowerCase() : ''))
-        search.forEach(item => {
-          if (item.field && !keys.includes(item.field.toLowerCase())) {
-            searches.push(item)
+
+          if (has) {
+            if (mainSearch) {
+              let keys = searches.map(item => (item.field ? item.field.toLowerCase() : ''))
+              mainSearch.forEach(item => {
+                if (item.field && !keys.includes(item.field.toLowerCase())) {
+                  searches.push(item)
+                }
+              })
+            }
+          } else {
+            box.components.forEach(item => {
+              if (item.type !== 'tabs') return
+
+              item.subtabs.forEach(tab => {
+                filterComponent(tab, mainSearch)
+              })
+            })
           }
-        })
+        }
+        filterComponent(menu, null)
       }
     }
 
@@ -607,11 +609,25 @@
     const { verify } = this.state
 
     let columns = fromJS(verify.columns).toJS()
-    let fields = columns.map(item => item.Column)
+    let _names = {}
+    let fields = columns.map(item => {
+      let key = item.Column.toLowerCase()
+      _names[key] = item.Text
+
+      return key
+    })
+    let names = {$up: false}
 
     config.columns.forEach(item => {
-      if (fields.includes(item.field) || !item.field) return
-      fields.push(item.field)
+      if (!item.field) return
+      let key = item.field.toLowerCase()
+      if (fields.includes(key)) {
+        if (_names[key] !== item.label) {
+          names.$up = true
+          names[key] = item.label
+        }
+        return
+      }
 
       let cell = {
         Column: item.field,
@@ -634,8 +650,15 @@
 
     if (config.subtype === 'dualdatacard') {
       config.subColumns.forEach(item => {
-        if (fields.includes(item.field) || !item.field) return
-        fields.push(item.field)
+        if (!item.field) return
+        let key = item.field.toLowerCase()
+        if (fields.includes(key)) {
+          if (_names[key] !== item.label) {
+            names.$up = true
+            names[key] = item.label
+          }
+          return
+        }
   
         let cell = {
           Column: item.field,
@@ -657,9 +680,37 @@
       })
     }
 
-    this.setState({
-      verify: {...verify, columns: columns}
-    })
+    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}
+          })
+        },
+        onCancel() {
+          that.setState({
+            verify: {...verify, columns: columns}
+          })
+        }
+      })
+    } else {
+      this.setState({
+        verify: {...verify, columns: columns}
+      })
+    }
   }
 
   clearField = () => {
@@ -843,8 +894,7 @@
       return
     }
 
-    let timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
-    let sql = SettingUtils.getDebugSql(verify, scripts, (verify.useSearch === 'true' ? searches : []), Utils, '2023-04-20 15:29:37')
+    let sql = SettingUtils.getDebugSql(verify, scripts, (verify.useSearch === 'true' ? searches : []))
 
     let _debugId = md5(sql)
 
@@ -853,17 +903,8 @@
       return
     }
 
-    let param = {
-      func: 's_debug_sql',
-      exec_type: 'y',
-      LText: sql
-    }
-    param.LText = Utils.formatOptions(param.LText)
-    param.timestamp = timestamp
-    param.secretkey = Utils.encrypt('', timestamp)
-
-    Api.genericInterface(param).then(result => {
-      if (result.status) {
+    Api.sDebug(sql).then(result => {
+      if (result.status || result.ErrCode === '-2') {
         this.setState({debugId: _debugId})
         _resolve()
       } else {
@@ -929,7 +970,7 @@
             <Button className="excel-col-add mk-red" title="娓呯┖Excel鍒�" onClick={this.clearField}>
               娓呯┖Excel鍒�
             </Button>
-            <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>濡傞渶瀵煎嚭搴忓彿锛岃浣跨敤瀛楁 $Index锛涙暟鍊肩被鍨嬪鍑烘椂鍙繘琛屾暟鎹鐞嗭紙鍙栫粷瀵瑰�笺�佷繚鐣欏皬鏁颁綅锛夛紱绾㈣壊鏍囬瀵煎嚭鏃跺垪澶存枃瀛椾负绾㈣壊銆�</div>
+            <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>濡傞渶瀵煎嚭搴忓彿锛岃浣跨敤瀛楁 $Index锛涙暟鍊肩被鍨嬪鍑烘椂鍙彇缁濆鍊间互鍙婅缃皬鏁颁綅锛涘鍑轰负鍚︽椂锛屼笉浣跨敤琛屼俊鎭紱绾㈣壊鏍囬瀵煎嚭鏃跺垪澶存枃瀛椾负绾㈣壊銆�</div>
             <EditTable actions={['edit', 'move', 'copy', 'del']} type="excelcolumn" wrappedComponentRef={(inst) => this.columnRef = inst} data={verify.columns} columns={excelColumns} onChange={this.changeColumns}/>
           </TabPane>
           {card.intertype === 'system' ? <TabPane tab={

--
Gitblit v1.8.0