haoxuan
2023-11-01 83fe183a48dd08242d61788fa982e36d81b97727
src/components/makepager/CommonFormTableView.vue
@@ -2,12 +2,17 @@
  <div class="page-view">
    <el-form ref="form" :model="tableList" :show-message="false" label-position="right">
      <el-table
        ref="fromTable"
        :data="tableList.tableData"
        :show-summary="showSummary.show"
        :summary-method="getSummaries"
        :span-method="arraySpanMethod"
        style="width: 100%"
        @selection-change="handleSelectionChange"
        :row-key="(row) => row.productId"
      >
        <el-table-column v-if="selectBox" type="selection" :reserve-selection="true" width="40" align="center">
        </el-table-column>
        <el-table-column v-if="tableList.isReturn" type="index" label="#" width="50" align="center"></el-table-column>
        <el-table-column
          v-for="(item, i) in tableList.tableColumn"
@@ -125,9 +130,30 @@
              </el-form-item>
              <span v-else>{{ scope.row[item.prop] }}</span>
            </template>
            <el-form-item
              v-else-if="item.inputNumber && selectBox"
              label=" "
              :prop="'tableData.' + scope.$index + '.' + item.prop"
              :rules="[{ required: item.isRequird ? true : false, message: '输入不能为空' }]"
            >
              <el-input-number
                v-model="scope.row[item.prop]"
                placeholder=""
                :min="0"
                :controls="false"
                size="mini"
                style="width: 100%; margin-right: 5px"
                @change="
                  (val) => {
                    commonInputChange(val, item.prop, scope.row)
                  }
                "
              ></el-input-number>
            </el-form-item>
            <span v-else style="text-align: right">{{ scope.row[item.prop] }}</span>
          </template>
        </el-table-column>
        <slot name="tableButton" />
      </el-table>
    </el-form>
    <div v-if="!detailEnter" style="margin: 10px">
@@ -138,13 +164,13 @@
        >重算</el-button
      >
    </div>
    <div v-if="showSummary.total || showSummary.refundable" style="height: 42px; line-height: 42px">
    <div v-if="false && (showSummary.total || showSummary.refundable)" style="height: 42px; line-height: 42px">
      <el-row :gutter="10">
        <el-col v-if="showSummary.total" :span="2" :offset="22">
        <el-col v-if="showSummary.total" :span="3" :offset="21">
          <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">
        <el-col v-if="showSummary.refundable" :span="3" :offset="21">
          <span style="font-weight: bold">应退款</span>
          <span style="margin-left: 10px">0.00</span>
        </el-col>
@@ -167,6 +193,10 @@
  components: { SelectCommonDialog },
  props: {
    detailEnter: {
      type: Boolean,
      default: false
    },
    selectBox: {
      type: Boolean,
      default: false
    },
@@ -211,7 +241,9 @@
    }
  },
  created() {
    this.getProductList()
    if (!this.selectBox) {
      this.getProductList()
    }
    this.tableList = this.productTableList
    if (this.tableList.tableData.length === 1 && this.tableList.tableData[0].name === "") {
      this.isRecalculate = false
@@ -229,10 +261,10 @@
        page: 1,
        pageSize: 5
      }).then((res) => {
        console.log(res.data)
        if (res.data.code === 200) {
          if (res.data.data.data && res.data.data.data.length > 0) {
            this.productList = res.data.data.data
        console.log(res, "产品名称")
        if (res.code === 200) {
          if (res.data.data && res.data.data.length > 0) {
            this.productList = res.data.data
          }
        }
      })
@@ -240,6 +272,7 @@
    handleReserve(row) {
      return row._id ? row._id : row.id
    },
    // 多选
    handleSelectionChange(val) {
      this.$emit("getSelectArray", val)
    },
@@ -420,6 +453,17 @@
      })
      this.$emit("clearupProduct", this.tableList.tableData)
    }
    // 多选设置已选中
    // toggleSelection(rows) {
    //   console.log("88888888888888888888888888888888888888888")
    //   console.log(rows)
    //   if (rows) {
    //     rows.forEach((row) => {
    //       this.$refs.fromTable.toggleRowSelection(row, true)
    //       console.log(row)
    //     })
    //   }
    // }
  }
}
</script>
@@ -456,7 +500,8 @@
    padding: 0 5px;
  }
  .el-input__inner {
    text-align: left;
    // text-align: left;
    text-align: center !important;
  }
}
</style>