ソースを参照

退款管理: 审批页 关联退货数据回填问题

lxf 1 年間 前
コミット
cf5380ee81
1 ファイル変更15 行追加3 行削除
  1. 15 3
      src/components/process/PurchaseRefund.vue

+ 15 - 3
src/components/process/PurchaseRefund.vue

@@ -124,7 +124,7 @@ const judgeStatus = () => {
     }
   }
   return false;
-};;
+};
 const formOption = reactive({
   inline: true,
   labelWidth: 100,
@@ -215,7 +215,10 @@ const getDict = () => {
   });
 };
 getDict();
-const changeSupply = (val) => {
+const changeSupply = (val, status) => {
+  if (!status) {
+    formData.data.refundDetailList = [];
+  }
   if (val) {
     proxy.get("/salesReturn/getBySupplyId", { supplyId: val }).then((res) => {
       if (res.data && res.data.length > 0) {
@@ -229,11 +232,17 @@ const changeSupply = (val) => {
       } else {
         returnGoods.value = [];
       }
+      if (status) {
+        if (formData.data.refundDetailList && formData.data.refundDetailList.length > 0) {
+          for (let i = 0; i < formData.data.refundDetailList.length; i++) {
+            changePurchaseId(formData.data.refundDetailList[i]);
+          }
+        }
+      }
     });
   } else {
     returnGoods.value = [];
   }
-  formData.data.refundDetailList = [];
 };
 const clickAdd = () => {
   if (formData.data.refundDetailList && formData.data.refundDetailList.length > 0) {
@@ -291,6 +300,9 @@ watch(
       for (var text in props.queryData) {
         formData.data[text] = props.queryData[text];
       }
+      if (formData.data.supplyId) {
+        changeSupply(formData.data.supplyId, true);
+      }
     }
   },
   {