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