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/pcdesign/index.jsx |  175 ++++++++++++++++++++--------------------------------------
 1 files changed, 60 insertions(+), 115 deletions(-)

diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx
index b26500d..c0f43de 100644
--- a/src/views/pcdesign/index.jsx
+++ b/src/views/pcdesign/index.jsx
@@ -25,7 +25,6 @@
 
 const MenuForm = asyncComponent(() => import('./menuform'))
 const Transfer = asyncComponent(() => import('@/pc/transfer'))
-const PopviewController = asyncComponent(() => import('@/menu/popview'))
 const Versions = asyncComponent(() => import('@/menu/versions'))
 const MenuShell = asyncComponent(() => import('@/pc/menushell'))
 const ViewNodes = asyncComponent(() => import('@/menu/viewnodes'))
@@ -45,15 +44,10 @@
 const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent'))
 
 sessionStorage.setItem('isEditState', 'true')
-sessionStorage.setItem('editMenuType', 'menu') // 缂栬緫鑿滃崟绫诲瀷
+
 sessionStorage.setItem('appType', 'pc')        // 搴旂敤绫诲瀷
 sessionStorage.setItem('typename', 'pc')
 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            // 淇濆瓨鑿滃崟淇℃伅
 
 const memberLevel = Utils.getMemberLevel()
 
@@ -67,13 +61,10 @@
     MenuNo: '',
     delButtons: [],
     copyButtons: [],
-    thawButtons: [],
     activeKey: 'basedata',
     menuloading: false,
     oriConfig: null,
     config: null,
-    popBtn: null,             // 寮圭獥鏍囩椤�
-    visible: false,
     customComponents: [],
     settingshow: sessionStorage.getItem('settingshow') !== 'false',
     controlshow: sessionStorage.getItem('controlshow') !== 'false',
@@ -84,6 +75,15 @@
 
   UNSAFE_componentWillMount() {
     if (memberLevel < 30) return
+
+    sessionStorage.setItem('editMenuType', 'menu') // 缂栬緫鑿滃崟绫诲瀷
+
+    window.GLOB.UserComponentMap = new Map() // 缂撳瓨鐢ㄦ埛鑷畾涔夌粍浠�
+    window.GLOB.TabsMap = new Map()          // 缂撳瓨鐢ㄦ埛鎿嶄綔鐨勬爣绛鹃〉
+    window.GLOB.CacheIndependent = new Map()
+    window.GLOB.urlFields = []               // url鍙橀噺
+    window.GLOB.customMenu = null            // 淇濆瓨鑿滃崟淇℃伅
+
     try {
       let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param)))
 
@@ -133,7 +133,6 @@
     }
     MKEmitter.addListener('delButtons', this.delButtons)
     MKEmitter.addListener('modalStatus', this.modalStatus)
-    MKEmitter.addListener('thawButtons', this.thawButtons)
     MKEmitter.addListener('copyButtons', this.copyButtons)
     MKEmitter.addListener('changePopview', this.initPopview)
     MKEmitter.addListener('changeEditMenu', this.changeEditMenu)
@@ -141,9 +140,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)
 
@@ -200,7 +207,6 @@
     }
     MKEmitter.removeListener('delButtons', this.delButtons)
     MKEmitter.removeListener('modalStatus', this.modalStatus)
-    MKEmitter.removeListener('thawButtons', this.thawButtons)
     MKEmitter.removeListener('copyButtons', this.copyButtons)
     MKEmitter.removeListener('changePopview', this.initPopview)
     MKEmitter.removeListener('changeEditMenu', this.changeEditMenu)
@@ -214,8 +220,6 @@
   }
 
   triggerMenuSave = () => {
-    if (this.state.visible) return
-
     this.submitConfig()
   }
 
@@ -238,7 +242,7 @@
       type: 'view'
     }
 
-    param.MenuNo = menu.MenuNo || ''
+    // param.MenuNo = menu.MenuNo || ''
     param.MenuName = menu.MenuName || ''
 
     param = window.btoa(window.encodeURIComponent(JSON.stringify(param)))
@@ -461,50 +465,46 @@
       typename: 'pc',
       typecharone: ''
     }).then(res => {
-      let coms = []
       if (!res.status) {
         notification.warning({
           top: 92,
           message: res.message,
           duration: 5
         })
-      } else 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
-          })
-        })
+      } 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()
     })
   }
 
