haoxuan
2024-04-19 3286b2af0a85f46644bc09cfb16171f4d399890d
src/views/purchaseManage/purchase/components/AddPurchase.vue
@@ -51,7 +51,6 @@
                    v-model="editConfig.infomation.purchaseTypeId"
                    clearable
                    style="width: calc(100% - 30px)"
                    @visible-change="selPurchaseChange"
                  >
                    <el-option
                      v-for="ele in plcBrandList"
@@ -145,6 +144,7 @@
                    clearable
                    placeholder="选择日期"
                    value-format="yyyy-MM-dd"
                    :picker-options="pickerOptionsBefore"
                  >
                  </el-date-picker>
                </el-form-item>
@@ -159,6 +159,7 @@
                    clearable
                    placeholder="选择日期"
                    value-format="yyyy-MM-dd"
                    :picker-options="pickerOptions"
                  >
                  </el-date-picker>
                </el-form-item>
@@ -229,6 +230,7 @@
          <div class="basic-info-title" style="display: flex">产品信息</div>
          <div class="product-view">
            <CommonFormTableView
              ref="tableRef"
              :detailEnter="editCommonConfig.detailEnter"
              :show-summary="showSummary"
              :recalculateShow="false"
@@ -399,7 +401,7 @@
        number: [{ required: true, validator: this.validateCheckCode, trigger: ["change", "blur"] }],
        warehouse: [{ required: true, message: "请选择收货仓库", trigger: "change" }],
        signingDate: [{ required: true, message: "请选择签约日期", trigger: "change" }],
        deliveryDate: [{ required: true, message: "请选择交付日期", trigger: "change" }]
        deliveryDate: [{ required: true, message: "请选择交付日期", trigger: "change" }],
      },
      productTableList: {},
      showSummary: {
@@ -430,14 +432,21 @@
      totalTwo: 0,
      productListIdx: 0,
      lacks: [],
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() < Date.now() - 8.64e7
        }
      },
      pickerOptionsBefore: {
        disabledDate(time) {
          return time.getTime() > Date.now()
        }
      },
      receiveWhouseList: [] // 收货仓库列表
    }
  },
  created() {
    console.log(this.editConfig, "参数")
    if (this.editConfig.title == "新建") {
      this.handleGetBomKindDictList()
    }
    this.handleGetBomKindDictList()
    this.getWarehouseInfo()
    this.$store.dispatch("getSupplier")
    this.formInfo()
@@ -451,9 +460,7 @@
    "editCommonConfig.visible": {
      immediate: true,
      handler: function () {
        if (this.editConfig.title == "新建") {
          this.handleGetBomKindDictList(true)
        }
        this.handleGetBomKindDictList(true)
      }
    }
  },
@@ -513,9 +520,6 @@
        this.plcBrandList = res.data
        this.setTableForm()
        if (val) {
          // this.plcBrandList.map((item)=>{
          //   item.purchaseTypeId=item.id
          // })
          for (let i in this.plcBrandList) {
            if (this.plcBrandList[i][this.editRow.isDefault]) {
              this.editConfig.infomation.purchaseTypeId = this.editConfig.infomation.purchaseTypeId
@@ -527,12 +531,6 @@
          }
        }
      })
    },
    // 选择采购类型下拉方法
    selPurchaseChange(val) {
      if (val) {
        this.handleGetBomKindDictList()
      }
    },
    handleConfirmSave(data) {
      console.log(data, "data")
@@ -757,6 +755,7 @@
    },
    // 选择供应商
    async handleSelectClient(value, item) {
      this.$refs.tableRef.supplierId=item.id
      this.productTableList.supplierId = item.id
      if (value === "client") {
        this.supplierId = item.id
@@ -769,6 +768,7 @@
      }).then((res) => {
        if (res.code === 200) {
          this.productTableList.tableProductList = res.data.list
          this.$refs.tableRef.productList=res.data.list
          console.log(this.productTableList.tableProductList, "pop")
        }
      })
@@ -777,12 +777,14 @@
      this.editSelectSupplierConfig.editVisible = true
    },
    async selClient(row) {
      this.$refs.tableRef.supplierId=row.id
      await getProductList({
        supplierId: row.id,
        page: 1,
        pageSize: 100
      }).then((res) => {
        if (res.code === 200) {
          this.$refs.tableRef.productList=res.data.list
          this.productTableList.tableProductList = res.data.list
        }
      })
@@ -792,11 +794,22 @@
      this.editConfig.infomation.supplierId = row.id
    },
    // 清除已选择用户
    clearupClient(value) {
    async clearupClient(value) {
      if (value == "client") {
        this.$refs.tableRef.supplierId=null
        this.$set(this.editConfig.infomation, "supplierName", "")
        this.supplierId = null
        this.$forceUpdate()
        await getProductList({
        page: 1,
        pageSize: 100
      }).then((res) => {
        if (res.code === 200) {
          this.productTableList.tableProductList = res.data.list
          this.$refs.tableRef.productList=res.data.list
          console.log(this.productTableList.tableProductList, "pop")
        }
      })
      }
    },
    setTableForm() {