yangfeng
2023-08-16 1249ca8ff44f8de7992fdb5866eae19613d606c3
src/views/sales/subOrder/AddSubOrderDialog.vue
@@ -50,10 +50,10 @@
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="销售总单" prop="masterOrderNumber">
                <el-form-item label="销售总单" prop="master_order_number">
                  <div class="custom-name">
                    <el-autocomplete
                      v-model="editConfig.infomation.masterOrderNumber"
                      v-model="editConfig.infomation.master_order_number"
                      :fetch-suggestions="
                        (queryString, callback) => {
                          querySearchAsync(queryString, callback, 'master')
@@ -87,7 +87,7 @@
            </el-row>
          </div>
          <!-- 附件信息 -->
          <div class="basic-info-title">附件信息</div>
          <!-- <div class="basic-info-title">附件信息</div>
          <div class="basic-info-view">
            <el-row>
              <el-col :span="12">
@@ -112,7 +112,7 @@
                </el-form-item>
              </el-col>
            </el-row>
          </div>
          </div> -->
          <!-- 产品管理 -->
          <div class="basic-info-title" style="display: flex">
            产品管理
@@ -131,7 +131,11 @@
            </div>
          </div>
          <div class="product-view">
            <CommonFormTableView :product-table-list="productTableList" />
            <CommonFormTableView
              :product-table-list="productTableList"
              @inputContent="inputContent"
              @addProductClick="addProductClick"
            />
          </div>
          <!-- 合计 -->
          <div class="basic-info-view">
@@ -281,7 +285,10 @@
        infomation: {}
      },
      clientId: this.editCommonConfig.infomation.client_id,
      masterId: this.editCommonConfig.infomation.masterOrderId
      masterId: this.editCommonConfig.infomation.masterOrderId,
      tableData: [],
      productId: 1,
      addProductArr: []
    }
  },
  created() {
@@ -307,7 +314,7 @@
    dataProcess() {
      this.masterOrderList.map((item) => {
        if (this.masterId === item.id) {
          this.editConfig.infomation.masterOrderNumber = item.number
          this.editConfig.infomation.master_order_number = item.number
        }
      })
    },
@@ -319,37 +326,23 @@
          const params = this.saveParams()
          console.log(params)
          if (this.editConfig.title === "新建") {
            getAddSubOrder(params)
              .then((res) => {
                console.log(res)
                this.editConfig.visible = false
                if (res.code === 200) {
                  this.$message({
                    message: "添加成功",
                    type: "success"
                  })
                  this.$parent.getData()
                }
              })
              .catch((err) => {
                console.log(err)
              })
            getAddSubOrder(params).then((res) => {
              console.log(res)
              this.editConfig.visible = false
              if (res.code === 200) {
                this.$message.success("添加成功")
                this.$parent.getData()
              }
            })
          } else {
            getUpdateSubOrder(params)
              .then((res) => {
                console.log(res)
                this.editConfig.visible = false
                if (res.code === 200) {
                  this.$message({
                    message: "编辑成功",
                    type: "success"
                  })
                  this.$parent.getData()
                }
              })
              .catch((err) => {
                console.log(err)
              })
            getUpdateSubOrder(params).then((res) => {
              console.log(res)
              this.editConfig.visible = false
              if (res.code === 200) {
                this.$message.success("编辑成功")
                this.$parent.getData()
              }
            })
          }
        } else {
          console.log("error submit")
@@ -361,21 +354,11 @@
      let data = this.editConfig.infomation
      let params = {
        id: this.editConfig.title === "新建" ? 0 : data.id,
        clientId: parseInt(this.clientId) || 0,
        masterOrderId: parseInt(this.masterId) || 0,
        clientId: this.clientId || 0,
        masterOrderId: this.masterId || 0,
        memberId: data.memberId || 0,
        number: data.number || "",
        product: [
          {
            amount: 0,
            desc: "",
            id: 0,
            name: "",
            number: "",
            price: 0,
            total: 0
          }
        ]
        product: this.tableData
      }
      return params
    },
@@ -431,7 +414,7 @@
        this.editConfig.infomation.client_id = row.id
        this.clientId = row.id
      } else if (value == "master") {
        this.editConfig.infomation.masterOrderNumber = row.number
        this.editConfig.infomation.master_order_number = row.number
        this.masterId = row.id
      }
    },
@@ -442,7 +425,7 @@
        this.editConfig.infomation.client_id = 0
        this.clientId = 0
      } else if (value == "master") {
        this.editConfig.infomation.masterOrderNumber = ""
        this.editConfig.infomation.master_order_number = ""
        this.masterId = 0
      }
    },
@@ -451,32 +434,64 @@
    // 设置允许上传文件格式
    setFormatClick() {},
    setTableForm() {
      this.productTableList = {
        tableData: [
      if (this.editConfig.title === "新建") {
        this.tableData = [
          {
            id: "1",
            productName: "上海有限公司",
            other0: "ZDYBD03-1",
            other1: "12",
            other2: "",
            other6: "3.00",
            other7: "2.00"
            id: 1,
            Amount: 0,
            IsSale: true,
            MaterialMode: "",
            MinInventory: 0,
            Name: "",
            Number: "",
            PurchaseType: "",
            SalePrice: 0,
            Unit: ""
          }
        ],
        ]
      } else {
        this.tableData = this.editConfig.infomation.products
      }
      this.productTableList = {
        tableData: this.tableData,
        tableColumn: [
          { label: "#", prop: "id", width: 40 },
          { label: "产品名称", prop: "productName", input: true, isRequird: true },
          { label: "产品编号", prop: "other0" },
          { label: "计量单位", prop: "other2" },
          { label: "规格编号", prop: "other3" },
          { label: "源单类型", prop: "other4" },
          { label: "合同信息", prop: "other5" },
          { label: "数量", prop: "other1", input: true, isRequird: true },
          { label: "含税单价", prop: "other6", input: true },
          { label: "价税合计", prop: "other7", input: true },
          { label: "产品名称", prop: "Name", input: true, isRequird: true },
          { label: "产品编号", prop: "Number" },
          { label: "数量", prop: "Amount", input: true, isRequird: true },
          { label: "销售单价", prop: "Unit", input: true },
          { label: "价税合计", prop: "other3", input: true },
          { label: "描述", prop: "other8" }
        ]
      }
    },
    // 产品列表输入
    inputContent(val, prop, row) {
      console.log("aaaaaaaa")
      console.log(val, prop)
      this.productId = row.id
      this.tableData.map((item) => {
        if (item.id === row.id) {
          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: ""
      })
    }
  }
}