Parcourir la source

Merge branch '对账单导出excel更改'

lxf il y a 1 an
Parent
commit
76ad74fc40

+ 165 - 0
src/views/group/finance/check-bill/ExcelFile.vue

@@ -0,0 +1,165 @@
+<template>
+  <div style="max-height: calc(100vh - 184px); overflow-y: auto; overflow-x: hidden">
+    <byTable
+      :source="sourceList.data"
+      :pagination="sourceList.pagination"
+      :config="config"
+      :loading="loading"
+      highlight-current-row
+      :action-list="[
+        {
+          text: '刷新',
+          action: () => getList(),
+        },
+      ]"
+      @get-list="getList">
+    </byTable>
+  </div>
+</template>
+
+<script setup>
+import byTable from "/src/components/byTable/index";
+import { ElMessage, ElMessageBox } from "element-plus";
+
+const { proxy } = getCurrentInstance();
+const status = ref([
+  {
+    dictKey: 1,
+    dictValue: "数据处理中",
+  },
+  {
+    dictKey: 2,
+    dictValue: "Excel生成中",
+  },
+  {
+    dictKey: 3,
+    dictValue: "Excel上传OBS中",
+  },
+  {
+    dictKey: 4,
+    dictValue: "完成",
+  },
+  {
+    dictKey: 99,
+    dictValue: "异常",
+  },
+]);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+    code: "",
+    departmentId: "",
+    beginTime: "",
+    endTime: "",
+  },
+});
+const loading = ref(false);
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "文件名称",
+        prop: "excelName",
+      },
+    },
+    {
+      attrs: {
+        label: "状态",
+        prop: "status",
+        width: 160,
+      },
+      render(val) {
+        return proxy.dictKeyValue(val, status.value);
+      },
+    },
+    {
+      attrs: {
+        label: "创建时间",
+        prop: "createTime",
+        width: 160,
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: 120,
+        align: "center",
+        fixed: "right",
+      },
+      renderHTML(row) {
+        return [
+          row.status == 4
+            ? {
+                attrs: {
+                  label: "下载",
+                  type: "primary",
+                  text: true,
+                },
+                el: "button",
+                click() {
+                  clickDownload(row);
+                },
+              }
+            : {},
+          row.status == 4
+            ? {
+                attrs: {
+                  label: "删除",
+                  type: "danger",
+                  text: true,
+                },
+                el: "button",
+                click() {
+                  clickDelete(row);
+                },
+              }
+            : {},
+        ];
+      },
+    },
+  ];
+});
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy.post("/excelGenerateLog/page", sourceList.value.pagination).then((res) => {
+    sourceList.value.data = res.rows;
+    sourceList.value.pagination.total = res.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
+};
+getList();
+const clickDownload = (row) => {
+  fetch(row.obsFileUrl).then((res) =>
+    res.blob().then((blob) => {
+      var a = document.createElement("a");
+      var url = window.URL.createObjectURL(blob);
+      a.href = url;
+      a.download = row.excelName; // 下载名称
+      a.click();
+      window.URL.revokeObjectURL(url);
+    })
+  );
+};
+const clickDelete = (row) => {
+  ElMessageBox.confirm("你是否确认此操作", "提示", {
+    confirmButtonText: "确定",
+    cancelButtonText: "取消",
+    type: "warning",
+  })
+    .then(() => {
+      proxy.post("/excelGenerateLog/delete", { id: row.id }).then(() => {
+        ElMessage({ message: "删除成功", type: "success" });
+        getList();
+      });
+    })
+    .catch(() => {});
+};
+</script>
+
+<style lang="scss" scoped></style>

+ 25 - 3
src/views/group/finance/check-bill/index.vue

@@ -9,9 +9,13 @@
         :searchConfig="searchConfig"
         highlight-current-row
         :action-list="[
+          // {
+          //   text: '登记对账',
+          //   action: () => clickModal(),
+          // },
           {
-            text: '登记对账',
-            action: () => clickModal(),
+            text: 'Excel文件',
+            action: () => clickExcelFile(),
           },
         ]"
         @get-list="getList"
@@ -126,10 +130,17 @@
           <PrintBOM :rowData="rowData" :activeName="activeName" @clickCancel="openPrint = false"></PrintBOM>
         </el-tab-pane>
         <el-tab-pane label="订单对账单" name="order">
-          <PrintOrder :rowData="rowData" :activeName="activeName" @clickCancel="openPrint = false"></PrintOrder>
+          <PrintOrder :rowData="rowData" :activeName="activeName" @clickCancel="clickCancel"></PrintOrder>
         </el-tab-pane>
       </el-tabs>
     </el-dialog>
+
+    <el-dialog title="Excel文件" v-if="openFileList" v-model="openFileList" width="60%">
+      <ExcelFile></ExcelFile>
+      <template #footer>
+        <el-button @click="openFileList = false" size="large">关 闭</el-button>
+      </template>
+    </el-dialog>
   </div>
 </template>
 
