子表数据只用最新一条

main
刘妍 2025-05-24 14:07:43 +08:00
parent a63286c80f
commit 1e59c4b628
1 changed files with 12 additions and 7 deletions

View File

@ -3,7 +3,11 @@
<div v-show="tabsColumns.length > 1"> <div v-show="tabsColumns.length > 1">
<a-tabs v-model:activeKey="activeTabsKey" style="width: 100%" @change="tabsChange"> <a-tabs v-model:activeKey="activeTabsKey" style="width: 100%" @change="tabsChange">
<a-tab-pane v-for="(colItem, index) in tabsColumns" :tab="colItem.label" :key="index"> <a-tab-pane v-for="(colItem, index) in tabsColumns" :tab="colItem.label" :key="index">
<BasicForm :ref="(el) => tabsFormRefs[index] = el" @register="registerForm" :key="index"> <BasicForm
:ref="(el) => (tabsFormRefs[index] = el)"
@register="registerForm"
:key="index"
>
<template #CardGroup> <template #CardGroup>
<CardGourp <CardGourp
v-if="cardGroupData.length > 0 && cardGroupData[index]" v-if="cardGroupData.length > 0 && cardGroupData[index]"
@ -122,7 +126,7 @@
const subTableRef = ref<any>(); const subTableRef = ref<any>();
const cardGroupData = ref([]); const cardGroupData = ref([]);
const cardGourpFormData = ref({}); const cardGourpFormData = ref({});
const tabsFormRefs = ref<any>([]) const tabsFormRefs = ref<any>([]);
subTableDataStore.clearGoupData(); subTableDataStore.clearGoupData();
const nowTime = ref(dayjs().format('YYYY-MM-DD HH:mm:ss')); const nowTime = ref(dayjs().format('YYYY-MM-DD HH:mm:ss'));
const userName = localStorage.getItem('fireUserLoginName'); const userName = localStorage.getItem('fireUserLoginName');
@ -373,8 +377,6 @@
async function getFormDetail(element) { async function getFormDetail(element) {
var instance = props.instanceInfo; var instance = props.instanceInfo;
if (!instance) return; if (!instance) return;
console.log('instanceInfo', instance);
console.log(!instance.parentPkeyValue);
const querys = { const querys = {
id: props.formVerison, id: props.formVerison,
key: keyValue.value, key: keyValue.value,
@ -383,6 +385,9 @@
const data = await functionGetFormDataFormScheme(querys); const data = await functionGetFormDataFormScheme(querys);
let obj = new Object(); let obj = new Object();
for (var i in data) { for (var i in data) {
//
data[i] = [data[i][0]];
subTableDB.value.forEach((element) => { subTableDB.value.forEach((element) => {
if (element.type == 'chlid') { if (element.type == 'chlid') {
subTableDataStore.getTableData.forEach((element) => { subTableDataStore.getTableData.forEach((element) => {
@ -443,7 +448,7 @@
// todo // todo
cardItemKeyList.forEach((item) => { cardItemKeyList.forEach((item) => {
if (item.indexOf('grid') !== -1) { if (item.indexOf('grid') !== -1) {
cardValues.value[cardItem][item] = infoUseSubTableData.value; cardValues.value[cardItem][item] = infoUseSubTableData.value.reverse();
} }
}); });
}); });
@ -484,7 +489,7 @@
} }
let resultObj = {}; let resultObj = {};
let values; let values;
if(tabsColumns.length > 1){ if (tabsColumns.length > 1) {
resultObj = tabsFormRefs[activeTabsKey.value].getFieldsValue(); resultObj = tabsFormRefs[activeTabsKey.value].getFieldsValue();
tabsFormRefs[activeTabsKey.value].setFieldsValue({ tabsFormRefs[activeTabsKey.value].setFieldsValue({
...resultObj, ...resultObj,
@ -492,7 +497,7 @@
}); });
await tabsFormRefs[activeTabsKey.value].validate(); await tabsFormRefs[activeTabsKey.value].validate();
values = tabsFormRefs[activeTabsKey.value].getFieldsValue(); values = tabsFormRefs[activeTabsKey.value].getFieldsValue();
}else{ } else {
resultObj = getFieldsValue(); resultObj = getFieldsValue();
setFieldsValue({ setFieldsValue({
...resultObj, ...resultObj,