Skip to content

Commit

Permalink
feat: 🚀 优化 ProTable && 面包屑导航
Browse files Browse the repository at this point in the history
1.优化 SearchFormItem 组件内部代码
2.增加 input-number、select-v2、slider 搜索类型
3.优化面包屑导航布局
  • Loading branch information
Halsey committed Jan 5, 2023
1 parent 97dc264 commit 905d7f1
Show file tree
Hide file tree
Showing 18 changed files with 227 additions and 186 deletions.
108 changes: 53 additions & 55 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"vite-plugin-html": "^3.2.0",
"vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-vue-setup-extend": "^0.4.0",
"vue-tsc": "^1.0.18"
"vue-tsc": "^1.0.22"
},
"config": {
"commitizen": {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Grid/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const cols = computed(() => {
});
provide("cols", cols);
const slots = useSlots().default!() as any;
const slots = useSlots().default!();
// 寻找需要开始折叠的字段 index
const findIndex = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProTable/components/ColSetting.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<!-- 列设置 -->
<el-drawer title="列设置" v-model="drawerVisible" size="500px">
<el-drawer title="列设置" v-model="drawerVisible" size="450px">
<div class="table" ref="colTableRef">
<el-table :data="colSetting" :border="true" row-key="prop" default-expand-all :tree-props="{ children: '_children' }">
<el-table-column prop="label" align="center" label="列名" />
Expand Down
8 changes: 4 additions & 4 deletions src/components/ProTable/components/TableColumn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<component :is="renderLoop(column)"></component>
</template>

<script lang="tsx" setup>
<script lang="tsx" setup name="tableColumn">
import { inject, ref, useSlots } from "vue";
import { ElTableColumn, ElTag } from "element-plus";
import { filterEnum, formatValue, handleRowAccordingToProp } from "@/utils/util";
import { ColumnProps } from "@/components/ProTable/interface";
const slots = useSlots();
import { filterEnum, formatValue, handleRowAccordingToProp } from "@/utils/util";
defineProps<{ column: ColumnProps }>();
const slots = useSlots();
const enumMap = inject("enumMap", ref(new Map()));
// 渲染表格数据
Expand Down
24 changes: 14 additions & 10 deletions src/components/ProTable/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
| 属性名 | 类型 | 是否必传 | 默认值 | 属性描述 |
| :----------: | :----------------: | :------: | :----: | :---------------------------------------------------------------------------------------------: |
| tag | Boolean || false | 当前单元格值是否为标签展示 |
| isShow | Boolean || true | 当前列是否显示在表格内 |
| isShow | Boolean || true | 当前列是否显示在表格内(只对 prop 列生效) |
| search | SearchProps ||| 搜索项配置,详情见 SearchProps |
| enum | Object \| Function ||| 字典,可格式化单元格内容,还可以作为搜索框的下拉选项(字典可以为 API 请求函数,内部会自动执行) |
| isFilterEnum | Boolean || true | 当前单元格值是否根据 enum 格式化(例如 enum 只作为搜索项数据,不参与内容格式化) |
Expand Down Expand Up @@ -58,15 +58,18 @@
>
> [el-table 方法文档链接](https://element-plus.org/zh-CN/component/table.html#table-%E6%96%B9%E6%B3%95)
| 方法名 | 描述 |
| :------------: | :-------------------------------------------------------------------: |
| element | `el-table` 实例,可以通过`element.方法名`来调用 `el-table` 的所有方法 |
| tableData | 当前页面所展示的数据 |
| searchParam | 所有的搜索参数,不包含分页 |
| pageable | 当前表格的分页数据 |
| getTableList | 获取、刷新表格数据的方法(携带所有参数) |
| clearSelection | 清空表格所选择的数据,除此方法之外还可使用 `element.clearSelection()` |
| enumMap | 当前表格使用的所有字典数据(Map 数据结构) |
| 方法名 | 描述 |
| :-------------: | :-------------------------------------------------------------------: |
| element | `el-table` 实例,可以通过`element.方法名`来调用 `el-table` 的所有方法 |
| tableData | 当前页面所展示的数据 |
| searchParam | 所有的搜索参数,不包含分页 |
| pageable | 当前表格的分页数据 |
| getTableList | 获取、刷新表格数据的方法(携带所有参数) |
| clearSelection | 清空表格所选择的数据,除此方法之外还可使用 `element.clearSelection()` |
| enumMap | 当前表格使用的所有字典数据(Map 数据结构) |
| isSelected | 表格是否选中数据 |
| selectedList | 表格选中的数据列表 |
| selectedListIds | 表格选中的数据列表的 id |

### 6、ProTable 插槽:

Expand All @@ -76,5 +79,6 @@
| tableHeader | 自定义表格头部左侧区域的插槽,一般情况该区域放操作按钮 |
| append | 插入至表格最后一行之后的内容, 如果需要对表格的内容进行无限滚动操作,可能需要用到这个 slot。 若表格有合计行,该 slot 会位于合计行之上。 |
| empty | 当表格数据为空时自定义的内容 |
| pagination | 分页组件插槽 |
| `column.prop` | 单元格的作用域插槽 |
| `column.prop` + "Header" | 表头的作用域插槽 |
Loading

1 comment on commit 905d7f1

@vercel
Copy link

@vercel vercel bot commented on 905d7f1 Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.