From fcdfdc9670866fecd2d239d75a6ec28391175e9f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 10 四月 2025 11:13:51 +0800
Subject: [PATCH] 2025-04-10

---
 src/tabviews/custom/components/group/normal-group/index.jsx |   71 ++++++++++++++++++++++++++++++-----
 1 files changed, 61 insertions(+), 10 deletions(-)

diff --git a/src/tabviews/custom/components/group/normal-group/index.jsx b/src/tabviews/custom/components/group/normal-group/index.jsx
index 5a87122..daaf5c3 100644
--- a/src/tabviews/custom/components/group/normal-group/index.jsx
+++ b/src/tabviews/custom/components/group/normal-group/index.jsx
@@ -1,30 +1,81 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
+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'))
 
 class NormalGroup extends Component {
   static propTpyes = {
-    config: PropTypes.object,        // 缁勪欢閰嶇疆淇℃伅
+    config: PropTypes.object
   }
 
-  state = {}
+  state = {
+    visible: true,
+    hidden: this.props.config.setting.bindPropId ? null : false,
+    mergeAble: this.props.config.setting.mergeAble === 'true'
+  }
 
-  render() {
+  componentDidMount () {
     const { config } = this.props
 
-    if (config.components.length === 0) return (<div style={config.style}></div>)
+    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, 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'
+    }
+
+    let title = config.setting && config.setting.title
+
+    if (title && hidden === null) {
+      title = ''
+    }
     
     return (
-      <div className={'normal-group-wrap ' + (config.setting.layout || '')} id={'anchor' + config.uuid} style={config.style}>
-        {config.setting && config.setting.title ? <div className="group-header" style={config.headerStyle}>
-          <span className="title">{config.setting.title}</span>
-        </div> : null}
-        <TabTransfer config={config}/>
-        {/* <Row className="component-wrap">{this.getComponents()}</Row> */}
+      <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})}/>
+            <DoubleRightOutlined onClick={() => this.setState({visible: true})}/>
+          </div>
+          {title ? <div className="group-header" style={config.headerStyle}>
+            <span className="title">{title}</span>
+          </div> : null}
+          <TabTransfer config={config}/>
+        </div>
       </div>
     )
   }

--
Gitblit v1.8.0