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

---
 src/menu/components/form/formaction/index.jsx |   60 +++++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 43 insertions(+), 17 deletions(-)

diff --git a/src/menu/components/form/formaction/index.jsx b/src/menu/components/form/formaction/index.jsx
index fcbdb30..12cc00f 100644
--- a/src/menu/components/form/formaction/index.jsx
+++ b/src/menu/components/form/formaction/index.jsx
@@ -1,12 +1,14 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Modal, Button, Popover, Icon } from 'antd'
+import { Modal, Button, Popover } from 'antd'
+import { FontColorsOutlined, EditOutlined, ProfileOutlined } from '@ant-design/icons'
 
 import zhCN from '@/locales/zh-CN/model.js'
 import enUS from '@/locales/en-US/model.js'
 import asyncComponent from '@/utils/asyncComponent'
 import { getActionForm } from './formconfig'
+import { resetStyle } from '@/utils/utils-custom.js'
 
 import MKEmitter from '@/utils/events.js'
 import MenuUtils from '@/utils/utils-custom.js'
@@ -23,6 +25,7 @@
 
   state = {
     dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
+    appType: sessionStorage.getItem('appType'),
     card: null,          // 缂栬緫涓厓绱�
     formlist: null,      // 琛ㄥ崟淇℃伅
     visible: false,      // 妯℃�佹鎺у埗
@@ -51,7 +54,7 @@
     const { group } = this.props
 
     let _style = element.style ? fromJS(element.style).toJS() : {}
-    let options = ['font', 'border', 'padding', 'margin', 'backgroundColor']
+    let options = ['font', 'border', 'padding', 'margin', 'backgroundColor', 'width']
 
     this.setState({
       card: element
@@ -86,7 +89,7 @@
     if (usefulFields) {
       try {
         usefulFields = JSON.parse(usefulFields)
-      } catch {
+      } catch (e) {
         usefulFields = []
       }
     } else {
@@ -98,7 +101,7 @@
       <p style={{marginBottom: '5px'}}>{this.state.dict['model.tooltip.func.innerface'].replace('@ableField', ableField)}</p>
     </div>
 
-    let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, config.uuid)
+    let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, config.uuid) || []
 
     this.setState({
       visible: true,
@@ -172,36 +175,51 @@
     })
   }
 
+  changeMenu = () => {
+    const { appType } = this.state
+    const { group } = this.props
+
+    if (appType !== 'pc' && appType !== 'mob') return
+    if (!group.subButton.linkmenu) return
+
+    MKEmitter.emit('changeEditMenu', {
+      MenuID: group.subButton.linkmenu,
+      copyMenuId: '',
+      MenuNo: '',
+      MenuName: '',
+    })
+  }
+
   render() {
     const { group, config } = this.props
     const { visible, profVisible, card, dict } = this.state
 
     return (
       <div className="mk-form-action">
-        {group.sort !== 1 ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
+        {group.prevButton && group.prevButton.enable !== 'false' && group.sort !== 1 ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
           <div className="mk-popover-control">
-            <Icon className="edit" title="缂栬緫" type="edit" onClick={() => this.handleAction(group.prevButton)} />
-            <Icon className="style" title="璋冩暣鏍峰紡" onClick={() => this.handleStyle(group.prevButton)} type="font-colors" />
+            <EditOutlined className="edit" title="缂栬緫" onClick={() => this.handleAction(group.prevButton)} />
+            <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.handleStyle(group.prevButton)}/>
           </div>
         } trigger="hover">
-          <Button type="link" className="prev" style={group.prevButton.style}>{group.prevButton.label}</Button>
+          <Button type="link" className="prev" style={resetStyle(group.prevButton.style)}>{group.prevButton.label}</Button>
         </Popover> : null}
         <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
           <div className="mk-popover-control">
-            <Icon className="edit" title="缂栬緫" type="edit" onClick={() => this.handleAction(group.subButton)} />
-            <Icon className="style" title="璋冩暣鏍峰紡" onClick={() => this.handleStyle(group.subButton)} type="font-colors" />
-            <Icon className="profile" title="setting" type="profile" onClick={() => this.profileAction()} />
+            <EditOutlined className="edit" title="缂栬緫" onClick={() => this.handleAction(group.subButton)} />
+            <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.handleStyle(group.subButton)}/>
+            <ProfileOutlined className="profile" title="setting" onClick={() => this.profileAction()} />
           </div>
         } trigger="hover">
-          <Button type="link" className="submit mk-primary" style={group.subButton.style}>{group.subButton.label}</Button>
+          <Button type="link" className="submit mk-primary" onDoubleClick={this.changeMenu} style={resetStyle(group.subButton.style)}>{group.subButton.label}</Button>
         </Popover>
-        {group.sort !== config.subcards.length ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
+        {group.nextButton && group.nextButton.enable !== 'false' && group.sort !== config.subcards.length ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
           <div className="mk-popover-control">
-            <Icon className="edit" title="缂栬緫" type="edit" onClick={() => this.handleAction(group.nextButton)} />
-            <Icon className="style" title="璋冩暣鏍峰紡" onClick={() => this.handleStyle(group.nextButton)} type="font-colors" />
+            <EditOutlined className="edit" title="缂栬緫" onClick={() => this.handleAction(group.nextButton)} />
+            <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.handleStyle(group.nextButton)}/>
           </div>
         } trigger="hover">
-          <Button type="link" className={'skip ' + group.nextButton.enable} style={group.nextButton.style}>{group.nextButton.label}</Button>
+          <Button type="link" className="skip" style={resetStyle(group.nextButton.style)}>{group.nextButton.label}</Button>
         </Popover> : null}
         {/* 缂栬緫鎸夐挳锛氬鍒躲�佺紪杈� */}
         <Modal
@@ -234,7 +252,15 @@
           maskClosable={false}
           okText={dict['model.submit']}
           onOk={this.verifySubmit}
-          onCancel={() => { this.setState({ profVisible: false }) }}
+          onCancel={() => {
+            if (this.verifyRef.handleCancel) {
+              this.verifyRef.handleCancel().then(() => {
+                this.setState({ profVisible: false })
+              })
+            } else {
+              this.setState({ profVisible: false })
+            }
+          }}
           destroyOnClose
         >
           <VerifyCard

--
Gitblit v1.8.0