Browse Source

预付款和材料调差默认显示最大的期数

Tony Kang 1 year ago
parent
commit
1ffaa8ca10
1 changed files with 4 additions and 2 deletions
  1. 4 2
      app/view/report/index.ejs

+ 4 - 2
app/view/report/index.ejs

@@ -812,9 +812,10 @@
                 break;
             }
         }
+        const maxIdx = (adList.length - 1) || 0;
         adList.forEach((advance, adIndex) => {
             let dispStr = '';
-            if (!hasMatch && adIndex === 0 || current_advance_id === advance.id) {
+            if (!hasMatch && adIndex === maxIdx || current_advance_id === advance.id) {
                 current_advance_id = advance.id;
                 $("#btnCurrentAdvancePay")[0].innerText = `第${adIndex + 1}期`;
                 dispStr = ';display:none';
@@ -830,9 +831,10 @@
     function buildMaterialSelection() {
         $("#optionSelectableMaterials").empty();
         $("#btnCurrentMaterial")[0].innerText = '';
+        const maxIdx = (MATERIAL_LIST.length - 1) || 0;
         MATERIAL_LIST.forEach((materialAdj, maIndex) => {
             let dispStr = '';
-            if (current_material_id === -1 && maIndex === 0 || current_material_id === materialAdj.id) {
+            if (current_material_id === -1 && maIndex === maxIdx || current_material_id === materialAdj.id) {
                 current_material_id = materialAdj.id;
                 $("#btnCurrentMaterial")[0].innerText = `第${maIndex + 1}期`;
                 dispStr = ';display:none';