11
WXL
2024-07-11 f06564ebbd94e8cca0874604217dfd03f60aa245
src/views/project/fund/performancedetails/index.vue
@@ -141,6 +141,8 @@
            max-height="800"
            border
            highlight-current-row
            :summary-method="getSummaries"
            show-summary
          >
            <el-table-column
              prop="orderno"
@@ -203,8 +205,8 @@
                ></el-cascader> -->
              </template>
            </el-table-column>
            <el-table-column
              prop="amount"
            <!-- <el-table-column
              prop="jxrq"
              align="center"
              label="绩效日期"
              width="260"
@@ -217,7 +219,7 @@
                >
                </el-date-picker>
              </template>
            </el-table-column>
            </el-table-column> -->
            <el-table-column
              prop="amount"
              align="center"
@@ -228,11 +230,21 @@
                <el-input
                  v-model="scope.row.amount"
                  placeholder="税前金额"
                  @blur="
                    val => {
                      calculateTax(scope.row, 'A');
                    }
                  "
                  @blur="chargeSum"
                />
              </template>
            </el-table-column>
            <el-table-column
              prop="taxamount"
              align="center"
              label="扣税金额"
              width="120"
            >
              <template slot-scope="scope">
                <el-input
                  @blur="chargeSum"
                  v-model="scope.row.taxamount"
                  placeholder="扣税金额"
                />
              </template>
            </el-table-column>
@@ -246,27 +258,11 @@
                <el-input
                  v-model="scope.row.taxedamount"
                  placeholder="税后金额"
                  @blur="
                    val => {
                      calculateTax(scope.row, 'B');
                    }
                  "
                  @blur="queenchargeSum"
                />
              </template>
            </el-table-column>
            <el-table-column
              prop="taxamount"
              align="center"
              label="扣税金额"
              width="120"
            >
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row.taxamount"
                  placeholder="扣税金额"
                />
              </template>
            </el-table-column>
            <el-table-column
              prop="beneficiaryname"
              align="center"
@@ -2050,17 +2046,37 @@
      }
    },
    //计算金额
    calculateTax(row, type) {
    //税前扣税算税后
    chargeSum(row, type) {
      let targetValue = 0;
      for (let i = 0; i < this.rbDetails.length; i++) {
        if (!this.rbDetails[i].amount) {
          this.rbDetails[i].amount = 0;
        }
        if (!this.rbDetails[i].taxamount) {
          this.rbDetails[i].taxamount = 0;
        }
        this.rbDetails[i].taxedamount =
          parseFloat(this.rbDetails[i].amount) -
          parseFloat(this.rbDetails[i].taxamount);
        targetValue += parseFloat(this.rbDetails[i].amount); // 假设每个对象中的特定值存储在'specificValue'属性下
      }
      console.log(targetValue, "合计");
      this.form.pretaxcost = targetValue;
    },
    //税后扣税算税前
    queenchargeSum(row, type) {
      for (let i = 0; i < this.rbDetails.length; i++) {
        if (!this.rbDetails[i].amount) {
          this.rbDetails[i].amount = 0;
        }
        if (!this.rbDetails[i].taxamount) {
          this.rbDetails[i].taxamount = 0;
        }
        this.rbDetails[i].amount =
          parseFloat(this.rbDetails[i].taxamount) +
          parseFloat(this.rbDetails[i].taxedamount);
      }
    },
    unsave() {
@@ -2807,6 +2823,48 @@
    Downloadfile(row) {
      console.log(row);
      window.location.href = this.Networkheader + "/prod-api" + row.url;
    },
    //表格合计
    getSummaries(param) {
      const { columns, data } = param;
      const sums = [];
      var columnnames = [
        "applytype",
        "itemid",
        // "jxrq",
        "beneficiaryname",
        "idcardno",
        "depositbank",
        "bankcardno",
        "remark"
      ];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = "合计";
          return;
        }
        //去除部分字段计算
        if (columnnames.indexOf(column.property) > -1) {
          return;
        }
        const values = data.map(item => Number(item[column.property]));
        if (!values.every(value => isNaN(value))) {
          sums[index] = values.reduce((prev, curr) => {
            const value = Number(curr);
            if (!isNaN(value)) {
              return prev + curr;
            } else {
              return prev;
            }
          }, 0);
          sums[index] = sums[index].toFixed(2); // 保留2位小数,解决小数合计列;
        } else {
          sums[index] = "";
        }
      });
      return sums;
    }
  },