From f6626b05f1275cc2f8ca77f773d4f6a6af1b0a89 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 21 十一月 2022 16:11:55 +0800
Subject: [PATCH] 2022-11-21

---
 src/views/tabledesign/menuform/index.jsx |   93 +++++++++++++++++++++++++++++++---------------
 1 files changed, 62 insertions(+), 31 deletions(-)

diff --git a/src/views/tabledesign/menuform/index.jsx b/src/views/tabledesign/menuform/index.jsx
index b779db1..5e16759 100644
--- a/src/views/tabledesign/menuform/index.jsx
+++ b/src/views/tabledesign/menuform/index.jsx
@@ -1,7 +1,6 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Input, Select, notification, Radio, Tooltip, Switch } from 'antd'
-import { QuestionCircleOutlined } from '@ant-design/icons'
+import { Form, Row, Col, Input, Select, notification, Radio, Switch } from 'antd'
 
 import Api from '@/api'
 import options from '@/store/options.js'
@@ -26,7 +25,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 +113,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 +123,10 @@
                     } catch (e) {
 
                     }
+                  }
+
+                  if (MenuId === trd.MenuID) {
+                    thdMenu = trdItem
                   }
 
                   thdMenuList.push(trdItem)
@@ -93,11 +141,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 : ''})
@@ -150,8 +200,6 @@
       this.props.updateConfig({...config, OpenType: value})
     } else if (key === 'hidden') {
       this.props.updateConfig({...config, hidden: value})
-    } else if (key === 'permission') {
-      this.props.updateConfig({...config, permission: value})
     }
   }
 
@@ -281,23 +329,6 @@
                 <Radio.Group onChange={(e) => {this.selectChange('OpenType', e.target.value)}}>
                   <Radio value="newtab">鏍囩椤�</Radio>
                   <Radio value="newpage">鏂伴〉闈�</Radio>
-                </Radio.Group>
-              )}
-            </Form.Item>
-          </Col>
-          <Col span={24}>
-            <Form.Item label={
-              <Tooltip placement="topLeft" title="璺宠繃鏉冮檺楠岃瘉鏃讹紝椤甸潰涓粍浠跺強鎸夐挳涓嶅湪杩涜鏉冮檺鎺у埗銆�">
-                <QuestionCircleOutlined className="mk-form-tip" />
-                鏉冮檺楠岃瘉
-              </Tooltip>
-            }>
-              {getFieldDecorator('permission', {
-                initialValue: config.permission || 'true'
-              })(
-                <Radio.Group onChange={(e) => {this.selectChange('permission', e.target.value)}}>
-                  <Radio value="true">浣跨敤</Radio>
-                  <Radio value="false">涓嶄娇鐢�</Radio>
                 </Radio.Group>
               )}
             </Form.Item>

--
Gitblit v1.8.0