songshankun
2023-09-25 c2dde74cf1067543999993b397475a5f6f32852e
src/components/makepager/TableCommonView.vue
@@ -1,17 +1,19 @@
<template>
  <div class="page-view">
  <div class="table-view">
    <el-table
      ref="table"
      border
      :data="tableList.tableInfomation"
      tooltip-effect="dark"
      :height="'calc(100% - 0px)'"
      style="width: 100%"
      :lazy="tableList.lazy"
      :show-summary="showSummary.show"
      :summary-method="getSummaries"
      :span-method="arraySpanMethod"
      @selection-change="handleSelectionChange"
      :header-cell-style="{ background: '#ECF4FF', color: '#666' }"
      :header-cell-style="{ background: '#f1f3f8', color: '#000009' , 'font-size': '12px','font-family':'PingFangSC'}"
      size="mini"
    >
      <el-table-column v-if="selectBox" type="selection" width="40"> </el-table-column>
      <el-table-column
@@ -28,13 +30,90 @@
          <span v-if="item.price">{{ "¥" + number_format(scope.row[item.prop], 2, ".", ",") }}</span>
          <div v-else-if="item.status" :class="scope.row.status">{{ scope.row[item.prop] }}</div>
          <span v-else-if="item.isTime">{{
            dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop]) === "1900-01-01 08:00:00"
            dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop]) === "1900-01-01 00:06:26"
              ? "--"
              : dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop])
          }}</span>
          <span v-else-if="item.isClick" class="sel-name" @click="selNameClick(scope.row)">{{
          <span v-else-if="item.isClick && scope.row[item.prop]" class="sel-name" @click="selNameClick(scope.row)">{{
            scope.row[item.prop]
          }}</span>
          <span v-else-if="item.isFirst">{{ scope.row[item.prop] ? "是" : "否" }}</span>
          <span
            v-else-if="item.isSalesLeadClick && scope.row[item.prop]"
            class="sel-name"
            @click="selSalesLeadClick(scope.row)"
            >{{ scope.row[item.prop] }}</span
          >
          <span
            v-else-if="item.isClientClick && scope.row[item.prop]"
            class="sel-name"
            @click="selClientClick(scope.row)"
            >{{ scope.row[item.prop] ? scope.row[item.prop] : "--" }}</span
          >
          <span
            v-else-if="item.isContactClick && scope.row[item.prop]"
            class="sel-name"
            @click="selContactsClick(scope.row)"
            >{{ scope.row[item.prop] }}</span
          >
          <span
            v-else-if="item.isMasterClick && scope.row[item.prop]"
            class="sel-name"
            @click="selMasterClick(scope.row)"
            >{{ scope.row[item.prop] }}</span
          >
          <span
            v-else-if="item.isServiceOrder && scope.row[item.prop]"
            class="sel-name"
            @click="selServiceOrderClick(scope.row)"
            >{{ scope.row[item.prop] }}</span
          >
          <span
            v-else-if="item.isCommonClick && scope.row[item.prop]"
            class="sel-name"
            @click="selCommonClick(scope.row)"
            >{{ scope.row[item.prop] }}</span
          >
          <div v-else-if="item.isProductName" class="product-view">
            <ul v-if="scope.row.products && scope.row.products.length > 0">
              <li v-for="(item, index) in scope.row.products" :key="index">
                <div :class="scope.row.products.length === 1 ? 'name-view no-bottom' : 'name-view'">
                  {{ item.name }}
                </div>
              </li>
            </ul>
            <div v-else class="no-product">{{ "--" }}</div>
          </div>
          <div v-else-if="item.isProductAmount" class="product-view">
            <ul v-if="scope.row.products && scope.row.products.length > 0">
              <li v-for="(item, index) in scope.row.products" :key="index">
                <div :class="scope.row.products.length === 1 ? 'name-view no-bottom' : 'name-view'">
                  {{ item.amount }}
                </div>
              </li>
            </ul>
            <div v-else class="no-product">{{ "--" }}</div>
          </div>
          <div v-else-if="item.isProductPrice" class="product-view">
            <ul v-if="scope.row.products && scope.row.products.length > 0">
              <li v-for="(item, index) in scope.row.products" :key="index">
                <div :class="scope.row.products.length === 1 ? 'name-view no-bottom' : 'name-view'">
                  {{ item.price }}
                </div>
              </li>
            </ul>
            <div v-else class="no-product">{{ "--" }}</div>
          </div>
          <div v-else-if="item.isProductTotal" class="product-view">
            <ul v-if="scope.row.products && scope.row.products.length > 0">
              <li v-for="(item, index) in scope.row.products" :key="index">
                <div :class="scope.row.products.length === 1 ? 'name-view no-bottom' : 'name-view'">
                  {{ item.total }}
                </div>
              </li>
            </ul>
            <div v-else class="no-product">{{ "--" }}</div>
          </div>
          <span v-else>{{ scope.row[item.prop] ? scope.row[item.prop] : "--" }}</span>
        </template>
      </el-table-column>
@@ -127,6 +206,37 @@
              }
            }, 0)
            sums[index + 1]
            if (column.property === "taxUnitPrice") {
              let sumPrice = 0
              this.tableList.tableInfomation.map((item) => {
                item.products.map((val) => {
                  console.log(val.price)
                  sumPrice += parseFloat(val.price)
                })
              })
              console.log((sums[index + 1] = sumPrice))
              console.log(sumPrice)
            }
            if (column.property === "priceTax") {
              let sumPrice = 0
              this.tableList.tableInfomation.map((item) => {
                item.products.map((val) => {
                  console.log(val.price)
                  sumPrice += parseFloat(val.total)
                })
              })
              sums[index + 1] = sumPrice
            }
            if (column.property === "productAmount") {
              let sumPrice = 0
              this.tableList.tableInfomation.map((item) => {
                item.products.map((val) => {
                  console.log(val.price)
                  sumPrice += parseFloat(val.amount)
                })
              })
              sums[index + 1] = sumPrice
            }
          }
        })
        // console.log(sums)
