From 5046d0d13dc6a8563b8e54e31913bc44cfa1072f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 26 四月 2022 19:23:18 +0800 Subject: [PATCH] 2022-04-26 --- src/mob/components/tabs/antv-tabs/index.jsx | 36 +++++++++++++++++++++++------------- 1 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/mob/components/tabs/antv-tabs/index.jsx b/src/mob/components/tabs/antv-tabs/index.jsx index c644570..108b32a 100644 --- a/src/mob/components/tabs/antv-tabs/index.jsx +++ b/src/mob/components/tabs/antv-tabs/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Tabs, Popover, Modal } from 'antd' +import { Tabs, Popover, Modal, notification } from 'antd' import { ToolOutlined, PlusOutlined, EditOutlined, FontColorsOutlined, DeleteOutlined, CloseOutlined } from '@ant-design/icons' import MKEmitter from '@/utils/events.js' @@ -44,7 +44,6 @@ let _tabs = { uuid: tabs.uuid, type: tabs.type, - floor: tabs.floor, tabId: tabs.tabId || '', parentId: tabs.parentId || '', subtype: tabs.subtype, @@ -53,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: [] } ] } @@ -254,6 +253,15 @@ insert = (item, tab) => { let tabs = fromJS(this.state.tabs).toJS() + if (item.type === 'search') { + notification.warning({ + top: 92, + message: '绉诲姩绔悳绱㈢粍浠朵笉鍙矘璐达紒', + duration: 5 + }) + return + } + tabs.subtabs.forEach(stab => { if (stab.uuid === tab.uuid) { stab.components.push(item) @@ -310,7 +318,6 @@ tab = { uuid: '', parentId: tabs.uuid, - floor: tabs.floor, label: '', icon: '', components: [] @@ -331,6 +338,9 @@ editab.label = res.label editab.icon = res.icon // editab.hasSearch = res.hasSearch || '' + editab.hide = res.hide || 'false' + editab.backgroundColor = res.backgroundColor + editab.controlVal = res.controlVal || '' editab.blacklist = res.blacklist if (editab.uuid) { @@ -357,7 +367,7 @@ getTabsForms = () => { const { tabs } = this.state - return getTabsSetForm(tabs.setting) + return getTabsSetForm(tabs.setting, tabs.uuid) } updateTabs = (res) => { @@ -383,12 +393,12 @@ return ( <div className={'mob-tabs-edit-box ' + tabs.setting.display} style={_style} onClick={this.clickComponent} id={tabs.uuid}> - <DraggableTabs defaultActiveKey={defaultActiveKey} tabPosition={'top'} type={tabs.setting.tabStyle} tabsMove={this.moveSwitch} onChange={this.onChange}> + <DraggableTabs defaultActiveKey={defaultActiveKey} tabBarStyle={{background: tabs.setting.backgroundColor || 'transparent'}} tabPosition={'top'} 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)}> + <NormalForm title="鏍囩缂栬緫" width={800} update={this.updateTab} getForms={() => this.getTabForms(tab)}> <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/> </NormalForm> <PasteComponent Tab={tab} insert={this.insert} /> @@ -396,9 +406,9 @@ <CloseOutlined className="close" onClick={() => this.delTab(tab)} /> </div> } trigger="hover"> - <span style={_tabStyle}>{tab.icon ? <MkIcon type={tab.icon} /> : null}{tab.label}</span> + <span style={{..._tabStyle, textDecoration: tab.hide === 'true' ? 'line-through' : 'none'}}>{tab.icon ? <MkIcon type={tab.icon} /> : null}{tab.label}</span> </Popover> - } key={tab.uuid}> + } key={tab.uuid} style={{backgroundColor: tab.backgroundColor || 'transparent'}}> {/* {appType === 'mob' && 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} /> @@ -407,10 +417,10 @@ </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()}> + <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}> + <NormalForm title="鏍囩椤佃缃�" width={800} update={this.updateTabs} getForms={this.getTabsForms}> <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/> </NormalForm> <CopyComponent type="tabs" card={tabs}/> -- Gitblit v1.8.0