loulijun2021
2022-11-16 72d29a847bda8db54c0823ce35f8ad9383e8b35d
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) {