@@ -182,7 +292,32 @@
      }
      return fmt
    },
    // 新建编辑选择弹窗
    selNameClick(row) {
      this.$emit("selCommonClick", row)
    },
    // 销售线索
    selSalesLeadClick(row) {
      this.$emit("selSalesLeadClick", row)
    },
    // 客户名称
    selClientClick(row) {
      this.$emit("selClientClick", row)
    },
    // 联系人姓名
    selContactsClick(row) {
      this.$emit("selContactsClick", row)
    },
    // 销售总单
    selMasterClick(row) {
      this.$emit("selMasterClick", row)
    },
    // 客户服务单
    selServiceOrderClick(row) {
      this.$emit("selServiceOrderClick", row)
    },
    // 公共(销售机会、报价单、销售总单、销售子单。。。)
    selCommonClick(row) {
      this.$emit("selCommonClick", row)
    }
  }
@@ -191,10 +326,9 @@
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.page-view {
  margin-top: 20px;
  margin-right: 10px;
  margin-bottom: 40px;
.table-view {
  position: relative;
  height: 100%;
  .blue {
    width: 70px;
    text-align: center;
@@ -206,11 +340,62 @@
    color: $color-primary;
    cursor: pointer;
  }
  .product-view {
    // background: #cc7d7d;
    margin-left: -10px;
    margin-right: -11px;
    li {
      height: 57px;
      line-height: 57px;
      .name-view {
        padding-left: 10px;
        border-bottom: 1px solid #ebeef5;
      }
      .no-bottom {
        border-bottom: 0;
      }
    }
    .no-product {
      height: 57px;
      line-height: 57px;
    }
  }
}
::v-deep {
  .el-table__footer-wrapper tbody td.el-table__cell {
    background-color: #fff;
    text-align: right;
  .el-table__footer-wrapper {
    tbody td.el-table__cell {
      background-color: #fff;
      font-weight: bold;
    }
  }
}
::v-deep .el-table .cell {
  font-size: 12px;
  line-height: 17px;
  font-family: PingFangSC;
  color: rgba(0, 0, 0, 0.9);
  .el-button--text {
    width: auto;
    height: auto;
    font-family: PingFangSC-Medium, sans-serif;
  }
}
::v-deep .el-table .el-table__cell {
  padding: 6px 0 !important;
  height: 35px;
  text-align: center;
}
::v-deep{
  .el-table .cell .el-button--text.el-button--small{
    padding: 4px 0;
  }
}
::v-deep .el-table .el-table__cell {
  padding: 6px 0 !important;
  height: 35px;
  text-align: center;
}
</style>