From 3b103caa6bfc9ed410e67156c3ca1785bf1cecc9 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 19 八月 2022 01:15:31 +0800
Subject: [PATCH] 2022-08-19

---
 src/menu/components/tabs/antv-tabs/index.jsx |   69 ++++++++++++++++------------------
 1 files changed, 32 insertions(+), 37 deletions(-)

diff --git a/src/menu/components/tabs/antv-tabs/index.jsx b/src/menu/components/tabs/antv-tabs/index.jsx
index ffa7b25..a272815 100644
--- a/src/menu/components/tabs/antv-tabs/index.jsx
+++ b/src/menu/components/tabs/antv-tabs/index.jsx
@@ -1,18 +1,18 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Tabs, Icon, Popover, Modal } from 'antd'
+import { Tabs, Popover, Modal } from 'antd'
+import { PlusOutlined, CloseOutlined, EditOutlined, DeleteOutlined, FontColorsOutlined, ToolOutlined } from '@ant-design/icons'
 
 import MKEmitter from '@/utils/events.js'
 import asyncComponent from '@/utils/asyncComponent'
 import asyncIconComponent from '@/utils/asyncIconComponent'
+import MkIcon from '@/components/mk-icon'
 import DraggableTabs from './dragabletabs'
 import { resetStyle } from '@/utils/utils-custom.js'
 import MenuUtils from '@/utils/utils-custom.js'
 import Utils from '@/utils/utils.js'
 import { getTabForm, getTabsSetForm } from './options'
-import zhCN from '@/locales/zh-CN/model.js'
-import enUS from '@/locales/en-US/model.js'
 import './index.scss'
 
 const NormalForm = asyncIconComponent(() => import('@/components/normalform'))
@@ -31,7 +31,6 @@
   }
 
   state = {
-    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     appType: sessionStorage.getItem('appType'),
     tabs: null,
     editab: null,
@@ -45,7 +44,6 @@
       let _tabs = {
         uuid: tabs.uuid,
         type: tabs.type,
-        floor: tabs.floor,
         tabId: tabs.tabId || '',
         parentId: tabs.parentId || '',
         subtype: tabs.subtype,
@@ -54,9 +52,9 @@
         setting: {width: 24, position: 'top', tabStyle: 'line', name: tabs.name},
         style: { marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px' },
         subtabs: [
-          { uuid: Utils.getuuid(), parentId: tabs.uuid, floor: tabs.floor, label: 'Tab 1', icon: '', components: [] },
-          { uuid: Utils.getuuid(), parentId: tabs.uuid, floor: tabs.floor, label: 'Tab 2', icon: '', components: [] },
-          { uuid: Utils.getuuid(), parentId: tabs.uuid, floor: tabs.floor, label: 'Tab 3', icon: '', components: [] }
+          { uuid: Utils.getuuid(), parentId: tabs.uuid, label: 'Tab 1', icon: '', components: [] },
+          { uuid: Utils.getuuid(), parentId: tabs.uuid, label: 'Tab 2', icon: '', components: [] },
+          { uuid: Utils.getuuid(), parentId: tabs.uuid, label: 'Tab 3', icon: '', components: [] }
         ]
       }
       this.setState({
@@ -77,7 +75,6 @@
   }
 
   componentDidMount () {
-    MKEmitter.addListener('submitStyle', this.getStyle)
     MKEmitter.addListener('submitSearch', this.getSearch)
     MKEmitter.addListener('tabsChange', this.handleTabsChange)
     MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle)
@@ -90,7 +87,6 @@
     this.setState = () => {
       return
     }
-    MKEmitter.removeListener('submitStyle', this.getStyle)
     MKEmitter.removeListener('submitSearch', this.getSearch)
     MKEmitter.removeListener('tabsChange', this.handleTabsChange)
     MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle)
@@ -132,15 +128,11 @@
   changeStyle = () => {
     const { tabs } = this.state
 
-    MKEmitter.emit('changeStyle', [tabs.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], tabs.style)
+    MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], tabs.style, this.getStyle)
   }
 
