|
@@ -19,8 +19,11 @@
|
|
|
<template #menu="{ row, index, type }">
|
|
|
<el-button type="primary" size="small" @click="showDetail(row)"
|
|
|
>查看</el-button
|
|
|
- ></template
|
|
|
- >
|
|
|
+ >
|
|
|
+ <el-button type="primary" size="small" @click="exportDataZip(row)"
|
|
|
+ >导出</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
<template #menu-right="{}">
|
|
|
<el-button
|
|
|
class="ml-3"
|
|
@@ -40,6 +43,7 @@ import { ref, getCurrentInstance } from "vue";
|
|
|
import { useCrud } from "@/hooks/userCrud";
|
|
|
import reportTemplate from "@/components/ReportView/reportTemplate.vue";
|
|
|
import ToPrintDialog from "./toPrintTables.vue";
|
|
|
+import {exportDataInfo} from "@/api/report";
|
|
|
// 传入一个url,后面不带/
|
|
|
const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
|
|
|
useCrud({
|
|
@@ -63,6 +67,8 @@ const importExcelData = () => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+
|
|
|
+
|
|
|
const toPrintRef = ref(null);
|
|
|
|
|
|
const detail = ref({});
|
|
@@ -72,6 +78,31 @@ const showDetail = (row) => {
|
|
|
toPrintRef.value && toPrintRef.value.openPrintDialog(row);
|
|
|
};
|
|
|
|
|
|
+const exportDataZip = async (row) => {
|
|
|
+
|
|
|
+ search.value=row;
|
|
|
+ exportData("/api/v1/quality/report/zip");
|
|
|
+
|
|
|
+};
|
|
|
+
|
|
|
+const downFile = (response) => {
|
|
|
+ const fileData = response.data;
|
|
|
+ const fileName = decodeURI(
|
|
|
+ response.headers["content-disposition"].split(";")[1].split("=")[1]
|
|
|
+ );
|
|
|
+ const fileType =
|
|
|
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8";
|
|
|
+ const blob = new Blob([fileData], { type: fileType });
|
|
|
+ const downloadUrl = window.URL.createObjectURL(blob);
|
|
|
+ const downloadLink = document.createElement("a");
|
|
|
+ downloadLink.href = downloadUrl;
|
|
|
+ downloadLink.download = fileName;
|
|
|
+ document.body.appendChild(downloadLink);
|
|
|
+ downloadLink.click();
|
|
|
+ document.body.removeChild(downloadLink);
|
|
|
+ window.URL.revokeObjectURL(downloadUrl);
|
|
|
+};
|
|
|
+
|
|
|
// 设置表格列或者其他自定义的option
|
|
|
option.value = Object.assign(option.value, {
|
|
|
searchEnter: true,
|