From bde2916433c7830e2879e6524e32b9f6c8bd0bab Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 02 一月 2022 16:31:32 +0800
Subject: [PATCH] 2022-01-02

---
 src/tabviews/custom/components/card/data-card/index.jsx |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 52 insertions(+), 7 deletions(-)

diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx
index ee17718..3a75334 100644
--- a/src/tabviews/custom/components/card/data-card/index.jsx
+++ b/src/tabviews/custom/components/card/data-card/index.jsx
@@ -54,6 +54,14 @@
     let precards = []
     let nextcards = []
 
+    if (_config.wrap.controlField) {
+      if (_config.wrap.controlVal) {
+        _config.wrap.controlVal = _config.wrap.controlVal.split(',')
+      } else {
+        _config.wrap.controlVal = ['']
+      }
+    }
+
     _config.subcards.forEach(item => {
       if (item.setting.click === 'button' && !item.setting.linkbtn) {
         item.elements.forEach(ele => {
@@ -116,6 +124,12 @@
         item.$$BID = BID || ''
         item.$$BData = BData || ''
         item.$Index = index + 1 + ''
+
+        if (_config.wrap.controlField) {
+          if (_config.wrap.controlVal.includes(item[_config.wrap.controlField])) {
+            item.$disabled = true
+          }
+        }
         return item
       })
 
@@ -150,6 +164,11 @@
     if (_config.wrap.supType === 'multi') {
       supComs = _config.supNodes.map(item => item.componentId)
     }
+
+    _config.wrap.selStyle = _config.wrap.selStyle || 'active'
+    _config.wrap.scale = _config.wrap.scale === 'true' ? 'scale' : ''
+
+    _config.wrap.wrapClass =  `${_config.wrap.selStyle} ${_config.wrap.cardType || ''} ${_config.wrap.scale}`
 
     this.setState({
       supComs,
@@ -196,6 +215,13 @@
           item.$$BID = BID || ''
           item.$$BData = BData || ''
           item.$Index = index + 1 + ''
+
+          if (config.wrap.controlField) {
+            if (config.wrap.controlVal.includes(item[config.wrap.controlField])) {
+              item.$disabled = true
+            }
+          }
+
           return item
         })
 
@@ -289,7 +315,7 @@
   checkTopLine = () => {
     const { config, data } = this.state
 
-    if (!data || data.length === 0) {
+    if (!data || data.length === 0 || data[0].$disabled) {
       this.setState({
         activeKey: '',
         selectKeys: [],
@@ -500,6 +526,13 @@
           item.$$BID = BID || ''
           item.$$BData = BData || ''
           item.$Index = index + start + ''
+
+          if (config.wrap.controlField) {
+            if (config.wrap.controlVal.includes(item[config.wrap.controlField])) {
+              item.$disabled = true
+            }
+          }
+          
           return item
         }),
         total: result.total,
@@ -627,6 +660,7 @@
     const { config, selectKeys, selectedData, activeKey, data } = this.state
 
     if (!config.wrap.cardType) return
+    if (item.$disabled) return
     
     let _selectKeys = []
     let _selectedData = []
@@ -709,7 +743,7 @@
             selectedData={selectedData}
           /> : null
         }
-        <div className={`data-zoom ${config.wrap.selStyle !== 'none' ? (config.wrap.cardType || '') : ''} ${config.wrap.scale || ''}`}>
+        <div className={`data-zoom ${config.wrap.wrapClass}`}>
           {switchable ? <div className={'prev-page ' + (pageIndex === 1 ? 'disabled' : '')} onClick={this.prevPage}><div><div><img src={preImg} alt=""/></div></div></div> : null}
           <Row className="card-row-list">
             {offset ? <Col span={offset} style={{height: '10px'}}> </Col> : null}
@@ -718,11 +752,22 @@
                 <CardItem card={item} cards={config} data={{$$BID: BID, $$BData: BData, $$selectedData: selectedData, $$type: 'extendCard'}}/>
               </Col>
             ))}
-            {data && data.map((item, index) => (
-              <Col className={(config.wrap.selStyle !== 'none' ? (activeKey === index ? ' active' : (selectKeys.indexOf(index) > -1 ? ' selected' : '')) : '') + (card.setting.click ? ' pointer' : '')} key={index} span={card.setting.width} onClick={() => {this.changeCard(index, item)}}>
-                <CardItem card={card} cards={config} data={item}/>
-              </Col>
-            ))}
+            {data && data.map((item, index) => {
+              let className = card.setting.click ? 'mk-card pointer ' : 'mk-card '
+              if (item.$disabled) {
+                className = 'mk-disabled'
+              } else if (activeKey === index) {
+                className += 'active'
+              } else if (selectKeys.indexOf(index) > -1) {
+                className += 'selected'
+              }
+
+              return (
+                <Col className={className} key={index} span={card.setting.width} onClick={() => {this.changeCard(index, item)}}>
+                  <CardItem card={card} cards={config} data={item}/>
+                </Col>
+              )
+            })}
             {nextcards.map((item, index) => (
               <Col key={'next' + index} className="extend-card" span={item.setting.width || 6}>
                 <CardItem card={item} cards={config} data={{$$BID: BID, $$BData: BData, $$selectedData: selectedData, $$type: 'extendCard'}}/>

--
Gitblit v1.8.0