From f3167f8371d19d0ea8fe7d0e7af5517ff0b08cd2 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 07 四月 2021 23:25:29 +0800
Subject: [PATCH] 2021-04-07

---
 src/menu/components/card/cardcellcomponent/index.jsx |   78 +++++++++++++++++++++------------------
 1 files changed, 42 insertions(+), 36 deletions(-)

diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx
index 24433e0..58deb61 100644
--- a/src/menu/components/card/cardcellcomponent/index.jsx
+++ b/src/menu/components/card/cardcellcomponent/index.jsx
@@ -1,7 +1,6 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import {connect} from 'react-redux'
 import { Modal, Button } from 'antd'
 
 import zhCN from '@/locales/zh-CN/model.js'
@@ -11,7 +10,7 @@
 import { getActionForm } from '@/menu/components/share/actioncomponent/formconfig'
 
 import MKEmitter from '@/utils/events.js'
-import MenuUtils from '@/menu/utils/menuUtils.js'
+import MenuUtils from '@/utils/utils-custom.js'
 import ElementForm from './elementform'
 import DragElement from './dragaction'
 import './index.scss'
@@ -19,7 +18,6 @@
 const { confirm } = Modal
 
 const ActionForm = asyncComponent(() => import('@/menu/components/share/actioncomponent/actionform'))
-const CreateFunc = asyncComponent(() => import('@/templates/zshare/createfunc'))
 const VerifyCard = asyncComponent(() => import('@/templates/zshare/verifycard'))
 const VerifyPrint = asyncComponent(() => import('@/templates/sharecomponent/actioncomponent/verifyprint'))
 const VerifyExcelIn = asyncComponent(() => import('@/templates/sharecomponent/actioncomponent/verifyexcelin'))
