From 8d66ff34fae5b048a6b7923cc75d34f13a08be9d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 02 八月 2022 11:42:43 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/menu/components/timeline/normal-timeline/index.jsx |   93 ++++++++++++++++++++++++++++++++++++----------
 1 files changed, 73 insertions(+), 20 deletions(-)

diff --git a/src/menu/components/timeline/normal-timeline/index.jsx b/src/menu/components/timeline/normal-timeline/index.jsx
index d6ad7e9..1dcb7f4 100644
--- a/src/menu/components/timeline/normal-timeline/index.jsx
+++ b/src/menu/components/timeline/normal-timeline/index.jsx
@@ -48,7 +48,7 @@
         name: card.name,
         subtype: card.subtype,
         setting: { interType: 'system' },
-        wrap: { title: '', name: card.name, width: card.width || 24, color: '#1890ff', mode: 'left' },
+        wrap: { title: '', name: card.name, direction: 'vertical', width: card.width || 24, color: '#1890ff', mode: 'left' },
         style: { marginLeft: '0px', marginRight: '0px', marginTop: '0px', marginBottom: '0px' },
         subcards: [{
           uuid: Utils.getuuid(),
@@ -82,10 +82,8 @@
           return scard
         })
       }
-      this.setState({
-        card: _card
-      })
-      this.props.updateConfig(_card)
+
+      this.updateComponent(_card)
     } else {
       this.setState({
         card: fromJS(card).toJS()
@@ -114,15 +112,57 @@
   /**
    * @description 鍗$墖琛屽灞備俊鎭洿鏂帮紙鏁版嵁婧愶紝鏍峰紡绛夛級
    */
-  updateComponent = (component) => {
+  updateComponent = (card) => {
+    card.width = card.wrap.width
+    card.name = card.wrap.name
+    if (!window.GLOB.styling || !card.errors) { // 鏍峰紡淇敼鏃朵笉鍋氱瓫鏌�
+      card.errors = []
+  
+      if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) {
+        card.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'})
+      } else if (card.setting.interType === 'system' && card.setting.execute === 'false' && card.scripts.filter(script => script.status !== 'false').length === 0) {
+        card.errors.push({ level: 0, detail: '鏁版嵁婧愪腑鏃犲彲鐢ㄨ剼鏈紒'})
+      } else if (!card.setting.primaryKey) {
+        card.errors.push({ level: 0, detail: '鏈缃富閿紒'})
+      } else if (!card.setting.supModule) {
+        card.errors.push({ level: 0, detail: '鏈缃笂绾х粍浠讹紒'})
+      }
+  
+      let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : ''
+      if (supModule === 'empty') {
+        supModule = ''
+      }
+      let columns = card.columns.map(c => c.field)
+      let lowcols = card.columns.map(c => c.field.toLowerCase())
+  
+      card.subcards.forEach(col => {
+        col.elements.forEach(cell => {
+          if (cell.eleType === 'button') {
+            if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) {
+              if (!cell.modal || cell.modal.fields.length === 0) {
+                card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`})
+              } else {
+                cell.modal.fields.forEach(m => {
+                  if (m.type === 'linkMain' && !supModule) {
+                    card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄})
+                  } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) {
+                    card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻})
+                  }
+                })
+              }
+            }
+          } else if (cell.datatype === 'dynamic' && cell.field && !columns.includes(cell.field)) {
+            card.errors.push({ level: 1, detail: `鍗$墖涓姩鎬佸瓧娈碘��${cell.field}鈥濇棤鏁坄})
+          }
+        })
+      })
+    }
+    
     this.setState({
-      card: component
+      card: card
     })
 
-    component.width = component.wrap.width
-    component.name = component.wrap.name
-
-    this.props.updateConfig(component)
+    this.props.updateConfig(card)
   }
 
   updateCard = (cell) => {
@@ -133,9 +173,7 @@
       return item
     })
 
-    this.setState({card})
-
-    this.props.updateConfig(card)
+    this.updateComponent(card)
   }
 
   changeStyle = () => {
@@ -150,12 +188,8 @@
     if (comIds.length !== 1 || comIds[0] !== card.uuid) return
 
     let _card = {...card, style}
-
-    this.setState({
-      card: _card
-    })
     
-    this.props.updateConfig(_card)
+    this.updateComponent(_card)
   }
 
   getWrapForms = () => {
@@ -166,6 +200,12 @@
 
   updateWrap = (res) => {
     delete res.quick
+
+    if (res.hmode) {
+      res.mode = res.hmode
+      delete res.hmode
+    }
+    
     this.updateComponent({...this.state.card, wrap: res})
   }
 
@@ -192,7 +232,20 @@
         </Popover>
         <NormalHeader hideSearch="true" config={card} updateComponent={this.updateComponent}/>
         {card.subcards.map(subcard => (<CardSimpleComponent key={subcard.uuid} cards={card} card={subcard} updateElement={this.updateCard}/>))}
-        <div className="component-name"><div className="center">{card.name}</div></div>
+        <div className="component-name">
+          <div className="center">
+            <div className="title">{card.name}</div>
+            <div className="content">
+              {card.errors && card.errors.map((err, index) => {
+                if (err.level === 0) {
+                  return <span key={index} className="error">{err.detail}</span>
+                } else {
+                  return <span key={index} className="waring">{err.detail}锛�</span>
+                }
+              })}
+            </div>
+          </div>
+        </div>
       </div>
     )
   }

--
Gitblit v1.8.0