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.
Files changed (87) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/index.full.js +7 -3
  3. package/dist/index.full.min.js +2 -2
  4. package/dist/index.full.min.js.map +1 -1
  5. package/dist/index.full.min.mjs +2 -2
  6. package/dist/index.full.min.mjs.map +1 -1
  7. package/dist/index.full.mjs +7 -3
  8. package/docs/api-examples.md +49 -0
  9. package/docs/components/attachment.md +111 -0
  10. package/docs/components/buttons.md +108 -0
  11. package/docs/components/custom-column.md +70 -0
  12. package/docs/components/date-picker-range.md +61 -0
  13. package/docs/components/dialog.md +104 -0
  14. package/docs/components/footer-info.md +101 -0
  15. package/docs/components/form.md +186 -0
  16. package/docs/components/header.md +89 -0
  17. package/docs/components/index.md +23 -0
  18. package/docs/components/input.md +109 -0
  19. package/docs/components/link.md +63 -0
  20. package/docs/components/search-list-page.md +81 -0
  21. package/docs/components/select.md +163 -0
  22. package/docs/components/table.md +133 -0
  23. package/docs/components/title.md +70 -0
  24. package/docs/components/use-choose-dialog.md +115 -0
  25. package/docs/components/use-confirm-dialog.md +87 -0
  26. package/docs/components/use-form-dialog.md +87 -0
  27. package/docs/guide/markdown-examples.md +85 -0
  28. package/docs/index.md +25 -0
  29. package/docs/pages/detail.md +74 -0
  30. package/docs/pages/list.md +73 -0
  31. package/es/cli/src/commands/gen-docs.d.ts +2 -0
  32. package/es/cli/src/commands/install.d.ts +13 -0
  33. package/es/cli/src/commands/parse.d.ts +2 -0
  34. package/es/cli/src/index.d.ts +2 -0
  35. package/es/cli/src/parser/image-parser.d.ts +8 -0
  36. package/es/cli/src/parser/modao.d.ts +54 -0
  37. package/es/components/buttons/index.d.ts +45 -45
  38. package/es/components/buttons/src/buttons-vue.d.ts +16 -16
  39. package/es/components/buttons/src/buttons.d.ts +1 -1
  40. package/es/components/date-picker-range/index.d.ts +3 -3
  41. package/es/components/date-picker-range/src/date-picker-range.vue.d.ts +1 -1
  42. package/es/components/footer-info/index.d.ts +3 -3
  43. package/es/components/footer-info/src/footer-info.vue.d.ts +1 -1
  44. package/es/components/form/src/form-item-vue.mjs +6 -2
  45. package/es/components/form/src/form-item-vue.mjs.map +1 -1
  46. package/es/components/header/index.d.ts +3 -3
  47. package/es/components/header/src/header.d.ts +1 -1
  48. package/es/components/header/src/header.mjs.map +1 -1
  49. package/es/components/header/src/header.vue.d.ts +1 -1
  50. package/es/components/input/index.d.ts +3 -3
  51. package/es/components/input/src/input.vue.d.ts +1 -1
  52. package/es/components/link/index.d.ts +6 -6
  53. package/es/components/link/src/link.d.ts +1 -1
  54. package/es/components/link/src/link.vue.d.ts +3 -3
  55. package/es/components/search-list-page/index.d.ts +12 -12
  56. package/es/components/search-list-page/src/search-list-page.vue.d.ts +4 -4
  57. package/es/components/search-list-page/src/use-search-list-page.d.ts +4 -4
  58. package/es/package.json.mjs +1 -1
  59. package/lib/cli/src/commands/gen-docs.d.ts +2 -0
  60. package/lib/cli/src/commands/install.d.ts +13 -0
  61. package/lib/cli/src/commands/parse.d.ts +2 -0
  62. package/lib/cli/src/index.d.ts +2 -0
  63. package/lib/cli/src/parser/image-parser.d.ts +8 -0
  64. package/lib/cli/src/parser/modao.d.ts +54 -0
  65. package/lib/components/buttons/index.d.ts +45 -45
  66. package/lib/components/buttons/src/buttons-vue.d.ts +16 -16
  67. package/lib/components/buttons/src/buttons.d.ts +1 -1
  68. package/lib/components/date-picker-range/index.d.ts +3 -3
  69. package/lib/components/date-picker-range/src/date-picker-range.vue.d.ts +1 -1
  70. package/lib/components/footer-info/index.d.ts +3 -3
  71. package/lib/components/footer-info/src/footer-info.vue.d.ts +1 -1
  72. package/lib/components/form/src/form-item-vue.js +5 -1
  73. package/lib/components/form/src/form-item-vue.js.map +1 -1
  74. package/lib/components/header/index.d.ts +3 -3
  75. package/lib/components/header/src/header.d.ts +1 -1
  76. package/lib/components/header/src/header.js.map +1 -1
  77. package/lib/components/header/src/header.vue.d.ts +1 -1
  78. package/lib/components/input/index.d.ts +3 -3
  79. package/lib/components/input/src/input.vue.d.ts +1 -1
  80. package/lib/components/link/index.d.ts +6 -6
  81. package/lib/components/link/src/link.d.ts +1 -1
  82. package/lib/components/link/src/link.vue.d.ts +3 -3
  83. package/lib/components/search-list-page/index.d.ts +12 -12
  84. package/lib/components/search-list-page/src/search-list-page.vue.d.ts +4 -4
  85. package/lib/components/search-list-page/src/use-search-list-page.d.ts +4 -4
  86. package/lib/package.json.js +1 -1
  87. package/package.json +2 -1
