This commit is contained in:
Net 2025-06-17 14:09:35 +08:00
parent 253ac80c88
commit 50de9f5794

View File

@ -118,7 +118,7 @@ const schema = reactive<FormsSchema[]>([
const formIndex = attrs.index;
if (formIndex !== undefined && education.xl[formIndex]) {
//
const endTime = education.xl[formIndex].value.gwpyjssj;
const endTime = education.xl[formIndex].value.gwrzjstime;
console.log("当前表单项数据:", education.xl[formIndex].value);
//
const years = calculatePositionYears(e.value, endTime);
@ -142,7 +142,7 @@ const schema = reactive<FormsSchema[]>([
const formIndex = attrs.index;
if (formIndex !== undefined && education.xl[formIndex]) {
//
const startTime = education.xl[formIndex].value.gwrztime;
const startTime = education.xl[formIndex].value.gwrzkstime;
console.log("当前表单项数据:", education.xl[formIndex].value);
if (startTime) {
//
@ -211,25 +211,15 @@ if (getFile.rgqkList && getFile.rgqkList.length > 0) {
return {value: item};
});
//
// 使gwrznx
nextTick(() => {
education.xl.forEach((item: any, index: number) => {
if (item.value.gwrztime) {
const years = calculatePositionYears(
item.value.gwrztime,
item.value.gwpyjssj
);
item.value.gwrznx = years;
console.log(`回显数据-表单项${index}计算结果:`, {
gwrztime: item.value.gwrztime,
gwpyjssj: item.value.gwpyjssj,
gwrznx: years,
是否为0: years === "0"
});
} else {
//
item.value.gwrznx = "";
}
console.log(`回显数据-表单项${index}数据:`, {
gwrzkstime: item.value.gwrzkstime,
gwrzjstime: item.value.gwrzjstime,
gwrznx: item.value.gwrznx, // 使
来源: "数据库回显"
});
});
//
forceUpdateKey.value++;
@ -239,15 +229,15 @@ if (getFile.rgqkList && getFile.rgqkList.length > 0) {
//
const calculateAllPositionYears = () => {
education.xl.forEach((item: any, index: number) => {
if (item.value.gwrztime) {
if (item.value.gwrzkstime) {
const years = calculatePositionYears(
item.value.gwrztime,
item.value.gwpyjssj
item.value.gwrzkstime,
item.value.gwrzjstime
);
item.value.gwrznx = years;
console.log(`表单项${index}计算结果:`, {
gwrztime: item.value.gwrztime,
gwpyjssj: item.value.gwpyjssj,
console.log(`表单项${index}计算结果:`, {
gwrzkstime: item.value.gwrzkstime,
gwrzjstime: item.value.gwrzjstime,
gwrznx: years,
是否为0: years === "0"
});
@ -285,11 +275,19 @@ function submit() {
//
onMounted(() => {
//
// 使gwrznx
if (getFile.rgqkList && getFile.rgqkList.length > 0) {
nextTick(() => {
console.log("组件挂载后处理回显数据");
calculateAllPositionYears();
console.log("组件挂载后处理回显数据直接使用数据库返回的gwrznx值");
education.xl.forEach((item: any, index: number) => {
console.log(`挂载后-表单项${index}数据:`, {
gwrzkstime: item.value.gwrzkstime,
gwrzjstime: item.value.gwrzjstime,
gwrznx: item.value.gwrznx, // 使
来源: "数据库回显-挂载后"
});
});
forceUpdateKey.value++;
});
}
});