Browse Source

fix:修改数据汇聚

zcuishan 3 months ago
parent
commit
761dd050d5
1 changed files with 4 additions and 9 deletions
  1. 4 9
      src/components/Form/src/components/SubForm.vue

+ 4 - 9
src/components/Form/src/components/SubForm.vue

@@ -399,15 +399,10 @@
     // 更改后
     const listKey = list.map((x) => x[props.valueField]);
     // 原数据
-    const sourceKey = data.value.map((x) => x[props.uniqueKey]);
-    //删除原数据中不存在的数据
-    sourceKey.map((item, index) => {
-      if (!listKey.includes(item)) {
-        data.value.splice(index, 1);
-      }
-    });
-    emit('change', unref(data));
-    emit('update:value', unref(data));
+    const newData = data.value.filter((item) => listKey.includes(item[props.uniqueKey]));
+    console.log(newData);
+    emit('change', newData);
+    emit('update:value', newData);
   };
 
   watch(