Prechádzať zdrojové kódy

⚙️ 修改细节问题

快乐的梦鱼 3 dní pred
rodič
commit
91c48a83b5

+ 3 - 1
src/pages/collect/assessment/argeement-sign.vue

@@ -217,8 +217,10 @@ const loader = useSimpleDataLoader(async () => {
     userId: authStore.userInfo?.id,
     year: new Date().getFullYear(),
   });
+  const currentYear = new Date().getFullYear();
   if (list.data.length > 0) {
-    const detail = await AssessmentContentApi.getAgreementDetail(list.data[0].id);
+    const currentYearItem = list.data.find((item) => item.year === currentYear);
+    const detail = await AssessmentContentApi.getAgreementDetail(currentYearItem?.id || list.data[0].id);
     currentAgreement.value = detail;
     partyAStampDate.value = { year: '', month: '', day: '' };
     partyBSignDate.value = { year: detail.updatetime.getFullYear().toString(), month: (detail.updatetime.getMonth() + 1).toString(), day: detail.updatetime.getDate().toString() };

+ 5 - 0
src/pages/collect/assessment/components/EvaluationFormBlock.vue

@@ -93,6 +93,7 @@ function getCheckedItemCount(id: number) {
 function setCheckedItem(checkItem: CheckItemInfo, childItem: CheckItemInfo, count: number|boolean) {
   if (!props.currentForm)
     return;
+  console.log('setCheckedItem', checkItem, childItem, count);
   if (typeof count === 'boolean') {
     count = count ? 1 : 0;
   }
@@ -115,6 +116,10 @@ function setCheckedItem(checkItem: CheckItemInfo, childItem: CheckItemInfo, coun
         if (allChildren.includes(item.id) && item.id !== childItem.id)
           item.count = 0;
       });
+      for (let i = props.currentFormCheckItems.length - 1; i >= 0; i--) {
+        if (props.currentFormCheckItems[i].count === 0)
+          props.currentFormCheckItems.splice(i, 1);
+      }
       break;
     }
   }

+ 4 - 2
src/pages/collect/assessment/evaluation-form.vue

@@ -390,12 +390,14 @@ const loader = useSimpleDataLoader(async () => {
     await loadAnnexList();
     return;
   }
+  const currentYear = new Date().getFullYear();
   const list = await AssessmentContentApi.getSelfAssessmentList({
     userId: authStore.userInfo?.id,
-    year: new Date().getFullYear(),
+    year: currentYear,
   });
   if (list.data.length > 0) {
-    const detail = await AssessmentContentApi.getSelfAssessmentDetail(list.data[0].id);
+    const currentYearItem = list.data.find((item) => item.year === currentYear);
+    const detail = await AssessmentContentApi.getSelfAssessmentDetail(currentYearItem?.id || list.data[0].id);
     currentForm.value = detail;
     await loadAnnexList();
     await loadCheckItems();