From 704f82b06befe96e5f739b2dce419f76f5683a6f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 15 八月 2022 09:27:54 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/views/mobdesign/index.jsx |  145 ++++++++++++++++++++++++++---------------------
 1 files changed, 80 insertions(+), 65 deletions(-)

diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx
index f22b547..5b6484a 100644
--- a/src/views/mobdesign/index.jsx
+++ b/src/views/mobdesign/index.jsx
@@ -161,9 +161,17 @@
     MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle)
     MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent)
     setTimeout(() => {
-      this.updateCustomComponent()
+      if (sessionStorage.getItem('app_custom_components')) {
+        let list = sessionStorage.getItem('app_custom_components')
+        list = JSON.parse(list)
+
+        this.setCustomComponent(list)
+      } else {
+        this.updateCustomComponent()
+      }
       this.getAppPictures()
       this.getSmStemp()
+      this.getRoleFields()
       setGLOBFuncs()
     }, 1000)
 
@@ -413,36 +421,46 @@
       typename: sessionStorage.getItem('typename'),
       typecharone: ''
     }).then(res => {
-      let coms = []
-      if (res.cus_list && res.cus_list.length > 0) {
-        res.cus_list.forEach(item => {
-          let config = ''
-
-          try {
-            config = JSON.parse(window.decodeURIComponent(window.atob(item.long_param)))
-          } catch (e) {
-            console.warn('Parse Failure')
-            config = ''
-          }
-
-          if (!config || !item.c_name) return
-
-          window.GLOB.UserComponentMap.set(item.c_id, item.c_name)
-          coms.push({
-            uuid: item.c_id,
-            type: 'menu',
-            title: item.c_name,
-            url: item.images,
-            component: config.type,
-            subtype: config.subtype,
-            width: config.width || 24,
-            config
-          })
+      if (!res.status) {
+        notification.warning({
+          top: 92,
+          message: res.message,
+          duration: 5
         })
+      } else if (res.cus_list) {
+        sessionStorage.setItem('app_custom_components', JSON.stringify(res.cus_list))
+        this.setCustomComponent(res.cus_list)
       }
-      this.setState({customComponents: coms})
-      this.getRoleFields()
     })
+  }
+
+  setCustomComponent = (cus_list) => {
+    let coms = []
+
+    cus_list.forEach(item => {
+      let config = ''
+
+      try {
+        config = JSON.parse(window.decodeURIComponent(window.atob(item.long_param)))
+      } catch (e) {
+        console.warn('Parse Failure')
+        config = ''
+      }
+
+      if (!config || !item.c_name) return
+
+      window.GLOB.UserComponentMap.set(item.c_id, item.c_name)
+      coms.push({
+        uuid: item.c_id,
+        type: 'menu',
+        title: item.c_name,
+        url: item.images,
+        component: config.type,
+        subtype: config.subtype,
+        config
+      })
+    })
+    this.setState({customComponents: coms})
   }
 
   updateComponentStyle = (parentId, keys, style) => {
@@ -551,7 +569,8 @@
             Template: 'webPage',
             enabled: false,
             MenuName: urlParam.MenuName || '',
-            MenuNo: urlParam.MenuNo || '',
+            // MenuNo: urlParam.MenuNo || '',
+            MenuNo: '',
             tables: [],
             components: [],
             viewType: 'menu',
@@ -801,7 +820,8 @@
       config.MenuID = MenuId
       config.open_edition = ''
       config.MenuName = urlParam.MenuName || ''
-      config.MenuNo = urlParam.MenuNo || ''
+      // config.MenuNo = urlParam.MenuNo || ''
+      config.MenuNo = ''
 
       let indeComs = []
       config.components.forEach(item => {
@@ -957,7 +977,6 @@
           item.action && item.action.forEach(btn => {
             if (btn.hidden === 'true') return
 
-            this.checkBtn(btn)
             m.children.push({
               key: btn.uuid,
               title: btn.label,
@@ -968,7 +987,6 @@
               if (cell.eleType !== 'button') return
               if (cell.hidden === 'true') return
 
-              this.checkBtn(cell)
               m.children.push({
                 key: cell.uuid,
                 title: cell.label,
@@ -981,7 +999,6 @@
               if (cell.eleType !== 'button') return
               if (cell.hidden === 'true') return
 
-              this.checkBtn(cell)
               m.children.push({
                 key: cell.uuid,
                 title: cell.label,
@@ -993,7 +1010,6 @@
             if (cell.eleType !== 'button') return
             if (cell.hidden === 'true') return
 
-            this.checkBtn(cell)
             m.children.push({
               key: cell.uuid,
               title: cell.label,
@@ -1023,7 +1039,6 @@
           item.action && item.action.forEach(btn => {
             if (btn.hidden === 'true') return
 
-            this.checkBtn(btn)
             m.children.push({
               key: btn.uuid,
               title: btn.label,
@@ -1034,7 +1049,6 @@
             col.elements.forEach(btn => {
               if (btn.hidden === 'true') return
 
-              this.checkBtn(btn)
               m.children.push({
                 key: btn.uuid,
                 title: btn.label,
@@ -1090,7 +1104,8 @@
                 menus.push({
                   MenuID: m.uuid,
                   MenuName: m.setting.name,
-                  MenuNo: m.setting.MenuNo
+                  // MenuNo: m.setting.MenuNo
+                  MenuNo: ''
                 })
               }
             } else if (m.setting.type === 'linkmenu' && menuObj[m.setting.linkMenuId]) {
@@ -1194,26 +1209,6 @@
     })
 
     return menus
-  }
-
-  checkBtn = (btn) => {
-    if (['prompt', 'exec', 'pop'].includes(btn.OpenType) && btn.Ot === 'required' && btn.verify && btn.verify.scripts && btn.verify.scripts.length > 0) {
-      let hascheck = false
-      btn.verify.scripts.forEach(item => {
-        if (item.status === 'false') return
-  
-        if (/\$check@|@check\$/ig.test(item.sql)) {
-          hascheck = true
-        }
-      })
-      if (hascheck) {
-        notification.warning({
-          top: 92,
-          message: `鍙�夋嫨澶氳鐨勬寜閽��${btn.label}銆嬩腑 $check@ 鎴� @check$ 灏嗕笉浼氱敓鏁堬紒`,
-          duration: 5
-        })
-      }
-    }
   }
 
   getMiniStyle = (config) => {
@@ -1625,16 +1620,16 @@
     let searchSum = 0
     let swipes = []
 
-    let check = (components) => {
+    let check = (components, level, sign) => {
       components.forEach(item => {
         if (error) return
         if (item.type === 'tabs') {
           item.subtabs.forEach(tab => {
-            check(tab.components)
+            check(tab.components, level + 1, tab.uuid)
           })
           return
         } else if (item.type === 'group') {
-          check(item.components)
+          check(item.components, level, sign)
           return
         } else if (item.type === 'navbar' && !item.wrap.MenuNo) {
           error = `瀵艰埅鏍忋��${item.name}銆嬫湭璁剧疆鑿滃崟鍙傛暟锛乣
@@ -1649,7 +1644,8 @@
           }
         }
         if (item.wrap && item.wrap.pagestyle === 'slide' && item.pageable && item.setting.laypage !== 'false') {
-          swipes.push(item.name)
+          // swipes.push(item.name)
+          swipes.push({level, name: item.name, sign})
         }
 
         item.errors && item.errors.forEach(err => {
@@ -1659,7 +1655,7 @@
       })
     }
 
-    check(config.components)
+    check(config.components, 1, 'view')
 
     // if (!error && viewType === 'userbind' && config.components.filter(item => item.type === 'login').length === 0) {
     //   error = '鐢ㄦ埛缁戝畾椤甸潰蹇呴』娣诲姞鐧诲綍銆�'
@@ -1667,8 +1663,27 @@
 
     if (!error && searchSum > 1) {
       error = '鎼滅储缁勪欢涓庡鑸爮鐨勬悳绱㈠姛鑳戒笉鍙悓鏃朵娇鐢ㄣ��'
-    } else if (!error && swipes.length > 1) {
-      error = `椤甸潰涓笉鍙悓鏃朵娇鐢ㄥ涓粦鍔ㄥ姞杞界粍浠躲�傦紙${swipes.join('銆�')}锛塦
+    } else if (!error && swipes.length > 0) {
+      swipes.forEach(cell => {
+        if (!error && cell.level > 2) {
+          error = `涓嶅彲鍦ㄥ灞傛爣绛鹃〉涓娇鐢ㄦ粦鍔ㄥ姞杞界粍浠躲�傦紙${cell.name}锛塦
+        }
+      })
+      if (!error) {
+        let levels = swipes.map(s => s.level)
+        levels = Array.from(new Set(levels))
+        if (levels.length > 1) {
+          error = `涓嶅彲鍦ㄩ〉闈笌鏍囩椤典腑鍚屾椂浣跨敤婊戝姩鍔犺浇缁勪欢銆傦紙${swipes.map(s => s.name).join('銆�')}锛塦
+        }
+      }
+
+      if (!error) {
+        let signs = swipes.map(s => s.sign)
+        signs = Array.from(new Set(signs))
+        if (signs.length !== swipes.length) {
+          error = `椤甸潰涓紙鎴栧悓涓�鏍囩椤典腑锛変笉鍙悓鏃朵娇鐢ㄥ涓粦鍔ㄥ姞杞界粍浠躲�傦紙${swipes.map(s => s.name).join('銆�')}锛塦
+        }
+      }
     }
 
     if (show && error) {
@@ -1921,7 +1936,7 @@
               <div className="pc-setting-tools">
                 <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}>
                   {/* 鍩烘湰淇℃伅 */}
-                  <Panel header={dict['mob.basemsg']} forceRender className="basedata" key="basedata">
+                  <Panel header="鍩烘湰淇℃伅" forceRender className="basedata" key="basedata">
                     {/* 鑿滃崟淇℃伅 */}
                     {config ? <MenuForm
                       dict={dict}

--
Gitblit v1.8.0