zouyu
2025-03-18 bc44c8e3c9d85691ce3fa73ef1300a6fae46e365
src/views/business/costStatistics/index.vue
@@ -1,4 +1,8 @@
<style scoped>
.costStatistics {
  width: 100%;
  height: 100%;
}
.title {
  height: 60px;
  line-height: 60px;
@@ -49,15 +53,20 @@
</style>
<template>
  <div class="inspection_order">
    <div style="width: 100%; height: 100%">
  <div>
    <div class="costStatistics bg-1">
      <div>
        <el-row class="title">
          <el-col :span="12" style="padding-left: 20px; text-align: left"
            >费用统计</el-col
          >
          <el-col :span="12" style="text-align: right">
            <el-button size="small" type="primary">OA推送</el-button>
            <el-button
              size="small"
              type="primary"
              v-hasPermi="['business:costStatistics:OA']"
              >OA推送</el-button
            >
          </el-col>
        </el-row>
      </div>
@@ -83,8 +92,6 @@
        <div class="search_thing" style="width: 340px">
          <div class="search_label">委托单位:</div>
          <div class="search_input">
            <!--            <el-input size="small" placeholder="请输入" clearable-->
            <!--               @keyup.enter.native="refreshTable()"></el-input>-->
            <el-select
              @focus="getCompanyOptions"
              @change="refreshTable()"
@@ -109,7 +116,6 @@
            >查 询</el-button
          >
        </div>
        <!-- <div class="search_thing" style="padding-left: 70px;">总价:{{total}}</div> -->
        <div class="search_thing" style="margin-left: 50px">
          <div style="width: 100%; text-align: right">总价:</div>
          <el-statistic
@@ -125,24 +131,18 @@
            type="primary"
            @click="handleDown"
            :loading="outLoading"
            v-hasPermi="['business:costStatistics:export']"
            >导出</el-button
          >
        </div>
      </div>
      <div class="table">
        <!-- <ValueTable
          ref="ValueTable"
          :url="$api.insOrder.costStatistics"
          :componentData="componentData"
          :key="upIndex"
          @handleWeave="handleWeave"
          :column-min-width="'140'"
        /> -->
        <lims-table
          :tableData="tableData"
          :parentSpanMethod="spanMethod"
          :column="column"
          :tableLoading="tableLoading"
          :height="'calc(100vh - 270px)'"
          :height="tableHeight"
          :page="page"
          @pagination="pagination"
        ></lims-table>
@@ -178,6 +178,7 @@
  },
  data() {
    return {
      tableHeight: "",
      tableData: [],
      column: [
        {
@@ -237,12 +238,48 @@
      outLoading: false,
    };
  },
  created() {
    this.getTableHeight();
  },
  mounted() {
    this.getDates();
    this.refreshTable();
    this.entityCopy = this.HaveJson(this.entity);
  },
  methods: {
    // 合并单元格
    spanMethod({row, column, rowIndex, columnIndex}) {
      // 委托单号相同的进行一个列合并
      const mergeColumns = [1,2,8,9]
      if (
        mergeColumns.includes(columnIndex)
      ) {
        // 如果是第一行, 或者上一行数据的委托单号和当前行的委托单号不一样
        if (
          rowIndex == 0 ||
          row.entrustCode != this.tableData[rowIndex - 1].entrustCode
        ) {
          // 计算需要合并的行数
          let rowspan = 1;
          while (
            rowIndex + rowspan < this.tableData.length &&
            row.entrustCode == this.tableData[rowIndex + rowspan].entrustCode
          ) {
            rowspan++;
          }
          return [rowspan, 1];
        } else {
          return [0, 0];
        }
      } else {
        // 其他列不合并
        return [1, 1];
      }
    },
    getTableHeight() {
      const windowHeight = window.innerHeight;
      this.tableHeight = windowHeight - 50 - 46 - 60 - 80 - 60 - 32 + "";
    },
    getData() {
      this.tableLoading = true;
      let params = { ...this.page, ...this.entity };
@@ -252,15 +289,15 @@
        this.tableLoading = false;
      });
    },
    pagination({ cutPage, size }) {
      this.page.current = cutPage;
      this.page.size = size;
    pagination({ page, limit }) {
      this.page.current = page;
      this.page.size = limit;
      this.refreshTable();
    },
    handleDown() {
      let data = {
        company: this.entity.company ? this.entity.company : '',
        company: this.entity.company ? this.entity.company : "",
        startTime: this.dates[0],
        endTime: this.dates[1],
      };