@@ -35,7 +33,7 @@
   }
 
   state = {
-    dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
+    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     card: null,          // 缂栬緫涓厓绱�
     formlist: null,      // 琛ㄥ崟淇℃伅
     elements: null,      // 鎸夐挳缁�
@@ -153,7 +151,7 @@
     const { cards, cardCell } = this.props
     const { card, elements } = this.state
 
-    if (comIds.length !== 3 || comIds[0] !== cards.uuid || comIds[1] !== cardCell.uuid) return
+    if (comIds.length !== 3 || comIds[0] !== cards.uuid || comIds[1] !== cardCell.uuid || !card) return
 
     let _card = this.resetCardStyle(card, style)
 
@@ -177,7 +175,7 @@
 
       let fontSize = 14
       let lineHeight = 1.5
-      let line = _card.height || 1
+      let line = _card.height || null
 
       if (_card.style.fontSize) {
         fontSize = parseInt(_card.style.fontSize)
@@ -186,7 +184,9 @@
         lineHeight = parseFloat(_card.style.lineHeight)
       }
 
-      _card.innerHeight = fontSize * lineHeight * line
+      if (line) {
+        _card.innerHeight = fontSize * lineHeight * line
+      }
     } else if (_card.eleType === 'barcode') {
       _card.style = style
 
@@ -276,7 +276,7 @@
    * @description 鎸夐挳缂栬緫锛岃幏鍙栨寜閽〃鍗曚俊鎭�
    */
   handleAction = (card) => {
-    const { menu, cards } = this.props
+    const { cards } = this.props
 
     let usefulFields = sessionStorage.getItem('permFuncField')
     if (usefulFields) {
@@ -305,7 +305,7 @@
       menulist = []
     }
 
-    let modules = MenuUtils.getSubModules(menu.components, cards.uuid)
+    let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, cards.uuid)
 
     this.setState({
       actvisible: true,
@@ -352,7 +352,7 @@
           } else if (res.eleType === 'text' || res.eleType === 'number') {
             let fontSize = 14
             let lineHeight = 1.5
-            let line = res.height || 1
+            let line = res.height || null
       
             if (res.style && res.style.fontSize) {
               fontSize = parseInt(res.style.fontSize)
@@ -360,7 +360,10 @@
             if (res.style && res.style.lineHeight) {
               lineHeight = parseFloat(res.style.lineHeight)
             }
-            res.innerHeight = fontSize * lineHeight * line
+
+            if (line) {
+              res.innerHeight = fontSize * lineHeight * line
+            }
 
             if (res.eleType === 'text' && res.link && !res.style.color) {
               res.style.color = '#2440B3'
@@ -499,21 +502,33 @@
     const { cards } = this.props
     let btn = fromJS(item).toJS()
 
-    if (btn.eleType !== 'button' || (sessionStorage.getItem('style-control') && sessionStorage.getItem('style-control') !== 'false')) return
+    if ((sessionStorage.getItem('style-control') && sessionStorage.getItem('style-control') !== 'false')) return
 
-    if (btn.OpenType === 'pop') {
-      if (!btn.modal) {
-        btn.modal = {
-          setting: { title: btn.label, width: 60, cols: '2', container: 'view', focus: '', finish: 'close', clickouter: 'unclose', display: 'modal' },
-          tables: [],
-          groups: [],
-          fields: []
+    if (btn.eleType === 'button') {
+      if (btn.OpenType === 'pop') {
+        if (!btn.modal) {
+          btn.modal = {
+            setting: { title: btn.label, width: 60, cols: '2', container: 'view', focus: '', finish: 'close', clickouter: 'unclose', display: 'modal' },
+            tables: [],
+            groups: [],
+            fields: []
+          }
         }
+  
+        MKEmitter.emit('changeModal', cards, btn)
+      } else if (btn.OpenType === 'popview') {
+        MKEmitter.emit('changePopview', cards, btn)
+      } else if (btn.OpenType === 'innerpage' && btn.pageTemplate === 'page') {
+        MKEmitter.emit('changeEditMenu', {MenuID: btn.uuid, copyMenuId: btn.copyMenuId})
+      } else if (btn.OpenType === 'innerpage' && btn.pageTemplate === 'linkpage') {
+        MKEmitter.emit('changeEditMenu', {MenuID: btn.linkmenu})
       }
-
-      MKEmitter.emit('changeModal', cards, btn)
-    } else if (btn.OpenType === 'popview') {
-      MKEmitter.emit('changePopview', cards, btn)
+    } else {
+      if (btn.link === 'page') {
+        MKEmitter.emit('changeEditMenu', {MenuID: btn.uuid, copyMenuId: btn.copyMenuId})
+      } else if (btn.link === 'linkpage') {
+        MKEmitter.emit('changeEditMenu', {MenuID: btn.linkmenu})
+      }
     }
   }
 
@@ -559,6 +574,9 @@
 
   dropButton = (id) => {
     const { cards } = this.props
+
+    if (!cards.action) return
+
     let index = cards.action.findIndex(item => item.uuid === id)
 
     if (index === -1) return
@@ -622,7 +640,6 @@
           maskClosable={false}
           onCancel={this.editModalCancel}
           footer={[
-            <CreateFunc key="create" dict={dict} ref="btnCreatFunc" trigger={this.creatFunc}/>,
             <Button key="cancel" onClick={this.editModalCancel}>{dict['model.cancel']}</Button>,
             <Button key="confirm" type="primary" onClick={this.handleActionSubmit}>{dict['model.confirm']}</Button>
           ]}
@@ -645,7 +662,6 @@
           visible={profVisible}
           width={'75vw'}
           maskClosable={false}
-          style={{minWidth: '900px', maxWidth: '1200px'}}
           okText={dict['model.submit']}
           onOk={this.verifySubmit}
           onCancel={() => { this.setState({ profVisible: false }) }}
@@ -690,14 +706,4 @@
   }
 }
 
-const mapStateToProps = (state) => {
-  return {
-    menu: state.customMenu
-  }
-}
-
-const mapDispatchToProps = () => {
-  return {}
-}
-
-export default connect(mapStateToProps, mapDispatchToProps)(CardCellComponent)
\ No newline at end of file
+export default CardCellComponent
\ No newline at end of file

--
Gitblit v1.8.0