From bd1dfc9e6c9b9f8076ca2783ce598e0936b4c664 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 22 十二月 2021 14:36:03 +0800
Subject: [PATCH] 2021-12-22

---
 src/mob/components/topbar/normal-navbar/index.jsx |   99 ++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 81 insertions(+), 18 deletions(-)

diff --git a/src/mob/components/topbar/normal-navbar/index.jsx b/src/mob/components/topbar/normal-navbar/index.jsx
index 74b39ac..3473c20 100644
--- a/src/mob/components/topbar/normal-navbar/index.jsx
+++ b/src/mob/components/topbar/normal-navbar/index.jsx
@@ -1,16 +1,16 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Icon, Popover } from 'antd'
+import { Popover } from 'antd'
+import { ExpandOutlined, ReloadOutlined, EllipsisOutlined, LogoutOutlined, ToolOutlined, ScanOutlined, LeftOutlined, EditOutlined, FontColorsOutlined, DeleteOutlined, SearchOutlined } from '@ant-design/icons'
 
 import asyncIconComponent from '@/utils/asyncIconComponent'
-
+import getWrapForm from './options'
 import MKEmitter from '@/utils/events.js'
-import zhCN from '@/locales/zh-CN/model.js'
-import enUS from '@/locales/en-US/model.js'
 import './index.scss'
 
-const WrapComponent = asyncIconComponent(() => import('./wrapsetting'))
+const NormalForm = asyncIconComponent(() => import('@/components/normalform'))
+const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent'))
 
 class NormalNavbar extends Component {
   static propTpyes = {
@@ -20,7 +20,6 @@
   }
 
   state = {
-    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     card: null,
     back: false
   }
@@ -35,8 +34,9 @@
         floor: card.floor,
         width: 24,
         subtype: card.subtype,
-        wrap: { type: 'navbar', height: 50, title: 'NavBar', back: 'true', search: 'false', logout: 'false' },
+        wrap: { type: 'navbar', height: 50, title: 'NavBar', back: 'true', logout: 'false' },
         style: {boxShadow: '0 0 3px #D9D9D9', shadowColor: '#D9D9D9', shadowBlur: '3px', paddingLeft: '10px', paddingRight: '10px', lineHeight: '2.8', fontSize: '18px' },
+        searchStyle: {}
       }
 
       if (card.config) {
@@ -51,8 +51,12 @@
       })
       this.props.updateConfig(_card)
     } else {
+      let _card = fromJS(card).toJS()
+      if (_card.wrap.type === 'navbar' && _card.wrap.search === 'true') {
+        _card.wrap.type = 'searchIcon'
+      }
       this.setState({
-        card: fromJS(card).toJS()
+        card: _card
       })
     }
   }
@@ -93,7 +97,13 @@
 
     if (comIds[0] !== card.uuid) return
 
-    let _card = {...card, style}
+    let _card = fromJS(card).toJS()
+
+    if (comIds[1] === 'search') {
+      _card.searchStyle = style
+    } else {
+      _card.style = style
+    }
 
     this.setState({
       card: _card
@@ -106,6 +116,12 @@
     const { card } = this.state
 
     MKEmitter.emit('changeStyle', [card.uuid], ['font', 'background', 'border', 'padding', 'shadow'], card.style)
+  }
+
+  changeSearchStyle = () => {
+    const { card } = this.state
+
+    MKEmitter.emit('changeStyle', [card.uuid, 'search'], ['font', 'background', 'border'], card.searchStyle || {})
   }
 
   clickComponent = (e) => {
@@ -146,7 +162,7 @@
     if (!card.search) {
       card.search = {
         floor: 1,
-        setting: { type: 'title', field: '', title: '', focus: 'true', btn: 'hidden' },
+        setting: { type: 'title', field: '', title: '', focus: 'true', btn: 'hidden', backgroundColor: sessionStorage.getItem('sysBgColor') },
         groups: [],
         fields: []
       }
@@ -155,31 +171,78 @@
     MKEmitter.emit('changeSearch', card)
   }
 
+  getWrapForms = () => {
+    const { wrap } = this.state.card
+
+    return getWrapForm(wrap)
+  }
+
+  updateWrap = (res) => {
+    this.updateComponent({...this.state.card, wrap: res})
+  }
+
+  skip = () => {
+    const { wrap } = this.state.card
+
+    if (!wrap.linkmenu) return
+    
+    MKEmitter.emit('changeEditMenu', {
+      MenuID: wrap.linkmenu,
+      copyMenuId: '',
+      MenuNo: '',
+      MenuName: '',
+    })
+  }
+
   render() {
     const { card } = this.state
+
+    let right = null
+    if (card.wrap.logout === 'true') {
+      right = <LogoutOutlined />
+    }
+    if (card.wrap.scan === 'true') {
+      right = !right ? <ExpandOutlined onDoubleClick={this.skip}/> : <EllipsisOutlined />
+    }
+    if (card.wrap.refresh === 'true') {
+      right = !right ? <ReloadOutlined /> : <EllipsisOutlined onDoubleClick={this.skip}/>
+    }
 
     return (
       <div className="normal-topbar-edit-box" style={card.style} onClick={this.clickComponent} id={card.uuid}>
         <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
           <div className="mk-popover-control">
-            <WrapComponent config={card} updateConfig={this.updateComponent} />
-            <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" />
-            <Icon className="close" title="鍒犻櫎缁勪欢" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} />
+            <NormalForm title="瀵艰埅鏍忚缃�" width={750} update={this.updateWrap} getForms={this.getWrapForms}>
+              <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/>
+            </NormalForm>
+            <CopyComponent type="topbar" card={card}/>
+            <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/>
+            <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} />
           </div>
         } trigger="hover">
-          <Icon type="tool" />
+          <ToolOutlined />
         </Popover>
         <div className="am-navbar">
           <div className="am-navbar-left">
-            {card.wrap.back !== 'false' ? <Icon type="left" /> : null}
+            {card.wrap.back !== 'false' ? <LeftOutlined /> : null}
           </div>
           {card.wrap.type !== 'search' ?
             <div className="am-navbar-title">{card.wrap.title || ''}</div> :
-            <div className="am-navbar-search" onDoubleClick={this.setSearch}><div className="search-bar"><Icon type="search" /></div></div>
+            <div className="am-navbar-search" onDoubleClick={this.setSearch}>
+              <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
+                <div className="mk-popover-control">
+                  <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeSearchStyle}/>
+                </div>
+              } trigger="hover">
+                <div style={card.searchStyle} className="search-bar">
+                  {card.search && card.search.setting.scan === 'true' ? <ScanOutlined /> : <SearchOutlined />}
+                </div>
+              </Popover>
+            </div>
           }
           <div className="am-navbar-right">
-            {card.wrap.search === 'true' ? <Icon type="search" onDoubleClick={this.setSearch}/> : null}
-            {card.wrap.logout === 'true' ? <Icon type="ellipsis" /> : null}
+            {card.wrap.type === 'searchIcon' ? <SearchOutlined onDoubleClick={this.setSearch}/> : null}
+            {right}
           </div>
         </div>
       </div>

--
Gitblit v1.8.0