From 0eb129a9beddbb86ae74d7106a8e60823206b8d5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 14 十二月 2023 11:29:15 +0800
Subject: [PATCH] 2023-12-14

---
 src/menu/components/form/step-form/index.jsx |   50 ++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 44 insertions(+), 6 deletions(-)

diff --git a/src/menu/components/form/step-form/index.jsx b/src/menu/components/form/step-form/index.jsx
index f4f7947..47e1fb8 100644
--- a/src/menu/components/form/step-form/index.jsx
+++ b/src/menu/components/form/step-form/index.jsx
@@ -89,6 +89,10 @@
     }
   }
 
+  componentDidMount () {
+    MKEmitter.addListener('mkUpdateInter', this.mkUpdateInter)
+  }
+
   shouldComponentUpdate (nextProps, nextState) {
     return !is(fromJS(this.state), fromJS(nextState))
   }
@@ -99,6 +103,21 @@
   componentWillUnmount () {
     this.setState = () => {
       return
+    }
+    MKEmitter.removeListener('mkUpdateInter', this.mkUpdateInter)
+  }
+
+  mkUpdateInter = (inter, split) => {
+    const { card } = this.state
+    
+    if (card.wrap.datatype === 'public' && card.wrap.publicId === inter.uuid) {
+      let _card = {...card, columns: fromJS(inter.columns).toJS()}
+
+      split.delay = split.delay + 10
+
+      setTimeout(() => {
+        this.updateComponent(_card)
+      }, split.delay)
     }
   }
 
@@ -111,7 +130,7 @@
     card.errors = []
     let idCtrl = false
 
-    if (card.wrap.datatype !== 'static') {
+    if (card.wrap.datatype === 'dynamic') {
       let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : ''
       if (supModule === 'empty') {
         supModule = ''
@@ -125,6 +144,9 @@
       }
 
       card.subcards.forEach(item => {
+        if (item.subButton.intertype === 'system' && !item.subButton.sqlType) {
+          card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳璇疯缃搷浣滅被鍨媊})
+        }
         item.fields.forEach(m => {
           if (m.dataSource && /@ID@/ig.test(m.dataSource)) {
             idCtrl = true
@@ -135,16 +157,22 @@
         })
       })
     } else {
-      let supModule = card.wrap.supModule ? card.wrap.supModule[card.wrap.supModule.length - 1] : ''
+      let supModule = ''
+      if (card.wrap.datatype === 'static') {
+        supModule = card.wrap.supModule ? card.wrap.supModule[card.wrap.supModule.length - 1] : ''
+      }
 
       card.$tables = getTables(card)
 
       card.subcards.forEach(item => {
+        if (item.subButton.intertype === 'system' && !item.subButton.sqlType) {
+          card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳璇疯缃搷浣滅被鍨媊})
+        }
         item.fields.forEach(m => {
           if (m.dataSource && /@ID@/ig.test(m.dataSource)) {
             idCtrl = true
           }
-          if (m.type === 'linkMain' && !supModule) {
+          if (m.type === 'linkMain' && !supModule && card.wrap.datatype === 'static') {
             card.errors.push({ level: 1, detail: `璇锋鏌ュ垎缁勨��${item.setting.title}鈥濅腑鍏宠仈涓昏〃鈥�${m.label}鈥濇槸鍚︽湁鏁坄})
           }
         })
@@ -196,7 +224,7 @@
       style: {},
       fields: [],
       prevButton: {label: '涓婁竴姝�', type: 'prev', enable: 'false', style: {marginRight: '15px', paddingTop: '5px', paddingBottom: '5px'}},
-      subButton: {label: '鎻愪氦', type: 'submit', intertype: 'system', reload: 'false', sqlType: 'update', sql: '', Ot: 'notRequired', enable: 'true', style: {backgroundColor: '#1890ff', color: '#ffffff', paddingLeft: '25px', paddingRight: '25px', paddingTop: '5px', paddingBottom: '5px'}},
+      subButton: {label: '鎻愪氦', type: 'submit', intertype: 'system', reload: 'false', sqlType: '', sql: '', Ot: 'notRequired', execSuccess: 'never', enable: 'true', style: {backgroundColor: '#1890ff', color: '#ffffff', paddingLeft: '25px', paddingRight: '25px', paddingTop: '5px', paddingBottom: '5px'}},
       nextButton: {label: '璺宠繃', type: 'next', enable: 'false', style: {paddingTop: '5px', paddingBottom: '5px'}}
     }
 
@@ -586,6 +614,17 @@
       } else {
         _card.setting.supModule = ''
       }
+    } else if (res.datatype === 'public') {
+      let interfaces = window.GLOB.customMenu.interfaces || []
+
+      let d = interfaces.filter(m => m.uuid === res.publicId && m.status === 'true')[0]
+
+      if (d) {
+        _card.columns = fromJS(d.columns).toJS()
+
+        _card.setting = { interType: 'system' }
+        _card.scripts = []
+      }
     }
 
     this.updateComponent(_card)
@@ -670,8 +709,7 @@
             <PasteComponent config={card} options={['formgroup', 'simpleform']} updateConfig={this.pasteForm} />
             <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/>
             <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} />
-            {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null}
-            {card.wrap.datatype === 'static' ? <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/> : null}
+            {card.wrap.datatype === 'dynamic' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>}
           </div>
         } trigger="hover">
           <ToolOutlined />

--
Gitblit v1.8.0