From 682a74e858e5a6cd24d36183931d3afafd6443d7 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 31 三月 2021 10:56:48 +0800
Subject: [PATCH] 2021-03-31

---
 src/menu/components/form/normal-form/index.jsx |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/menu/components/form/normal-form/index.jsx b/src/menu/components/form/normal-form/index.jsx
index 590fe46..f609d62 100644
--- a/src/menu/components/form/normal-form/index.jsx
+++ b/src/menu/components/form/normal-form/index.jsx
@@ -45,7 +45,8 @@
     visible: false,
     editform: null,
     formlist: null,
-    sqlVerifing: false
+    sqlVerifing: false,
+    standardform: null
   }
 
   UNSAFE_componentWillMount () {
@@ -429,8 +430,9 @@
 
     group.fields.push(newcard)
 
-    this.setState({group})
-    this.handleForm(newcard)
+    this.setState({group}, () => {
+      this.handleForm(newcard)
+    })
   }
 
   editModalCancel = () => {
@@ -453,6 +455,7 @@
       value: '',
       text: '绌�'
     }]
+    let standardform = null
 
     _inputfields = group.fields.filter(item => item.type === 'text' || item.type === 'number' || item.type === 'textarea' || item.type === 'color')
     _tabfields = group.fields.filter(item => _form.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type))
@@ -460,7 +463,11 @@
 
     let uniq = new Map()
     uniq.set(_form.field, true)
-    group.fields.forEach(item => {
+    let index = null
+    group.fields.forEach((item, i) => {
+      if (_form.uuid === item.uuid) {
+        index = i
+      }
       if (item.type !== 'select' && item.type !== 'link' && item.type !== 'radio') return
       if (item.field && !uniq.has(item.field)) {
         uniq.set(item.field, true)
@@ -475,6 +482,13 @@
         })
       }
     })
+    if (index !== null) {
+      if (index === 0) {
+        standardform = group.fields[index + 1] || null
+      } else {
+        standardform = group.fields[index - 1] || null
+      }
+    }
 
     card.columns.forEach(col => {
       if (col.field && !uniq.has(col.field)) {
@@ -493,6 +507,7 @@
     }
 
     this.setState({
+      standardform,
       visible: true,
       editform: _form,
       formlist: getModalForm(_form, _inputfields, _tabfields, _linkableFields, _linksupFields, false)
@@ -673,6 +688,7 @@
             card={this.state.editform}
             formlist={this.state.formlist}
             inputSubmit={this.handleSubmit}
+            standardform={this.state.standardform}
             wrappedComponentRef={(inst) => this.formRef = inst}
           />
         </Modal>

--
Gitblit v1.8.0