From 24bfb39e86c7a265803486bc4b546ea2bfaef4a5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 02 四月 2023 23:40:30 +0800
Subject: [PATCH] 2023-04-02

---
 src/views/menudesign/menuform/index.jsx |   94 +++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 82 insertions(+), 12 deletions(-)

diff --git a/src/views/menudesign/menuform/index.jsx b/src/views/menudesign/menuform/index.jsx
index 5f217c5..7c8be79 100644
--- a/src/views/menudesign/menuform/index.jsx
+++ b/src/views/menudesign/menuform/index.jsx
@@ -26,7 +26,57 @@
   }
 
   UNSAFE_componentWillMount () {
+    if (sessionStorage.getItem('thdMenuList') && sessionStorage.getItem('fstMenuList')) {
+      this.setMenus()
+    } else {
+      this.getMenus()
+    }
+  }
+
+  setMenus = () => {
     const { MenuId, config } = this.props
+
+    let menulist = sessionStorage.getItem('fstMenuList')
+    let thdMenuList = sessionStorage.getItem('thdMenuList')
+
+    menulist = JSON.parse(menulist)
+    thdMenuList = JSON.parse(thdMenuList)
+
+    let thdMenu = null
+
+    thdMenuList.forEach(trd => {
+      if (MenuId === trd.MenuID) {
+        thdMenu = trd
+      }
+    })
+
+    let smenulist = []
+
+    if (thdMenu) {
+      menulist.forEach(item => {
+        if (item.MenuID === thdMenu.FstId) {
+          smenulist = item.children
+        }
+      })
+    }
+
+    this.props.updateConfig({...config, fstMenuId: thdMenu ? thdMenu.FstId : ''})
+
+    this.setState({
+      fstMenuId: thdMenu ? thdMenu.FstId : '',
+      menulist,
+      smenulist
+    }, () => {
+      this.props.form.setFieldsValue({
+        fstMenuId: thdMenu ? thdMenu.FstId : '',
+        parentId: thdMenu ? thdMenu.ParentId : ''
+      })
+    })
+  }
+
+  getMenus = () => {
+    const { MenuId, config } = this.props
+
     Api.getSystemConfig({func: 's_get_pc_menus', systemType: options.sysType, debug: 'Y'}).then(result => {
       if (result.status) {
         let thdMenu = null
@@ -64,12 +114,7 @@
                     value: trd.MenuID,
                     label: trd.MenuName,
                     type: 'CommonTable',
-                    // disabled: trd.MenuID === MenuId
                     disabled: false
-                  }
-
-                  if (MenuId === trd.MenuID) {
-                    thdMenu = trdItem
                   }
 
                   if (trd.PageParam) {
@@ -79,6 +124,10 @@
                     } catch (e) {
 
                     }
+                  }
+
+                  if (MenuId === trd.MenuID) {
+                    thdMenu = trdItem
                   }
 
                   thdMenuList.push(trdItem)
@@ -93,11 +142,13 @@
         })
 
         let smenulist = []
-        menulist.forEach(item => {
-          if (thdMenu && (item.MenuID === thdMenu.FstId)) {
-            smenulist = item.children
-          }
-        })
+        if (thdMenu) {
+          menulist.forEach(item => {
+            if (item.MenuID === thdMenu.FstId) {
+              smenulist = item.children
+            }
+          })
+        }
         sessionStorage.setItem('fstMenuList', JSON.stringify(menulist))
         sessionStorage.setItem('thdMenuList', JSON.stringify(thdMenuList))
         this.props.updateConfig({...config, fstMenuId: thdMenu ? thdMenu.FstId : ''})
@@ -154,6 +205,8 @@
       this.props.updateConfig({...config, hidden: value})
     } else if (key === 'permission') {
       this.props.updateConfig({...config, permission: value})
+    } else if (key === 'cacheLocal') {
+      this.props.updateConfig({...config, cacheLocal: value})
     }
   }
 
@@ -289,9 +342,26 @@
           </Col>
           <Col span={24}>
             <Form.Item label={
+              <Tooltip placement="topLeft" title="鏁版嵁浼氱紦瀛樺埌鐢ㄦ埛鏈湴锛屾柟渚块〉闈㈠揩閫熷憟鐜般��">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                鏈湴缂撳瓨
+              </Tooltip>
+            }>
+              {getFieldDecorator('cacheLocal', {
+                initialValue: config.cacheLocal || 'false'
+              })(
+                <Radio.Group onChange={(e) => {this.selectChange('cacheLocal', e.target.value)}}>
+                  <Radio value="true">浣跨敤</Radio>
+                  <Radio value="false">涓嶄娇鐢�</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col>
+          <Col span={24}>
+            <Form.Item label={
               <Tooltip placement="topLeft" title="瀵逛簬涓嶇粡甯告�у彉鍔ㄧ殑淇℃伅锛岀紦瀛樻暟鎹湁鍔╀簬鎻愰珮鏌ヨ鏁堢巼銆�">
                 <QuestionCircleOutlined className="mk-form-tip" />
-                缂撳瓨鏁版嵁
+                鍚庣缂撳瓨
               </Tooltip>
             }>
               {getFieldDecorator('cacheUseful', {
@@ -362,7 +432,7 @@
               }} />
             </Form.Item>
           </Col>
-          <Col span={24}>
+          <Col span={24} className="red-font">
             <Form.Item label="澶囨敞">
               {getFieldDecorator('Remark', {
                 initialValue: config.Remark || '',

--
Gitblit v1.8.0