From 3f79b6ee9f7159f92d468185f2460cb19d20ece2 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 30 一月 2022 20:49:19 +0800
Subject: [PATCH] 2022-01-30

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

diff --git a/src/templates/zshare/editTable/index.jsx b/src/templates/zshare/editTable/index.jsx
index 3d8fd2b..bb8ae46 100644
--- a/src/templates/zshare/editTable/index.jsx
+++ b/src/templates/zshare/editTable/index.jsx
@@ -12,6 +12,7 @@
 import CusSwitch from './cusSwitch'
 import zhCN from '@/locales/zh-CN/model.js'
 import enUS from '@/locales/en-US/model.js'
+import MKEmitter from '@/utils/events.js'
 import './index.scss'
 
 const MkEditIcon = asyncComponent(() => import('@/components/mkIcon'))
@@ -171,6 +172,7 @@
     data: [],
     editingKey: '',
     visible: false,
+    editLineId: '',
     columns: []
   }
 
@@ -268,6 +270,21 @@
         this.setState({columns})
       }
     }
+  }
+
+  componentDidMount () {
+    MKEmitter.addListener('editLineId', this.getEditLineId)
+  }
+
+  componentWillUnmount () {
+    this.setState = () => {
+      return
+    }
+    MKEmitter.removeListener('editLineId', this.getEditLineId)
+  }
+
+  getEditLineId = (id) => {
+    this.setState({ editLineId: id })
   }
 
   isEditing = record => record.uuid === this.state.editingKey
@@ -508,6 +525,7 @@
 
   render() {
     const { actions, indexShow } = this.props
+    const { editLineId } = this.state
 
     let components = {
       body: {
@@ -570,7 +588,7 @@
               components={components}
               dataSource={data}
               columns={columns}
-              rowClassName="editable-row"
+              rowClassName={record => !editLineId || editLineId !== record.uuid ? 'editable-row' : 'editable-row active'}
               pagination={false}
               onRow={(record, index) => ({
                 index,

--
Gitblit v1.8.0