From b5364600d98c8749caba625ec813d4fe670d0a19 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 16 十二月 2021 17:29:55 +0800
Subject: [PATCH] 2021-12-16

---
 src/menu/components/share/actioncomponent/actionform/index.jsx |  154 ++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 114 insertions(+), 40 deletions(-)

diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx
index 36f4db9..e703f77 100644
--- a/src/menu/components/share/actioncomponent/actionform/index.jsx
+++ b/src/menu/components/share/actioncomponent/actionform/index.jsx
@@ -1,7 +1,8 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { fromJS } from 'immutable'
-import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber, Cascader } from 'antd'
+import { Form, Row, Col, Input, Select, Radio, notification, Tooltip, InputNumber, Cascader } from 'antd'
+import { QuestionCircleOutlined } from '@ant-design/icons'
 import { btnCustomClasses, formRule } from '@/utils/option.js'
 
 import asyncComponent from '@/utils/asyncComponent'
@@ -10,12 +11,12 @@
 const { TextArea } = Input
 const MkIcon = asyncComponent(() => import('@/components/mkIcon'))
 const actionTypeOptions = {
-  pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'output', 'refreshTab'],
-  prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'output', 'refreshTab'],
-  exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'output', 'refreshTab'],
+  pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'output', 'refreshTab', 'reload'],
+  prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'output', 'refreshTab', 'reload'],
+  exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width', 'openmenu', 'open', 'output', 'refreshTab', 'reload'],
   excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'sheet', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'switchTab', 'width'],
   excelOut: ['label', 'OpenType', 'intertype', 'show', 'icon', 'class', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'resetPageIndex', 'pagination', 'search', 'width'],
-  popview: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'popClose', 'resetPageIndex', 'width', 'display', 'ratio', 'placement'],
+  popview: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'popClose', 'resetPageIndex', 'width', 'display', 'ratio', 'placement', 'syncComponent', 'clickouter'],
   tab: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'linkmenu', 'width'],
   innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'show', 'icon', 'class', 'width', 'open'],
   funcbutton: ['label', 'OpenType', 'funcType', 'show', 'icon', 'class', 'width']
@@ -37,6 +38,7 @@
     interType: null, // 鎺ュ彛绫诲瀷锛氬唴閮ㄣ�佸閮�
     funcType: null,  // 鍔熻兘绫诲瀷
     procMode: null,  // 鍙傛暟鏂瑰紡
+    control: '',
     pageTemplate: null,
     appType: sessionStorage.getItem('appType'),
     Ot: null,
