From 2aa76e9677e390497706b460815356eb1f162bc6 Mon Sep 17 00:00:00 2001 From: xuhuajiao <13476289682@163.com> Date: Wed, 18 Oct 2023 17:48:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=8E=92=E5=BA=8F=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/components/field/index.vue | 6 +++++- src/views/system/fileLibraryField/field/index.vue | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/views/components/field/index.vue b/src/views/components/field/index.vue index 931c2fb..cc5f6e2 100644 --- a/src/views/components/field/index.vue +++ b/src/views/components/field/index.vue @@ -138,7 +138,11 @@ export default { [CRUD.HOOK.beforeSubmit]() { this.crud.form.isType = this.isType if (this.crud.status.add > CRUD.STATUS.NORMAL) { - this.crud.form.isSequence = this.crud.data.reduce((prev, cur) => { return { isSequence: Math.max(prev.isSequence, cur.isSequence) } }).isSequence + 1 + if (this.crud.data && this.crud.data.length > 0) { + this.crud.form.isSequence = this.crud.data.reduce((prev, cur) => { return { isSequence: Math.max(prev.isSequence, cur.isSequence) } }).isSequence + 1 + } else { + this.crud.form.isSequence = 1 + } } }, handleConfirm() { diff --git a/src/views/system/fileLibraryField/field/index.vue b/src/views/system/fileLibraryField/field/index.vue index 7ce1a31..36f9304 100644 --- a/src/views/system/fileLibraryField/field/index.vue +++ b/src/views/system/fileLibraryField/field/index.vue @@ -138,7 +138,11 @@ export default { [CRUD.HOOK.beforeSubmit]() { this.crud.form.isType = this.isType if (this.crud.status.add > CRUD.STATUS.NORMAL) { - this.crud.form.isSequence = this.crud.data.reduce((prev, cur) => { return { isSequence: Math.max(prev.isSequence, cur.isSequence) } }).isSequence + 1 + if (this.crud.data && this.crud.data.length > 0) { + this.crud.form.isSequence = this.crud.data.reduce((prev, cur) => { return { isSequence: Math.max(prev.isSequence, cur.isSequence) } }).isSequence + 1 + } else { + this.crud.form.isSequence = 1 + } } }, handleConfirm() {