-  getStyle = (comIds, style) => {
-    const { tabs } = this.state
-
-    if (comIds.length !== 1 || comIds[0] !== tabs.uuid) return
-
-    let _card = {...tabs, style}
+  getStyle = (style) => {
+    let _card = {...this.state.tabs, style}
 
     this.setState({
       tabs: _card
@@ -297,7 +289,6 @@
       tab = {
         uuid: '',
         parentId: tabs.uuid,
-        floor: tabs.floor,
         label: '',
         icon: '',
         components: []
@@ -317,7 +308,11 @@
 
     editab.label = res.label
     editab.icon = res.icon
-    editab.hasSearch = res.hasSearch || ''
+    // editab.hasSearch = res.hasSearch || ''
+    editab.hide = res.hide || 'false'
+    editab.backgroundColor = res.backgroundColor
+    editab.controlVal = res.controlVal || ''
+    editab.selectVal = res.selectVal || ''
     editab.blacklist = res.blacklist
 
     if (editab.uuid) {
@@ -344,7 +339,7 @@
   getTabsForms = () => {
     const { tabs } = this.state
 
-    return getTabsSetForm(tabs.setting)
+    return getTabsSetForm(tabs.setting, tabs.uuid)
   }
 
   updateTabs = (res) => {
@@ -357,46 +352,46 @@
   }
 
   render() {
-    const { tabs, appType, defaultActiveKey } = this.state
+    const { tabs, defaultActiveKey } = this.state
     let _style = resetStyle(tabs.style)
 
     return (
-      <div className={'menu-tabs-edit-box ' + tabs.setting.display} style={_style} onClick={this.clickComponent} id={tabs.uuid}>
-        <DraggableTabs defaultActiveKey={defaultActiveKey} tabPosition={tabs.setting.position} type={tabs.setting.tabStyle} tabsMove={this.moveSwitch} onChange={this.onChange}>
+      <div className={'menu-tabs-edit-box ' + (tabs.setting.display || '')} style={_style} onClick={this.clickComponent} id={tabs.uuid}>
+        <DraggableTabs defaultActiveKey={defaultActiveKey} tabBarStyle={{background: tabs.setting.backgroundColor || 'transparent'}} tabPosition={tabs.setting.position} type={tabs.setting.tabStyle} tabsMove={this.moveSwitch} onChange={this.onChange}>
           {tabs.subtabs.map(tab => (
             <TabPane tab={
               <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
                 <div className="mk-popover-control">
-                  <NormalForm title="鏍囩缂栬緫" width={600} update={this.updateTab} getForms={() => this.getTabForms(tab)}>
-                    <Icon type="edit" style={{color: '#1890ff'}} title="缂栬緫"/>
+                  <NormalForm title="鏍囩缂栬緫" width={800} update={this.updateTab} getForms={() => this.getTabForms(tab)}>
+                    <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/>
                   </NormalForm>
                   <PasteComponent Tab={tab} insert={this.insert} />
-                  <Icon className="close" title="delete" type="close" onClick={() => this.delTab(tab)} />
+                  <CloseOutlined className="close" onClick={() => this.delTab(tab)} />
                 </div>
               } trigger="hover">
-                <span>{tab.icon ? <Icon type={tab.icon} /> : null}{tab.label}</span>
+                <span style={{textDecoration: tab.hide === 'true' ? 'line-through' : 'none'}}>{tab.icon ? <MkIcon type={tab.icon} /> : null}{tab.label}</span>
               </Popover>
-            } key={tab.uuid}>
-              {appType === 'mob' && tabs.setting.position === 'top' && tabs.setting.display === 'inline-block' && tab.hasSearch === 'icon' ?
-                <Icon className="search-icon" onDoubleClick={() => this.setSearch(tab)} type="search" /> : null}
+            } key={tab.uuid} style={{backgroundColor: tab.backgroundColor || 'transparent'}}>
+              {/* {appType === 'mob' && tabs.setting.position === 'top' && tabs.setting.display === 'inline-block' && tab.hasSearch === 'icon' ?
+                <SearchOutlined className="search-icon" onDoubleClick={() => this.setSearch(tab)}/> : null} */}
               <TabComponents config={tab} handleList={this.updateTabComponent} deleteCard={this.deleteCard} />
             </TabPane>
           ))}
         </DraggableTabs>
         <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
           <div className="mk-popover-control">
-            <NormalForm title="娣诲姞鏍囩" width={600} update={this.updateTab} getForms={() => this.getTabForms()}>
-              <Icon type="plus" className="plus" title="娣诲姞鏍囩"/>
+            <NormalForm title="娣诲姞鏍囩" width={800} update={this.updateTab} getForms={() => this.getTabForms()}>
+              <PlusOutlined className="plus" title="娣诲姞鏍囩"/>
             </NormalForm>
-            <NormalForm title="鏍囩椤佃缃�" width={700} update={this.updateTabs} getForms={this.getTabsForms}>
-              <Icon type="edit" style={{color: '#1890ff'}} title="缂栬緫"/>
+            <NormalForm title="鏍囩椤佃缃�" width={800} update={this.updateTabs} getForms={this.getTabsForms}>
+              <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/>
             </NormalForm>
             <CopyComponent type="tabs" card={tabs}/>
-            <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" />
-            <Icon className="close" title="delete" type="delete" onClick={() => this.props.deletecomponent(tabs.uuid)} />
+            <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/>
+            <DeleteOutlined className="close" onClick={() => this.props.deletecomponent(tabs.uuid)} />
           </div>
         } trigger="hover">
-          <Icon type="tool" />
+          <ToolOutlined />
         </Popover>
       </div>
     )

--
Gitblit v1.8.0