diff --git a/src/views/able/execl.vue b/src/views/able/execl.vue
index 72809b94f..4340a3ab6 100644
--- a/src/views/able/execl.vue
+++ b/src/views/able/execl.vue
@@ -64,7 +64,7 @@ const exportExcel = () => {
const workSheet = utils.aoa_to_sheet(res);
const workBook = utils.book_new();
utils.book_append_sheet(workBook, workSheet, "数据报表");
- writeFile(workBook, "tale-list.xlsx");
+ writeFile(workBook, "tableV2.xlsx");
};
@@ -83,7 +83,7 @@ const exportExcel = () => {
)
- 导出Excel
+ 导出Excel
diff --git a/src/views/pure-table/high/execl/columns.tsx b/src/views/pure-table/high/execl/columns.tsx
new file mode 100644
index 000000000..2ef53131c
--- /dev/null
+++ b/src/views/pure-table/high/execl/columns.tsx
@@ -0,0 +1,50 @@
+import { ref } from "vue";
+import { utils, writeFile } from "xlsx";
+import { tableDataDrag } from "../data";
+import { clone } from "@pureadmin/utils";
+import { message } from "@pureadmin/components";
+
+export function useColumns() {
+ const dataList = ref(clone(tableDataDrag, true));
+
+ const columns: TableColumnList = [
+ {
+ label: "ID",
+ prop: "id"
+ },
+ {
+ label: "日期",
+ prop: "date"
+ },
+ {
+ label: "姓名",
+ prop: "name"
+ }
+ ];
+
+ const exportExcel = () => {
+ const res = dataList.value.map(item => {
+ const arr = [];
+ columns.forEach(column => {
+ arr.push(item[column.prop as string]);
+ });
+ return arr;
+ });
+ const titleList = [];
+ columns.forEach(column => {
+ titleList.push(column.label);
+ });
+ res.unshift(titleList);
+ const workSheet = utils.aoa_to_sheet(res);
+ const workBook = utils.book_new();
+ utils.book_append_sheet(workBook, workSheet, "数据报表");
+ writeFile(workBook, "pure-admin-table.xlsx");
+ message.success("导出成功");
+ };
+
+ return {
+ columns,
+ dataList,
+ exportExcel
+ };
+}
diff --git a/src/views/pure-table/high/execl/index.vue b/src/views/pure-table/high/execl/index.vue
new file mode 100644
index 000000000..4d07cdcb0
--- /dev/null
+++ b/src/views/pure-table/high/execl/index.vue
@@ -0,0 +1,18 @@
+
+
+
+
+
diff --git a/src/views/pure-table/high/list.tsx b/src/views/pure-table/high/list.tsx
index ff7d1fff6..ed5c3d00a 100644
--- a/src/views/pure-table/high/list.tsx
+++ b/src/views/pure-table/high/list.tsx
@@ -1,6 +1,7 @@
import RowDrag from "./drag/row/index.vue";
import ColumnDrag from "./drag/column/index.vue";
import Contextmenu from "./contextmenu/index.vue";
+import Execl from "./execl/index.vue";
const rendContent = (val: string) =>
`代码位置:src/views/pure-table/high/${val}/index.vue`;
@@ -23,5 +24,11 @@ export const list = [
content: rendContent("contextmenu"),
title: "右键菜单",
component: Contextmenu
+ },
+ {
+ key: "execl",
+ content: rendContent("execl"),
+ title: "导出execl",
+ component: Execl
}
];