From 883ea180577e8aeacd55dd0965f86985afefcb00 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 21 十一月 2023 20:27:15 +0800
Subject: [PATCH] 2023-11-21

---
 src/templates/zshare/editTable/index.jsx                               |   14 ++++
 src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx   |   17 ++++-
 src/templates/sharecomponent/actioncomponent/verifyexcelout/index.scss |   28 +++++++++
 src/menu/datasource/verifycard/index.jsx                               |    2 
 src/templates/sharecomponent/actioncomponent/verifyexcelin/index.scss  |   28 +++++++++
 src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx  |   38 +++++++++++-
 6 files changed, 118 insertions(+), 9 deletions(-)

diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx
index 2849a5b..a3c262b 100644
--- a/src/menu/datasource/verifycard/index.jsx
+++ b/src/menu/datasource/verifycard/index.jsx
@@ -59,6 +59,7 @@
         dataIndex: 'label',
         inputType: 'input',
         editable: true,
+        searchable: true,
         width: '28%'
       },
       {
@@ -68,6 +69,7 @@
         editable: true,
         unique: true,
         strict: true,
+        searchable: true,
         copy: true,
         rules: [{
           pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/ig,
diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
index 40af7ca..18de67e 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
@@ -17,6 +17,7 @@
 
 const { TabPane } = Tabs
 const { confirm } = Modal
+const { Search } = Input
 const { Paragraph } = Typography
 const EditTable = asyncComponent(() => import('@/templates/zshare/editTable'))
 const FullScripts = asyncComponent(() => import('@/templates/zshare/verifycard/fullScripts'))
@@ -31,6 +32,7 @@
     verify: {},
     systemScripts: [],
     activeKey: 'basemsg',
+    searchKey: '',
     excelColumns: [
       {
         title: '瀛楁',
@@ -39,6 +41,8 @@
         inputType: 'input',
         unique: true,
         strict: true,
+        searchable: true,
+        copy: true,
         editable: true
       },
       {
@@ -46,6 +50,7 @@
         dataIndex: 'Text',
         width: '14%',
         inputType: 'input',
+        searchable: true,
         editable: true
       },
       {
@@ -297,6 +302,7 @@
     }
 
     this.setState({
+      searchKey: '',
       verify: {
         ..._verify,
         default: _verify.default || 'true',
@@ -833,7 +839,7 @@
   render() {
     const { card } = this.props
     const { getFieldDecorator } = this.props.form
-    const { verify, excelColumns, scriptsColumns, uniqueColumns, activeKey } = this.state
+    const { verify, excelColumns, scriptsColumns, uniqueColumns, activeKey, searchKey } = this.state
     const formItemLayout = {
       labelCol: {
         xs: { span: 24 },
@@ -907,7 +913,7 @@
               娓呯┖Excel鍒�
             </Button>
             <Col style={{fontSize: '12px', color: '#757575', paddingLeft: '10px'}} span={24}>娉細鏁板�肩被鍨嬶紙int 鎴� decimal锛夛紝鍐呭涓哄繀濉紱鏈�澶у�煎拰鏈�灏忓�煎湪绫诲瀷涓烘暟鍊兼椂鏈夋晥銆傚鍏�-鍒濆鍖栵細鐢ㄤ簬excel涓笉瀛樺湪锛屽鍏ユ椂闇�瑕佸垵濮嬪寲鐨勫瓧娈�</Col>
-            <EditTable actions={['edit', 'move', 'copy', 'del', 'extra:required:鏄惁蹇呭~']} type="excelcolumn" data={verify.columns} columns={excelColumns} onChange={this.changeColumns}/>
+            <EditTable actions={['edit', 'move', 'copy', 'del', 'extra:required:鏄惁蹇呭~']} searchKey={searchKey} type="excelcolumn" data={verify.columns} columns={excelColumns} onChange={this.changeColumns}/>
           </TabPane>
           {card.intertype === 'system' ? <TabPane tab={
             <span>
@@ -951,7 +957,12 @@
             />
             <EditTable actions={['move']} data={verify.scripts} columns={scriptsColumns} onChange={(scripts) => {this.setState({verify: {...verify, scripts}})}}/>
           </TabPane> : null}
-          <TabPane tab="淇℃伅鎻愮ず" key="tip">
+          <TabPane tab={
+            <span>
+              淇℃伅鎻愮ず
+              {activeKey === 'excelcolumn' ? <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="tip">
             <Form {...formItemLayout}>
               <Row gutter={24}>
                 <Col offset={6} span={6}>
diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.scss b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.scss
index a9f4ffa..54d7f31 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.scss
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.scss
@@ -15,6 +15,34 @@
     color: #1890ff;
     font-size: 12px;
   }
+  .mk-search-fields {
+    position: absolute;
+    cursor: pointer;
+    width: 150px;
+    z-index: 1;
+    top: 10px;
+    right: -170px;
+    display: inline-block;
+    .ant-input {
+      border-radius: 40px;
+      height: 30px;
+      transition: opacity 0.2s;
+    }
+    .ant-input:not(:hover):not(:active):not(:focus) {
+      opacity: 0.6;
+    }
+    .ant-input:not(:hover):not(:active):not(:focus) + .ant-input-suffix {
+      opacity: 0.6;
+    }
+  }
+  .mk-search-fields:hover {
+    .ant-input {
+      opacity: 1;
+    }
+    .ant-input-suffix {
+      opacity: 1;
+    }
+  }
   .verify-form {
     .sql {
       .ant-col-sm-8 {
diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
index b42893e..fb05456 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
@@ -1,7 +1,7 @@
 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 md5 from 'md5'
 
@@ -16,6 +16,7 @@
 
 const { TabPane } = Tabs
 const { confirm } = Modal
+const { Search } = Input
 const { Paragraph } = Typography
 const EditTable = asyncComponent(() => import('@/templates/zshare/editTable'))
 
@@ -29,6 +30,7 @@
     verify: {},
     debugId: '',
     activeKey: 'setting',
+    searchKey: '',
     excelColumns: [
       {
         title: '瀛楁',
@@ -36,6 +38,8 @@
         inputType: 'input',
         editable: true,
         unique: true,
+        searchable: true,
+        copy: true,
         width: '16%'
       },
       {
@@ -43,6 +47,7 @@
         dataIndex: 'Text',
         inputType: 'input',
         editable: true,
+        searchable: true,
         unique: true,
         width: '16%'
       },
@@ -354,6 +359,7 @@
     }
 
     this.setState({
+      searchKey: '',
       verify: _verify,
       searches: searches,
       activeKey: card.intertype === 'system' && _verify.dataType === 'custom' ? 'setting' : 'columns'
@@ -501,6 +507,7 @@
   }
 
   handleConfirm = () => {
+    const { card, config } = this.props
     const { activeKey, verify } = this.state
     
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
@@ -516,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') {
@@ -937,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 },
@@ -971,7 +996,7 @@
               娓呯┖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}/>
+            <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>
@@ -988,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}>
diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.scss b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.scss
index 7964dfe..3a59dce 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.scss
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.scss
@@ -15,6 +15,34 @@
     color: #1890ff;
     font-size: 12px;
   }
+  .mk-search-fields {
+    position: absolute;
+    cursor: pointer;
+    width: 150px;
+    z-index: 1;
+    top: 10px;
+    right: -170px;
+    display: inline-block;
+    .ant-input {
+      border-radius: 40px;
+      height: 30px;
+      transition: opacity 0.2s;
+    }
+    .ant-input:not(:hover):not(:active):not(:focus) {
+      opacity: 0.6;
+    }
+    .ant-input:not(:hover):not(:active):not(:focus) + .ant-input-suffix {
+      opacity: 0.6;
+    }
+  }
+  .mk-search-fields:hover {
+    .ant-input {
+      opacity: 1;
+    }
+    .ant-input-suffix {
+      opacity: 1;
+    }
+  }
   .verify-form {
     .sql {
       .ant-col-sm-8 {
diff --git a/src/templates/zshare/editTable/index.jsx b/src/templates/zshare/editTable/index.jsx
index eeb913e..6b4c9f4 100644
--- a/src/templates/zshare/editTable/index.jsx
+++ b/src/templates/zshare/editTable/index.jsx
@@ -826,7 +826,17 @@
       return item
     })
 
-    let reg = searchKey ? new RegExp(searchKey, 'i') : null
+    let reg = null
+    let regs = []
+
+    if (searchKey) {
+      reg = new RegExp(searchKey, 'i')
+      this.state.columns.forEach(col => {
+        if (col.searchable) {
+          regs.push(col.dataIndex)
+        }
+      })
+    }
 
     return (
       <EditableContext.Provider value={this.props.form}>
@@ -845,7 +855,7 @@
                   className += ' active'
                 }
                 if (searchKey) {
-                  if (!reg.test(record.field) && !reg.test(record.label)) {
+                  if (regs.findIndex(f => reg.test(record[f])) === -1) {
                     className += ' hidden'
                   }
                 }

--
Gitblit v1.8.0