From d5c3340757ae00a2ad617c4241dfd3792f36e036 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 14 十二月 2020 18:23:42 +0800
Subject: [PATCH] 2020-12-14

---
 src/menu/components/card/data-card/index.jsx |   68 ++++++++++++++++++++++++++++++++-
 1 files changed, 65 insertions(+), 3 deletions(-)

diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx
index 409cf2c..240956e 100644
--- a/src/menu/components/card/data-card/index.jsx
+++ b/src/menu/components/card/data-card/index.jsx
@@ -2,7 +2,7 @@
 import PropTypes from 'prop-types'
 import {connect} from 'react-redux'
 import { is, fromJS } from 'immutable'
-import { Icon, Popover, Modal } from 'antd'
+import { Icon, Popover, Modal, Pagination } from 'antd'
 
 import asyncComponent from '@/utils/asyncComponent'
 import asyncIconComponent from '@/utils/asyncIconComponent'
@@ -16,6 +16,8 @@
 const SettingComponent = asyncIconComponent(() => import('@/menu/datasource'))
 const WrapComponent = asyncIconComponent(() => import('./wrapsetting'))
 const CardComponent = asyncComponent(() => import('../cardcomponent'))
+const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader'))
+const ActionComponent = asyncComponent(() => import('@/menu/components/share/actioncomponent'))
 
 const { confirm } = Modal
 
@@ -81,10 +83,12 @@
         name: card.name,
         subtype: card.subtype,
         setting: { interType: 'system' },
-        wrap: { name: card.name, width: 24, addable: 'false', switch: 'false' },
+        wrap: { name: card.name, width: 24, pagestyle: 'page', switch: 'false' },
         style: { marginLeft: '0px', marginRight: '0px', marginTop: '8px', marginBottom: '8px' },
+        headerStyle: { fontSize: '16px', borderBottomWidth: '1px', borderBottomColor: '#e8e8e8' },
         columns: [],
         scripts: [],
+        action: [],
         subcards: subcards
       }
       this.setState({
@@ -92,6 +96,8 @@
       })
       this.props.updateConfig(_card)
     } else {
+      card.action = card.action || [] // 鍏煎
+      card.search = card.search || [] // 鍏煎
       this.setState({
         card: fromJS(card).toJS()
       })
@@ -185,14 +191,68 @@
     this.props.updateConfig(_card)
   }
 
+  addSearch = () => {
+    const { card } = this.state
+
+    let newcard = {}
+    newcard.uuid = Utils.getuuid()
+    newcard.focus = true
+
+    newcard.label = 'label'
+    newcard.type = 'select'
+    newcard.resourceType = '0'
+    newcard.options = []
+    newcard.setAll = 'false'
+    newcard.orderType = 'asc'
+    newcard.display = 'dropdown'
+    newcard.match = '='
+
+    // 娉ㄥ唽浜嬩欢-娣诲姞鎼滅储
+    MKEmitter.emit('addSearch', card.uuid, newcard)
+  }
+
+  addButton = () => {
+    const { card } = this.state
+
+    let newcard = {}
+    newcard.uuid = Utils.getuuid()
+    newcard.focus = true
+    
+    newcard.label = 'label'
+    newcard.Ot = 'requiredSgl'
+    newcard.OpenType = 'pop'
+    newcard.icon = ''
+    newcard.class = 'green'
+    newcard.intertype = card.setting.interType || 'system'
+    newcard.innerFunc = card.setting.innerFunc || ''
+    newcard.sysInterface = card.setting.sysInterface || ''
+    newcard.outerFunc = card.setting.outerFunc || ''
+    newcard.interface = card.setting.interface || ''
+    newcard.execSuccess = 'grid'
+    newcard.execError = 'never'
+    newcard.verify = null
+    newcard.show = 'button'
+    newcard.btnstyle = {marginRight: '15px'}
+
+    // 娉ㄥ唽浜嬩欢-娣诲姞鎸夐挳
+    MKEmitter.emit('addButton', card.uuid, newcard)
+  }
+
+  setSubConfig = () => {
+
+  }
+
   render() {
     const { menu } = this.props
     const { card } = this.state
 
     return (
       <div className="menu-data-card-edit-box" style={{...card.style, minHeight: card.wrap.minHeight}}>
+        <NormalHeader defaultshow="hidden" config={card} updateComponent={this.updateComponent}/>
         <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
           <div className="mk-popover-control">
+            {menu && menu.MenuType !== 'billPrint' ? <Icon className="plus" title="娣诲姞鎼滅储" onClick={this.addSearch} type="plus-circle" /> : null}
+            {menu && menu.MenuType !== 'billPrint' ? <Icon className="plus" title="娣诲姞鎸夐挳" onClick={this.addButton} type="plus-square" /> : null}
             {menu ? <WrapComponent MenuType={menu.MenuType} config={card} updateConfig={this.updateComponent} /> : null}
             <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" />
             <Icon className="close" title="鍒犻櫎缁勪欢" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} />
@@ -201,8 +261,10 @@
         } trigger="hover">
           <Icon type="tool" />
         </Popover>
+        <ActionComponent config={card} setSubConfig={this.setSubConfig} updateaction={this.updateComponent}/>
         {card.subcards.map(subcard => (<CardComponent key={subcard.uuid} MenuType={menu ? menu.MenuType : ''} cards={card} card={subcard} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))}
-        {card.wrap.addable === 'true' ? <div className="card-add-button"><Icon type="plus" /></div> : null}
+        <div style={{clear: 'both'}}></div>
+        {card.wrap.pagestyle !== 'switch' && card.setting.laypage === 'true' ? <Pagination total={85} showTotal={total => `鍏� ${total} 鏉} pageSize={20} defaultCurrent={1}/> : null}
       </div>
     )
   }

--
Gitblit v1.8.0