【表单信息】卡片组信息回显

zzq
Zhufu 2024-06-08 08:43:52 +08:00
parent c29319fd54
commit fe421eb3ba
1 changed files with 32 additions and 25 deletions

View File

@ -31,7 +31,7 @@
<script lang="ts" setup>
import { BasicForm, useForm } from '@/components/Form';
import { CardGourp } from './index';
import { ref, watch } from 'vue';
import { ref, watch, nextTick } from 'vue';
import { subTableStore } from '@/store/modules/subTable';
import dayjs from 'dayjs';
@ -86,6 +86,30 @@
},
{ deep: true },
);
const onTabChange = (event, field) => {
let value = event.target.value
subTableDataStore.setOneGroupData(field, value)
noTitleKey.value = value;
var currentIndex = (childGourp.value || []).findIndex((element) => element.index === value);
if (currentIndex == -1) {
childItem.value = {};
} else {
childItem.value = childGourp.value[currentIndex];
}
formColumns.forEach((element) => {
element.show = false;
updateSchema([{ field: element.field, show: false }]);
if (element.index == value) {
element.show = true;
updateSchema([{ field: element.field, show: true }]);
}
});
setTimeout(() => {
resetFields();
setFieldsValue(subTableDataStore.getGroupData);
}, 10);
};
if (tableData.componentProps) {
tableData.componentProps.options.forEach((element, index) => {
tabListNoTitle.value.push({
@ -121,34 +145,17 @@
}
});
});
nextTick(() => {
if(Object.keys(subTableDataStore.getGroupData).includes(tableData.field)){
noTitleKey.value = subTableDataStore.getGroupData[tableData.field].toString()
onTabChange({target:{value: noTitleKey.value}},tableData.field)
}
})
}
setTimeout(() => {
resetFields();
}, 10);
const onTabChange = (event, field) => {
let value = event.target.value
subTableDataStore.setOneGroupData(field, value)
noTitleKey.value = value;
var currentIndex = (childGourp.value || []).findIndex((element) => element.index === value);
console.log(currentIndex);
if (currentIndex == -1) {
childItem.value = {};
} else {
childItem.value = childGourp.value[currentIndex];
}
formColumns.forEach((element) => {
element.show = false;
updateSchema([{ field: element.field, show: false }]);
if (element.index == value) {
element.show = true;
updateSchema([{ field: element.field, show: true }]);
}
});
setTimeout(() => {
resetFields();
setFieldsValue(subTableDataStore.getGroupData);
}, 10);
};
function changeForm() {
subTableDataStore.setGroupData(getFieldsValue());
}