@@ -142,6 +153,7 @@ import PrintSKU from "/src/views/group/finance/check-bill/printSKU.vue";
 import PrintBOM from "/src/views/group/finance/check-bill/printBOM.vue";
 import PrintOrder from "/src/views/group/finance/check-bill/printOrder.vue";
 import { copyText } from "vue3-clipboard";
+import ExcelFile from "/src/views/group/finance/check-bill/ExcelFile.vue";
 
 const { proxy } = getCurrentInstance();
 const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
@@ -609,6 +621,16 @@ const clickCopyWLNCode = (row) => {
     });
   });
 };
+const openFileList = ref(false);
+const clickCancel = (status) => {
+  openPrint.value = false;
+  if (status) {
+    openFileList.value = true;
+  }
+};
+const clickExcelFile = () => {
+  openFileList.value = true;
+};
 </script>
 
 <style lang="scss" scoped>

+ 3 - 4
src/views/group/finance/check-bill/printOrder.vue

@@ -22,7 +22,6 @@
 
 <script setup>
 import { cloneVNode } from "vue";
-import { ElMessage } from "element-plus";
 
 const { proxy } = getCurrentInstance();
 const props = defineProps({
@@ -127,11 +126,11 @@ const clickCancel = () => {
   emit("clickCancel", "");
 };
 const deriveExcel = () => {
-  ElMessage("导出文件中,请稍后");
   loading.value = true;
   proxy.getFile("/statementOfAccount/exportDocumentByOrder", { id: props.rowData.id }).then(
-    (res) => {
-      proxy.downloadFile(res, "订单对账单.xlsx");
+    () => {
+      emit("clickCancel", true);
+      // proxy.downloadFile(res, "订单对账单.xlsx");
       loading.value = false;
     },
     (err) => {

+ 25 - 1
src/views/group/finance/summary/index.vue

@@ -8,6 +8,12 @@
         :loading="loading"
         :searchConfig="searchConfig"
         highlight-current-row
+        :action-list="[
+          {
+            text: 'Excel文件',
+            action: () => clickExcelFile(),
+          },
+        ]"
         @get-list="getList"
         @clickReset="clickReset"
         @changeRadioGroup="changeRadioGroup">
@@ -23,10 +29,17 @@
           <PrintBOM :rowData="rowData" :activeName="activeName" @clickCancel="openPrint = false"></PrintBOM>
         </el-tab-pane>
         <el-tab-pane label="订单对账单" name="order">
-          <PrintOrder :rowData="rowData" :activeName="activeName" @clickCancel="openPrint = false"></PrintOrder>
+          <PrintOrder :rowData="rowData" :activeName="activeName" @clickCancel="clickCancel"></PrintOrder>
         </el-tab-pane>
       </el-tabs>
     </el-dialog>
+    
+    <el-dialog title="Excel文件" v-if="openFileList" v-model="openFileList" width="60%">
+      <ExcelFile></ExcelFile>
+      <template #footer>
+        <el-button @click="openFileList = false" size="large">关 闭</el-button>
+      </template>
+    </el-dialog>
   </div>
 </template>
 
@@ -37,6 +50,7 @@ import PrintBOM from "/src/views/group/finance/summary/printBOM.vue";
 import PrintOrder from "/src/views/group/finance/summary/printOrder.vue";
 import { copyText } from "vue3-clipboard";
 import { ElMessage } from "element-plus";
+import ExcelFile from "/src/views/group/finance/check-bill/ExcelFile.vue";
 
 const { proxy } = getCurrentInstance();
 const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
@@ -231,6 +245,16 @@ const clickCopyWLNCode = (row) => {
     });
   }
 };
+const openFileList = ref(false);
+const clickCancel = (status) => {
+  openPrint.value = false;
+  if (status) {
+    openFileList.value = true;
+  }
+};
+const clickExcelFile = () => {
+  openFileList.value = true;
+};
 </script>
 
 <style lang="scss" scoped>

+ 3 - 5
src/views/group/finance/summary/printOrder.vue

@@ -22,8 +22,6 @@
 
 <script setup>
 import { cloneVNode } from "vue";
-import { ElMessage } from "element-plus";
-
 const { proxy } = getCurrentInstance();
 const props = defineProps({
   rowData: Object,
@@ -127,7 +125,6 @@ const clickCancel = () => {
   emit("clickCancel", "");
 };
 const deriveExcel = () => {
-  ElMessage("导出文件中,请稍后");
   loading.value = true;
   proxy
     .getFile("/statementOfAccountMerge/exportDocumentByOrder", {
@@ -136,8 +133,9 @@ const deriveExcel = () => {
       beginDate: props.rowData.dimensionality,
     })
     .then(
-      (res) => {
-        proxy.downloadFile(res, "订单对账单.xlsx");
+      () => {
+        emit("clickCancel", true);
+        // proxy.downloadFile(res, "订单对账单.xlsx");
         loading.value = false;
       },
       (err) => {