yangfeng
2024-02-28 fb3da04f2244f66545462dcaaa63c0b5a4684976
新增销售机会-产品管理-添加、上传、编辑产品数据处理
1个文件已修改
48 ■■■■ 已修改文件
src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue
@@ -767,11 +767,11 @@
    saveClick(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          const hasProduct = this.tableData.every((ele) => !!ele.name)
          if (!hasProduct) {
            this.$message.error("产品名称不能为空")
            return
          }
          // const hasProduct = this.tableData.every((ele) => !!ele.name)
          // if (!hasProduct) {
          //   this.$message.error("产品名称不能为空")
          //   return
          // }
          const params = this.saveParams()
          console.log(params)
@@ -810,6 +810,12 @@
    },
    saveParams() {
      let data = this.editConfig.infomation
      let products = []
      this.tableData.map((item) => {
        if (item.number.length > 0) {
          products.push(item)
        }
      })
      let params = {
        id: this.editConfig.title === "新建" ? 0 : data.id,
        advantages: data.advantages || "",
@@ -847,7 +853,7 @@
        detail_address: data.detail_address || "",
        codeStandID: data.ID,
        products: this.tableData
        products: products
      }
      return params
    },
@@ -981,8 +987,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 },
@@ -993,9 +1000,9 @@
    },
    // 产品列表输入
    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
        }
      })
@@ -1016,13 +1023,26 @@
      // this.showSummary.show = true
    },
    // 新增方式修改
    getSelectArray(val) {
      if (val.length > 0) {
        val.map((item, index) => {
          item.productId = this.tableData.length + index + 1
        })
    getSelectArray(val, index) {
      // if (val.length > 0) {
      //   val.map((item, index) => {
      //     item.productId = this.tableData.length + index + 1
      //   })
      // }
      // this.tableData = this.tableData.concat(val)
      // this.productTableList.tableData = this.tableData
      // this.showSummary.show = true
      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
    },