From f3d4db769ba9b51b799d981511a710fd443d0e08 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 21 四月 2025 12:18:03 +0800
Subject: [PATCH] Merge branch 'master' into positec

---
 src/views/basedesign/index.jsx |  210 ++++++++++++++++++++--------------------------------
 1 files changed, 80 insertions(+), 130 deletions(-)

diff --git a/src/views/basedesign/index.jsx b/src/views/basedesign/index.jsx
index ddbea7f..011b207 100644
--- a/src/views/basedesign/index.jsx
+++ b/src/views/basedesign/index.jsx
@@ -1,42 +1,25 @@
 import React, {Component} from 'react'
-import PropTypes from 'prop-types'
-// import { is, fromJS } from 'immutable'
-import { connect } from 'react-redux'
-import { withRouter } from 'react-router-dom'
 import { notification, Spin } from 'antd'
-// import moment from 'moment'
 
 import Api from '@/api'
-import MKEmitter from '@/utils/events.js'
-import zhCN from '@/locales/zh-CN/model.js'
-import enUS from '@/locales/en-US/model.js'
-// import Utils from '@/utils/utils.js'
-import MenuUtils from '@/utils/utils-custom.js'
 import asyncComponent from '@/utils/asyncComponent'
 import asyncLoadComponent from '@/utils/asyncLoadComponent'
+
+import '@/assets/css/design.scss'
 import './index.scss'
 
 const Header = asyncComponent(() => import('@/menu/header'))
 const ComTableConfig = asyncLoadComponent(() => import('@/templates/comtableconfig'))
 const TreePageConfig = asyncLoadComponent(() => import('@/templates/treepageconfig'))
-const CalendarPageConfig = asyncLoadComponent(() => import('@/templates/calendarconfig'))
-const FormTabConfig = asyncLoadComponent(() => import('@/templates/formtabconfig'))
 const ModalConfig = asyncLoadComponent(() => import('@/templates/modalconfig'))
 const SubTable = asyncLoadComponent(() => import('@/templates/subtableconfig'))
+const UpdateFormTab = asyncLoadComponent(() => import('./updateFormTab'))
+
+document.body.className = ''
 
 class BaseDesign extends Component {
-  static propTpyes = {
-    menulist: PropTypes.any,     // 涓夌骇鑿滃崟鍒楄〃
-    exitEdit: PropTypes.func,    // 閫�鍑虹紪杈戠姸鎬�
-    supMenu: PropTypes.object,   // 瀵瑰簲鐨勪笂绾ц彍鍗�
-    supMenuList: PropTypes.array // 涓婄骇鑿滃崟鍒楄〃锛岀敤浜庝笁绾ц彍鍗曞垏鎹笂绾ц彍鍗�
-  }
-
   state = {
-    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     loading: false,         // 缂栬緫鑿滃崟鎴栦娇鐢ㄥ凡浣跨敤妯℃澘鏃讹紝鑾峰彇閰嶇疆淇℃伅
-    btnParam: null,         // 缂栬緫鎸夐挳鐨勯厤缃俊鎭�
-    menulist: null,         // 缂栬緫涓殑鑿滃崟
     tabview: '',            // 閫夋嫨妯℃澘绐楀彛锛坱emplate锛夈�佸熀纭�琛ㄦ牸閰嶇疆锛圕ommonTable锛夈�佽〃鍗曪紙Modal锛夈�佸瓙琛紙SubTable锛�
     editMenu: null,         // 缂栬緫鑿滃崟
     editAction: null,       // 缂栬緫鎸夐挳
@@ -53,6 +36,20 @@
   }
 
   UNSAFE_componentWillMount() {
+    if (sessionStorage.getItem('devError') === 'true') {
+      sessionStorage.clear()
+      window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login')
+      window.location.reload()
+      return
+    }
+
+    if (!sessionStorage.getItem('UserID')) {
+      this.props.history.replace('/login')
+      return
+    }
+
+    window.GLOB.developing = true
+
     try {
       let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param)))
 
@@ -92,20 +89,43 @@
       loading: true
     })
 
