From e4c9b7fd59cb081ad8df27328527d46413e95f84 Mon Sep 17 00:00:00 2001 From: ZF sun <34314687@qq.com> Date: Fri, 3 Jul 2026 15:52:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=9F=E4=B8=80=E5=A4=84=E7=90=86?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E6=8F=90=E4=BA=A4=E6=95=B0=E6=8D=AE=E7=9A=84?= =?UTF-8?q?=E5=BA=8F=E5=88=97=E5=8C=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 修复多处表单提交时重复判断序列化的逻辑,统一处理当formData已经是字符串时不再重复序列化 2. 简化nameStyle样式计算的代码写法,移除不必要的objToStyle调用 --- components-diy/diy-form.vue | 5 ++++- components/ns-newform/ns-newform.vue | 6 +++--- pages_tool/form/form.vue | 2 +- pages_tool/form/formdata.vue | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/components-diy/diy-form.vue b/components-diy/diy-form.vue index 0ad6e55..7e0caa7 100644 --- a/components-diy/diy-form.vue +++ b/components-diy/diy-form.vue @@ -283,12 +283,15 @@ export default { return; } + // 获得保单数据 + const submitFormData = this.getFormData(); + // 提交到后端 this.$api.sendRequest({ url: '/form/api/form/create', data: { form_id: this.value.form_id || 0, - form_data: JSON.stringify(this.getFormData()), + form_data: typeof submitFormData === 'string' ? submitFormData : JSON.stringify(submitFormData), component_id: this.value.id || '', form_name: this.value.form_name || '默认表单' }, diff --git a/components/ns-newform/ns-newform.vue b/components/ns-newform/ns-newform.vue index a5a1202..7b65142 100644 --- a/components/ns-newform/ns-newform.vue +++ b/components/ns-newform/ns-newform.vue @@ -517,11 +517,11 @@ export default { // 标签与输入框间距 nameStyle() { if (this.mode === 'vertical') { - return this.$util.objToStyle({}); + return {}; } - return this.$util.objToStyle({ + return { 'margin-right': `${this.config.labelGap}rpx` - }); + }; }, // 输入框样式(全局,未指定 item 时使用) inputStyle() { diff --git a/pages_tool/form/form.vue b/pages_tool/form/form.vue index eadac21..ed304fe 100644 --- a/pages_tool/form/form.vue +++ b/pages_tool/form/form.vue @@ -85,7 +85,7 @@ url: '/form/api/form/create', data: { form_id: this.id, - form_data: JSON.stringify(this.$refs.form.formData) + form_data: typeof this.$refs.form.formData === 'string' ? this.$refs.form.formData : JSON.stringify(this.$refs.form.formData) }, success: res => { if (res.code == 0) { diff --git a/pages_tool/form/formdata.vue b/pages_tool/form/formdata.vue index 7504ae9..e53a3ae 100644 --- a/pages_tool/form/formdata.vue +++ b/pages_tool/form/formdata.vue @@ -158,7 +158,7 @@ export default { url: '/form/api/form/create', data: { form_id: this.id, - form_data: JSON.stringify(formData), + form_data: typeof formData === 'string' ? formData : JSON.stringify(formData), uniacid: this.uniacid }, success: res => {