Procházet zdrojové kódy

采购分页更改

cz před 10 měsíci
rodič
revize
f7efddb59c
1 změnil soubory, kde provedl 101 přidání a 91 odebrání
  1. 101 91
      src/components/process/EHSD/Purchase.vue

+ 101 - 91
src/components/process/EHSD/Purchase.vue

@@ -1590,66 +1590,54 @@ onMounted(() => {
   }
 
   if (props.queryData.ids) {
-    proxy.post("/delivery/page", { ids: props.queryData.ids }).then((res) => {
-      formData.data.dataResource = props.queryData.type;
-      formData.data.dataResourceId = route.query.dataResourceId;
-      if (res.rows && res.rows.length > 0) {
-        formData.data.purchaseProductList = res.rows.map((item) => {
-          return {
-            productId: item.productId,
-            contractId: item.contractId,
-            productName: item.productName,
-            productModel: item.productModel,
-            quantity: item.expendQuantity,
-            oldQuantity: item.expendQuantity,
-            price: "",
-            amount: "",
-            remark: "",
-            json: "",
-            fileUrl: "",
-            dataResource: props.queryData.type,
-            dataResourceId: item.id,
-            purchaseProductMountingsList: [
-              {
-                productId: item.productId,
-                productType: 1,
-                productName: item.productName,
-                productModel: item.productModel,
-                quantity: item.expendQuantity,
-                oldQuantity: item.expendQuantity,
-                price: undefined,
-                amount: "",
-                remark: "",
-                json: "",
-                fileUrl: "",
-                activeName: true,
-              },
-            ],
-            fileList: [],
-          };
-        });
-        if (
-          contractShipmentList.value &&
-          contractShipmentList.value.length > 0
-        ) {
-          for (let i = 0; i < res.rows.length; i++) {
-            const item = res.rows[i];
-            let arr = contractShipmentList.value.filter(
-              (x) => x.productId == item.productId
-            );
-            formData.data.purchaseArrivalList = [
-              ...formData.data.purchaseArrivalList,
-              ...arr.map((x) => ({
-                productCode: item.productCode,
-                productId: item.productId,
-                productName: item.productName,
-                arrivalTime: x ? x.shipmentTime : "",
-                quantity: x ? x.quantity : "",
-              })),
-            ];
-          }
-        } else {
-          setTimeout(() => {
+    proxy
+      .post("/delivery/page", {
+        ids: props.queryData.ids,
+        pageNum: 1,
+        pageSize: 999,
+      })
+      .then((res) => {
+        formData.data.dataResource = props.queryData.type;
+        formData.data.dataResourceId = route.query.dataResourceId;
+        if (res.rows && res.rows.length > 0) {
+          formData.data.purchaseProductList = res.rows.map((item) => {
+            return {
+              productId: item.productId,
+              contractId: item.contractId,
+              productName: item.productName,
+              productModel: item.productModel,
+              quantity: item.expendQuantity,
+              oldQuantity: item.expendQuantity,
+              price: "",
+              amount: "",
+              remark: "",
+              json: "",
+              fileUrl: "",
+              dataResource: props.queryData.type,
+              dataResourceId: item.id,
+              purchaseProductMountingsList: [
+                {
+                  productId: item.productId,
+                  productType: 1,
+                  productName: item.productName,
+                  productModel: item.productModel,
+                  quantity: item.expendQuantity,
+                  oldQuantity: item.expendQuantity,
+                  price: undefined,
+                  amount: "",
+                  remark: "",
+                  json: "",
+                  fileUrl: "",
+                  activeName: true,
+                },
+              ],
+              fileList: [],
+            };
+          });
+          if (
+            contractShipmentList.value &&
+            contractShipmentList.value.length > 0
+          ) {
             for (let i = 0; i < res.rows.length; i++) {
               const item = res.rows[i];
               let arr = contractShipmentList.value.filter(
@@ -1666,39 +1654,61 @@ onMounted(() => {
                 })),
               ];
             }
-          }, 1500);
-        }
-        let fileIds = formData.data.purchaseProductList.map(
-          (item) => item.productId
-        );
-        proxy
-          .post("/fileInfo/getList", { businessIdList: fileIds })
-          .then((resFile) => {
-            for (let i = 0; i < formData.data.purchaseProductList.length; i++) {
-              if (
-                resFile[formData.data.purchaseProductList[i].productId] &&
-                resFile[formData.data.purchaseProductList[i].productId].length >
-                  0
+          } else {
+            setTimeout(() => {
+              for (let i = 0; i < res.rows.length; i++) {
+                const item = res.rows[i];
+                let arr = contractShipmentList.value.filter(
+                  (x) => x.productId == item.productId
+                );
+                formData.data.purchaseArrivalList = [
+                  ...formData.data.purchaseArrivalList,
+                  ...arr.map((x) => ({
+                    productCode: item.productCode,
+                    productId: item.productId,
+                    productName: item.productName,
+                    arrivalTime: x ? x.shipmentTime : "",
+                    quantity: x ? x.quantity : "",
+                  })),
+                ];
+              }
+            }, 1500);
+          }
+          let fileIds = formData.data.purchaseProductList.map(
+            (item) => item.productId
+          );
+          proxy
+            .post("/fileInfo/getList", { businessIdList: fileIds })
+            .then((resFile) => {
+              for (
+                let i = 0;
+                i < formData.data.purchaseProductList.length;
+                i++
               ) {
-                formData.data.purchaseProductList[i].fileUrl =
-                  resFile[
-                    formData.data.purchaseProductList[i].productId
-                  ][0].fileUrl;
-                formData.data.purchaseProductList[
-                  i
-                ].purchaseProductMountingsList[0].fileUrl =
-                  resFile[
-                    formData.data.purchaseProductList[i].productId
-                  ][0].fileUrl;
+                if (
+                  resFile[formData.data.purchaseProductList[i].productId] &&
+                  resFile[formData.data.purchaseProductList[i].productId]
+                    .length > 0
+                ) {
+                  formData.data.purchaseProductList[i].fileUrl =
+                    resFile[
+                      formData.data.purchaseProductList[i].productId
+                    ][0].fileUrl;
+                  formData.data.purchaseProductList[
+                    i
+                  ].purchaseProductMountingsList[0].fileUrl =
+                    resFile[
+                      formData.data.purchaseProductList[i].productId
+                    ][0].fileUrl;
+                }
               }
-            }
-          });
-        // 单价提示
-        changeProductPrice();
-      } else {
-        formData.data.purchaseProductList = [];
-      }
-    });
+            });
+          // 单价提示
+          changeProductPrice();
+        } else {
+          formData.data.purchaseProductList = [];
+        }
+      });
   }
   formOption.disabled = judgeStatus();
   if (route.query && route.query.processType) {