From 4c538565bd930279c9e32234617aa25804b19dee Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 05 四月 2023 13:15:40 +0800
Subject: [PATCH] 2023-04-05

---
 src/templates/zshare/editTable/index.jsx |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/templates/zshare/editTable/index.jsx b/src/templates/zshare/editTable/index.jsx
index ff2c97f..e4e7d67 100644
--- a/src/templates/zshare/editTable/index.jsx
+++ b/src/templates/zshare/editTable/index.jsx
@@ -163,6 +163,7 @@
 class EditTable extends Component {
   static propTpyes = {
     actions: PropTypes.any,         // 鎿嶄綔椤�
+    searchKey: PropTypes.any,       // 鎼滅储鏉′欢
     data: PropTypes.any,            // 鏁版嵁鍒楄〃
     columns: PropTypes.array,       // 鏄剧ず鍒�
     onChange: PropTypes.func        // 鏁版嵁鍙樺寲
@@ -585,7 +586,7 @@
   }
 
   render() {
-    const { actions, indexShow } = this.props
+    const { actions, indexShow, searchKey } = this.props
     const { editLineId } = this.state
 
     let components = {
@@ -595,7 +596,7 @@
     }
 
     let moveprops = {}
-    if (actions.includes('move')) {
+    if (actions.includes('move') && !searchKey) {
       components.body.row = DragableBodyRow
       moveprops.moveAble = !this.state.editingKey
       moveprops.moveRow = this.moveRow
@@ -641,6 +642,8 @@
       return item
     })
 
+    let reg = searchKey ? new RegExp(searchKey, 'ig') : null
+
     return (
       <EditableContext.Provider value={this.props.form}>
         <div className="modal-edit-table">
@@ -651,7 +654,18 @@
               components={components}
               dataSource={data}
               columns={columns}
-              rowClassName={record => !editLineId || editLineId !== record.uuid ? 'editable-row' : 'editable-row active'}
+              rowClassName={record => {
+                let className = 'editable-row'
+                if (editLineId && editLineId === record.uuid) {
+                  className += ' active'
+                }
+                if (searchKey) {
+                  if (!reg.test(record.field) && !reg.test(record.label)) {
+                    className += ' hidden'
+                  }
+                }
+                return className
+              }}
               pagination={false}
               onRow={(record, index) => ({
                 index,

--
Gitblit v1.8.0