From f8c3c53f9e29541f8c0e3fcbf682c301fd17e06a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 23 十一月 2020 17:49:23 +0800
Subject: [PATCH] 2020-11-23

---
 src/views/menudesign/menuform/index.jsx |  104 +++++++++++++++++++++++++++------------------------
 1 files changed, 55 insertions(+), 49 deletions(-)

diff --git a/src/views/menudesign/menuform/index.jsx b/src/views/menudesign/menuform/index.jsx
index a52cd68..8944632 100644
--- a/src/views/menudesign/menuform/index.jsx
+++ b/src/views/menudesign/menuform/index.jsx
@@ -4,6 +4,7 @@
 import { Form, Row, Col, Input, Select, notification, Radio, Icon, Tooltip, InputNumber } from 'antd'
 
 import Api from '@/api'
+import options from '@/store/options.js'
 import './index.scss'
 
 class CustomMenuForm extends Component {
@@ -25,48 +26,72 @@
   }
 
   UNSAFE_componentWillMount () {
-    const { parentId } = this.props
-    let param = {
-      func: 's_Get_FSMenusForOpen',
-      SndMenuID: parentId,
-      TYPE: 20,
-      TypeCharOne: 'PC'
+    const { MenuId } = this.props
+    let _param = {func: 's_get_pc_menus', systemType: options.sysType, debug: 'Y'}
+    if (options.sysType !== 'cloud' && window.GLOB.systemType !== 'production') {
+      _param.linkurl = window.GLOB.linkurl
     }
+    _param.pro_sys = window.GLOB.systemType === 'production' ? 'Y' : ''
 
-    Api.getSystemConfig(param).then(result => {
+    Api.getSystemConfig(_param).then(result => {
       if (result.status) {
-        let menulist = result.data.map(smenu => {
-          let _smenu = {
-            value: smenu.FstID,
-            text: smenu.FstName,
-            options: smenu.SndData.map(menu => {
-              return {
-                value: menu.SndID,
-                text: menu.SndName,
+        let thdMenu = null
+        let menulist = result.fst_menu.map(fst => {
+          let fstItem = {
+            MenuID: fst.MenuID,
+            MenuName: fst.MenuName,
+            children: []
+          }
+    
+          if (fst.snd_menu) {
+            fstItem.children = fst.snd_menu.map(snd => {
+              let sndItem = {
+                ParentId: fst.MenuID,
+                MenuID: snd.MenuID,
+                MenuName: snd.MenuName,
+                children: []
               }
+    
+              if (snd.trd_menu) {
+                sndItem.children = snd.trd_menu.map(trd => {
+                  let trdItem = {
+                    FstId: fst.MenuID,
+                    ParentId: snd.MenuID,
+                    MenuID: trd.MenuID,
+                    MenuName: trd.MenuName,
+                    MenuNo: trd.MenuNo,
+                    EasyCode: trd.EasyCode
+                  }
+
+                  if (MenuId === trd.MenuID) {
+                    thdMenu = trdItem
+                  }
+                  return trdItem
+                })
+              }
+              return sndItem
             })
           }
-
-          return _smenu
+          return fstItem
         })
 
         let smenulist = []
         menulist.forEach(item => {
-          if (item.value === result.FstIDSeleted) {
-            smenulist = item.options
+          if (thdMenu && (item.MenuID === thdMenu.FstId)) {
+            smenulist = item.children
           }
         })
 
-        this.props.initMenuList({fstMenuList: fromJS(menulist).toJS(), fstMenuId: result.FstIDSeleted})
+        this.props.initMenuList({fstMenuList: fromJS(menulist).toJS(), fstMenuId: thdMenu ? thdMenu.FstId : ''})
 
         this.setState({
-          fstMenuId: result.FstIDSeleted,
+          fstMenuId: thdMenu ? thdMenu.FstId : '',
           menulist,
           smenulist
         }, () => {
           this.props.form.setFieldsValue({
-            fstMenuId: result.FstIDSeleted,
-            parentId: parentId
+            fstMenuId: thdMenu ? thdMenu.FstId : '',
+            parentId: thdMenu ? thdMenu.ParentId : ''
           })
         })
       } else {
@@ -94,15 +119,15 @@
     if (key === 'fstMenuId') {
       let smenulist = []
       menulist.forEach(item => {
-        if (item.value === value) {
-          smenulist = item.options
+        if (item.MenuID === value) {
+          smenulist = item.children
         }
       })
 
       this.setState({
         smenulist
       }, () => {
-        let _id = smenulist[0] ? smenulist[0].value : ''
+        let _id = smenulist[0] ? smenulist[0].MenuID : ''
         this.props.form.setFieldsValue({parentId: _id})
         this.props.updateConfig({...config, fstMenuId: value, parentId: _id})
       })
@@ -110,8 +135,6 @@
       this.props.updateConfig({...config, parentId: value})
     } else if (key === 'cacheUseful') {
       this.props.updateConfig({...config, cacheUseful: value})
-    } else if (key === 'diffUser') {
-      this.props.updateConfig({...config, diffUser: value})
     } else if (key === 'timeUnit') {
       this.props.updateConfig({...config, timeUnit: value})
     }
@@ -170,8 +193,8 @@
               })(
                 <Select onChange={(value) => {this.selectChange('fstMenuId', value)}}>
                   {menulist.map(option =>
-                    <Select.Option key={option.value} value={option.value}>
-                      {option.text}
+                    <Select.Option key={option.MenuID} value={option.MenuID}>
+                      {option.MenuName}
                     </Select.Option>
                   )}
                 </Select>
@@ -191,8 +214,8 @@
               })(
                 <Select onChange={(value) => {this.selectChange('parentId', value)}}>
                   {smenulist.map(option =>
-                    <Select.Option key={option.value} value={option.value}>
-                      {option.text}
+                    <Select.Option key={option.MenuID} value={option.MenuID}>
+                      {option.MenuName}
                     </Select.Option>
                   )}
                 </Select>
@@ -242,23 +265,6 @@
               )}
             </Form.Item>
           </Col>
-          {config.cacheUseful === 'true' ? <Col span={24}>
-            <Form.Item label={
-              <Tooltip placement="topLeft" title="瀵逛簬涓嶅悓鐢ㄦ埛锛屾煡璇俊鎭槸鍚﹀瓨鍦ㄥ樊寮傘��">
-                <Icon type="question-circle" />
-                鍖哄垎鐢ㄦ埛
-              </Tooltip>
-            }>
-              {getFieldDecorator('diffUser', {
-                initialValue: config.diffUser || 'true'
-              })(
-                <Radio.Group onChange={(e) => {this.selectChange('diffUser', e.target.value)}}>
-                  <Radio value="true">鏄�</Radio>
-                  <Radio value="false">鍚�</Radio>
-                </Radio.Group>
-              )}
-            </Form.Item>
-          </Col> : null}
           {config.cacheUseful === 'true' ? <Col span={24}>
             <Form.Item label="鍗曚綅">
               {getFieldDecorator('timeUnit', {

--
Gitblit v1.8.0