yangfeng
2023-08-18 96fdf32bd5612b6c16dcbcc8352a9f54adcc8e7e
src/views/sales/quotation/AddQuotationDialog.vue
@@ -203,6 +203,7 @@
              @addProductClick="addProductClick"
              @emptyProductClick="emptyProductClick"
              @recalculateProductClick="recalculateProductClick"
              @clearupProduct="clearupProduct"
            />
          </div>
          <!-- 选择审批流程 -->
@@ -327,8 +328,8 @@
      showSummary: {
        show: true,
        total: true,
        sumProp: ["Amount", "Unit", "other3"],
        mergeNumber: 3
        sumProp: ["Amount", "total"],
        mergeNumber: 2
      },
      editSelectClientConfig: {
        editVisible: false,
@@ -350,8 +351,7 @@
      saleChanceId: this.editCommonConfig.infomation.sale_chance_id,
      tableData: [],
      productId: 1,
      addProductArr: [],
      isProductName: false
      isNoProduct: true
    }
  },
  created() {
@@ -380,23 +380,19 @@
        }
      })
    },
    productNameValidate() {
      for (let i = 0; i < this.tableData.length; i++) {
        if (this.tableData[i].Name === "") {
          this.isProductName = true
          return
        } else {
          this.isProductName = false
        }
      }
    },
    // 保存
    saveClick(formName) {
      this.productNameValidate()
      this.$refs[formName].validate((valid) => {
        if (valid) {
          console.log(this.isProductName)
          if (this.isProductName) {
          for (let i = 0; i < this.tableData.length; i++) {
            if (this.tableData[i].name.length === 0) {
              this.isNoProduct = true
              break
            } else {
              this.isNoProduct = false
            }
          }
          if (this.isNoProduct) {
            this.$message.error("产品名称不能为空")
          } else {
            const params = this.saveParams()
@@ -514,86 +510,84 @@
    // 设置允许上传文件格式
    setFormatClick() {},
    setTableForm() {
      if (this.editConfig.title === "新建" || this.editConfig.infomation.products === null) {
      if (this.editConfig.title === "新建") {
        this.tableData = [
          {
            id: 1,
            Amount: 0,
            IsSale: true,
            MaterialMode: "",
            MinInventory: 0,
            Name: "",
            Number: "",
            PurchaseType: "",
            SalePrice: 0,
            Unit: ""
            productId: this.productId,
            id: 0,
            amount: 0,
            desc: "",
            name: "",
            number: "",
            price: 0,
            total: 0
          }
        ]
      } else {
        this.tableData = this.editConfig.infomation.products
        this.tableData.map((item, index) => {
          item.productId = index + 1
        })
      }
      this.productTableList = {
        tableData: this.tableData,
        tableColumn: [
          { label: "#", prop: "id", width: 40 },
          { label: "产品名称", prop: "Name", input: true, isRequird: true },
          { label: "产品编号", prop: "Number" },
          { label: "数量", prop: "Amount", input: true, isRequird: true },
          { label: "销售单价", prop: "Unit", input: true },
          { label: "价税合计", prop: "total", input: true },
          { label: "描述", prop: "other8" }
          { label: "#", prop: "productId", width: 40 },
          { label: "产品名称", prop: "name", productName: true, isRequird: true },
          { label: "产品编号", prop: "number" },
          { label: "数量", prop: "amount", inputNumber: true, isRequird: true },
          { label: "销售单价", prop: "price", inputFloat: true },
          { label: "价税合计", prop: "total", inputFloat: true }
        ]
      }
    },
    // 产品列表输入
    inputContent(val, prop, row) {
      console.log("aaaaaaaa")
      console.log(val, prop)
      this.productId = row.id
      this.productId = row.productId
      this.tableData.map((item) => {
        if (item.id === row.id) {
        if (item.productId === row.productId) {
          item[prop] = val
        }
      })
      console.log(this.tableData)
    },
    // 产品新增
    addProductClick() {
      this.productId++
      this.tableData.push({
        id: this.productId,
        Amount: 0,
        IsSale: true,
        MaterialMode: "",
        MinInventory: 0,
        Name: "",
        Number: "",
        PurchaseType: "",
        SalePrice: 0,
        Unit: ""
        productId: this.productId,
        id: 0,
        amount: 0,
        desc: "",
        name: "",
        number: "",
        price: 0,
        total: 0
      })
      this.showSummary.show = true
    },
    //  产品清空
    emptyProductClick() {
      this.productId = 1
      this.tableData = [
        {
          id: 1,
          Amount: 0,
          IsSale: true,
          MaterialMode: "",
          MinInventory: 0,
          Name: "",
          Number: "",
          PurchaseType: "",
          SalePrice: 0,
          Unit: ""
          productId: this.productId,
          id: 0,
          amount: 0,
          desc: "",
          name: "",
          number: "",
          price: 0,
          total: 0
        }
      ]
      this.productTableList.tableData = this.tableData
    },
    // 产品重算
    recalculateProductClick() {}
    recalculateProductClick() {},
    clearupProduct(data) {
      this.tableData = data
      this.productTableList.tableData = this.tableData
    }
  }
}
</script>