From 49f09cc6f8ff8c30a75ed1a9d6f510b69b73962a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 12 十二月 2023 21:05:37 +0800
Subject: [PATCH] 2023-12-12

---
 src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx |   99 +++++++++++++++++++++++++++++++++++--------------
 1 files changed, 70 insertions(+), 29 deletions(-)

diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
index b6acd2e..fb05456 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
@@ -1,9 +1,8 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { fromJS } from 'immutable'
-import { Form, Tabs, Row, Col, Button, notification, Modal, message, InputNumber, Spin, Typography, Popconfirm } from 'antd'
+import { Form, Tabs, Row, Col, Button, Input, 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'
@@ -17,6 +16,7 @@
 
 const { TabPane } = Tabs
 const { confirm } = Modal
+const { Search } = Input
 const { Paragraph } = Typography
 const EditTable = asyncComponent(() => import('@/templates/zshare/editTable'))
 
@@ -30,6 +30,7 @@
     verify: {},
     debugId: '',
     activeKey: 'setting',
+    searchKey: '',
     excelColumns: [
       {
         title: '瀛楁',
@@ -37,6 +38,8 @@
         inputType: 'input',
         editable: true,
         unique: true,
+        searchable: true,
+        copy: true,
         width: '16%'
       },
       {
@@ -44,6 +47,7 @@
         dataIndex: 'Text',
         inputType: 'input',
         editable: true,
+        searchable: true,
         unique: true,
         width: '16%'
       },
@@ -86,7 +90,9 @@
         editable: true,
         required: false,
         width: '12%',
-        render: (text) => {
+        render: (text, record) => {
+          if (record.type !== 'number') return ''
+
           if (text === 'true') {
             return '鏄�'
           } else {
@@ -106,7 +112,8 @@
         max: 18,
         editable: true,
         required: false,
-        width: '12%'
+        width: '12%',
+        render: (text, record) => record.type === 'number' ? text : ''
       },
       {
         title: '瀵煎嚭',
@@ -234,6 +241,13 @@
         }
       }
 
+      if (col.type !== 'number') {
+        col.decimal = ''
+        col.abs = 'false'
+      } else {
+        col.abs = col.abs || 'false'
+      }
+
       return col
     })
 
@@ -345,6 +359,7 @@
     }
 
     this.setState({
+      searchKey: '',
       verify: _verify,
       searches: searches,
       activeKey: card.intertype === 'system' && _verify.dataType === 'custom' ? 'setting' : 'columns'
@@ -492,6 +507,7 @@
   }
 
   handleConfirm = () => {
+    const { card, config } = this.props
     const { activeKey, verify } = this.state
     
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
@@ -507,6 +523,24 @@
         })
         
         return
+      }
+
+      if (card.intertype === 'system' && verify.dataType !== 'custom' && verify.columns.length > 0 && config.$c_ds && config.setting.interType === 'system' && config.columns && config.columns.length > 0) {
+        let cols = []
+        let columns = config.columns.map(c => c.field)
+        verify.columns.forEach(col => {
+          if (col.output === 'false' || col.Column === '$Index') return
+          if (!columns.includes(col.Column)) {
+            cols.push(col.Column)
+          }
+        })
+        if (cols.length) {
+          notification.warning({
+            top: 92,
+            message: `瀵煎嚭鍒楋紙${cols.join('銆�')}锛夊湪瀛楁闆嗕腑涓嶅瓨鍦紒`,
+            duration: 5
+          })
+        }
       }
 
       if (activeKey === 'setting') {
@@ -600,14 +634,23 @@
     const { verify } = this.state
 
     let columns = fromJS(verify.columns).toJS()
-    let fields = columns.map(item => item.Column.toLowerCase())
+    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 (!item.field) return
-      if (fields.includes(item.field.toLowerCase())) {
-        names.$up = true
-        names[item.field.toLowerCase()] = item.label
+      let key = item.field.toLowerCase()
+      if (fields.includes(key)) {
+        if (_names[key] !== item.label) {
+          names.$up = true
+          names[key] = item.label
+        }
         return
       }
 
@@ -633,9 +676,12 @@
     if (config.subtype === 'dualdatacard') {
       config.subColumns.forEach(item => {
         if (!item.field) return
-        if (fields.includes(item.field.toLowerCase())) {
-          names.$up = true
-          names[item.field.toLowerCase()] = item.label
+        let key = item.field.toLowerCase()
+        if (fields.includes(key)) {
+          if (_names[key] !== item.label) {
+            names.$up = true
+            names[key] = item.label
+          }
           return
         }
   
@@ -873,8 +919,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)
 
@@ -883,17 +928,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 {
@@ -926,7 +962,7 @@
 
   render() {
     const { card } = this.props
-    const { verify, excelColumns, scriptsColumns, activeKey, loading, searches } = this.state
+    const { verify, excelColumns, scriptsColumns, activeKey, loading, searches, searchKey } = this.state
     const formItemLayout = {
       labelCol: {
         xs: { span: 24 },
@@ -954,13 +990,13 @@
           } key="columns">
             <ColumnForm columnChange={this.columnChange}/>
             <Button className="excel-col-add mk-green" title="娣诲姞鏄剧ず鍒楀瓧娈�" onClick={this.columnFieldInput}>
-              鍚屾鏄剧ず鍒�
+              鍚屾瀛楁闆�
             </Button>
             <Button className="excel-col-add mk-red" title="娓呯┖Excel鍒�" onClick={this.clearField}>
               娓呯┖Excel鍒�
             </Button>
-            <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}/>
+            <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>濡傞渶瀵煎嚭搴忓彿锛岃浣跨敤瀛楁 $Index锛涙暟鍊肩被鍨嬪鍑烘椂鍙彇缁濆鍊间互鍙婅缃皬鏁颁綅锛涘鍑轰负鍚︽椂锛屼笉浣跨敤琛屼俊鎭紱绾㈣壊鏍囬瀵煎嚭鏃跺垪澶存枃瀛椾负绾㈣壊銆�</div>
+            <EditTable actions={['edit', 'move', 'copy', 'del']} type="excelcolumn" searchKey={searchKey} wrappedComponentRef={(inst) => this.columnRef = inst} data={verify.columns} columns={excelColumns} onChange={this.changeColumns}/>
           </TabPane>
           {card.intertype === 'system' ? <TabPane tab={
             <span>
@@ -977,7 +1013,12 @@
             />
             <EditTable actions={['move']} data={verify.scripts} columns={scriptsColumns} onChange={(scripts) => {this.setState({verify: {...verify, scripts}})}}/>
           </TabPane> : null}
-          <TabPane tab="淇℃伅鎻愮ず" key="message">
+          <TabPane tab={
+            <span>
+              淇℃伅鎻愮ず
+              {activeKey === 'columns' ? <span onClick={(e) => {e.stopPropagation()}}><Search className="mk-search-fields" defaultValue={searchKey} allowClear onSearch={(val, e) => {e.stopPropagation();this.setState({searchKey: val})}} /></span> : null}
+            </span>
+          } key="message">
             <Form {...formItemLayout}>
               <Row gutter={24}>
                 <Col offset={6} span={6}>

--
Gitblit v1.8.0