From a3755ab81e0799bf0eab003780f83d23a7f56050 Mon Sep 17 00:00:00 2001 From: vdpAdmin Date: Thu, 3 Nov 2022 11:17:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=90=8E=E6=97=A0=E6=B3=95=E7=82=B9=E5=87=BB=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +++ .../form-widget/field-widget/fieldMixin.js | 2 +- .../field-widget/file-upload-widget.vue | 17 ++++++---------- src/utils/util.js | 20 +++++++++++++++++++ 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index f84b517..af3bf33 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,9 @@ ### Vue 3正式版已发布 [立即进入](https://gitee.com/vdpadmin/variant-form3-vite) +### 🎉🎉基于Vant组件库的Mobile版本已发布🎉🎉 +[立即进入](https://vform666.com/vform-mobile.html) + ### 友情链接 [Fantastic-admin](https://hooray.gitee.io/fantastic-admin/) —— 一款开箱即用的 Vue 中后台管理系统框架(支持Vue2/Vue3) diff --git a/src/components/form-designer/form-widget/field-widget/fieldMixin.js b/src/components/form-designer/form-widget/field-widget/fieldMixin.js index c0920b7..b1bca24 100644 --- a/src/components/form-designer/form-widget/field-widget/fieldMixin.js +++ b/src/components/form-designer/form-widget/field-widget/fieldMixin.js @@ -189,7 +189,7 @@ export default { }, buildFieldRules() { - if (!this.field.formItemFlag) { + if (!this.field.formItemFlag && this.field.options.hidden) { return } diff --git a/src/components/form-designer/form-widget/field-widget/file-upload-widget.vue b/src/components/form-designer/form-widget/field-widget/file-upload-widget.vue index 17d4242..88d26e9 100644 --- a/src/components/form-designer/form-widget/field-widget/file-upload-widget.vue +++ b/src/components/form-designer/form-widget/field-widget/file-upload-widget.vue @@ -199,22 +199,17 @@ } this.updateFieldModelAndEmitDataChangeForUpload(fileList, customResult, res) + if (!!customResult && !!customResult.name) { + file.name = customResult.name + } + if (!!customResult && !!customResult.url) { + file.url = customResult.url + } this.fileList = deepClone(fileList) this.uploadBtnHidden = fileList.length >= this.field.options.limit } }, - // handleFileRemove(file, fileList) { - // this.fileList = deepClone(fileList) //this.fileList = fileList - // this.updateUploadFieldModelAndEmitDataChange(fileList) - // this.uploadBtnHidden = fileList.length >= this.field.options.limit - // - // if (!!this.field.options.onFileRemove) { - // let customFn = new Function('file', 'fileList', this.field.options.onFileRemove) - // customFn.call(this, file, fileList) - // } - // }, - updateFieldModelAndEmitDataChangeForRemove(deletedFileIdx, fileList) { let oldValue = deepClone(this.fieldModel) this.fieldModel.splice(deletedFileIdx, 1) diff --git a/src/utils/util.js b/src/utils/util.js index 9f824b9..9f6eba4 100644 --- a/src/utils/util.js +++ b/src/utils/util.js @@ -127,6 +127,10 @@ export const loadRemoteScript = function(srcPath, callback) { /*加载远程js } export function traverseFieldWidgets(widgetList, handler, parent = null) { + if (!widgetList) { + return + } + widgetList.forEach(w => { if (w.formItemFlag) { handler(w, parent) @@ -153,6 +157,10 @@ export function traverseFieldWidgets(widgetList, handler, parent = null) { } export function traverseContainerWidgets(widgetList, handler) { + if (!widgetList) { + return + } + widgetList.forEach(w => { if (w.category === 'container') { handler(w) @@ -181,6 +189,10 @@ export function traverseContainerWidgets(widgetList, handler) { } export function traverseAllWidgets(widgetList, handler) { + if (!widgetList) { + return + } + widgetList.forEach(w => { handler(w) @@ -259,6 +271,10 @@ export function traverseFieldWidgetsOfContainer(con, handler) { * @returns {[]} */ export function getAllFieldWidgets(widgetList) { + if (!widgetList) { + return [] + } + let result = [] let handlerFn = (w) => { result.push({ @@ -278,6 +294,10 @@ export function getAllFieldWidgets(widgetList) { * @returns {[]} */ export function getAllContainerWidgets(widgetList) { + if (!widgetList) { + return [] + } + let result = [] let handlerFn = (w) => { result.push({