@@ -1,4 +1,4 @@
1
- /*! ElPlus v0.0.84 */
1
+ /*! ElPlus v0.0.86-beta.0 */
2
2
 
3
3
  import { useAttrs, getCurrentInstance, inject, provide, ref, nextTick, defineComponent, computed, createVNode, Fragment, withDirectives, resolveComponent, mergeProps, resolveDirective, useTemplateRef, reactive, onBeforeUpdate, createTextVNode, h, mergeModels, useModel, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createCommentVNode, withCtx, renderSlot, renderList, createBlock, vShow, toDisplayString, useSlots, watch, onMounted, createSlots, normalizeProps, guardReactiveProps, markRaw, Transition, shallowReactive, isVNode, render, createElementVNode, toRaw } from 'vue';
4
4
  import { buttonProps, useLocale as useLocale$1, ElLoading, ElMessage, ElMessageBox, formProps as formProps$1, formEmits as formEmits$1, ElTooltip, formItemProps as formItemProps$1, ElFormItem, ElForm, ElRow, ElCol, inputProps as inputProps$1, inputEmits as inputEmits$1, configProviderContextKey, ElConfigProvider, ElDialog, ElButton, ElTable, ElIcon, selectProps as selectProps$1, selectEmits as selectEmits$1, ElPageHeader, datePickerProps, linkProps as linkProps$1, ElSkeleton } from 'element-plus';
