src/views/purchaseManage/purchase/components/AddPurchase.vue
@@ -231,11 +231,13 @@
              :detailEnter="editCommonConfig.detailEnter"
              :show-summary="showSummary"
              :recalculateShow="false"
              :addTypeIdMultiple="true"
              :product-table-list="productTableList"
              sign="purchase"
              @inputContent="inputContent"
              @getSummaries="getSummaries"
              @addProductClick="addProductClick"
              @getSelectArray="getSelectArray"
              @emptyProductClick="emptyProductClick"
              @clearupProduct="clearupProduct"
              @rowClick="rowClick"
@@ -393,7 +395,8 @@
          },
          { validator: this.validatorNumThree, trigger: "change" }
        ],
        number: [{ required: true, validator: this.validateCheckCode, trigger: ["change", "blur"] }]
        number: [{ required: true, validator: this.validateCheckCode, trigger: ["change", "blur"] }],
        warehouse: [{ required: true, message: "请选择", trigger: "change" }]
      },
      productTableList: {},
      showSummary: {
@@ -616,6 +619,8 @@
                  if (res.code === 200) {
                    this.$message.success("创建成功")
                    this.$parent.getData()
                  } else {
                    this.$message.error(res.msg)
                  }
                })
              }
@@ -788,7 +793,7 @@
            purchaseId: 0,
            productId: Number(this.productId),
            productIndex: this.productIndex,
            amount: 0,
            amount: 1,
            name: "",
            number: "",
            price: 0,
@@ -813,6 +818,7 @@
        supplierId: undefined,
        tableData: this.tableData,
        disabled: this.editConfig.isDisabled,
        isReturn: true,
        tableColumn: [
          {
            label: "产品名称",
@@ -828,7 +834,7 @@
          { label: "数量", prop: "amount", inputNumber: true, disabled: this.editConfig.isDisabled },
          {
            label: "采购单价",
            prop: "price",
            prop: "purchasePrice",
            inputFloat: true,
            isRequird: true,
            disabled: this.editConfig.isDisabled
@@ -841,12 +847,10 @@
    },
    // 产品列表输入
    inputContent(val, prop, row) {
      // this.productId = row.productId;
      this.productIndex = row.productIndex
      let num = 0
      this.tableData.map((item) => {
        num += item.amount
        if (item.productIndex === row.productIndex) {
        if (item.number === row.number) {
          item[prop] = val
        }
      })
@@ -880,18 +884,35 @@
    },
    // 产品新增
    addProductClick() {
      this.productIndex++
      this.tableData.push({
        productIndex: this.productIndex,
        productId: "",
        id: 0,
        amount: 0,
        desc: "",
        name: "",
        number: "",
        price: 0,
        total: 0
      })
      // this.productIndex++
      // this.tableData.push({
      //   productIndex: this.productIndex,
      //   productId: "",
      //   id: 0,
      //   amount: 0,
      //   desc: "",
      //   name: "",
      //   number: "",
      //   price: 0,
      //   total: 0
      // })
      // this.showSummary.show = true
    },
    // 新增方式修改
    getSelectArray(val, index) {
      console.log(val, "ddd99999")
      if (this.tableData.length == 1 && this.tableData[0].number.length == 0) {
        this.tableData = []
      }
      if (index < this.tableData.length) {
        this.tableData.splice(index, 1)
        val.map((item, ind) => {
          this.tableData.splice(index + ind, 0, item)
        })
      } else {
        this.tableData = this.tableData.concat(val)
      }
      this.productTableList.tableData = this.tableData
      this.showSummary.show = true
    },
    //  产品清空