@@ -65,10 +67,10 @@
     }],
     deleteOptions: [{
       value: 'LogicDelete',
-      text: this.props.dict['header.form.action.LogicDelete']
+      text: '閫昏緫鍒犻櫎'
     }, {
       value: 'delete',
-      text: this.props.dict['header.form.action.delete']
+      text: '鐗╃悊鍒犻櫎'
     }, {
       value: 'custom',
       text: this.props.dict['header.form.custom']
@@ -96,13 +98,15 @@
     let _intertype = card.intertype || 'system'  // 鎺ュ彛绫诲瀷
     let _funcType = card.funcType || ''          // 鍔熻兘鎸夐挳榛樿绫诲瀷
     let _procMode = card.procMode || 'system'
-    let _Ot = card.Ot || 'requiredSgl'
+    let _Ot = card.Ot
     let _pageTemplate = card.pageTemplate || ''
+    let control = card.control || ''
 
-    let _options = this.getOptions(_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot)
+    let _options = this.getOptions(_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot, control)
 
     this.setState({
       Ot: _Ot,
+      control: control,
       openType: _opentype,
       interType: _intertype,
       procMode: _procMode,
@@ -113,18 +117,26 @@
           item.options = btnCustomClasses
         } else if (item.key === 'innerFunc' && _procMode === 'inner') {
           item.required = true
+        } else if (item.key === 'linkmenu') {
+          if (_opentype === 'funcbutton' && _funcType === 'scan') {
+            item.required = false
+            item.tooltip = '浣跨敤鎵爜鐧诲綍鍔熻兘鎴栬彍鍗曡烦杞姛鑳芥椂锛岄渶閫夋嫨璺宠浆鐨勮彍鍗曘��'
+          } else {
+            item.tooltip = ''
+            item.required = true
+          }
         } else if (item.key === 'intertype') {
           let iscustom = ['pop', 'prompt', 'exec'].includes(_opentype)
           item.options = this.state.interTypeOptions.filter(op => (iscustom || op.value !== 'custom'))
         } else if (item.key === 'Ot') {
-          if (type === 'card') {
+          if (card.sqlType === 'insert') {
+            item.options = this.state.requireOptions.filter(op => ['notRequired'].includes(op.value))
+          } else if (type === 'card') {
             item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
           } else if (_pageTemplate === 'pay') { // 琛岀骇鎸夐挳銆佹敮浠樻寜閽紝鍙兘閫夊崟琛�
             item.options = this.state.requireOptions.filter(op => ['requiredSgl'].includes(op.value))
           } else if (['innerpage', 'tab', 'popview', 'excelIn'].includes(_opentype)) {
             item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
-          } else if (card.sqlType === 'insert') {
-            item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl', 'required'].includes(op.value))
           } else {
             item.options = this.state.requireOptions
           }
@@ -144,9 +156,9 @@
     })
   }
 
-  getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot) => {
+  getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot, _control) => {
     let _options = actionTypeOptions[_opentype] ? fromJS(actionTypeOptions[_opentype]).toJS() : [] // 閫夐」鍒楄〃
-    
+
     if (_opentype === 'innerpage') {         // 鏂伴〉闈紝鍙�夋ā鏉�(鑷畾涔夋椂锛屽彲濉叆澶栭儴閾炬帴)
       if (_pageTemplate === 'custom') {
         _options.push('url', 'joint')
@@ -169,7 +181,7 @@
       }
     } else if (_opentype === 'funcbutton') {
       if (_funcType === 'print') {
-        _options.push('execMode', 'intertype', 'Ot', 'execSuccess', 'execError', 'resetPageIndex', 'controlField', 'controlVal')
+        _options.push('execMode', 'intertype', 'Ot', 'execSuccess', 'execError', 'resetPageIndex')
         if (_intertype === 'outer') {
           _options.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc')
         } else if (_intertype === 'inner') {
@@ -179,6 +191,10 @@
         _options.push('execSuccess', 'execError')
       } else if (_funcType === 'closetab') {
         _options.push('refreshTab')
+      } else if (_funcType === 'scan') {
+        _options.push('linkmenu')
+      } else if (_funcType === 'goBack') {
+        _options.push('reload')
       }
     } else if (_opentype !== 'popview' && _opentype !== 'tab') {
       if (_intertype === 'custom') {
@@ -198,8 +214,11 @@
       }
     }
 
-    if (_Ot !== 'notRequired' && _opentype !== 'excelOut' && _opentype !== 'funcbutton') {
-      _options.push('controlField', 'controlVal')
+    if (_Ot !== 'notRequired' && _opentype !== 'excelOut') {
+      _options.push('control')
+      if (_control) {
+        _options.push('controlField', 'controlVal')
+      }
     }
     if (_Ot === 'requiredSgl' && ['pop', 'prompt', 'exec'].includes(_opentype)) {
       _options.push('swipe')
@@ -228,11 +247,11 @@
    * 3銆佸垏鎹㈡爣绛剧被鍨嬶紝閲嶇疆鍙�夋爣绛�
    */
   optionChange = (key, value) => {
-    const { card, type } = this.props
-    const { openType, procMode, Ot, pageTemplate } = this.state
+    const { type } = this.props
+    const { openType, procMode, Ot, pageTemplate, control } = this.state
 
     if (key === 'OpenType') {
-      let _options = this.getOptions(value, 'system', this.state.funcType, '', 'system', Ot)
+      let _options = this.getOptions(value, 'system', this.state.funcType, '', 'system', Ot, control)
 
       let _fieldval = {}
       let _formlist = this.state.formlist.map(item => {
@@ -241,12 +260,16 @@
         if (item.key === 'intertype') {
           let iscustom = ['pop', 'prompt', 'exec'].includes(value)
           item.options = this.state.interTypeOptions.filter(op => (iscustom || op.value !== 'custom'))
+        } else if (item.key === 'control') {
+          item.initVal = control
         }
 
         if (item.hidden) return item
 
         if (item.key === 'intertype') {
           _fieldval.intertype = 'system'
+        } else if (item.key === 'popClose' && value === 'popview') {
+          _fieldval.popClose = 'grid'
         } else if (item.key === 'Ot') {
           if (type === 'card') {
             item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
@@ -268,6 +291,14 @@
           _fieldval.sqlType = ''
         } else if (item.key === 'pageTemplate') {
           item.initVal = ''
+        } else if (item.key === 'linkmenu') {
+          if (value === 'funcbutton' && this.state.funcType === 'scan') {
+            item.required = false
+            item.tooltip = '浣跨敤鎵爜鐧诲綍鍔熻兘鎴栬彍鍗曡烦杞姛鑳芥椂锛岄渶閫夋嫨璺宠浆鐨勮彍鍗曘��'
+          } else {
+            item.tooltip = ''
+            item.required = true
+          }
         }
 
         return item
@@ -291,10 +322,17 @@
         this.props.form.setFieldsValue(_fieldval)
       })
     } else if (key === 'funcType') {
-      let _options = this.getOptions(openType, this.state.interType, value, pageTemplate, procMode, Ot)
+      let _options = this.getOptions(openType, this.state.interType, value, pageTemplate, procMode, Ot, control)
       let _fieldval = {}
 
+      if (value === 'print') {
+        _fieldval.label = '鎵撳嵃'
+      } else if (value === 'closetab') {
+        _fieldval.label = '鍏抽棴'
+      }
+
       this.setState({
+        funcType: value,
         formlist: this.state.formlist.map(item => {
           item.hidden = !_options.includes(item.key)
 
@@ -308,6 +346,14 @@
             } else {
               item.options = this.state.requireOptions
             }
+          } else if (item.key === 'linkmenu') {
+            if (value === 'scan') {
+              item.required = false
+              item.tooltip = '浣跨敤鎵爜鐧诲綍鍔熻兘鎴栬彍鍗曡烦杞姛鑳芥椂锛岄渶閫夋嫨璺宠浆鐨勮彍鍗曘��'
+            } else {
+              item.tooltip = ''
+              item.required = true
+            }
           }
 
           return item
@@ -319,12 +365,14 @@
       let _fieldval = {}
       this.setState({
         formlist: this.state.formlist.map(item => {
-          if (item.key === 'Ot' && type === 'card') {
-            item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
-          } else if (item.key === 'Ot' && value === 'insert') {
-            item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl', 'required'].includes(op.value))
-          } else if (item.key === 'Ot') {
-            item.options = this.state.requireOptions
+          if (item.key === 'Ot') {
+            if (value === 'insert') {
+              item.options = this.state.requireOptions.filter(op => ['notRequired'].includes(op.value))
+            } else if (type === 'card') {
+              item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
+            } else {
+              item.options = this.state.requireOptions
+            }
           }
           return item
         })
@@ -347,15 +395,11 @@
           _fieldval.Ot = 'requiredSgl'
         }
 
-        if (card.$type === 'tableButton') { // 琛ㄦ牸鎸夐挳
-          delete _fieldval.Ot
-        }
-
         this.props.form.setFieldsValue(_fieldval)
       })
     } else if (key === 'pageTemplate') {
       let _fieldval = {}
-      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, value, procMode, Ot)
+      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, value, procMode, Ot, control)
 
       this.setState({
         pageTemplate: value,
@@ -379,7 +423,7 @@
         this.props.form.setFieldsValue(_fieldval)
       })
     } else if (key === 'intertype') {
-      let _options = this.getOptions(openType, value, this.state.funcType, pageTemplate, procMode, Ot)
+      let _options = this.getOptions(openType, value, this.state.funcType, pageTemplate, procMode, Ot, control)
 
       this.setState({
         interType: value,
@@ -401,7 +445,7 @@
         })
       })
     } else if (key === 'procMode') {
-      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, value, Ot)
+      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, value, Ot, control)
 
       this.setState({
         procMode: value,
@@ -415,10 +459,20 @@
         })
       })
     } else if (key === 'Ot') {
-      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, procMode, value)
+      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, procMode, value, control)
 
       this.setState({
         Ot: value,
+        formlist: this.state.formlist.map(item => {
+          item.hidden = !_options.includes(item.key)
+          return item
+        })
+      })
+    } else if (key === 'control') {
+      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, procMode, Ot, value)
+
+      this.setState({
+        control: value,
         formlist: this.state.formlist.map(item => {
           item.hidden = !_options.includes(item.key)
           return item
@@ -489,7 +543,7 @@
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
               <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -519,7 +573,7 @@
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
               <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -540,7 +594,7 @@
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
               <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -575,7 +629,7 @@
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
               <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -622,7 +676,7 @@
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
               <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -723,6 +777,26 @@
               })
             }
           }
+
+          if (values.openmenu && Array.isArray(values.openmenu) && values.openmenu.length > 0) {
+            let list = null
+            try {
+              list = JSON.parse(sessionStorage.getItem('thdMenuList')) || []
+            } catch (e) {
+              list = []
+            }
+
+            let id = values.openmenu[values.openmenu.length - 1]
+
+            list.forEach(item => {
+              if (item.MenuID === id) {
+                values.MenuID = id
+                values.MenuName = item.MenuName
+                values.MenuNo = item.MenuNo
+                values.tabType = item.type
+              }
+            })
+          }
           
           resolve(values)
         } else {

--
Gitblit v1.8.0