From 9e716f3bd30820a08757845b592db73363faa48c Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 25 四月 2022 14:53:37 +0800 Subject: [PATCH] 2022-04-25 --- src/tabviews/custom/components/share/normalTable/index.jsx | 25 +++++++++++++++++-------- 1 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index fe54374..0c6f9ad 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -527,18 +527,27 @@ MKEmitter.removeListener('resetTable', this.resetTable) } - mkCheckTopLine = (menuId) => { + mkCheckTopLine = (menuId, id) => { const { MenuID, data, setting } = this.props if (MenuID !== menuId || !data || data.length === 0) return - if (data[0].$disabled) return - this.changedata(0) - this.setState({ selectedRowKeys: [0], activeIndex: 0 }) - this.props.chgSelectData([data[0]]) + let index = 0 + if (id) { + index = data.findIndex(item => item.$$uuid === id) + if (index === -1) { + index = 0 + } + } + + if (data[index].$disabled) return + + this.changedata(index) + this.setState({ selectedRowKeys: [index], activeIndex: index }) + this.props.chgSelectData([data[index]]) if (setting.$hasSyncModule) { - MKEmitter.emit('syncBalconyData', MenuID, [data[0]], data.length === 1) + MKEmitter.emit('syncBalconyData', MenuID, [data[index]], data.length === 1) } } @@ -721,13 +730,13 @@ } changedata = (index) => { - const { MenuID, data, setting } = this.props + const { MenuID, data } = this.props let _id = '' let _data = '' if (data && data.length > 0 && index !== '') { - _id = data[index][setting.primaryKey] || '' + _id = data[index].$$uuid || '' _data = data[index] || '' } -- Gitblit v1.8.0