haoxuan
2023-08-25 641ce71b7b29c32105c82619fa7abfb9b2f38e3b
src/components/makepager/CommonFormTableView.vue
@@ -1,13 +1,8 @@
<template>
  <div class="page-view">
    <el-form ref="form" :model="tableList" :show-message="false" label-position="right">
      <el-table
        :data="tableList.tableData"
        :show-summary="showSummary.show"
        :summary-method="getSummaries"
        :span-method="arraySpanMethod"
        style="width: 100%"
      >
      <el-table :data="tableList.tableData" style="width: 100%">
        <el-table-column type="index" label="编号" width="50" align="center"></el-table-column>
        <el-table-column
          v-for="(item, i) in tableList.tableColumn"
          :key="i"
@@ -127,25 +122,13 @@
    </el-form>
    <div v-if="!detailEnter" style="margin: 10px">
      <el-button size="small" type="primary" @click="add">新增</el-button>
      <!-- <el-button size="small" type="primary" disabled>导入明细</el-button> -->
      <el-button size="small" type="primary" @click="empty">清空</el-button>
      <el-button size="small" v-if="recalculateShow" type="primary" @click="recalculate" :disabled="isRecalculate ? false : true"
        >重算</el-button
      >
    </div>
    <div v-if="showSummary.total || showSummary.refundable" style="height: 42px; line-height: 42px">
      <el-row :gutter="10">
        <el-col v-if="showSummary.total" :span="2" :offset="22">
          <span style="font-weight: bold">合计</span>
          <span style="margin-left: 10px">{{ total }}</span>
        </el-col>
        <el-col v-if="showSummary.refundable" :span="2" :offset="22">
          <span style="font-weight: bold">应退款</span>
          <span style="margin-left: 10px">0.00</span>
        </el-col>
      </el-row>
    </div>
    <!-- 合同订单 -->
    <!-- 产品名称 -->
    <SelectCommonDialog
      v-if="editSelCommonConfig.editVisible"
      :edit-common-config="editSelCommonConfig"
@@ -297,6 +280,7 @@
      })
      return sums
    },
    // 数字换行为金额显示格式
    number_format(number, decimals, dec_point, thousands_sep) {
      decimals = 2 //这里默认设置保留两位小数,也可以注释这句采用传入的参数
@@ -338,21 +322,6 @@
    empty() {
      this.isRecalculate = false
      this.$emit("emptyProductClick")
    },
    // 重算
    recalculate() {
      this.$confirm("确定要重算明细所有行?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.$emit("recalculateProductClick")
          this.tableList.tableData.map((ite) => {
            ite.total = ite.amount ? ite.amount * ite.price : 1 * ite.price
          })
        })
        .catch(() => {})
    },
    // 选择产品名称相关方法
    querySearchAsync(queryString, cb) {
@@ -412,6 +381,10 @@
        }
      })
      this.$emit("clearupProduct", this.tableList.tableData)
    },
    // 删除
    deleteClient(row) {
      this.$emit("deleteProduct", row)
    }
  }
}