From c39fc1db18c6d754312ccbc187f11076c203392b Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 22 十二月 2023 17:59:47 +0800
Subject: [PATCH] 2023-12-22

---
 src/pc/components/navbar/normal-navbar/menusetting/menuform/index.jsx |  147 ++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 120 insertions(+), 27 deletions(-)

diff --git a/src/pc/components/navbar/normal-navbar/menusetting/menuform/index.jsx b/src/pc/components/navbar/normal-navbar/menusetting/menuform/index.jsx
index bd7216a..f8ea138 100644
--- a/src/pc/components/navbar/normal-navbar/menusetting/menuform/index.jsx
+++ b/src/pc/components/navbar/normal-navbar/menusetting/menuform/index.jsx
@@ -1,6 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Input, Radio, Tooltip, Icon } from 'antd'
+import { Form, Row, Col, Input, Radio, Tooltip, Select } from 'antd'
+import { QuestionCircleOutlined } from '@ant-design/icons'
 
 import './index.scss'
 
@@ -13,11 +14,33 @@
   }
 
   state = {
-    property: this.props.menu.property || 'menu'
+    property: this.props.menu.property || 'menu',
+    copyMenu: this.props.menu.copyMenuId || '',
+    appMenus: [],
   }
 
   UNSAFE_componentWillMount () {
-    
+    let appMenus = sessionStorage.getItem('appMenus')
+    if (appMenus) {
+      try {
+        appMenus = JSON.parse(appMenus)
+      } catch (e) {
+        appMenus = []
+      }
+    } else {
+      appMenus = []
+    }
+
+    this.setState({appMenus})
+  }
+
+  componentDidMount() {
+    const { menu } = this.props
+
+    if (!menu.MenuID) {
+      let _form = document.getElementById('name')
+      _form && _form.select()
+    }
   }
 
   handleConfirm = () => {
@@ -50,7 +73,7 @@
   render() {
     const { menu } = this.props
     const { getFieldDecorator } = this.props.form
-    const { property } = this.state
+    const { property, appMenus, copyMenu } = this.state
 
     const formItemLayout = {
       labelCol: {
@@ -66,7 +89,7 @@
     return (
       <Form {...formItemLayout}>
         <Row gutter={24}>
-          <Col span={24}>
+          <Col span={22}>
             <Form.Item label="鑿滃崟鍚嶇О">
               {getFieldDecorator('name', {
                 initialValue: menu.name,
@@ -79,51 +102,121 @@
               })(<Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit} />)}
             </Form.Item>
           </Col>
-          <Col span={24}>
-            <Form.Item label="灞炴��">
+          {/* <Col span={22}>
+            <Form.Item label="鑿滃崟鍙傛暟">
+              {getFieldDecorator('MenuNo', {
+                initialValue: menu.MenuNo || '',
+                rules: [
+                  {
+                    required: true,
+                    message: '璇疯緭鍏ヨ彍鍗曞弬鏁�!'
+                  }
+                ]
+              })(<Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit} />)}
+            </Form.Item>
+          </Col> */}
+          <Col span={22}>
+            <Form.Item label="鑿滃崟灞炴��">
               {getFieldDecorator('property', {
                 initialValue: menu.property || 'menu'
               })(
                 <Radio.Group onChange={this.changeProperty}>
                   <Radio value="menu">鑿滃崟</Radio>
+                  <Radio value="linkmenu">鍏宠仈鑿滃崟</Radio>
                   <Radio value="link">閾炬帴</Radio>
-                  <Radio value="classify">鍒嗙被</Radio>
+                  {menu.level === 1 || menu.level === 2 ? <Radio value="classify">鍒嗙被</Radio> : null}
                 </Radio.Group>
               )}
             </Form.Item>
           </Col>
-          {property === 'link' ? <Col span={24}>
+          {property === 'linkmenu' ? <Col span={22}>
             <Form.Item label={
-              <Tooltip placement="topLeft" title="閾炬帴鑷冲綋鍓嶇郴缁熺殑鑿滃崟鏃讹紝鍙互浣跨敤 $ + 鑿滃崟ID锛屼緥濡傦細$dsdffowejdsfi銆�">
-                <Icon type="question-circle" style={{color: '#c49f47', marginRight: '3px'}}/>
-                閾炬帴鍦板潃
+              <Tooltip placement="topLeft" title="鍏宠仈褰撳墠app涓凡鏈夌殑鑿滃崟銆�">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                鍏宠仈鑿滃崟
               </Tooltip>
             }>
-              {getFieldDecorator('link', {
-                initialValue: menu.link || '',
-                rules: [
-                  {
-                    required: true,
-                    message: '璇疯緭鍏ラ摼鎺ュ湴鍧�!'
-                  }
-                ]
-              })(<TextArea rows={2} />)}
+              {getFieldDecorator('linkMenuId', {
+                initialValue: menu.linkMenuId || '',
+                rules: [{
+                  required: true,
+                  message: '璇烽�夋嫨鍏宠仈鑿滃崟!'
+                }]
+              })(
+                <Select>
+                  {appMenus.map(item => (<Select.Option key={item.MenuID} value={item.MenuID}>{item.MenuName}</Select.Option>))}
+                </Select>
+              )}
             </Form.Item>
           </Col> : null}
-          {property === 'menu' ? <Col span={24}>
+          {property === 'menu' ? <Col span={22}>
             <Form.Item label={
-              <Tooltip placement="topLeft" title="澶嶅埗鍏朵粬鑿滃崟鏃讹紝璇峰~鍐欏搴旂殑鑿滃崟ID銆�">
-                <Icon type="question-circle" style={{color: '#c49f47', marginRight: '3px'}}/>
+              <Tooltip placement="topLeft" title="澶嶅埗鑿滃崟浠呭湪褰撳墠鑿滃崟涓嶅瓨鍦ㄦ椂鏈夋晥銆�">
+                <QuestionCircleOutlined className="mk-form-tip" />
                 澶嶅埗鑿滃崟
               </Tooltip>
             }>
-              {getFieldDecorator('copyMenu', {
-                initialValue: menu.copyMenu || ''
+              {getFieldDecorator('copyMenuId', {
+                initialValue: menu.copyMenuId || ''
               })(
-                <Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit} />
+                <Select allowClear onChange={(val) => this.setState({copyMenu: val})}>
+                  {appMenus.map(item => (<Select.Option key={item.MenuID} value={item.MenuID}>{item.MenuName}</Select.Option>))}
+                </Select>
               )}
             </Form.Item>
           </Col> : null}
+          {property === 'menu' && copyMenu ? <Col span={12}>
+            <Form.Item label={
+              <Tooltip placement="topLeft" title="澶嶅埗鑿滃崟鏃讹紝鏄惁娓呯┖鍘熼〉闈腑鐨勫叧鑱旇彍鍗曘��">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                娓呯┖鍏宠仈鑿滃崟
+              </Tooltip>
+            }>
+              {getFieldDecorator('clearMenu', {
+                initialValue: menu.clearMenu || 'true'
+              })(
+                <Radio.Group>
+                  <Radio value="true">鏄�</Radio>
+                  <Radio value="false">鍚�</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col> : null}
+          <Col span={22}>
+            <Form.Item label="闅愯棌">
+              {getFieldDecorator('hidden', {
+                initialValue: menu.hidden || 'false'
+              })(
+                <Radio.Group>
+                  <Radio value="false">鍚�</Radio>
+                  <Radio value="true">鏄�</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col>
+          {property !== 'classify' ? <Col span={22}>
+            <Form.Item label="鎵撳紑鏂瑰紡">
+              {getFieldDecorator('open', {
+                initialValue: menu.open || 'blank'
+              })(
+                <Radio.Group>
+                  <Radio value="blank">鏂扮獥鍙�</Radio>
+                  <Radio value="self">褰撳墠绐楀彛</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col> : null}
+          {property === 'link' ? <Col span={22}>
+            <Form.Item label="閾炬帴鍦板潃">
+              {getFieldDecorator('link', {
+                initialValue: menu.link || '',
+                rules: [{
+                  required: true,
+                  message: '璇疯緭鍏ラ摼鎺ュ湴鍧�!'
+                }]
+              })(<TextArea rows={2} />)}
+            </Form.Item>
+          </Col> : null}
         </Row>
       </Form>
     )

--
Gitblit v1.8.0