From 34e7681fd12b1c4e4994d3bea1a553870e10bc50 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 11 三月 2023 17:58:54 +0800
Subject: [PATCH] 2023-03-11

---
 src/menu/components/card/cardcellcomponent/elementform/index.jsx |  100 ++++++++++++++++++++++++++++++++++----------------
 1 files changed, 68 insertions(+), 32 deletions(-)

diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx
index cb4f601..009826c 100644
--- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx
+++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx
@@ -17,7 +17,7 @@
   sequence: ['eleType', 'width'],
   text: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'link', 'anchors', 'noValue', 'bgImage', 'fixStyle', 'copyable'],
   number: ['eleType', 'datatype', 'width', 'height', 'prefix', 'postfix', 'noValue', 'fixStyle'],
-  picture: ['eleType', 'datatype', 'width', 'lenWidRadio', 'backgroundSize', 'maxWidth', 'link', 'noValue'],
+  picture: ['eleType', 'datatype', 'width', 'lenWidRadio', 'maxWidth', 'link', 'noValue'],
   video: ['eleType', 'datatype', 'width', 'aspectRatio', 'autoPlay', 'loop', 'startTime', 'noValue', 'posterType'],
   icon: ['eleType', 'datatype', 'width', 'tooltip'],
   slider: ['eleType', 'datatype', 'width', 'color', 'maxValue', 'showInfo', 'showType', 'strokeWidth', 'strokeLinecap', 'trailColor'],
@@ -48,7 +48,7 @@
   }
 
   UNSAFE_componentWillMount () {
-    const { card, config } = this.props
+    const { card, config, side } = this.props
     let _options = this.getOptions(card.eleType, card.datatype, card.link, (card.showType || 'line'), card.showInfo, card.fixStyle || '', card.posterType || '')
     
     this.setState({
@@ -64,20 +64,38 @@
 
         if (item.key === 'field' || item.key === 'linkurl' || item.key === 'bgImage' || item.key === 'posterField') {
           item.options = []
-          config.columns.forEach(col => {
-            let label = `${col.field}锛�${col.label}锛塦
-            if (/^(Int|Decimal)/ig.test(col.datatype) && (card.eleType === 'number' || card.eleType === 'slider')) {
-              item.options.push({
-                value: col.field,
-                text: label
-              })
-            } else if (/^(Nvarchar|date)/ig.test(col.datatype) && card.eleType !== 'number' && card.eleType !== 'slider') {
-              item.options.push({
-                value: col.field,
-                text: label
-              })
-            }
-          })
+          
+          if (side === 'sub') {
+            config.subColumns.forEach(col => {
+              let label = `${col.field}锛�${col.label}锛塦
+              if (/^(Int|Decimal)/ig.test(col.datatype) && (card.eleType === 'number' || card.eleType === 'slider')) {
+                item.options.push({
+                  value: col.field,
+                  text: label
+                })
+              } else if (/^(Nvarchar|date)/ig.test(col.datatype) && card.eleType !== 'number' && card.eleType !== 'slider') {
+                item.options.push({
+                  value: col.field,
+                  text: label
+                })
+              }
+            })
+          } else {
+            config.columns.forEach(col => {
+              let label = `${col.field}锛�${col.label}锛塦
+              if (/^(Int|Decimal)/ig.test(col.datatype) && (card.eleType === 'number' || card.eleType === 'slider')) {
+                item.options.push({
+                  value: col.field,
+                  text: label
+                })
+              } else if (/^(Nvarchar|date)/ig.test(col.datatype) && card.eleType !== 'number' && card.eleType !== 'slider') {
+                item.options.push({
+                  value: col.field,
+                  text: label
+                })
+              }
+            })
+          }
         } else if (item.key === 'value' && card.eleType === 'slider') {
           item.type = 'number'
           item.label = '鍊�'
@@ -140,7 +158,7 @@
       }
     } else if (eleType === 'icon') {
       if (datatype === 'dynamic') {
-        _options.push('field')
+        _options.push('field', 'noValue')
       } else {
         _options.push('icon')
       }
@@ -159,7 +177,7 @@
    * 3銆佸垏鎹㈡爣绛剧被鍨嬶紝閲嶇疆鍙�夋爣绛�
    */
   selectChange = (key, value, option) => {
-    const { card, config } = this.props
+    const { card, config, side } = this.props
     const { datatype, eleType, showType, showInfo, fixStyle, posterType } = this.state
 
     if (key === 'eleType') {
@@ -170,21 +188,39 @@
 
         if (item.key === 'field') {
           item.options = []
-          config.columns.forEach(col => {
-            let label = `${col.field}锛�${col.label}锛塦
 
-            if (/^(Int|Decimal)/ig.test(col.datatype) && (value === 'number' || value === 'slider')) {
-              item.options.push({
-                value: col.field,
-                text: label
-              })
-            } else if (/^(Nvarchar|date)/ig.test(col.datatype) && value !== 'number' && value !== 'slider') {
-              item.options.push({
-                value: col.field,
-                text: label
-              })
-            }
-          })
+          if (side === 'sub') {
+            config.subColumns.forEach(col => {
+              let label = `${col.field}锛�${col.label}锛塦
+              if (/^(Int|Decimal)/ig.test(col.datatype) && (value === 'number' || value === 'slider')) {
+                item.options.push({
+                  value: col.field,
+                  text: label
+                })
+              } else if (/^(Nvarchar|date)/ig.test(col.datatype) && value !== 'number' && value !== 'slider') {
+                item.options.push({
+                  value: col.field,
+                  text: label
+                })
+              }
+            })
+          } else {
+            config.columns.forEach(col => {
+              let label = `${col.field}锛�${col.label}锛塦
+  
+              if (/^(Int|Decimal)/ig.test(col.datatype) && (value === 'number' || value === 'slider')) {
+                item.options.push({
+                  value: col.field,
+                  text: label
+                })
+              } else if (/^(Nvarchar|date)/ig.test(col.datatype) && value !== 'number' && value !== 'slider') {
+                item.options.push({
+                  value: col.field,
+                  text: label
+                })
+              }
+            })
+          }
         } else if (item.key === 'value') {
           if (value === 'slider') {
             item.type = 'number'

--
Gitblit v1.8.0