From 0245e64a9dff794903e546c3bdf9fef7efeefdf1 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 06 十二月 2022 16:09:04 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/tabviews/custom/components/share/normalTable/index.jsx | 62 +++++++++++++++++++++++++++---- 1 files changed, 54 insertions(+), 8 deletions(-) diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index b009cc7..34e9aad 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -255,7 +255,7 @@ <div> {photos.map((url, i) => ( <Col key={i} span={col.span || 24}> - <MkPicture style={{paddingTop}} scale={scale} url={url} urls={photos}/> + <MkPicture style={{paddingTop, backgroundSize: col.backgroundSize || 'cover'}} scale={scale} url={url} urls={photos}/> </Col> ))} </div> @@ -409,6 +409,7 @@ loading: PropTypes.bool, // 琛ㄦ牸鍔犺浇涓� refreshdata: PropTypes.func, // 琛ㄦ牸涓帓搴忓垪銆侀〉鐮佺殑鍙樺寲鏃跺埛鏂� chgSelectData: PropTypes.func, // 鏁版嵁鍒囨崲 + autoMatic: PropTypes.any } state = { @@ -548,9 +549,17 @@ } componentDidMount () { - MKEmitter.addListener('mkCheckTopLine', this.mkCheckTopLine) + const { autoMatic } = this.props + MKEmitter.addListener('mkCheckAll', this.mkCheckAll) MKEmitter.addListener('resetTable', this.resetTable) + + if (autoMatic === true) { + MKEmitter.addListener('autoQueryData', this.autoQueryData) + MKEmitter.addListener('autoSelectData', this.autoSelectData) + } + + MKEmitter.addListener('mkCheckTopLine', this.mkCheckTopLine) } /** @@ -560,9 +569,50 @@ this.setState = () => { return } - MKEmitter.removeListener('mkCheckTopLine', this.mkCheckTopLine) MKEmitter.removeListener('mkCheckAll', this.mkCheckAll) MKEmitter.removeListener('resetTable', this.resetTable) + MKEmitter.removeListener('autoQueryData', this.autoQueryData) + MKEmitter.removeListener('autoSelectData', this.autoSelectData) + MKEmitter.removeListener('mkCheckTopLine', this.mkCheckTopLine) + } + + autoSelectData = (id, index) => { + if (id !== this.props.MenuID) return + + const { pageSize, pageIndex } = this.state + + let i = index - (pageIndex - 1) * pageSize - 1 + + if (this.props.data[i]) { + this.changeRow(this.props.data[i], i) + MKEmitter.emit('autoTransSelectData', this.props.MenuID, this.props.data[i]) + } else { + MKEmitter.emit('autoMaticOver', this.props.MenuID) + } + } + + autoQueryData = (id, index) => { + if (id !== this.props.MenuID) return + + const { total } = this.props + const { pageSize } = this.state + + if (index !== 1 && (!total || index > total)) { + MKEmitter.emit('autoMaticOver', this.props.MenuID) + return + } + + console.clear() + + let pageIndex = Math.ceil(index / pageSize) + + this.setState({ + pageIndex: pageIndex, + selectedRowKeys: [], + activeIndex: null + }) + + this.props.refreshdata({pageIndex}) } mkCheckTopLine = (menuId, id) => { @@ -641,11 +691,7 @@ tabmenu.param = __param - if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) { - MKEmitter.emit('modifyTabs', tabmenu, 'replace') - } else { - MKEmitter.emit('modifyTabs', tabmenu, 'plus', true) - } + MKEmitter.emit('modifyTabs', tabmenu, true) } else if (item.linkurl) { let src = item.linkurl -- Gitblit v1.8.0