loulijun2021
2022-11-30 7d540071e539dda17f0e11859958167d0c1a7615
src/views/bbgl/bzgz.vue
@@ -1,8 +1,28 @@
<template>
  <div>
    <div class="body" :style="{height:mainHeight+'px'}">
      <div class="bodyTopButtonGroup">
      <div class="bodyTopButtonGroup" style="justify-content: space-between">
        <el-button type="primary" icon="el-icon-download" @click="download">导出</el-button>
        <div class="topRight" style="display: flex;align-items: center">
          <!--          <div style="font-size: 14px;margin-right: 15px;color: #a7a7a7">剔除工序</div>-->
          <el-select
            v-model="form.rejectstepcode"
            style="width: 170px;"
            multiple
            placeholder="请选择剔除工序"
            collapse-tags
            @change="rejectstepcodeChange"
          >
            <el-option
              v-for="item in StepSelectArr"
              :key="item.stepcode"
              :label="item.stepname"
              :value="item.stepcode"
            />
          </el-select>
        </div>
      </div>
      <div class="bodyTopFormGroup">
@@ -42,7 +62,7 @@
            <el-form-item v-show="isExpandForm" label="操作人员" style=" display: flex;">
              <el-input v-model="form.username" style="width: 200px" placeholder="请输入" />
            </el-form-item>
            <el-form-item v-show="isExpandForm" label="操作时间" style="display: flex;align-items: center">
            <el-form-item v-show="isExpandForm" label="报工时间" style="display: flex;align-items: center">
              <el-date-picker
                v-model="form.operdate"
                type="daterange"
@@ -92,6 +112,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
@@ -178,7 +200,7 @@
            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>
@@ -189,14 +211,20 @@
            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"
            label="操作人员"
            label="报工人员"
            width="110"
            sortable="custom"
          />
          <el-table-column
            prop="report_date"
            label="报工时间"
            width="160"
            sortable="custom"
          />
@@ -287,6 +315,7 @@
  GroupSalaryReportSearchUser
} from '@/api/bbgl'
import { MesOrderStepReportSelectUserGroup } from '@/api/scgl'
import { StepSelect } from '@/api/zzmx'
export default {
  name: 'Zzjg',
@@ -299,6 +328,7 @@
      isExpandForm: false,
      mainHeight: 0,
      tableHeight: 0,
      StepSelectArr: [], // 剔除工序数组
      form: {
        wocode: '', // 工单编号
        partcode: '', // 产品编码
@@ -308,6 +338,7 @@
        groupcode: '', // 生产班组
        username: '', // 操作人员
        operdate: '', // 操作时间
        rejectstepcode: [], // 剔除工序(固定薪资工序不参与计算
        prop: 'lm_date', // 排序字段
        order: 'desc', // 排序字段
        page: 1, // 第几页
@@ -317,7 +348,7 @@
      total: 10,
      tableData: [],
      dialogVisible: false,
      tagArr: [], //
      tagArr: [],
      dialogForm: {
        OrgType: '',
        OrgCode: '',
@@ -363,8 +394,49 @@
      this.getGroupSalaryReportSearch().then(res => {
        if (res.code === '200') {
          this.getMesOrderStepReportSelectUserGroup()
          this.getStepSelect()
        }
      })
    },
    // 获取工序下拉接口
    async  getStepSelect() {
      const { data: res } = await StepSelect()
      this.StepSelectArr = res
    },
    // 剔除工序下拉选项值变化时
    rejectstepcodeChange(val) {
      this.getGroupSalaryReportSearch()
    },
    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 getGroupSalaryReportSearch() {
      let tempDate = this.form.operdate
@@ -380,13 +452,13 @@
        groupcode: this.form.groupcode,
        username: this.form.username,
        operdate: tempDate,
        rejectstepcode: this.form.rejectstepcode.join(','),
        prop: this.form.prop,
        order: this.form.order,
        page: this.form.page,
        rows: this.form.rows
      }
      console.log(data, 1)
      const res = await GroupSalaryReportSearch(data)
      this.tableData = res.data
      this.total = res.count
@@ -674,6 +746,19 @@
    height: 100% !important;
  }
}
.topRight ::v-deep {
  input::-webkit-input-placeholder {
    color: $main_color;
  }
  //input::-moz-input-placeholder {
  //  color: rgba(0, 204, 254, 1);
  //}
  input::-ms-input-placeholder {
    color: $main_color;
  }
}
</style>
<style>