Explorar o código

选择年份修改

duy hai 6 meses
pai
achega
ea97cd2a3e
Modificáronse 1 ficheiros con 10 adicións e 13 borrados
  1. 10 13
      src/renderer/src/views/project/modules/project-list.vue

+ 10 - 13
src/renderer/src/views/project/modules/project-list.vue

@@ -389,26 +389,20 @@ const getDetailData = async (id) => {
     //设置默认数据
     if (list.length > 0) {
         let isIndex = false
-        // for (let i = 0; i < list.length; i++) {
-        //     const planYear = list[i].planYear.toString()
-        //     if (planYear === currentYear.value) {
-        //         yearIndex.value = i
-        //         yearKey.value = list[i].planYear
-        //       console.log( yearKey.value, ' yearKey.value')
-              
-              
-        //         isIndex = true
-        //     }
-            
-        // }
         for (let i = 0; i < list.length; i++) {
             const planYear = list[i].planYear.toString()
             if (planYear === planYearData.value) {
-                yearKey.value = planYearData.value
+                yearKey.value = list[i].planYear
                 yearIndex.value = i
                 isIndex = true
                 break
+            } else if (planYearData.value > parseInt( Math.max(...list.map(item => parseInt(item.planYear))))) {
+                yearKey.value = list[list.length - 1].planYear
+                yearIndex.value = list.length - 1
+                isIndex = true
             }
+         
+        
         }
         //默认值
         if (!isIndex) {
@@ -417,6 +411,9 @@ const getDetailData = async (id) => {
            
             
         }
+    
+            
+            
     } else {
         yearIndex.value = -1
         yearKey.value = null