diff --git a/src/components/AutoDataForm/index.vue b/src/components/AutoDataForm/index.vue
index 7c47630ca..7222d0d6c 100644
--- a/src/components/AutoDataForm/index.vue
+++ b/src/components/AutoDataForm/index.vue
@@ -1,20 +1,24 @@
-
+ >
+
+
@@ -66,16 +70,16 @@ export default {
this.optionUrlMetaAndGenerateColumns()
},
methods: {
- optionUrlMetaAndGenerateColumns() {
- this.$store.dispatch('common/getUrlMeta', { url: this.url }).then(data => {
- this.remoteMeta = data.actions[this.method.toUpperCase()] || {}
- this.generateColumns()
- this.cleanFormValue()
- }).catch(err => {
- this.$log.error(err)
- }).finally(() => {
- this.loading = false
- })
+ async optionUrlMetaAndGenerateColumns() {
+ let data = { actions: {}}
+ if (this.url) {
+ data = await this.$store.dispatch('common/getUrlMeta', { url: this.url })
+ }
+ this.remoteMeta = data.actions[this.method.toUpperCase()] || {}
+ this.generateColumns()
+ this.cleanFormValue()
+ this.loading = false
+ console.log('Loading: ', this.groups)
},
generateColumns() {
const generator = new FormFieldGenerator()
@@ -114,6 +118,18 @@ export default {
} else {
field.attrs.error = error
}
+ },
+ groupHidden(group, i) {
+ for (const field of group.fields) {
+ let hidden = field.hidden
+ if (typeof hidden === 'function') {
+ hidden = hidden(this.iForm)
+ }
+ if (!hidden) {
+ return false
+ }
+ }
+ return true
}
}
}
diff --git a/src/components/AutoDataForm/utils.js b/src/components/AutoDataForm/utils.js
index e77c07c21..eda6b93bb 100644
--- a/src/components/AutoDataForm/utils.js
+++ b/src/components/AutoDataForm/utils.js
@@ -148,13 +148,15 @@ export class FormFieldGenerator {
}
generateFieldGroup(field, fieldsMeta, remoteFieldsMeta) {
const [groupTitle, fields] = field
- this.groups.push({
+ const _fields = this.generateFields(fields, fieldsMeta, remoteFieldsMeta)
+ const group = {
id: groupTitle,
title: groupTitle,
- name: fields[0],
- fields: fields
- })
- return this.generateFields(fields, fieldsMeta, remoteFieldsMeta)
+ fields: _fields,
+ name: _fields[0].id
+ }
+ this.groups.push(group)
+ return _fields
}
generateFields(_fields, fieldsMeta, remoteFieldsMeta) {
let fields = []
diff --git a/src/components/FormFields/AssetAccounts.vue b/src/components/FormFields/AssetAccounts.vue
index f1c0fc6dc..d9e93872f 100644
--- a/src/components/FormFields/AssetAccounts.vue
+++ b/src/components/FormFields/AssetAccounts.vue
@@ -3,19 +3,21 @@
-
+
-
+
- 添加
- 模版添加
+
+ 添加
+ 模版添加
+