yangfeng
2024-02-27 441f8436a70c22fba6f25154f2f38a072c85b76b
src/views/service/serviceContract/AddServiceContractDialog.vue
@@ -368,9 +368,11 @@
          <div class="product-view">
            <CommonFormTableView
              :show-summary="showSummary"
              :addTypeIdMultiple="true"
              :product-table-list="productTableList"
              @inputContent="inputContent"
              @addProductClick="addProductClick"
              @getSelectArray="getSelectArray"
              @emptyProductClick="emptyProductClick"
              @recalculateProductClick="recalculateProductClick"
              @clearupProduct="clearupProduct"
@@ -800,8 +802,9 @@
      }
      this.productTableList = {
        tableData: this.tableData,
        isReturn: true,
        tableColumn: [
          { label: "#", prop: "productId", width: 40 },
          // { label: "#", prop: "productId", width: 40 },
          { label: "产品名称", prop: "name", productName: true, isRequird: true },
          { label: "产品编号", prop: "number" },
          { label: "数量", prop: "amount", inputNumber: true, isRequird: true },
@@ -813,27 +816,44 @@
    },
    // 产品列表输入
    inputContent(val, prop, row) {
      this.productId = row.productId
      // this.productId = row.productId
      this.tableData.map((item) => {
        if (item.productId === row.productId) {
        if (item.number === row.number) {
          item[prop] = val
        }
      })
    },
    // 产品新增
    addProductClick() {
      this.productId++
      this.tableData.push({
        productId: this.productId,
        id: 0,
        amount: 0,
        desc: "",
        name: "",
        number: "",
        price: 0,
        total: 0,
        unit: ""
      })
      // this.productId++
      // this.tableData.push({
      //   productId: this.productId,
      //   id: 0,
      //   amount: 0,
      //   desc: "",
      //   name: "",
      //   number: "",
      //   price: 0,
      //   total: 0,
      //   unit: ""
      // })
      // this.showSummary.show = true
    },
    // 新增方式修改
    getSelectArray(val) {
      // if (val.length > 0) {
      //   val.map((item, index) => {
      //     item.productId = this.tableData.length + index + 1
      //   })
      // }
      console.log(this.tableData, "ddddaaaqqq")
      if (this.tableData.length == 1 && this.tableData[0].number.length == 0) {
        console.log("ssss")
        this.tableData = []
      }
      this.tableData = this.tableData.concat(val)
      console.log(this.tableData, "55555ddddaaaqqq")
      this.productTableList.tableData = this.tableData
      this.showSummary.show = true
    },
    //  产品清空