Bläddra i källkod

待入库导出功能

cz 1 år sedan
förälder
incheckning
9f5e355b18

+ 46 - 3
src/views/WDLY/outInBound/waitInBound/index.vue

@@ -11,9 +11,15 @@
         :selectConfig="selectConfig"
         :table-events="{
           //element talbe事件都能传
-          select: select,
+          'selection-change': selectionChange,
         }"
-        :action-list="[]"
+        :action-list="[
+          {
+            text: '导出Excel',
+            disabled: selectData.length === 0,
+            action: () => deriveExcel(),
+          },
+        ]"
         @get-list="getList"
       >
         <template #code="{ item }">
@@ -105,7 +111,8 @@ import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
 import { computed, defineComponent, ref } from "vue";
 import useUserStore from "@/store/modules/user";
-
+import { getToken } from "@/utils/auth";
+const actionUrl = import.meta.env.VITE_APP_BASE_API;
 const loading = ref(false);
 const submitLoading = ref(false);
 const sourceList = ref({
@@ -154,6 +161,9 @@ const inboundType = ref([
 const config = computed(() => {
   return [
     {
+      type: "selection",
+    },
+    {
       attrs: {
         label: "数据来源",
         prop: "businessType",
@@ -427,6 +437,39 @@ onMounted(() => {
     value: x.value,
   }));
 });
+const selectData = ref([]);
+const selectionChange = (data) => {
+  selectData.value = data;
+};
+const deriveExcel = () => {
+  ElMessage({
+    message: "请稍后",
+    type: "success",
+  });
+  proxy
+    .postTwo(
+      "/stockWait/inStockWaitExportExcel",
+      selectData.value.map((x) => x.id)
+    )
+    .then((res) => {
+      const content = res;
+      const blob = new Blob([content], { type: "application/ms-excel" });
+      const fileName = "待入库.xlsx";
+      if ("download" in document.createElement("a")) {
+        // 非IE下载
+        const elink = document.createElement("a");
+        elink.download = fileName;
+        elink.style.display = "none";
+        elink.href = URL.createObjectURL(blob);
+        document.body.appendChild(elink);
+        elink.click();
+        URL.revokeObjectURL(elink.href); // 释放URL 对象
+        document.body.removeChild(elink);
+      } else {
+        navigator.msSaveBlob(blob, fileName);
+      }
+    });
+};
 </script>
   
 <style lang="scss" scoped>

+ 4 - 0
src/views/WDLY/purchaseManage/alreadyPurchase/index.vue

@@ -865,6 +865,10 @@ const paymentStatus = ref([
     label: "已付款",
     value: "20",
   },
+  {
+    label: "付款结束",
+    value: "30",
+  },
 ]);
 const inRransitData = ref([
   {