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/tabviews/custom/components/card/data-card/index.jsx |   59 ++++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 42 insertions(+), 17 deletions(-)

diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx
index 82c426f..fe0c8a2 100644
--- a/src/tabviews/custom/components/card/data-card/index.jsx
+++ b/src/tabviews/custom/components/card/data-card/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Spin, Empty, notification, Col } from 'antd'
+import { Spin, Empty, notification, Col, Pagination } from 'antd'
 
 import Api from '@/api'
 import UtilsDM from '@/utils/utils-datamanage.js'
@@ -12,6 +12,7 @@
 import './index.scss'
 
 const CardItem = asyncComponent(() => import('../cardItem'))
+const MainAction = asyncComponent(() => import('@/tabviews/zshare/actionList'))
 
 class DataCard extends Component {
   static propTpyes = {
@@ -24,6 +25,7 @@
 
   state = {
     BID: '',                   // 涓婄骇ID
+    BData: '',                 // 涓婄骇琛屾暟鎹�
     config: null,              // 鍥捐〃閰嶇疆淇℃伅
     pageIndex: 1,              // 椤电爜
     activeKey: '',             // 閫変腑鍗�
@@ -146,12 +148,12 @@
     })
   }
 
-  resetParentParam = (MenuID, id) => {
+  resetParentParam = (MenuID, id, data) => {
     const { config } = this.state
 
     if (!config.setting.supModule || config.setting.supModule !== MenuID) return
     if (id !== this.state.BID) {
-      this.setState({ BID: id }, () => {
+      this.setState({ BID: id, BData: data }, () => {
         this.loadData()
       })
     }
@@ -252,6 +254,14 @@
       this.loadData()
     })
   }
+
+  changePageIndex = (page) => {
+    this.setState({
+      pageIndex: page
+    }, () => {
+      this.loadData()
+    })
+  }
   
   changeCard = (index, item) => {
     const { config } = this.state
@@ -264,12 +274,12 @@
   }
 
   render() {
-    const { config, loading, data, pageIndex, total, card, activeKey } = this.state
+    const { config, loading, data, pageIndex, total, card, activeKey, BID, BData, selectedData } = this.state
 
     let _total = config.setting.pageSize * pageIndex
-    let pageable = config.pageable && config.setting.laypage
-    if ((pageIndex === 1 && total <= _total) || !data) {
-      pageable = false
+    let switchable = false
+    if (config.wrap.pagestyle === 'switch' && config.pageable && config.setting.laypage && total > config.setting.pageSize && data) {
+      switchable = true
     }
 
     return (
@@ -280,16 +290,31 @@
             <Spin />
           </div> : null
         }
-        {pageable ? <div className={'prev-page ' + (pageIndex === 1 ? 'disabled' : '')} onClick={this.prevPage}><div><div><img src={preImg} alt=""/></div></div></div> : null}
-        {data && data.length > 0 ? <div className="card-row-list">
-          {data.map((item, index) => (
-            <Col className={activeKey === index ? 'active' : ''} key={index} span={card.setting.width || 6} onClick={() => {this.changeCard(index, item)}}>
-              <CardItem card={card} cards={config} data={item} updateStatus={this.updateStatus}/>
-            </Col>
-          ))}
-        </div> : null}
-        {pageable ? <div className={'prev-page ' + (total <= _total ? 'disabled' : '')} onClick={this.nextPage}><div><div><img src={nextImg} alt=""/></div></div></div> : null}
-        {data && data.length === 0 ? <Empty description={false}/> : null}
+        {config.action && config.action.length > 0 ?
+          <MainAction
+            BID={BID}
+            BData={BData}
+            setting={config.setting}
+            actions={config.action}
+            columns={config.columns}
+            selectedData={selectedData}
+            refreshdata={this.refreshbyaction}
+            getexceloutparam={this.getexceloutparam}
+          /> : null
+        }
+        <div className="data-zoom">
+          {switchable ? <div className={'prev-page ' + (pageIndex === 1 ? 'disabled' : '')} onClick={this.prevPage}><div><div><img src={preImg} alt=""/></div></div></div> : null}
+          {data && data.length > 0 ? <div className="card-row-list">
+            {data.map((item, index) => (
+              <Col className={activeKey === index ? 'active' : ''} key={index} span={card.setting.width || 6} onClick={() => {this.changeCard(index, item)}}>
+                <CardItem card={card} cards={config} data={item} updateStatus={this.updateStatus}/>
+              </Col>
+            ))}
+          </div> : null}
+          {switchable ? <div className={'prev-page ' + (total <= _total ? 'disabled' : '')} onClick={this.nextPage}><div><div><img src={nextImg} alt=""/></div></div></div> : null}
+          {data && data.length === 0 ? <Empty description={false}/> : null}
+        </div>
+        {config.wrap.pagestyle !== 'switch' && config.setting.laypage && data ? <Pagination total={total} showTotal={t => `鍏� ${t} 鏉} pageSize={config.setting.pageSize} onChange={this.changePageIndex} current={pageIndex}/> : null}
       </div>
     )
   }

--
Gitblit v1.8.0