From af7a6bfa1e7faa007aa1bb53090839ce56e3bd09 Mon Sep 17 00:00:00 2001
From: Zhufu <1176354795@qq.com>
Date: Thu, 8 Aug 2024 17:41:54 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E5=88=87=E6=8D=A2=E5=8C=BA?=
=?UTF-8?q?=E5=8E=BF=E5=AE=A1=E6=A0=B8=E5=90=8E=E5=88=87=E5=9B=9E=E7=BA=BF?=
=?UTF-8?q?=E7=B4=A2=E5=A1=AB=E6=8A=A5=E5=90=8E=E6=A0=A1=E9=AA=8C=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/FormViewer/index.vue | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/components/FormViewer/index.vue b/src/components/FormViewer/index.vue
index aaecbc11..def7216e 100644
--- a/src/components/FormViewer/index.vue
+++ b/src/components/FormViewer/index.vue
@@ -3,7 +3,7 @@
@@ -91,7 +91,8 @@
const { proxy } = getCurrentInstance();
const emit = defineEmits(['getFormSuccess']);
const subTableDataStore = subTableStore();
-
+ const tabsFormRef = ref()
+ const formRef = ref()
let formColumns: FormSchema[] = [];
const props = defineProps({
formConfig: Object,
@@ -315,8 +316,7 @@
}, 10);
}
}
- async function tabsChange(e) {
- clearValidate();
+ function tabsChange(e) {
tabsKey.value = e;
formColumns.forEach((element) => {
element.show = false;
@@ -341,6 +341,7 @@
}
setTimeout(() => {
setFieldsValue(FieldsValue.value);
+ clearValidate()
}, 10);
}
@@ -425,8 +426,19 @@
}
}
console.log(subTableDataStore.getGroupData);
+ let resultObj = {}
+ tabsFormRef.value.forEach((item,index) => {
+ console.log(item.getFieldsValue(),index)
+ let data = item.getFieldsValue()
+ Object.keys(data).forEach(key => {
+ if(!resultObj[key]){
+ resultObj[key] = data[key]
+ }
+ })
+ })
//卡片组的值赋值给form,优化卡片组必填验证不通过
setFieldsValue({
+ ...resultObj,
...subTableDataStore.getGroupData,
});
@@ -491,7 +503,8 @@
if (props.formVerison) {
getFormHistory();
}
- clearValidate();
+ tabsFormRef.value && tabsFormRef.value.clearValidate();
+ formRef.value && formRef.value.clearValidate();
});
function radioVal() {
console.log('radioVal');