dengjunjie
2025-01-15 e6b95b867105e7be676510c248638ecb41dd6f87
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/extension/basic/materielCodeInfo.js
@@ -26,26 +26,47 @@
      })
      return option;
    },
    formatDate(dateStr) {
      let date = new Date(dateStr);
      let year = date.getFullYear();
      let month = String(date.getMonth() + 1).padStart(2, "0");
      let day = String(date.getDate()).padStart(2, "0");
      return year + "-" + month + "-" + day;
    },
    //下面这些方法可以保留也可以删除
    onInit() {  //框架初始化配置前,
      let warehouseIdOption = this.getOption("warehouseId");
      let materielCodeOption = this.getOption("materielCode");
      let purchaseOrderNoOption = this.getOption("purchaseOrderNo");
      purchaseOrderNoOption.onChange = (val, option) => {
      warehouseIdOption.onChange=(val,option)=>{
        this.editFormFields.materielCode = "";
        materielCodeOption.data = [];
        this.editFormFields.purchaseOrderNo = "";
        purchaseOrderNoOption.data = [];
        if (val == null || val == 0) {
          return this.$error("请选择物料编号!")
          return this.$error("请选择仓库!")
        }
        // console.log(val)
        // console.log(option)
        this.http.post("/api/PurchaseOrder/GetPurchaseOrderInfo?purchaseOrderNo=" + val, {}, true).then(
        this.http.post("/api/PurchaseOrderDetail/GetPurchaseOrderDetailMaterielCode?warehouseId=" + val, {}, true).then(
          source => {
            if (!source.status) return this.$error(source.message);
            for (let i = 0; i < source.data.length; i++) {
              materielCodeOption.data.push({ key: source.data[i], value: source.data[i] })
            }
            // this.editFormFields.InputOder_itemname = source.data.itemName;
            // this.$success(source.data.itemName);
            this.refresh();
          })
      }
      materielCodeOption.onChange = (val, option) => {
        this.editFormFields.purchaseOrderNo = "";
        purchaseOrderNoOption.data = [];
        if (val == null || val == 0) {
          return this.$error("请选择物料编号!")
        }
        this.http.post("/api/PurchaseOrderDetail/GetPurchaseOrderNos?materielCode=" + val, {}, true).then(
          source => {
            if (!source.status) return this.$error(source.message);
            for (let i = 0; i < source.data.length; i++) {
              purchaseOrderNoOption.data.push({ key: source.data[i], value: source.data[i] })
            }
            this.refresh();
          })
      }
@@ -99,6 +120,16 @@
      //(3)this.editFormFields.字段='xxx';
      //如果需要给下拉框设置默认值,请遍历this.editFormOptions找到字段配置对应data属性的key值
      //看不懂就把输出看:console.log(this.editFormOptions)
      let isAdd = this.currentAction == 'Add';
      if (isAdd) {
        let date = new Date();
        let year = date.getFullYear();
        let month = String(date.getMonth() + 1).padStart(2, "0");
        let day = String(date.getDate()).padStart(2, "0");
        this.editFormFields.lotNo = year + month + day;
        this.editFormFields.productionDate = year + "-" + month + "-" + day;
        this.editFormFields.effectiveDate = year + 2 + "-" + month + "-" + day;
      }
    }
  }
};