From 72d29a847bda8db54c0823ce35f8ad9383e8b35d Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期三, 16 十一月 2022 10:46:35 +0800
Subject: [PATCH] 1.班组、人员工资报表求和统计

---
 src/views/bbgl/rygz.vue |   47 +++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/src/views/bbgl/rygz.vue b/src/views/bbgl/rygz.vue
index c4835c3..974da2e 100644
--- a/src/views/bbgl/rygz.vue
+++ b/src/views/bbgl/rygz.vue
@@ -90,6 +90,8 @@
           :data="tableData"
           :height="isExpandForm?tableHeight:(tableHeight+40)+'px'"
           border
+          :summary-method="getSummaries"
+          show-summary
           :row-class-name="tableRowClassName"
           :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}"
           highlight-current-row
@@ -164,13 +166,13 @@
             sortable="custom"
           />
           <el-table-column
-            prop="good_qty"
+            prop="report_qty"
             label="鎶ュ伐鏁伴噺"
             width="110"
             sortable="custom"
           >
             <template slot-scope="{row}">
-              <div v-if="row.good_qty">{{ row.good_qty }}</div>
+              <div v-if="row.report_qty">{{ row.report_qty }}</div>
               <div v-else>/</div>
             </template>
           </el-table-column>
@@ -181,23 +183,23 @@
             sortable="custom"
           >
             <template slot-scope="{row}">
-              <div v-if="row.unprice">{{ row.unprice }}鍏�</div>
+              <div v-if="row.unprice">{{ row.unprice }} 鍏�</div>
               <div v-else>/</div>
             </template>
           </el-table-column>
           <el-table-column
             prop="usermoney"
-            label="鐝粍璁颁欢宸ヨ祫"
+            label="涓汉璁颁欢宸ヨ祫"
             width="130"
             sortable="custom"
           >
             <template slot-scope="{row}">
-              <div v-if="row.usermoney">{{ row.usermoney }}鍏�</div>
+              <div v-if="row.usermoney">{{ row.usermoney }} 鍏�</div>
               <div v-else>/</div>
             </template>
           </el-table-column>
           <el-table-column
-            prop="lm_user"
+            prop="username"
             label="鎶ュ伐浜哄憳"
             width="110"
             sortable="custom"
@@ -352,6 +354,39 @@
         }
       })
     },
+    getSummaries(param) {
+      const { columns, data } = param
+      const sums = []
+
+      columns.forEach((column, index) => {
+        if (index === 10) {
+          sums[index] = '鎬讳环'
+          return
+        }
+        const values = data.map(item => Number(item[column.property]))
+        if (column.property === 'usermoney') {
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr)
+            if (!isNaN(value)) {
+              return prev + curr
+            } else {
+              return prev
+            }
+          }, 0)
+
+          sums[index] += ' 鍏�'
+        } else {
+          // sums[index] = 'N/A'
+          sums[index] = ' '
+        }
+      })
+
+      this.$nextTick(() => {
+        this.$refs.tableDataRef.doLayout()
+      })
+
+      return sums
+    },
     async getPeopleSalaryReportSearch() {
       let tempDate = this.form.reportdate
       if (tempDate.length > 0) {

--
Gitblit v1.9.3