From a02fc6a77fa1b35c6516b2d37108d80e260c6c85 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 07 十一月 2024 22:05:08 +0800
Subject: [PATCH] 2024-11-07

---
 src/views/menudesign/homeform/index.jsx |  201 ++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 161 insertions(+), 40 deletions(-)

diff --git a/src/views/menudesign/homeform/index.jsx b/src/views/menudesign/homeform/index.jsx
index d16f9b4..433e83a 100644
--- a/src/views/menudesign/homeform/index.jsx
+++ b/src/views/menudesign/homeform/index.jsx
@@ -1,38 +1,114 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Radio, Icon, Tooltip, InputNumber } from 'antd'
+import { Form, Row, Col, Radio, Tooltip, InputNumber, notification } from 'antd'
+import { QuestionCircleOutlined } from '@ant-design/icons'
 
-import './index.scss'
+import Api from '@/api'
+// import './index.scss'
 
 class CustomMenuForm extends Component {
   static propTpyes = {
-    dict: PropTypes.object, // 瀛楀吀椤�
     config: PropTypes.object,
     updateConfig: PropTypes.func
+  }
+
+  state = {}
+
+  UNSAFE_componentWillMount () {
+    if (sessionStorage.getItem('thdMenuList') && sessionStorage.getItem('fstMenuList')) {
+
+    } else {
+      this.getMenus()
+    }
+  }
+
+  getMenus = () => {
+    Api.getCloudConfig({func: 's_get_pc_menus', systemType: window.GLOB.sysType, debug: 'Y'}).then(result => {
+      if (result.status) {
+        let thdMenuList = []
+        let menulist = result.fst_menu.map(fst => {
+          let fstItem = {
+            MenuID: fst.MenuID,
+            MenuName: fst.MenuName,
+            value: fst.MenuID,
+            label: fst.MenuName,
+            isLeaf: false,
+            children: []
+          }
+    
+          if (fst.snd_menu) {
+            fstItem.children = fst.snd_menu.map(snd => {
+              let sndItem = {
+                ParentId: fst.MenuID,
+                MenuID: snd.MenuID,
+                MenuName: snd.MenuName,
+                value: snd.MenuID,
+                label: 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,
+                    value: trd.MenuID,
+                    label: trd.MenuName,
+                    type: 'CustomPage',
+                    disabled: false
+                  }
+
+                  if (trd.PageParam) {
+                    try {
+                      trd.PageParam = JSON.parse(trd.PageParam)
+                      trdItem.type = trd.PageParam.Template || 'CustomPage'
+                    } catch (e) {
+
+                    }
+                  }
+
+                  thdMenuList.push(trdItem)
+
+                  return trdItem
+                })
+              }
+              return sndItem
+            })
+          }
+          return fstItem
+        })
+
+        sessionStorage.setItem('fstMenuList', JSON.stringify(menulist))
+        sessionStorage.setItem('thdMenuList', JSON.stringify(thdMenuList))
+      } else {
+        notification.warning({
+          top: 92,
+          message: result.message,
+          duration: 5
+        })
+      }
+    })
   }
 
   // 涓�浜岀骇鑿滃崟鍒囨崲
   selectChange = (key, value) => {
     const { config } = this.props
 
-    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})
+    if (key === 'cacheTime' || key === 'localCacheTime') {
+      if (typeof(value) !== 'number') {
+        value = ''
+      }
     }
-  }
-
-  changeCacheDay = (val) => {
-    if (typeof(val) !== 'number') {
-      val = ''
-    }
-    this.props.updateConfig({...this.props.config, cacheTime: val})
+    
+    this.props.updateConfig({...config, [key]: value})
   }
 
   render() {
-    const { dict, config } = this.props
+    const { config } = this.props
     const { getFieldDecorator } = this.props.form
     const formItemLayout = {
       labelCol: {
@@ -46,13 +122,57 @@
     }
 
     return (
-      <Form {...formItemLayout} className="custom-menu-form">
+      <Form {...formItemLayout}>
         <Row>
           <Col span={24}>
             <Form.Item label={
+              <Tooltip placement="topLeft" title="棣栭〉涓嶈繘琛屾潈闄愭帶鍒躲��">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                鏉冮檺楠岃瘉
+              </Tooltip>
+            }>
+              <Radio.Group value={'false'} disabled={true}>
+                <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('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>
+          {config.cacheLocal === 'true' ? <Col span={24}>
+            <Form.Item label={
+              <Tooltip placement="topLeft" title="璁剧疆鏈湴缂撳瓨鏃堕暱鍚庯紝鍦ㄧ紦瀛樻湡闄愬唴涓嶅悜鍚庡彴璇锋眰鏁版嵁锛屾椂闀挎渶澶т负5澶╋紙鍗�7200鍒嗛挓锛夈�傛敞锛氭椂闀夸负绌烘椂缂撳瓨鏁版嵁鍙敤浜庨〉闈㈠揩閫熷憟鐜帮紝涓嶅奖鍝嶆帴鍙h姹傘��">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                鏃堕暱(鍒�)
+              </Tooltip>
+            }>
+              {getFieldDecorator('localCacheTime', {
+                initialValue: config.localCacheTime
+              })(
+                <InputNumber min={1} max={7200} precision={0} onChange={(val) => {this.selectChange('localCacheTime', val)}}/>
+              )}
+            </Form.Item>
+          </Col> : null}
+          <Col span={24}>
+            <Form.Item label={
               <Tooltip placement="topLeft" title="瀵逛簬涓嶇粡甯告�у彉鍔ㄧ殑淇℃伅锛岀紦瀛樻暟鎹湁鍔╀簬鎻愰珮鏌ヨ鏁堢巼銆�">
-                <Icon type="question-circle" />
-                缂撳瓨鏁版嵁
+                <QuestionCircleOutlined className="mk-form-tip" />
+                鍚庣缂撳瓨
               </Tooltip>
             }>
               {getFieldDecorator('cacheUseful', {
@@ -66,30 +186,14 @@
             </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', {
                 initialValue: config.timeUnit || 'day'
               })(
-                <Radio.Group onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}>
+                <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}>
                   <Radio value="day">澶�</Radio>
                   <Radio value="hour">灏忔椂</Radio>
+                  <Radio value="minute">鍒嗛挓</Radio>
                 </Radio.Group>
               )}
             </Form.Item>
@@ -101,14 +205,31 @@
                 rules: [
                   {
                     required: true,
-                    message: dict['mob.required.input'] + '鏃堕暱!'
+                    message: '璇疯緭鍏ユ椂闀�!'
                   }
                 ]
               })(
-                <InputNumber min={1} max={config.timeUnit !== 'hour' ? 7 : 23} precision={0} onChange={this.changeCacheDay}/>
+                <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={(val) => {this.selectChange('cacheTime', val)}}/>
               )}
             </Form.Item>
           </Col> : null}
+          <Col span={24}>
+            <Form.Item label={
+              <Tooltip placement="topLeft" title="鏁版嵁鍔犺浇鏃剁殑閬僵鏄惁鏄剧ず銆�">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                鍔犺浇閬僵
+              </Tooltip>
+            }>
+              {getFieldDecorator('mask', {
+                initialValue: config.mask || 'true'
+              })(
+                <Radio.Group onChange={(e) => {this.selectChange('mask', e.target.value)}}>
+                  <Radio value="true">鏄剧ず</Radio>
+                  <Radio value="false">闅愯棌</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col>
         </Row>
       </Form>
     )

--
Gitblit v1.8.0