From e35e2d2e9956803b4ec5356395b02a6484441b4f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 20 二月 2025 16:58:41 +0800 Subject: [PATCH] 2025-02-20 --- src/tabviews/custom/components/group/normal-group/index.jsx | 39 +++++++++++++++++++++++++++++++++++++-- 1 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/tabviews/custom/components/group/normal-group/index.jsx b/src/tabviews/custom/components/group/normal-group/index.jsx index 3868f59..0f33480 100644 --- a/src/tabviews/custom/components/group/normal-group/index.jsx +++ b/src/tabviews/custom/components/group/normal-group/index.jsx @@ -3,6 +3,7 @@ import { DoubleLeftOutlined, DoubleRightOutlined } from '@ant-design/icons' import asyncComponent from '@/utils/asyncComponent' +import MKEmitter from '@/utils/events.js' import './index.scss' const TabTransfer = asyncComponent(() => import('@/tabviews/custom/components/share/tabtransfer')) @@ -14,17 +15,51 @@ state = { visible: true, + hidden: false, mergeAble: this.props.config.setting.mergeAble === 'true' + } + + componentDidMount () { + const { config } = this.props + + if (config.setting.bindPropId) { + MKEmitter.addListener('resetSelectLine', this.resetStatus) + } + } + + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('resetSelectLine', this.resetStatus) + } + + resetStatus = (MenuID, _, data) => { + const { config } = this.props + + if (config.setting.bindPropId !== MenuID) return + + if (!data || data.$$empty) { + this.setState({hidden: true}) + } else { + this.setState({hidden: false}) + } } render() { const { config, style } = this.props - const { visible, mergeAble } = this.state + const { visible, mergeAble, hidden } = this.state if (config.components.length === 0) return (<div className={'ant-col ant-col-' + config.width} style={style}><div style={config.style}></div></div>) + + let _wrapStyle = style + if (hidden) { + _wrapStyle = {...style} + _wrapStyle.display = 'none' + } return ( - <div className={`ant-col ant-col-${config.width} ${mergeAble ? ' mk-merge-able mk-ctrl-' + (config.setting.ctrlNumber || 1) : ''} ${visible ? '' : ' close'}`} style={style}> + <div className={`ant-col ant-col-${config.width} ${mergeAble ? ' mk-merge-able mk-ctrl-' + (config.setting.ctrlNumber || 1) : ''} ${visible ? '' : ' close'}`} style={_wrapStyle}> <div className={'normal-group-wrap ' + (config.setting.layout || '')} id={'anchor' + config.uuid} style={config.style}> <div className="mk-control"> <DoubleLeftOutlined onClick={() => this.setState({visible: false})}/> -- Gitblit v1.8.0