-  handleBack = () => {
-    this.setState({popBtn: null, delButtons: [], copyButtons: [], thawButtons: []}, () => {
-      sessionStorage.setItem('editMenuType', 'menu')
-      window.GLOB.customMenu = this.state.config
-      this.setState({visible: false})
+  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) => {
@@ -536,10 +536,6 @@
   copyButtons = (items) => {
     this.setState({copyButtons: [...this.state.copyButtons, ...items]})
   }
-  
-  thawButtons = (item) => {
-    this.setState({thawButtons: [...this.state.thawButtons, item]})
-  }
 
   initPopview = (card, btn) => {
     const { oriConfig, config } = this.state
@@ -553,12 +549,11 @@
       return
     }
 
-    btn.config = fromJS(config).toJS()
-    btn.component = card
+    let _btn = fromJS(btn).toJS()
+    _btn.MenuName = config.MenuName + '-' + card.name + '-' + btn.label
+    _btn.ParentMenuID = config.uuid
 
-    sessionStorage.setItem('editMenuType', 'popview') // 缂栬緫寮圭獥鏍囩
-
-    this.setState({popBtn: btn, visible: true})
+    this.props.history.push('/popdesign/' + window.btoa(window.encodeURIComponent((JSON.stringify(_btn)))))
   }
 
   closeView = () => {
@@ -640,7 +635,7 @@
             Template: 'webPage',
             enabled: false,
             MenuName: urlParam.MenuName || '',
-            MenuNo: urlParam.MenuNo || '',
+            MenuNo: '',
             tables: [],
             components: [],
             viewType: 'menu',
@@ -777,7 +772,7 @@
       config.MenuID = MenuId
       config.open_edition = ''
       config.MenuName = urlParam.MenuName || ''
-      config.MenuNo = urlParam.MenuNo || ''
+      config.MenuNo = ''
 
       let indeComs = []
       config.components.forEach(item => {
@@ -933,7 +928,6 @@
           item.action && item.action.forEach(btn => {
             if (btn.hidden === 'true') return
 
-            this.checkBtn(btn)
             m.children.push({
               key: btn.uuid,
               title: btn.label,
@@ -947,7 +941,6 @@
               if (cell.eleType !== 'button') return
               if (cell.hidden === 'true') return
 
-              this.checkBtn(cell)
               m.children.push({
                 key: cell.uuid,
                 title: cell.label,
@@ -960,7 +953,6 @@
               if (cell.eleType !== 'button') return
               if (cell.hidden === 'true') return
 
-              this.checkBtn(cell)
               m.children.push({
                 key: cell.uuid,
                 title: cell.label,
@@ -976,7 +968,6 @@
               if (cell.eleType !== 'button') return
               if (cell.hidden === 'true') return
 
-              this.checkBtn(cell)
               m.children.push({
                 key: cell.uuid,
                 title: cell.label,
@@ -991,7 +982,6 @@
             if (cell.eleType !== 'button') return
             if (cell.hidden === 'true') return
 
-            this.checkBtn(cell)
             m.children.push({
               key: cell.uuid,
               title: cell.label,
@@ -1024,7 +1014,6 @@
           item.action && item.action.forEach(btn => {
             if (btn.hidden === 'true') return
 
-            this.checkBtn(btn)
             m.children.push({
               key: btn.uuid,
               title: btn.label,
@@ -1038,7 +1027,6 @@
             col.elements.forEach(btn => {
               if (btn.hidden === 'true') return
               
-              this.checkBtn(btn)
               m.children.push({
                 key: btn.uuid,
                 title: btn.label,
@@ -1071,26 +1059,6 @@
     }
 
     return nodes
-  }
-
-  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
-        })
-      }
-    }
   }
 
   getSubMenus = () => {
@@ -1209,7 +1177,7 @@
   }
 
   submitConfig = () => {
-    const { delButtons, copyButtons, thawButtons } = this.state
+    const { delButtons, copyButtons } = this.state
     let config = fromJS(this.state.config).toJS()
 
     if (!config.MenuName || !config.MenuNo || (config.cacheUseful === 'true' && !config.cacheTime)) {
@@ -1445,27 +1413,6 @@
           }
           return Api.getSystemConfig(_param)
         }
-      }).then(res => { // 鎸夐挳瑙i櫎鍐荤粨
-        if (!res) return
-        if (!res.status) {
-          notification.warning({
-            top: 92,
-            message: res.message,
-            duration: 5
-          })
-          return false
-        } else if (!res.nonexec) { // 鎵ц鍒犻櫎鍚庡埛鏂拌彍鍗曞垪琛�
-          this.getAppMenus()
-        }
-
-        if (thawButtons.length === 0) {
-          return { status: true }
-        } else {
-          return Api.getSystemConfig({
-            func: 'sPC_MainMenu_ReDel',
-            MenuID: thawButtons.join(',')
-          })
-        }
       }).then(res => { // 椤甸潰淇濆瓨
         if (!res) return
 
@@ -1604,7 +1551,6 @@
           this.setState({
             delButtons: [],
             copyButtons: [],
-            thawButtons: [],
             menuloading: false
           })
           notification.success({
@@ -1883,13 +1829,13 @@
   }
 
   render () {
-    const { localedict, loading, visible, popBtn, comloading, activeKey, settingshow, controlshow, dict, MenuId, config, menuloading, customComponents, eyeopen } = this.state
+    const { localedict, loading, comloading, activeKey, settingshow, controlshow, dict, MenuId, config, menuloading, customComponents, eyeopen } = this.state
 
     return (
       <ConfigProvider locale={localedict}>
         <div className={'mk-pc-view '} id="mk-pc-design-view">
           {loading ? <Spin className="view-spin" size="large" /> : null}
-          {!popBtn && !visible ? <DndProvider backend={HTML5Backend}>
+          <DndProvider backend={HTML5Backend}>
             <div className={'menu-setting ' + (!settingshow ? 'hidden' : '')}>
               <div className="draw">
                 {settingshow ? <DoubleLeftOutlined onClick={() => {sessionStorage.setItem('settingshow', 'false'); this.setState({settingshow: false})}}/> : null}
@@ -1898,7 +1844,7 @@
               <div className="pc-setting-tools">
                 <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}>
                   {/* 鍩烘湰淇℃伅 */}
-                  <Panel header={dict['mob.basemsg']} key="basedata">
+                  <Panel header="鍩烘湰淇℃伅" key="basedata">
                     {/* 鑿滃崟淇℃伅 */}
                     {config ? <MenuForm
                       dict={dict}
@@ -1953,8 +1899,7 @@
             <div className={'menu-body menu-view' + (menuloading ? ' saving' : '') + (eyeopen ? ' eye-open' : '')}>
               {config && !comloading ? <MenuShell menu={config} handleList={this.updateConfig} /> : null}
             </div>
-          </DndProvider> : null}
-          {popBtn && visible ? <PopviewController btn={popBtn} handleBack={this.handleBack}/> : null}
+          </DndProvider>
           <StyleController />
           <StyleCombController />
           <ModalController />

--
Gitblit v1.8.0