From 9fa1d9d2ea93073d3857025ea372cbb615757f70 Mon Sep 17 00:00:00 2001
From: xiaoxian521 <1923740402@qq.com>
Date: Wed, 22 Jun 2022 20:16:33 +0800
Subject: [PATCH] perf: use `@pureadmin/table` replace `el-table`
---
src/views/system/dept/columns.tsx | 66 ++++++++
src/views/system/dept/index.vue | 115 +++++---------
src/views/system/role/columns.tsx | 4 +-
src/views/system/role/index.vue | 2 +-
src/views/system/user/columns.tsx | 130 ++++++++++++++++
src/views/system/user/index.vue | 246 ++++++++----------------------
6 files changed, 301 insertions(+), 262 deletions(-)
create mode 100644 src/views/system/dept/columns.tsx
create mode 100644 src/views/system/user/columns.tsx
diff --git a/src/views/system/dept/columns.tsx b/src/views/system/dept/columns.tsx
new file mode 100644
index 000000000..fb891ff80
--- /dev/null
+++ b/src/views/system/dept/columns.tsx
@@ -0,0 +1,66 @@
+import { ref } from "vue";
+import dayjs from "dayjs";
+
+export function useColumns() {
+ const columns = ref([
+ {
+ type: "selection",
+ width: 55,
+ align: "left",
+ hide: ({ checkList }) => !checkList.includes("勾选列")
+ },
+ {
+ label: "序号",
+ type: "index",
+ width: 60,
+ align: "left",
+ hide: ({ checkList }) => !checkList.includes("序号列")
+ },
+ {
+ label: "部门名称",
+ prop: "name",
+ width: 180,
+ align: "left"
+ },
+ {
+ label: "排序",
+ prop: "sort",
+ width: 60
+ },
+ {
+ label: "状态",
+ prop: "status",
+ width: 80,
+ cellRenderer: ({ row, props }) => (
+
+ {row.status === 0 ? "关闭" : "开启"}
+
+ )
+ },
+ {
+ label: "创建时间",
+ width: 180,
+ prop: "createTime",
+ formatter: ({ createTime }) =>
+ dayjs(createTime).format("YYYY-MM-DD HH:mm:ss")
+ },
+ {
+ label: "备注",
+ prop: "remark"
+ },
+ {
+ label: "操作",
+ fixed: "right",
+ width: 140,
+ slot: "operation"
+ }
+ ]);
+
+ return {
+ columns
+ };
+}
diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue
index 5eaebe318..9cc96b830 100644
--- a/src/views/system/dept/index.vue
+++ b/src/views/system/dept/index.vue
@@ -1,8 +1,9 @@