From c98e45bfac25e9110ad0383faac54a54d98ea9d5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 18 十一月 2021 20:47:04 +0800
Subject: [PATCH] 2021-11-18

---
 src/mob/components/menubar/normal-menubar/index.jsx |   44 ++++++++++++++++++++++++++++++++++++++------
 1 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/src/mob/components/menubar/normal-menubar/index.jsx b/src/mob/components/menubar/normal-menubar/index.jsx
index 8603277..43d1e85 100644
--- a/src/mob/components/menubar/normal-menubar/index.jsx
+++ b/src/mob/components/menubar/normal-menubar/index.jsx
@@ -8,16 +8,18 @@
 import { resetStyle } from '@/utils/utils-custom.js'
 import MKEmitter from '@/utils/events.js'
 import Utils from '@/utils/utils.js'
+import getWrapForm from './options'
 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 MenuComponent = asyncComponent(() => import('./menucomponent'))
 const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent'))
 const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent'))
 const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent'))
 const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader'))
+const SettingComponent = asyncIconComponent(() => import('@/menu/datasource'))
 
 const { confirm } = Modal
 
@@ -44,10 +46,14 @@
         floor: card.floor,
         tabId: '',
         parentId: '',
+        format: 'object',   // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡
+        pageable: false,    // 缁勪欢灞炴�� - 鏄惁鍙垎椤�
+        switchable: false,  // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹�
         dataName: card.dataName || '',
         width: card.width || 24,
         name: card.name,
         subtype: card.subtype,
+        setting: { interType: 'system' },
         wrap: { name: card.name, width: card.width || 24, title: '' },
         style: { marginLeft: '0px', marginRight: '0px', marginTop: '8px', marginBottom: '8px' },
         headerStyle: { fontSize: '16px', borderBottomWidth: '1px', borderBottomColor: '#e8e8e8' },
@@ -125,6 +131,11 @@
 
     card.subMenus = card.subMenus.map(item => {
       if (item.uuid === cell.uuid) return cell
+      if (cell.oriuuid && item.uuid === cell.oriuuid) {
+        delete cell.oriuuid
+
+        return cell
+      }
       return item
     })
 
@@ -180,14 +191,12 @@
       setting: { type: 'menu', width: 6, sign: 'icon', icon: 'user', name: '瀹㈡埛', url: '', color: '#ffffff', iconFont: 20, padding: 12, background: '#1890ff', imgWidth: '' },
       style: {
         paddingTop: '15px', paddingBottom: '15px'
-      },
-      isnew: true
+      }
     }
 
     if (card.subMenus.length > 0) {
       newcard = fromJS(card.subMenus.slice(-1)[0]).toJS()
       newcard.uuid = Utils.getuuid()
-      newcard.isnew = true
     }
 
     card.subMenus.push(newcard)
@@ -214,6 +223,25 @@
 
     this.setState({card})
     this.props.updateConfig(card)
+  }
+
+  getWrapForms = () => {
+    const { card } = this.state
+
+    return getWrapForm(card.wrap)
+  }
+
+  updateWrap = (res) => {
+    let card = {...this.state.card, wrap: res}
+    if (res.datatype === 'dynamic' && !card.format) {
+      card.format = 'object'
+      card.pageable = false
+      card.switchable = false
+      card.setting = { interType: 'system' }
+      card.columns = []
+      card.scripts = []
+    }
+    this.updateComponent(card)
   }
 
   clickComponent = (e) => {
@@ -246,12 +274,16 @@
         <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
           <div className="mk-popover-control">
             <Icon className="plus" title="娣诲姞鑿滃崟" onClick={this.addMenu} type="plus" />
-            <WrapComponent config={card} updateConfig={this.updateComponent} />
-            <CopyComponent type="normalmenu" card={card}/>
+            <NormalForm title="鑿滃崟璁剧疆" width={800} update={this.updateWrap} getForms={this.getWrapForms}>
+              <Icon type="edit" style={{color: '#1890ff'}} title="缂栬緫"/>
+            </NormalForm>
+            <CopyComponent type="menubar" card={card}/>
             <PasteComponent config={card} options={['menucell']} updateConfig={this.updateComponent} />
             <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" />
             <UserComponent config={card}/>
             <Icon className="close" title="鍒犻櫎缁勪欢" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} />
+            {card.wrap.datatype === 'dynamic' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null}
+            {card.wrap.datatype !== 'dynamic' ? <Icon style={{color: '#eeeeee', cursor: 'not-allowed'}} type="setting"/> : null}
           </div>
         } trigger="hover">
           <Icon type="tool" />

--
Gitblit v1.8.0