ソースを参照

🐞 fix(【drp-采购需求单】): 子表物料编码变更没有更新相关字段

一、业务现状 1、输入物料编码无法联查出物料相关字段信息 2、新增选择物料或导入成功后,修改物料编码,没有更新物料相关字段信息 二、解决方案 1、输入和变更物料编码更新相关字段

20240513235
002390 1 年間 前
コミット
96f5f7ddb5
1 ファイル変更55 行追加0 行削除
  1. 55 0
      src/views/purchase/PurchaseDemandList/add.vue

+ 55 - 0
src/views/purchase/PurchaseDemandList/add.vue

@@ -419,6 +419,8 @@
                 :disabled="sonDisable"
                 :size="size"
                 v-model="scope.row.materialCode"
+                :source="scope.row"
+                @change="(val) => changeMaterialCode(val, scope.row)"
                 @paste.native="pasteMe($event, scope, scope.rowIndex)"
               >
                 <el-button
@@ -2480,6 +2482,7 @@ export default {
                   line.transportationCondition =
                     rowList[i].transportationCondition;
                   line.storageCondition = rowList[i].storageCondition;
+                  line.materialRemark = rowList[i].remark;
                   newLine.push(line);
                   console.log("临时数组", newLine);
                 }
@@ -3146,6 +3149,58 @@ export default {
       // 返回一个二维数组的表尾合计(不要平均值,你就不要在数组中添加)
       return [means];
     },
+
+    // 物料编码
+    async changeMaterialCode(val, row) {
+      try {
+        let { code, rows } = await getRefer({
+          type: "MATERIAL_PARAM",
+          materialCodeList: [val],
+        });
+        if (rows && rows.length) {
+          let source = rows[0];
+          let fieldObject = {
+            puOrg: "purchasingOrganization",
+            purOrgName: "purchasingOrganizationName", //  默认采购组织
+            material: "id",
+            materialName: "name", // 物料名称
+            specification: "specification", // 规格
+            model: "model", // 型号
+            materialRemark: "remark", // 物料备注
+            unit: "unitId",
+            unitName: "unitIdName", // 单位
+            manufacturerName: "manufacturerIdName", // 生产厂家/代理人
+            minPackage: "minPackQty", // 最小包装量
+            materialClassifyOneName: "oneClass", // 物料一级分类
+            materialClassifyTwoName: "twoClass", // 物料二级分类
+            materialClassifyThreeName: "threeClass", // 物料三级分类
+            materialClassifyFourName: "fourClass", // 物料四级分类
+            minOrderQty: "minOrderQty", // 最小订货量
+            minBatch: "minBatchQty", // 最小批量
+            puPeriod: "deliveryPeriod", // 采购周期
+            expiry: "usefulLife", // 有效期
+            expiryUnit: "expiryUnitIdName", // 有效期单位
+            registrant: "registrant", // 注册人
+            transportationCondition: "transportationCondition", // 运输条件
+            storageCondition: "storageCondition", // 存储条件
+            storageCondition: "storageCondition", // 存储条件
+            classifyId: "classifyId",
+          };
+
+          let { billType } = this.basicForm;
+          row.isUrgency = billType == "JJXQ" ? "Y" : "N";
+          row.isReplenishment = billType == "BDXQ" ? "Y" : "N";
+
+          for (const key in fieldObject) {
+            row[key] = source[fieldObject[key]];
+          }
+        } else {
+          row.materialCode = null;
+          // 清空不弹窗
+          val && this.$notify.error("该物料编码不存在或已停用");
+        }
+      } catch (error) {}
+    },
   },
 };
 </script>