-    Api.getSystemConfig(param).then(res => {
+    Api.getCloudConfig(param).then(res => {
       if (res.status) {
-        let _LongParam = ''
+        editMenu.open_edition = res.open_edition || ''
+        editMenu.LongParam = ''
+
         if (res.LongParam) {
+          let _LongParam = ''
           try {
             _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam)))
           } catch (e) {
             console.warn('Parse Failure')
             _LongParam = ''
           }
-        }
 
-        editMenu.LongParam = _LongParam
-        editMenu.open_edition = res.open_edition || ''
+          if (_LongParam && (_LongParam.Template === 'BaseTable' || _LongParam.Template === 'CustomPage')) {
+            let _param = {
+              MenuId: editMenu.MenuID,
+              MenuID: editMenu.MenuID,
+              ParentId: _LongParam.ParentId,
+              MenuName: _LongParam.MenuName,
+              MenuNo: _LongParam.MenuNo
+            }
+            let url = ''
+            if (_LongParam.Template === 'BaseTable') {
+              url = window.location.href.split('#')[0] + `#/tabledesign/${window.btoa(window.encodeURIComponent(JSON.stringify(_param)))}`
+            } else {
+              _param.MenuType = 'custom'
+              _param = window.btoa(window.encodeURIComponent(JSON.stringify(_param)))
+              url = window.location.href.split('#')[0] + `#/menudesign/${_param}`
+            }
+            
+            window.history.replaceState(null, null, url)
+            window.location.reload()
+            return
+          }
+          editMenu.LongParam = _LongParam
+        }
         
         this.setState({
           editMenu: editMenu,
@@ -140,140 +160,70 @@
     }, () => {
       if (param) {
         this.setState(param)
-      }
-    })
-  }
-
-  copyMenu = (param, MenuId) => {
-    Api.getSystemConfig({
-      func: 'sPC_Get_LongParam',
-      MenuID: MenuId
-    }).then(result => {
-      if (result.status) {
-        let config = null
-  
-        try {
-          config = result.LongParam ? JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) : null
-        } catch (e) {
-          console.warn('Parse Failure')
-          config = null
-        }
-  
-        if (config) {
-          config.uuid = param.MenuID
-          config.MenuID = param.MenuID
-          config.parentId = param.ParentID
-          config.MenuName = param.MenuName
-          config.MenuNo = param.MenuNo
-          config.easyCode = ''
-          config.components = MenuUtils.resetConfig(config.components)
-          config.enabled = false
-
-          param.LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(config)))
-        }
-
-        Api.getSystemConfig(param).then(response => {
-          if (response.status) {
-            this.setState({
-              handleMVisible: false,
-              sysMenu: null
-            })
-  
-            MKEmitter.emit('mkUpdateMenuList')
-          } else {
-            notification.warning({
-              top: 92,
-              message: response.message,
-              duration: 5
-            })
-          }
-        })
       } else {
-        notification.warning({
-          top: 92,
-          message: result.message,
-          duration: 5
-        })
+        window.close()
       }
     })
   }
 
   render () {
-    const { loading } = this.state
+    const { loading, editMenu, subConfig, btnTab } = this.state
 
     return (
       <div className="mk-base-design-wrap">
         <Header/>
-        {this.state.tabview === 'TreePage' ?
-          <TreePageConfig
-            menu={this.state.editMenu}
-            reloadmenu={() => {localStorage.setItem('menuUpdate', new Date().getTime())}}
-            handleView={this.handleView}
-          /> : null
-        }
-        {this.state.tabview === 'CalendarPage' ?
-          <CalendarPageConfig
-            menu={this.state.editMenu}
-            reloadmenu={() => {localStorage.setItem('menuUpdate', new Date().getTime())}}
-            handleView={this.handleView}
-          /> : null
-        }
         {this.state.tabview === 'CommonTable' ?
           <ComTableConfig
-            menu={this.state.editMenu}
+            menu={editMenu}
             reloadmenu={() => {localStorage.setItem('menuUpdate', new Date().getTime())}}
-            handleView={this.handleView}
-          /> : null
-        }
-        {this.state.tabview === 'Modal' ?
-          <ModalConfig
-            menu={this.state.editMenu}
-            editTab={this.state.editTab}
-            tabConfig={this.state.tabConfig}
-            editSubTab={this.state.editSubTab}
-            subTabConfig={this.state.subTabConfig}
-            btnTab={this.state.btnTab}
-            btnTabConfig={this.state.btnTabConfig}
-            editAction={this.state.editAction}
-            subConfig={this.state.subConfig}
             handleView={this.handleView}
           /> : null
         }
         {this.state.tabview === 'SubTable' ?
           <SubTable
-            menu={this.state.editMenu}
+            menu={editMenu}
             editTab={this.state.editTab}
             editSubTab={this.state.editSubTab}
             tabConfig={this.state.tabConfig}
-            btnTab={this.state.btnTab}
+            btnTab={btnTab}
             btnTabConfig={this.state.btnTabConfig}
-            config={this.state.subConfig}
+            config={subConfig}
+            handleView={this.handleView}
+          /> : null
+        }
+        {this.state.tabview === 'Modal' ?
+          <ModalConfig
+            menu={editMenu}
+            editTab={this.state.editTab}
+            tabConfig={this.state.tabConfig}
+            editSubTab={this.state.editSubTab}
+            subTabConfig={this.state.subTabConfig}
+            btnTab={btnTab}
+            btnTabConfig={this.state.btnTabConfig}
+            editAction={this.state.editAction}
+            subConfig={subConfig}
+            handleView={this.handleView}
+          /> : null
+        }
+        {this.state.tabview === 'TreePage' ?
+          <TreePageConfig
+            menu={editMenu}
+            reloadmenu={() => {localStorage.setItem('menuUpdate', new Date().getTime())}}
             handleView={this.handleView}
           /> : null
         }
         {this.state.tabview === 'FormTab' ?
-          <FormTabConfig
-            menu={this.state.editMenu}
-            btnTab={this.state.btnTab}
-            config={this.state.subConfig}
+          <UpdateFormTab
+            menu={editMenu}
+            btnTab={btnTab}
+            config={subConfig}
             handleView={this.handleView}
           /> : null
         }
-        {loading ? <Spin className="loading-view" /> : null}
+        {loading ? <Spin className="loading-view" size="large"/> : null}
       </div>
     )
   }
 }
 
-const mapStateToProps = (state) => {
-  return {
-    mainMenu: state.mainMenu,
-    menuTree: state.menuTree
-  }
-}
-
-const mapDispatchToProps = () => {
-  return {}
-}
-
-export default withRouter(connect(mapStateToProps, mapDispatchToProps)(BaseDesign))
\ No newline at end of file
+export default BaseDesign
\ No newline at end of file

--
Gitblit v1.8.0