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 +++++++++++++++++++-
 src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx |    8 +++++++-
 src/templates/zshare/customscript/index.jsx                                       |    3 +++
 src/templates/zshare/verifycard/index.jsx                                         |    3 +++
 src/menu/datasource/verifycard/customscript/index.jsx                             |    4 ++++
 src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx              |    3 +++
 src/templates/zshare/editTable/index.scss                                         |    5 +++++
 7 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/src/menu/datasource/verifycard/customscript/index.jsx b/src/menu/datasource/verifycard/customscript/index.jsx
index 8cb1907..2b009a3 100644
--- a/src/menu/datasource/verifycard/customscript/index.jsx
+++ b/src/menu/datasource/verifycard/customscript/index.jsx
@@ -5,6 +5,7 @@
 
 import Utils from '@/utils/utils.js'
 import CodeMirror from '@/templates/zshare/codemirror'
+import MKEmitter from '@/utils/events.js'
 import './index.scss'
 
 class CustomForm extends Component {
@@ -150,6 +151,9 @@
             editItem: null,
             loading: false
           })
+
+          MKEmitter.emit('editLineId', values.uuid)
+
           this.props.form.setFieldsValue({
             sql: ' '
           })
diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx
index 66e19b2..f89a973 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx
@@ -44,7 +44,13 @@
 
     fields.push('jskey')
 
-    let _sql = `Declare @${btn.sheet} table (${columns.map(item => item.Column + ' ' + item.type).join(',')},jskey nvarchar(50) )
+    let _dec = columns.map(item => item.Column + ' ' + item.type).join(',')
+
+    if (_dec) {
+      _dec += ','
+    }
+
+    let _sql = `Declare @${btn.sheet} table (${_dec}jskey nvarchar(50) )
       Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@login_city nvarchar(50),@ErrorCode nvarchar(50), @retmsg nvarchar(4000),@tbid Nvarchar(512)
       Select @ErrorCode='', @retmsg=''
     `
diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
index 82c757b..959ca42 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
@@ -12,6 +12,7 @@
 import ColumnForm from './columnform'
 import CustomScript from './customscript'
 import asyncComponent from '@/utils/asyncComponent'
+import MKEmitter from '@/utils/events.js'
 import './index.scss'
 
 const { TabPane } = Tabs
@@ -518,6 +519,8 @@
       verify.scripts.push(values)
     }
 
+    MKEmitter.emit('editLineId', values.uuid)
+
     this.setState({
       verify: verify
     })
diff --git a/src/templates/zshare/customscript/index.jsx b/src/templates/zshare/customscript/index.jsx
index d322307..2caa82b 100644
--- a/src/templates/zshare/customscript/index.jsx
+++ b/src/templates/zshare/customscript/index.jsx
@@ -9,6 +9,7 @@
 import Api from '@/api'
 import CodeMirror from '@/templates/zshare/codemirror'
 import asyncComponent from '@/utils/asyncComponent'
+import MKEmitter from '@/utils/events.js'
 import './index.scss'
 
 const { Paragraph } = Typography
@@ -260,6 +261,8 @@
         editItem: null
       })
 
+      MKEmitter.emit('editLineId', values.uuid)
+
       this.props.scriptsUpdate(_scripts)
       this.props.form.setFieldsValue({
         sql: ''
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,
diff --git a/src/templates/zshare/editTable/index.scss b/src/templates/zshare/editTable/index.scss
index 954f3ab..a4319e4 100644
--- a/src/templates/zshare/editTable/index.scss
+++ b/src/templates/zshare/editTable/index.scss
@@ -20,6 +20,11 @@
       padding: 0px;
     }
   }
+  .editable-row.active {
+    td {
+      background-color: #bae7ff!important;
+    }
+  }
   .mk-index {
     text-align: center;
     white-space: nowrap;
diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx
index 5fa5f62..93e19b9 100644
--- a/src/templates/zshare/verifycard/index.jsx
+++ b/src/templates/zshare/verifycard/index.jsx
@@ -17,6 +17,7 @@
 import VoucherForm from './voucherform'
 import asyncComponent from '@/utils/asyncComponent'
 import { updateForm } from '@/utils/utils-update.js'
+import MKEmitter from '@/utils/events.js'
 import './index.scss'
 
 const { TabPane } = Tabs
@@ -1098,6 +1099,8 @@
       verify.scripts.push(values)
     }
 
+    MKEmitter.emit('editLineId', values.uuid)
+
     this.setState({ verify })
   }
 

--
Gitblit v1.8.0