From 31ec63f0419895876cbaba99637a884a32d33d0d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 01 九月 2021 10:31:45 +0800
Subject: [PATCH] 2021-09-01

---
 src/views/mobdesign/index.jsx |   71 ++++++++++++++++++++++++-----------
 1 files changed, 48 insertions(+), 23 deletions(-)

diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx
index 45210ac..36f4c49 100644
--- a/src/views/mobdesign/index.jsx
+++ b/src/views/mobdesign/index.jsx
@@ -47,6 +47,7 @@
 sessionStorage.setItem('appType', 'mob')       // 搴旂敤绫诲瀷
 document.body.className = ''
 window.GLOB.UserComponentMap = new Map() // 缂撳瓨鐢ㄦ埛鑷畾涔夌粍浠�
+window.GLOB.TabsMap = new Map()          // 缂撳瓨鐢ㄦ埛鎿嶄綔鐨勬爣绛鹃〉
 window.GLOB.CacheIndependent = new Map()
 window.GLOB.urlFields = []               // url鍙橀噺
 window.GLOB.customMenu = null            // 淇濆瓨鑿滃崟淇℃伅
@@ -107,7 +108,7 @@
           this.getMenuParam(param)
         })
       }
-    } catch {
+    } catch (e) {
       notification.warning({
         top: 92,
         message: '鑿滃崟淇℃伅瑙f瀽閿欒锛�',
@@ -132,6 +133,7 @@
       return
     }
     MKEmitter.addListener('changeEditMenu', this.changeEditMenu)
+    MKEmitter.addListener('triggerMenuSave', this.submitConfig)
     MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle)
     MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent)
     setTimeout(() => {
@@ -150,6 +152,7 @@
       return
     }
     MKEmitter.removeListener('changeEditMenu', this.changeEditMenu)
+    MKEmitter.removeListener('triggerMenuSave', this.submitConfig)
     MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle)
     MKEmitter.removeListener('updateCustomComponent', this.updateCustomComponent)
   }
@@ -308,6 +311,17 @@
       }).then(res => {
         if (res.status) {
           sessionStorage.setItem('app_videos', JSON.stringify(res.data || []))
+        }
+      })
+      Api.getSystemConfig({
+        func: 's_url_db_adduptdel',
+        PageIndex: 0,  // 0 浠h〃鍏ㄩ儴
+        PageSize: 0,   // 0 浠h〃鍏ㄩ儴
+        typecharone: 'color',
+        type: 'search'
+      }).then(res => {
+        if (res.status) {
+          sessionStorage.setItem('app_colors', JSON.stringify(res.data || []))
         }
       })
     })
@@ -500,6 +514,11 @@
       appIndeList = appIndeList.map(item => (item.keys_type !== 'index' ? item.keys_id : '')).join(',')
 
       let menus = res.menus.filter(item => appIndeList.indexOf(item.MenuID) === -1)
+      menus = menus.map(item => {
+        item.value = item.MenuID
+        item.label = item.MenuName
+        return item
+      })
       sessionStorage.setItem('appMenus', JSON.stringify(menus))
     })
   }
@@ -672,7 +691,10 @@
           title: item.name,
           children: []
         }
-        if (item.type === 'tabs') {
+
+        if (item.type === 'topbar' || item.type === 'login') {
+          return null
+        } else if (item.type === 'tabs') {
           let tabs = []
           item.subtabs.forEach(tab => {
             let s = traversal(tab.components)
@@ -748,6 +770,13 @@
               title: menu.setting.name
             }
           })
+        } else if (item.type === 'form') {
+          m.children = item.subcards.map(m => {
+            return {
+              key: m.uuid,
+              title: m.setting.title
+            }
+          })
         } else if (item.type === 'table' && item.subtype === 'normaltable') {
           item.action && item.action.forEach(btn => {
             this.checkBtn(btn)
@@ -767,8 +796,6 @@
             })
           })
         }
-
-        if (m.children.length === 0) return null
 
         return m
       })
@@ -1032,12 +1059,7 @@
           this.setState({
             config,
             oriConfig: fromJS(config).toJS(),
-            menuloading: false,
-            comloading: true
-          }, () => {
-            this.setState({
-              comloading: false
-            })
+            menuloading: false
           })
 
           notification.success({
@@ -1055,6 +1077,7 @@
             menuloading: false
           })
         }
+        MKEmitter.emit('completeSave')
       })
     }, 300)
   }
@@ -1338,19 +1361,21 @@
                 {controlshow ? <Icon onClick={() => {this.setState({controlshow: false})}} type="double-right" /> : null}
                 {!controlshow ? <Icon onClick={() => {this.setState({controlshow: true})}} type="double-left" /> : null}
               </div>
-              <Button type="primary" onClick={this.submitConfig} loading={menuloading}>{dict['mob.save']}</Button>
-              <Switch className="big" checkedChildren={dict['mob.enable']} unCheckedChildren={dict['mob.disable']} checked={config && config.enabled} onChange={this.onEnabledChange} />
-              <CreateView resetmenu={this.getAppMenus} />
-              <PasteController type="menu" Tab={null} insert={this.insert} />
-              <StyleCombControlButton menu={config} />
-              <SysInterface config={config} updateConfig={this.updateConfig}/>
-              <PictureController/>
-              <Quotecomponent config={config} updateConfig={this.updateConfig}/>
-              <Button className="mk-border-green" icon="home" onClick={this.setHomeView}>璁句负棣栭〉</Button>
-              <Button className="mk-border-danger" icon="redo" onClick={this.refreshView}>寮哄埗鍒锋柊</Button>
-              <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/>
-              <Transfer MenuID={MenuId} />
-              <Button type="default" onClick={this.closeView}>鍏抽棴</Button>
+              <div className="wrap">
+                <Button type="primary" onClick={this.submitConfig} loading={menuloading}>{dict['mob.save']}</Button>
+                <Switch className="big" checkedChildren={dict['mob.enable']} unCheckedChildren={dict['mob.disable']} checked={config && config.enabled} onChange={this.onEnabledChange} />
+                <CreateView resetmenu={this.getAppMenus} />
+                <PasteController type="menu" Tab={null} insert={this.insert} />
+                <StyleCombControlButton menu={config} />
+                <SysInterface config={config} updateConfig={this.updateConfig}/>
+                <PictureController/>
+                <Quotecomponent config={config} updateConfig={this.updateConfig}/>
+                <Button className="mk-border-green" icon="home" onClick={this.setHomeView}>璁句负棣栭〉</Button>
+                <Button className="mk-border-danger" icon="redo" onClick={this.refreshView}>寮哄埗鍒锋柊</Button>
+                <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/>
+                <Transfer MenuID={MenuId} />
+                <Button type="default" onClick={this.closeView}>鍏抽棴</Button>
+              </div>
             </div>
             <div className={'menu-body menu-view' + (menuloading ? 'saving' : '')}>
               {config && !comloading ? <div className="mob-shell" style={{width: window.GLOB.shellWidth, height: window.GLOB.shellHeight}}>

--
Gitblit v1.8.0