Explorar el Código

部门预算计划统计

duy hace 2 años
padre
commit
bb1d6b8f33
Se han modificado 1 ficheros con 10 adiciones y 8 borrados
  1. 10 8
      src/views/static/components/tab-decost.vue

+ 10 - 8
src/views/static/components/tab-decost.vue

@@ -75,13 +75,10 @@ const budgetAndPracticalByDept = async () => {
 const getTableData = (res)=>{
   let tablearr = []
   res.forEach((ele)=>{
-    // tablearr.push(getBlist(ele.budgetList))
-    let Blist = getBlist(ele.budgetList)
+   let Blist = getBlist(ele.budgetList)
     let Plist = getPlist(ele.costList)
     let allList = Object.assign(Blist, Plist)
       tablearr.push(allList)
-   
-  
   })
   // return tablearr
   res.forEach((item, index)=>{
@@ -98,10 +95,13 @@ const getTableData = (res)=>{
 
   const getBlist = (arr)=>{
     let a = {}
-      arr.forEach((ele)=>{
+      arr.forEach((ele, index)=>{
           for (let i = 0;i < arr.length;i++) {
             let b = 'budget' + i//每个属性的属性名,不一样
-            a[b] = ele
+            if (index === i) {
+              a[b] = ele
+            } 
+            
           
           }
       })
@@ -109,10 +109,12 @@ const getTableData = (res)=>{
   }
   const getPlist = (arr)=>{
     let a = {}
-      arr.forEach((ele)=>{
+      arr.forEach((ele, index)=>{
           for (let i = 0;i < arr.length;i++) {
             let b = 'practical' + i//每个属性的属性名,不一样
-            a[b] = ele
+            if (index === i) {
+              a[b] = ele
+            } 
           
           }
       })