@@ -994,9 +994,13 @@ var EpFormItem = /* @__PURE__ */ defineComponent({
994
994
  disabled,
995
995
  ...formItemProps2
996
996
  } = props;
997
+ const isShowLabel = computed(() => {
998
+ if (!props.label) return false;
999
+ return props.isShowLabel;
1000
+ });
997
1001
  return () => {
998
1002
  return createVNode(ElFormItem, mergeProps({
999
- "class": [bem$4.b(), bem$4.is("hide-label", !props.isShowLabel), prepareClassNames()],
1003
+ "class": [bem$4.b(), bem$4.is("hide-label", !isShowLabel.value), prepareClassNames()],
1000
1004
  "style": prepareStyles()
1001
1005
  }, {
1002
1006
  ...prepareProps(formItemProps2, [...expandFormItemPropsKeys]),
@@ -4457,7 +4461,7 @@ var components = [
4457
4461
  EpFooterInfo
4458
4462
  ];
4459
4463
 
4460
- var version = "0.0.84";
4464
+ var version = "0.0.86-beta.0";
4461
4465
 
4462
4466
  var globalProperties = {
4463
4467
  install(app) {
@@ -0,0 +1,49 @@
1
+ ---
2
+ outline: deep
3
+ ---
4
+
5
+ # Runtime API Examples
6
+
7
+ This page demonstrates usage of some of the runtime APIs provided by VitePress.
8
+
9
+ The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files:
10
+
11
+ ```md
12
+ <script setup>
13
+ import { useData } from 'vitepress'
14
+
15
+ const { theme, page, frontmatter } = useData()
16
+ </script>
17
+
18
+ ## Results
19
+
20
+ ### Theme Data
21
+ <pre>{{ theme }}</pre>
22
+
23
+ ### Page Data
24
+ <pre>{{ page }}</pre>
25
+
26
+ ### Page Frontmatter
27
+ <pre>{{ frontmatter }}</pre>
28
+ ```
29
+
30
+ <script setup>
31
+ import { useData } from 'vitepress'
32
+
33
+ const { site, theme, page, frontmatter } = useData()
34
+ </script>
35
+
36
+ ## Results
37
+
38
+ ### Theme Data
39
+ <pre>{{ theme }}</pre>
40
+
41
+ ### Page Data
42
+ <pre>{{ page }}</pre>
43
+
44
+ ### Page Frontmatter
45
+ <pre>{{ frontmatter }}</pre>
46
+
47
+ ## More
48
+
49
+ Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).
@@ -0,0 +1,111 @@
1
+ # EpAttachment 附件管理
2
+
3
+ 附件上传和管理组件,支持对话框和内嵌两种模式。
4
+
5
+ ## 基本用法
6
+
7
+ ```vue
8
+ <template>
9
+ <EpAttachment v-model="fileList" />
10
+ </template>
11
+
12
+ <script setup>
13
+ import { ref } from 'vue'
14
+
15
+ const fileList = ref([])
16
+ </script>
17
+ ```
18
+
19
+ ## Props
20
+
21
+ | 属性 | 说明 | 类型 | 默认值 |
22
+ |------|------|------|--------|
23
+ | v-model | 附件列表 | `array` | `[]` |
24
+ | mode | 页面模式 | `'add' \| 'edit' \| 'view'` | - |
25
+ | openType | 展示模式 | `'dialog' \| 'normal'` | `'dialog'` |
26
+ | isType | 是否需要类型 | `boolean` | `true` |
27
+ | isNote | 是否需要备注 | `boolean` | `false` |
28
+ | isShowOpenDialogButton | 显示打开弹窗按钮 | `boolean` | `false` |
29
+ | formatColumns | 格式化列配置 | [`TableColumn[]`](./table.md#tablecolumn-配置) | `[]` |
30
+ | beforeAdd | 添加前校验 | `(fileItem) => boolean` | - |
31
+ | permission | 权限标识 | `string` | - |
32
+
33
+ ## 在 Form 中使用
34
+
35
+ ```tsx
36
+ const formItemList = [
37
+ {
38
+ col: 24,
39
+ type: 'EpAttachment',
40
+ props: {
41
+ modelValue: formData.fileList,
42
+ openType: 'normal',
43
+ formatColumns: [
44
+ {
45
+ prop: 'type',
46
+ props: {
47
+ options: [
48
+ { label: '图片', value: 0 },
49
+ { label: '普通附件', value: 2 },
50
+ ],
51
+ },
52
+ },
53
+ ],
54
+ },
55
+ },
56
+ ]
57
+ ```
58
+
59
+ ## 配合 EpHeader 使用
60
+
61
+ ```vue
62
+ <template>
63
+ <EpHeader
64
+ :buttons="headerButtons"
65
+ is-show-attachment-button
66
+ :file-list="formData.fileList"
67
+ :attachment-props="attachmentProps"
68
+ />
69
+ </template>
70
+
71
+ <script setup>
72
+ const attachmentProps = {
73
+ formatColumns: [
74
+ {
75
+ prop: 'type',
76
+ props: {
77
+ options: [
78
+ { label: '图片', value: 0 },
79
+ { label: '附件', value: 2 },
80
+ ],
81
+ },
82
+ },
83
+ ],
84
+ }
85
+ </script>
86
+ ```
87
+
88
+ ## 内嵌模式
89
+
90
+ ```tsx
91
+ {
92
+ type: 'EpAttachment',
93
+ props: {
94
+ openType: 'normal', // 内嵌模式,直接显示附件表格
95
+ modelValue: formData.fileList,
96
+ },
97
+ }
98
+ ```
99
+
100
+ ## 对话框模式
101
+
102
+ ```tsx
103
+ {
104
+ type: 'EpAttachment',
105
+ props: {
106
+ openType: 'dialog', // 对话框模式,点击按钮打开
107
+ isShowOpenDialogButton: true,
108
+ modelValue: formData.fileList,
109
+ },
110
+ }
111
+ ```
@@ -0,0 +1,108 @@
1
+ # EpButtons 按钮组
2
+
3
+ 按钮组组件,支持权限控制、确认弹窗等功能。
4
+
5
+ ## 基本用法
6
+
7
+ ```vue
8
+ <template>
9
+ <EpButtons :list="buttons" />
10
+ </template>
11
+
12
+ <script setup>
13
+ const buttons = [
14
+ {
15
+ name: '新增',
16
+ prop: 'add',
17
+ type: 'primary',
18
+ onClick: () => {},
19
+ },
20
+ {
21
+ name: '删除',
22
+ prop: 'delete',
23
+ type: 'danger',
24
+ onClick: () => {},
25
+ },
26
+ ]
27
+ </script>
28
+ ```
29
+
30
+ ## Props
31
+
32
+ | 属性 | 说明 | 类型 | 默认值 |
33
+ |------|------|------|--------|
34
+ | list | 按钮列表 | `ButtonProps[]` | `[]` |
35
+ | size | 按钮尺寸 | `'large' \| 'default' \| 'small'` | `'small'` |
36
+ | type | 默认按钮类型 | `string` | `'default'` |
37
+ | disabled | 是否禁用(支持函数) | `boolean \| () => boolean` | `false` |
38
+
39
+ ## ButtonProps 配置
40
+
41
+ | 属性 | 说明 | 类型 |
42
+ |------|------|------|
43
+ | name | 按钮文本 | `string` |
44
+ | prop | 唯一标识 | `string` |
45
+ | type | 按钮类型 | `'primary' \| 'success' \| 'warning' \| 'danger' \| 'info'` |
46
+ | plain | 朴素按钮 | `boolean` |
47
+ | disabled | 是否禁用 | `boolean \| () => boolean` |
48
+ | visible | 是否显示 | `boolean \| () => boolean` |
49
+ | permission | 权限标识 | `string` |
50
+ | confirm | 是否需要确认 | `boolean` |
51
+ | confirmText | 确认提示文本 | `string` |
52
+ | onClick | 点击回调 | `(e: MouseEvent \| TableScope) => void` |
53
+
54
+ ## 带确认弹窗
55
+
56
+ ```tsx
57
+ const buttons = [
58
+ {
59
+ name: '删除',
60
+ prop: 'delete',
61
+ type: 'danger',
62
+ confirm: true,
63
+ confirmText: '确定要删除吗?',
64
+ onClick: () => {
65
+ // 删除逻辑
66
+ },
67
+ },
68
+ ]
69
+ ```
70
+
71
+ ## 权限控制
72
+
73
+ ```tsx
74
+ const buttons = [
75
+ {
76
+ name: '编辑',
77
+ prop: 'edit',
78
+ permission: 'order:edit', // 需要 order:edit 权限才显示
79
+ onClick: () => {},
80
+ },
81
+ ]
82
+ ```
83
+
84
+ ## 动态禁用
85
+
86
+ ```tsx
87
+ const buttons = [
88
+ {
89
+ name: '提交',
90
+ prop: 'submit',
91
+ disabled: () => formData.status !== 'draft',
92
+ onClick: () => {},
93
+ },
94
+ ]
95
+ ```
96
+
97
+ ## 动态显示
98
+
99
+ ```tsx
100
+ const buttons = [
101
+ {
102
+ name: '审核',
103
+ prop: 'audit',
104
+ visible: () => formData.status === 'pending',
105
+ onClick: () => {},
106
+ },
107
+ ]
108
+ ```
@@ -0,0 +1,70 @@
1
+ # EpCustomColumn 自定义列配置
2
+
3
+ 用于配置表格显示列的组件,支持拖拽排序和持久化。
4
+
5
+ ## 基本用法
6
+
7
+ ```vue
8
+ <template>
9
+ <EpCustomColumn
10
+ ref="customColumn"
11
+ module="orderList"
12
+ @confirm="handleConfirm"
13
+ />
14
+ </template>
15
+
16
+ <script setup>
17
+ import { useTemplateRef } from 'vue'
18
+
19
+ const customColumn = useTemplateRef('customColumn')
20
+
21
+ // 打开配置弹窗
22
+ const openCustomColumn = () => {
23
+ customColumn.value?.open()
24
+ }
25
+
26
+ const handleConfirm = (columns) => {
27
+ console.log('选中的列', columns)
28
+ }
29
+ </script>
30
+ ```
31
+
32
+ ## Props
33
+
34
+ | 属性 | 说明 | 类型 | 默认值 |
35
+ |------|------|------|--------|
36
+ | module | 模块标识 | `string \| number` | - |
37
+ | api | 获取列配置接口 | `string` \| `Function` | `/api-item/api/customizedColumns/find` |
38
+ | saveApi | 保存列配置接口 | `string`\| `Function` | `/api-item/api/customizedColumns/save` |
39
+ | showHandler | 显示拖拽手柄 | `boolean` | `true` |
40
+
41
+ ## Events
42
+
43
+ | 事件名 | 说明 | 回调参数 |
44
+ |--------|------|----------|
45
+ | confirm | 确认配置 | `(columns: TransferDataItem[])` |
46
+ | loaded | 配置加载完成 | `(columns: TransferDataItem[])` |
47
+
48
+ ## 配合 EpSearchListPage 使用
49
+
50
+ ```vue
51
+ <template>
52
+ <EpSearchListPage
53
+ :columns="columns"
54
+ :custom-column-module="11"
55
+ custom-column-api="/api/columns/find"
56
+ custom-column-save-api="/api/columns/save"
57
+ />
58
+ </template>
59
+ ```
60
+
61
+ ## 配合 EpTable 使用
62
+
63
+ ```vue
64
+ <template>
65
+ <EpTable
66
+ :columns="columns"
67
+ :custom-column-module="11"
68
+ />
69
+ </template>
70
+ ```
@@ -0,0 +1,61 @@
1
+ # EpDatePickerRange 日期范围选择
2
+
3
+ 基于 el-date-picker 封装的日期范围选择组件,内置快捷选项。
4
+
5
+ ## 基本用法
6
+
7
+ ```vue
8
+ <template>
9
+ <EpDatePickerRange v-model="dateRange" />
10
+ </template>
11
+
12
+ <script setup>
13
+ import { ref } from 'vue'
14
+
15
+ const dateRange = ref([])
16
+ </script>
17
+ ```
18
+
19
+ ## Props
20
+
21
+ | 属性 | 说明 | 类型 | 默认值 |
22
+ |------|------|------|--------|
23
+ | v-model | 绑定值 ^el^ | `[Date, Date] \| [number, number]` | - |
24
+ | type | 类型 ^el^ | `string` | `'daterange'` |
25
+ | valueFormat | 值格式 ^el^ | `string` | `'x'` (时间戳) |
26
+ | rangeSeparator | 分隔符 ^el^ | `string` | `'~'` |
27
+ | startPlaceholder | 开始占位文本 ^el^ | `string` | '开始时间' |
28
+ | endPlaceholder | 结束占位文本 ^el^ | `string` | '结束时间' |
29
+ | size | 尺寸 ^el^ | `'large' \| 'default' \| 'small'` | `'default'` |
30
+ | shortcuts | 快捷选项 ^el^ | `array` | 最近一周/一月/三月 |
31
+
32
+ > ^el^ 表示继承自 [el-date-picker](https://element-plus.org/zh-CN/component/date-picker.html) 的属性
33
+
34
+ ## 默认快捷选项
35
+
36
+ - 最近一周
37
+ - 最近一月
38
+ - 最近三月
39
+
40
+ ## 在 Form 中使用
41
+
42
+ ```tsx
43
+ const formItemList = [
44
+ {
45
+ prop: 'orderDate',
46
+ label: '日期范围',
47
+ type: 'EpDatePickerRange',
48
+ props: {
49
+ start: formData.orderDateStart,
50
+ end: formData.orderDateEnd,
51
+ },
52
+ 'onUpdate:start': (val) => {
53
+ formData.orderDateStart = val
54
+ },
55
+ 'onUpdate:end': (val) => {
56
+ formData.orderDateEnd = val
57
+ },
58
+ }
59
+ ]
60
+ ```
61
+
@@ -0,0 +1,104 @@
1
+ # EpDialog 对话框
2
+
3
+ 基于 useDialog hook 实现的对话框,支持 Promise 方式调用。
4
+
5
+ ## 基本用法
6
+
7
+ ```vue
8
+ <template>
9
+ <el-button @click="openDialog">打开对话框</el-button>
10
+ <Dialog />
11
+ </template>
12
+
13
+ <script setup lang="tsx">
14
+ import { useDialog } from 'el-plus'
15
+
16
+ const Dialog = useDialog({
17
+ title: '对话框标题',
18
+ width: '600px',
19
+ onConfirm: (resolve) => {
20
+ // 确认逻辑
21
+ resolve('success')
22
+ },
23
+ onCancel: (reject) => {
24
+ reject('cancel')
25
+ },
26
+ })
27
+
28
+ const openDialog = async () => {
29
+ try {
30
+ const result = await Dialog.start()
31
+ console.log('确认', result)
32
+ } catch (e) {
33
+ console.log('取消', e)
34
+ }
35
+ }
36
+ </script>
37
+ ```
38
+
39
+ ## useDialog Options
40
+
41
+ | 属性 | 说明 | 类型 | 默认值 |
42
+ |------|------|------|--------|
43
+ | title | 对话框标题 ^el^ | `string` | '提示' |
44
+ | width | 对话框宽度 ^el^ | `string` | - |
45
+ | showFooter | 显示底部按钮 | `boolean` | `true` |
46
+ | confirmText | 确认按钮文本 | `string` | '确定' |
47
+ | cancelText | 取消按钮文本 | `string` | '取消' |
48
+ | onConfirm | 确认回调 | `(resolve) => void` | - |
49
+ | onBeforeConfirm | 确认前回调 | `(resolve) => void` | - |
50
+ | onCancel | 取消回调 | `(reject) => void` | - |
51
+ | onBeforeCancel | 取消前回调 | `(reject) => void` | - |
52
+ | render | 自定义渲染函数 | `(props) => VNode` | - |
53
+ | scopedSlots | 插槽 | `object` | - |
54
+ | destroyOnClose | 关闭时销毁 ^el^ | `boolean` | - |
55
+
56
+ > ^el^ 表示继承自 [el-dialog](https://element-plus.org/zh-CN/component/dialog.html) 的属性
57
+
58
+ ## 自定义内容
59
+
60
+ ```tsx
61
+ const Dialog = useDialog({
62
+ title: '自定义内容',
63
+ render: ({ resolve, reject }) => (
64
+ <div>
65
+ <p>自定义内容</p>
66
+ <EpForm v-model={formData} formItemList={formItemList} />
67
+ </div>
68
+ ),
69
+ onConfirm: async (resolve) => {
70
+ const valid = await formRef.value?.validate()
71
+ if (valid) {
72
+ resolve(formData)
73
+ }
74
+ },
75
+ })
76
+ ```
77
+
78
+ ## 使用插槽
79
+
80
+ ```vue
81
+ <template>
82
+ <Dialog>
83
+ <template #default="{ resolve, reject }">
84
+ <p>对话框内容</p>
85
+ </template>
86
+ </Dialog>
87
+ </template>
88
+
89
+ <script setup>
90
+ import { useDialog } from 'el-plus'
91
+
92
+ const Dialog = useDialog({
93
+ title: '使用插槽',
94
+ })
95
+ </script>
96
+ ```
97
+
98
+ ## 其他对话框 Hooks
99
+
100
+ | Hook | 说明 |
101
+ |------|------|
102
+ | [useFormDialog](./use-form-dialog.md) | 表单对话框 |
103
+ | [useConfirmDialog](./use-confirm-dialog.md) | 确认对话框 |
104
+ | [useChooseDialog](./use-choose-dialog.md) | 选择对话框 |
@@ -0,0 +1,101 @@
1
+ # EpFooterInfo 底部信息
2
+
3
+ 用于显示单据底部的创建人、修改人等信息。
4
+
5
+ ## 基本用法
6
+
7
+ ```vue
8
+ <template>
9
+ <EpFooterInfo v-model="formData" />
10
+ </template>
11
+
12
+ <script setup>
13
+ import { reactive } from 'vue'
14
+
15
+ const formData = reactive({
16
+ creator: 'admin',
17
+ creatorName: '管理员',
18
+ createTime: '2024-01-01 10:00:00',
19
+ editor: 'admin',
20
+ editorName: '管理员',
21
+ editTime: '2024-01-02 15:00:00',
22
+ })
23
+ </script>
24
+ ```
25
+
26
+ ## Props
27
+
28
+ | 属性 | 说明 | 类型 | 默认值 |
29
+ |------|------|------|--------|
30
+ | v-model | 数据对象 | `Record<string, any>` | `{}` |
31
+ | list | 字段配置列表 | `FooterInfoFieldConfig[]` | 默认四字段 |
32
+ | fieldMap | 字段映射配置 | `FooterInfoFieldMap` | `{}` |
33
+
34
+ ## 默认字段
35
+
36
+ | 字段 | 说明 |
37
+ |------|------|
38
+ | creator / creatorName | 制单人 |
39
+ | createTime / createTimestamp | 创建时间 |
40
+ | editor / editorName | 最新修改人 |
41
+ | editTime / editTimestamp | 最新修改时间 |
42
+
43
+ ## FooterInfoFieldConfig
44
+
45
+ ```ts
46
+ interface FooterInfoFieldConfig {
47
+ name: string // 显示名称
48
+ prop: string // 字段名
49
+ formatter?: (value: any, modelValue: any) => string
50
+ }
51
+ ```
52
+
53
+ ## 自定义字段
54
+
55
+ ```vue
56
+ <template>
57
+ <EpFooterInfo v-model="formData" :list="fieldList" />
58
+ </template>
59
+
60
+ <script setup>
61
+ const fieldList = [
62
+ { name: '创建人', prop: 'createBy' },
63
+ { name: '创建时间', prop: 'createTime' },
64
+ { name: '审核人', prop: 'auditBy' },
65
+ { name: '审核时间', prop: 'auditTime' },
66
+ ]
67
+ </script>
68
+ ```
69
+
70
+ ## 使用 fieldMap 格式化
71
+
72
+ ```vue
73
+ <template>
74
+ <EpFooterInfo v-model="formData" :field-map="fieldMap" />
75
+ </template>
76
+
77
+ <script setup>
78
+ const fieldMap = {
79
+ creator: {
80
+ name: '制单人',
81
+ formatter: (value, data) => `${data.creatorName}(${value})`,
82
+ },
83
+ createTime: (value) => value?.split(' ')[0], // 只显示日期
84
+ }
85
+ </script>
86
+ ```
87
+
88
+ ## 在 Form 中使用
89
+
90
+ ```tsx
91
+ const formItemList = [
92
+ // 其他表单项...
93
+ {
94
+ col: 24,
95
+ type: 'EpFooterInfo',
96
+ props: {
97
+ modelValue: formData,
98
+ },
99
+ },
100
+ ]
101
+ ```