el-plus 0.0.84 → 0.0.86-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.full.js +7 -3
- package/dist/index.full.min.js +2 -2
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +2 -2
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +7 -3
- package/docs/api-examples.md +49 -0
- package/docs/components/attachment.md +111 -0
- package/docs/components/buttons.md +108 -0
- package/docs/components/custom-column.md +70 -0
- package/docs/components/date-picker-range.md +61 -0
- package/docs/components/dialog.md +104 -0
- package/docs/components/footer-info.md +101 -0
- package/docs/components/form.md +186 -0
- package/docs/components/header.md +89 -0
- package/docs/components/index.md +23 -0
- package/docs/components/input.md +109 -0
- package/docs/components/link.md +63 -0
- package/docs/components/search-list-page.md +81 -0
- package/docs/components/select.md +163 -0
- package/docs/components/table.md +133 -0
- package/docs/components/title.md +70 -0
- package/docs/components/use-choose-dialog.md +115 -0
- package/docs/components/use-confirm-dialog.md +87 -0
- package/docs/components/use-form-dialog.md +87 -0
- package/docs/guide/markdown-examples.md +85 -0
- package/docs/index.md +25 -0
- package/docs/pages/detail.md +74 -0
- package/docs/pages/list.md +73 -0
- package/es/cli/src/commands/gen-docs.d.ts +2 -0
- package/es/cli/src/commands/install.d.ts +13 -0
- package/es/cli/src/commands/parse.d.ts +2 -0
- package/es/cli/src/index.d.ts +2 -0
- package/es/cli/src/parser/image-parser.d.ts +8 -0
- package/es/cli/src/parser/modao.d.ts +54 -0
- package/es/components/buttons/index.d.ts +45 -45
- package/es/components/buttons/src/buttons-vue.d.ts +16 -16
- package/es/components/buttons/src/buttons.d.ts +1 -1
- package/es/components/date-picker-range/index.d.ts +3 -3
- package/es/components/date-picker-range/src/date-picker-range.vue.d.ts +1 -1
- package/es/components/footer-info/index.d.ts +3 -3
- package/es/components/footer-info/src/footer-info.vue.d.ts +1 -1
- package/es/components/form/src/form-item-vue.mjs +6 -2
- package/es/components/form/src/form-item-vue.mjs.map +1 -1
- package/es/components/header/index.d.ts +3 -3
- package/es/components/header/src/header.d.ts +1 -1
- package/es/components/header/src/header.mjs.map +1 -1
- package/es/components/header/src/header.vue.d.ts +1 -1
- package/es/components/input/index.d.ts +3 -3
- package/es/components/input/src/input.vue.d.ts +1 -1
- package/es/components/link/index.d.ts +6 -6
- package/es/components/link/src/link.d.ts +1 -1
- package/es/components/link/src/link.vue.d.ts +3 -3
- package/es/components/search-list-page/index.d.ts +12 -12
- package/es/components/search-list-page/src/search-list-page.vue.d.ts +4 -4
- package/es/components/search-list-page/src/use-search-list-page.d.ts +4 -4
- package/es/package.json.mjs +1 -1
- package/lib/cli/src/commands/gen-docs.d.ts +2 -0
- package/lib/cli/src/commands/install.d.ts +13 -0
- package/lib/cli/src/commands/parse.d.ts +2 -0
- package/lib/cli/src/index.d.ts +2 -0
- package/lib/cli/src/parser/image-parser.d.ts +8 -0
- package/lib/cli/src/parser/modao.d.ts +54 -0
- package/lib/components/buttons/index.d.ts +45 -45
- package/lib/components/buttons/src/buttons-vue.d.ts +16 -16
- package/lib/components/buttons/src/buttons.d.ts +1 -1
- package/lib/components/date-picker-range/index.d.ts +3 -3
- package/lib/components/date-picker-range/src/date-picker-range.vue.d.ts +1 -1
- package/lib/components/footer-info/index.d.ts +3 -3
- package/lib/components/footer-info/src/footer-info.vue.d.ts +1 -1
- package/lib/components/form/src/form-item-vue.js +5 -1
- package/lib/components/form/src/form-item-vue.js.map +1 -1
- package/lib/components/header/index.d.ts +3 -3
- package/lib/components/header/src/header.d.ts +1 -1
- package/lib/components/header/src/header.js.map +1 -1
- package/lib/components/header/src/header.vue.d.ts +1 -1
- package/lib/components/input/index.d.ts +3 -3
- package/lib/components/input/src/input.vue.d.ts +1 -1
- package/lib/components/link/index.d.ts +6 -6
- package/lib/components/link/src/link.d.ts +1 -1
- package/lib/components/link/src/link.vue.d.ts +3 -3
- package/lib/components/search-list-page/index.d.ts +12 -12
- package/lib/components/search-list-page/src/search-list-page.vue.d.ts +4 -4
- package/lib/components/search-list-page/src/use-search-list-page.d.ts +4 -4
- package/lib/package.json.js +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# EpForm 表单容器
|
|
2
|
+
|
|
3
|
+
基于 el-form 封装,支持通过配置生成表单。
|
|
4
|
+
|
|
5
|
+
## 基本用法
|
|
6
|
+
|
|
7
|
+
```vue
|
|
8
|
+
<template>
|
|
9
|
+
<EpForm
|
|
10
|
+
ref="epForm"
|
|
11
|
+
v-model="formData"
|
|
12
|
+
:formItemList="formItemList"
|
|
13
|
+
/>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup lang="tsx">
|
|
17
|
+
import { reactive, ref, useTemplateRef } from 'vue'
|
|
18
|
+
import type { FormProps } from 'el-plus'
|
|
19
|
+
|
|
20
|
+
const epForm = useTemplateRef('epForm')
|
|
21
|
+
const formData = reactive({
|
|
22
|
+
name: '',
|
|
23
|
+
type: '',
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const formItemList = ref<FormProps['formItemList']>([
|
|
27
|
+
{
|
|
28
|
+
prop: 'name',
|
|
29
|
+
label: '名称',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
prop: 'type',
|
|
33
|
+
label: '类型',
|
|
34
|
+
type: 'EpSelect',
|
|
35
|
+
props: {
|
|
36
|
+
options: [
|
|
37
|
+
{ label: '类型1', value: '1' },
|
|
38
|
+
{ label: '类型2', value: '2' },
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
])
|
|
43
|
+
</script>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Props
|
|
47
|
+
|
|
48
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
49
|
+
|------|------|------|--------|
|
|
50
|
+
| v-model | 表单数据 | `Record<string, any>` | `{}` |
|
|
51
|
+
| formItemList | 表单项配置 | [`FormItemProps[]`](#formitemprops-配置) | `[]` |
|
|
52
|
+
| col | 每行列数 | `number` | `4` |
|
|
53
|
+
| isShowFold | 是否显示折叠 | `boolean` | `false` |
|
|
54
|
+
| showFieldCount | 折叠时显示数量 | `number` | `8` |
|
|
55
|
+
| labelWidth | 标签宽度 ^el^ | `string \| number` | `100` |
|
|
56
|
+
| labelPosition | 标签位置 ^el^ | `'left' \| 'right' \| 'top'` | - |
|
|
57
|
+
| size | 表单尺寸 ^el^ | `'large' \| 'default' \| 'small'` | `'small'` |
|
|
58
|
+
| scrollIntoViewOptions | 滚动到错误项配置 ^el^ | `object` | `{ inline: 'center' }` |
|
|
59
|
+
|
|
60
|
+
> ^el^ 表示继承自 [el-form](https://element-plus.org/zh-CN/component/form.html) 的属性
|
|
61
|
+
|
|
62
|
+
## FormItemProps 配置
|
|
63
|
+
|
|
64
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
65
|
+
|------|------|------|--------|
|
|
66
|
+
| type | 组件类型 | `string` | `'EpInput'` |
|
|
67
|
+
| prop | 字段名 | `string` | - |
|
|
68
|
+
| label | 标签文本 | `string` | - |
|
|
69
|
+
| col | 占用列数 | `number` | - |
|
|
70
|
+
| disabled | 是否禁用 | `boolean` | `false` |
|
|
71
|
+
| visible | 是否显示 | `boolean` | `true` |
|
|
72
|
+
| required | 是否必填 | `boolean` | `false` |
|
|
73
|
+
| rules | 校验规则 | `FormItemRule[]` | - |
|
|
74
|
+
| props | 传递给组件的属性 | `object` | - |
|
|
75
|
+
| render | 自定义渲染 | `() => VNode` | - |
|
|
76
|
+
| labelRender | 自定义标签渲染 | `({ label }) => VNode` | - |
|
|
77
|
+
| isShowLabel | 是否显示标签 | `boolean` | `true` |
|
|
78
|
+
| class | 样式类名 | `string` | - |
|
|
79
|
+
| style | 行内样式 | `string \| CSSProperties` | - |
|
|
80
|
+
| onChange | 值变化事件 | `(val, item?) => void` | - |
|
|
81
|
+
|
|
82
|
+
> **注意**:在 EpTable 的 columns 中使用表单项时,`type` 不能省略,否则会显示为普通文本。
|
|
83
|
+
> ```json
|
|
84
|
+
> // ❌ 错误:表格列中省略 type,会显示为文本
|
|
85
|
+
> { "prop": "quantity", "label": "数量" }
|
|
86
|
+
> // ✅ 正确:表格列中必须指定 type
|
|
87
|
+
> { "prop": "quantity", "label": "数量", "type": "EpInput" }
|
|
88
|
+
> ```
|
|
89
|
+
|
|
90
|
+
## Expose 方法
|
|
91
|
+
|
|
92
|
+
| 方法 | 说明 | 类型 |
|
|
93
|
+
|------|------|------|
|
|
94
|
+
| validate | 表单验证 | `() => Promise<boolean>` |
|
|
95
|
+
| resetFields | 重置表单 | `() => void` |
|
|
96
|
+
| clearValidate | 清除验证 | `(props?: string[]) => void` |
|
|
97
|
+
| getFormItemRenderRef | 获取表单项组件 ref | `(ref: string) => any` |
|
|
98
|
+
|
|
99
|
+
## 组件自由组合示例
|
|
100
|
+
|
|
101
|
+
在 formItemList 中可自由组合其他组件:
|
|
102
|
+
- type:组件名字,优先使用 Ep 前缀的组件,如 EpInput、EpSelect 等,其次使用 Element Plus 的组件,如 ElInput、ElSelect 等。
|
|
103
|
+
- 外层: EpFormItem的属性
|
|
104
|
+
- props:传递给组件的属性
|
|
105
|
+
- 事件:组件的事件,以 `on` 开头,如 onClick、onChange 等
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
const formItemList = computed<FormProps['formItemList']>(() => [
|
|
110
|
+
// 标题分组
|
|
111
|
+
{
|
|
112
|
+
col: 24,
|
|
113
|
+
type: 'EpTitle',
|
|
114
|
+
props: {
|
|
115
|
+
title: '基本信息',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
// 输入框
|
|
119
|
+
{
|
|
120
|
+
prop: 'name',
|
|
121
|
+
label: '名称',
|
|
122
|
+
},
|
|
123
|
+
// 下拉选择
|
|
124
|
+
{
|
|
125
|
+
prop: 'type',
|
|
126
|
+
label: '类型',
|
|
127
|
+
type: 'EpSelect',
|
|
128
|
+
props: {
|
|
129
|
+
options: [],
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
// 日期范围
|
|
133
|
+
{
|
|
134
|
+
prop: 'orderDate',
|
|
135
|
+
label: '日期范围',
|
|
136
|
+
type: 'EpDatePickerRange',
|
|
137
|
+
props: {
|
|
138
|
+
start: formData.orderDateStart,
|
|
139
|
+
end: formData.orderDateEnd,
|
|
140
|
+
},
|
|
141
|
+
'onUpdate:start': (val) => {
|
|
142
|
+
formData.orderDateStart = val
|
|
143
|
+
},
|
|
144
|
+
'onUpdate:end': (val) => {
|
|
145
|
+
formData.orderDateEnd = val
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
// 表格嵌套
|
|
149
|
+
{
|
|
150
|
+
col: 24,
|
|
151
|
+
type: 'EpTable',
|
|
152
|
+
props: {
|
|
153
|
+
ref: 'detailTable',
|
|
154
|
+
data: formData.detailList,
|
|
155
|
+
columns: [],
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
// 附件
|
|
159
|
+
{
|
|
160
|
+
col: 24,
|
|
161
|
+
type: 'EpAttachment',
|
|
162
|
+
props: {
|
|
163
|
+
modelValue: formData.fileList,
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
])
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## 验证示例
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
const handleSave = async () => {
|
|
173
|
+
const valid = await epForm.value?.validate()
|
|
174
|
+
if (valid) {
|
|
175
|
+
// 验证通过,提交数据
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## 获取嵌套组件 ref
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
// 获取 formItemList 中 props.ref='detailTable' 的组件
|
|
184
|
+
const table = epForm.value?.getFormItemRenderRef('detailTable')
|
|
185
|
+
const rows = table?.getSelectionRows()
|
|
186
|
+
```
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# EpHeader 顶部操作栏
|
|
2
|
+
|
|
3
|
+
详情页顶部操作栏组件,支持返回、按钮组、附件等功能。
|
|
4
|
+
|
|
5
|
+
## 基本用法
|
|
6
|
+
|
|
7
|
+
```vue
|
|
8
|
+
<template>
|
|
9
|
+
<EpHeader
|
|
10
|
+
:buttons="headerButtons"
|
|
11
|
+
is-show-attachment-button
|
|
12
|
+
:file-list="formData.fileList"
|
|
13
|
+
/>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup lang="tsx">
|
|
17
|
+
import type { HeaderProps } from 'el-plus'
|
|
18
|
+
|
|
19
|
+
// 只放非内置的自定义按钮
|
|
20
|
+
const headerButtons: HeaderProps['buttons'] = [
|
|
21
|
+
{ name: '提交审批', onClick: () => {} },
|
|
22
|
+
{ name: '取消审批', onClick: () => {} },
|
|
23
|
+
{ name: '作废', onClick: () => {} },
|
|
24
|
+
]
|
|
25
|
+
</script>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Props
|
|
29
|
+
|
|
30
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
31
|
+
|------|------|------|--------|
|
|
32
|
+
| buttons | 自定义按钮列表 | [`ButtonProps[]`](./buttons.md#buttonprops-配置) | `[]` |
|
|
33
|
+
| defaultButtons | 显示的默认按钮 | `('edit' \| 'save' \| 'cancel' \| 'refresh' \| 'auditLog')[]` | `['edit', 'save', 'cancel', 'refresh', 'auditLog']` |
|
|
34
|
+
| mode | 页面模式 | `'add' \| 'edit' \| 'browse'` | - |
|
|
35
|
+
| allowBack | 是否允许返回 | `boolean` | `true` |
|
|
36
|
+
| name | 权限前缀 | `string` | - |
|
|
37
|
+
| workflowId | 工作流ID,有值则显示审批日志按钮 | `string` | - |
|
|
38
|
+
| isShowAttachmentButton | 显示附件按钮 | `boolean` | `false` |
|
|
39
|
+
| fileList | 附件列表 | `Record<string, any>[]` | `[]` |
|
|
40
|
+
| attachmentProps | 附件组件属性 | [`AttachmentProps`](./attachment.md#props) | `{}` |
|
|
41
|
+
|
|
42
|
+
> **注意**:`defaultButtons` 默认为全部按钮,无需显式设置。只有需要自定义显示的按钮时才需设置。
|
|
43
|
+
> ```json
|
|
44
|
+
> // ❌ 错误:无需设置默认值属性
|
|
45
|
+
> { "type": "EpHeader", "props": { "defaultButtons": ["edit", "save", "cancel", "refresh", "auditLog"] } }
|
|
46
|
+
> // ✅ 正确:使用默认值
|
|
47
|
+
> { "type": "EpHeader" }
|
|
48
|
+
> // ✅ 正确:自定义显示的按钮
|
|
49
|
+
> { "type": "EpHeader", "props": { "defaultButtons": ["edit", "save"] } }
|
|
50
|
+
> ```
|
|
51
|
+
|
|
52
|
+
## 默认按钮说明
|
|
53
|
+
|
|
54
|
+
| 按钮 | 说明 |
|
|
55
|
+
|------|------|
|
|
56
|
+
| edit | 编辑按钮 |
|
|
57
|
+
| save | 保存按钮 |
|
|
58
|
+
| cancel | 取消按钮 |
|
|
59
|
+
| refresh | 刷新按钮 |
|
|
60
|
+
| auditLog | 审批日志按钮 |
|
|
61
|
+
|
|
62
|
+
## 带附件按钮
|
|
63
|
+
|
|
64
|
+
```vue
|
|
65
|
+
<template>
|
|
66
|
+
<EpHeader
|
|
67
|
+
:buttons="headerButtons"
|
|
68
|
+
is-show-attachment-button
|
|
69
|
+
:file-list="formData.fileList"
|
|
70
|
+
:attachment-props="attachmentProps"
|
|
71
|
+
/>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<script setup>
|
|
75
|
+
const attachmentProps = {
|
|
76
|
+
formatColumns: [
|
|
77
|
+
{
|
|
78
|
+
prop: 'type',
|
|
79
|
+
props: {
|
|
80
|
+
options: [
|
|
81
|
+
{ label: '图片', value: 0 },
|
|
82
|
+
{ label: '附件', value: 2 },
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
}
|
|
88
|
+
</script>
|
|
89
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# 组件文档索引
|
|
2
|
+
|
|
3
|
+
所有组件可自由组合到 Form 中,配置时请参考各组件文档:
|
|
4
|
+
|
|
5
|
+
| 组件 | 文档 | 说明 |
|
|
6
|
+
|------|------|------|
|
|
7
|
+
| EpSearchListPage | [search-list-page.md](./search-list-page.md) | 搜索列表页容器 |
|
|
8
|
+
| EpForm | [form.md](./form.md) | 表单容器 |
|
|
9
|
+
| EpHeader | [header.md](./header.md) | 顶部操作栏 |
|
|
10
|
+
| EpTitle | [title.md](./title.md) | 标题分组 |
|
|
11
|
+
| EpDialog | [dialog.md](./dialog.md) | 对话框 |
|
|
12
|
+
| useFormDialog | [use-form-dialog.md](./use-form-dialog.md) | 表单对话框 Hook |
|
|
13
|
+
| useConfirmDialog | [use-confirm-dialog.md](./use-confirm-dialog.md) | 确认对话框 Hook |
|
|
14
|
+
| useChooseDialog | [use-choose-dialog.md](./use-choose-dialog.md) | 选择对话框 Hook |
|
|
15
|
+
| EpInput | [input.md](./input.md) | 输入框 |
|
|
16
|
+
| EpSelect | [select.md](./select.md) | 下拉选择 |
|
|
17
|
+
| EpDatePickerRange | [date-picker-range.md](./date-picker-range.md) | 日期范围选择 |
|
|
18
|
+
| EpTable | [table.md](./table.md) | 数据表格 |
|
|
19
|
+
| EpCustomColumn | [custom-column.md](./custom-column.md) | 自定义列配置 |
|
|
20
|
+
| EpLink | [link.md](./link.md) | 链接 |
|
|
21
|
+
| EpButtons | [buttons.md](./buttons.md) | 按钮组 |
|
|
22
|
+
| EpAttachment | [attachment.md](./attachment.md) | 附件管理 |
|
|
23
|
+
| EpFooterInfo | [footer-info.md](./footer-info.md) | 底部信息 |
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# EpInput 输入框
|
|
2
|
+
|
|
3
|
+
基于 el-input 封装,增加数字格式化等功能。
|
|
4
|
+
|
|
5
|
+
## 基本用法
|
|
6
|
+
|
|
7
|
+
```vue
|
|
8
|
+
<template>
|
|
9
|
+
<EpInput v-model="value" />
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup>
|
|
13
|
+
import { ref } from 'vue'
|
|
14
|
+
|
|
15
|
+
const value = ref('')
|
|
16
|
+
</script>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
22
|
+
|------|------|------|--------|
|
|
23
|
+
| v-model | 绑定值 ^el^ | `string \| number` | - |
|
|
24
|
+
| placeholder | 占位文本 ^el^ | `string` | '请输入' |
|
|
25
|
+
| clearable | 是否可清空 ^el^ | `boolean` | `true` |
|
|
26
|
+
| max | 最大值(数字模式) | `number` | - |
|
|
27
|
+
| min | 最小值(数字模式) | `number` | - |
|
|
28
|
+
| radix | 小数位数 | `number` | - |
|
|
29
|
+
| nonzero | 不允许为零 | `boolean` | `false` |
|
|
30
|
+
| thousand | 千分位格式化 | `boolean` | `true` |
|
|
31
|
+
|
|
32
|
+
> ^el^ 表示继承自 [el-input](https://element-plus.org/zh-CN/component/input.html) 的属性
|
|
33
|
+
|
|
34
|
+
> **注意**:
|
|
35
|
+
> - `clearable` 默认为 `true`,无需显式设置。只有需要 `clearable: false` 时才需设置。
|
|
36
|
+
> - `thousand` 默认为 `true`,无需显式设置。
|
|
37
|
+
> - 数值相关属性(`max`、`min`、`radix`、`nonzero`)默认不设置,只有明确需要时才添加。
|
|
38
|
+
> ```json
|
|
39
|
+
> // ❌ 错误:无需设置默认值属性
|
|
40
|
+
> { "prop": "name", "type": "EpInput", "props": { "clearable": true } }
|
|
41
|
+
> // ✅ 正确:使用默认值
|
|
42
|
+
> { "prop": "name" }
|
|
43
|
+
> // ❌ 错误:数值文本框默认不加数字属性
|
|
44
|
+
> { "prop": "amount", "label": "金额", "props": { "thousand": true } }
|
|
45
|
+
> // ✅ 正确:数值文本框无需设置默认值属性
|
|
46
|
+
> { "prop": "amount", "label": "金额" }
|
|
47
|
+
> // ✅ 正确:有特殊需求时才设置
|
|
48
|
+
> { "prop": "amount", "label": "金额", "props": { "radix": 2, "max": 999999 } }
|
|
49
|
+
> ```
|
|
50
|
+
|
|
51
|
+
## 在 Form 中使用
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
const formItemList = [
|
|
55
|
+
{
|
|
56
|
+
prop: 'name',
|
|
57
|
+
label: '名称',
|
|
58
|
+
// type 默认为 EpInput
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
prop: 'number',
|
|
62
|
+
label: '数字',
|
|
63
|
+
// type 默认为 EpInput
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
prop: 'remark',
|
|
67
|
+
label: '备注',
|
|
68
|
+
col: 24,
|
|
69
|
+
props: {
|
|
70
|
+
type: 'textarea',
|
|
71
|
+
rows: 4,
|
|
72
|
+
maxlength: 200,
|
|
73
|
+
showWordLimit: true,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
]
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## 数字输入
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
const formItemList = [
|
|
83
|
+
{
|
|
84
|
+
prop: 'amount',
|
|
85
|
+
label: '金额',
|
|
86
|
+
props: {
|
|
87
|
+
max: 999999,
|
|
88
|
+
min: 0,
|
|
89
|
+
radix: 2, // 保留2位小数
|
|
90
|
+
thousand: true, // 千分位
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
]
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## 格式化显示
|
|
97
|
+
|
|
98
|
+
通过 `formatter` 属性自定义显示格式:
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
{
|
|
102
|
+
prop: 'value',
|
|
103
|
+
label: '值',
|
|
104
|
+
disabled: true,
|
|
105
|
+
props: {
|
|
106
|
+
formatter: (value) => `${value} 元`,
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
```
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# EpLink 链接
|
|
2
|
+
|
|
3
|
+
基于 el-link 封装的链接组件。
|
|
4
|
+
|
|
5
|
+
## 基本用法
|
|
6
|
+
|
|
7
|
+
```vue
|
|
8
|
+
<template>
|
|
9
|
+
<EpLink content="查看详情" @click="handleClick" />
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup>
|
|
13
|
+
const handleClick = () => {
|
|
14
|
+
console.log('点击')
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
22
|
+
|------|------|------|--------|
|
|
23
|
+
| content | 链接文本 | `string` | - |
|
|
24
|
+
| type | 类型 ^el^ | `'primary' \| 'success' \| 'warning' \| 'danger' \| 'info'` | `'primary'` |
|
|
25
|
+
| underline | 下划线 ^el^ | `'always' \| 'hover' \| 'never'` | `'never'` |
|
|
26
|
+
| disabled | 是否禁用 ^el^ | `boolean` | `false` |
|
|
27
|
+
| href | 链接地址 ^el^ | `string` | - |
|
|
28
|
+
|
|
29
|
+
> ^el^ 表示继承自 [el-link](https://element-plus.org/zh-CN/component/link.html) 的属性
|
|
30
|
+
|
|
31
|
+
## 在表格中使用
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
const columns = [
|
|
35
|
+
{
|
|
36
|
+
prop: 'orderNo',
|
|
37
|
+
label: '订单号',
|
|
38
|
+
type: 'EpLink',
|
|
39
|
+
props: {
|
|
40
|
+
onClick: (row) => {
|
|
41
|
+
// 跳转详情
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
]
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 在 Form 中使用
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
const formItemList = [
|
|
52
|
+
{
|
|
53
|
+
prop: 'relatedNo',
|
|
54
|
+
label: '关联单号',
|
|
55
|
+
type: 'EpLink',
|
|
56
|
+
props: {
|
|
57
|
+
onClick: () => {
|
|
58
|
+
// 跳转关联单据
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
]
|
|
63
|
+
```
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# EpSearchListPage 搜索列表页
|
|
2
|
+
|
|
3
|
+
集成搜索表单和数据表格的列表页容器组件。
|
|
4
|
+
|
|
5
|
+
## 基本用法
|
|
6
|
+
|
|
7
|
+
```vue
|
|
8
|
+
<template>
|
|
9
|
+
<EpSearchListPage
|
|
10
|
+
:form-item-list="formItemList"
|
|
11
|
+
:form-data="formData"
|
|
12
|
+
:columns="columns"
|
|
13
|
+
:left-buttons="leftButtons"
|
|
14
|
+
api="/api/list/page"
|
|
15
|
+
:add="handleAdd"
|
|
16
|
+
show-selection-col
|
|
17
|
+
:action-buttons="actionButtons"
|
|
18
|
+
/>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup lang="tsx">
|
|
22
|
+
import { ref, reactive } from 'vue'
|
|
23
|
+
import type { SearchListPageProps } from 'el-plus'
|
|
24
|
+
|
|
25
|
+
const formData = reactive({})
|
|
26
|
+
|
|
27
|
+
const formItemList = ref<SearchListPageProps['formItemList']>([
|
|
28
|
+
{ prop: 'name', label: '名称' },
|
|
29
|
+
{ prop: 'status', label: '状态', type: 'EpSelect', props: { options: [] } },
|
|
30
|
+
])
|
|
31
|
+
// 如果有自定义列,就不需要定义 columns
|
|
32
|
+
const columns = [
|
|
33
|
+
{ prop: 'name', label: '名称' },
|
|
34
|
+
{ prop: 'status', label: '状态' },
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
const leftButtons = ref<SearchListPageProps['leftButtons']>([
|
|
38
|
+
{ name: '删除', prop: 'delete', type: 'danger' },
|
|
39
|
+
])
|
|
40
|
+
|
|
41
|
+
const actionButtons = ref<SearchListPageProps['actionButtons']>([
|
|
42
|
+
{ name: '编辑', prop: 'edit', onClick: (row) => {} },
|
|
43
|
+
{ name: '删除', prop: 'delete', onClick: (row) => {} },
|
|
44
|
+
])
|
|
45
|
+
|
|
46
|
+
const handleAdd = () => {}
|
|
47
|
+
</script>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Props
|
|
51
|
+
|
|
52
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
53
|
+
|------|------|------|--------|
|
|
54
|
+
| api | 列表接口地址 | `string \| (reqData) => Promise` | - |
|
|
55
|
+
| method | 请求方法 | `string` | `'post'` |
|
|
56
|
+
| reqData | 请求体数据 | `object` | `{}` |
|
|
57
|
+
| reqParams | URL 参数 | `object` | `{}` |
|
|
58
|
+
| reqBefore | 请求前处理 | `(reqData) => reqData` | - |
|
|
59
|
+
| reqAfter | 响应后处理 | `(res) => data` | - |
|
|
60
|
+
| formData | 表单数据 | `object` | `{}` |
|
|
61
|
+
| formItemList | 搜索表单配置 | [`FormItemProps[]`](./form.md#formitemprops-配置) | `[]` |
|
|
62
|
+
| columns | 表格列配置(有customColumnModule就不需要定义列) | [`TableColumn[]`](./table.md#tablecolumn-配置) | `[]` |
|
|
63
|
+
| leftButtons | 左侧按钮 | [`ButtonProps[]`](./buttons.md#buttonprops-配置) | `[]` |
|
|
64
|
+
| actionButtons | 操作列按钮 | [`ButtonProps[]`](./buttons.md#buttonprops-配置) | `[]` |
|
|
65
|
+
| add | 新增按钮回调 | `Function` | - |
|
|
66
|
+
| showSelectionCol | 显示多选列 | `boolean` | `false` |
|
|
67
|
+
| showSingleSelectionCol | 显示单选列 | `boolean` | `false` |
|
|
68
|
+
| showIndexCol | 显示序号列 | `boolean` | `true` |
|
|
69
|
+
| showOperationColumn | 显示操作列 | `boolean` | - |
|
|
70
|
+
| minWidth | 列最小宽度 | `number \| string` | - |
|
|
71
|
+
| actionColWidth | 操作列宽度 | `number \| string` | `200` |
|
|
72
|
+
| formatColumns | 格式化列配置 | [`TableColumn[]`](./table.md#tablecolumn-配置) | `[]` |
|
|
73
|
+
| offsetTop | 表格额外距离 | `number` | `0` |
|
|
74
|
+
| isInitSearch | 是否初始化加载 | `boolean` | `true` |
|
|
75
|
+
| tableProps | 表格额外属性 | `object` | - |
|
|
76
|
+
| formProps | 表单额外属性 | `object` | - |
|
|
77
|
+
| buttonsProps | 按钮组额外属性 | `object` | - |
|
|
78
|
+
| name | 权限前缀 | `string` | - |
|
|
79
|
+
| customColumnModule | 自定义列模块 | `string \| number` | - |
|
|
80
|
+
| customColumnApi | 自定义列接口 | `string` | - |
|
|
81
|
+
| customColumnSaveApi | 自定义列保存接口 | `string` | - |
|