@infly/ui 1.0.9 → 1.0.13

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 (3) hide show
  1. package/README.md +718 -13
  2. package/index.js +9 -4
  3. package/package.json +1 -3
package/README.md CHANGED
@@ -1,23 +1,728 @@
1
1
  # @infly/ui
2
2
 
3
- ## 介绍
3
+ `@infly/ui` 是运营端通用 Vue2 组件库。当前业务页面优先使用 `InflyList`、`InflyForm`、`InflyDialog` 等组件承载筛选、表格、分页、详情展示和弹窗表单。
4
4
 
5
- 组件库
5
+ 修改 `InflyList` 或 `InflyForm` 时必须同步更新本文档:新增 prop、事件、插槽、字段配置、列类型或表单类型,都要补充至少一个可复制的使用示例。
6
6
 
7
- ## 注意事项
7
+ ## InflyList
8
8
 
9
+ `InflyList` 组合了 `el-tabs`、`InflyForm`、`el-table` 和分页。适合“tab + 筛选区 + 操作按钮 + 表格 + 分页”的运营端页面。
9
10
 
10
- ## 软件架构
11
+ ### 基础示例
11
12
 
12
- @infly/ui
13
- ├── Base - 基础组件库
14
- │ └── InflyForm - 动态表单组件
15
- ├── Business - 业务组件
16
- │ └── InstitutionSelect - 机构选择组件
13
+ ```vue
14
+ <template>
15
+ <InflyList
16
+ ref="listRef"
17
+ :formData="formData"
18
+ :reqUrl="reqUrl"
19
+ :filterList="filterList"
20
+ :btnList="btnList"
21
+ :columns="columns"
22
+ :dealParams="dealParams"
23
+ :customRender="customRender"
24
+ @tab-change="handleTabChange"
25
+ />
26
+ </template>
17
27
 
18
- ## 安装教程
28
+ <script>
29
+ export default {
30
+ data() {
31
+ return {
32
+ reqUrl: "/admin/reconciliation/bills/",
33
+ formData: { page: 1, pagesize: 10, total: 0 },
34
+ filterList: [
35
+ { label: "账单年份", name: "bill_year", type: "el-select", options: [{ label: "2026", value: "2026" }], clearable: true },
36
+ { label: "关键词", name: "keyword", type: "infly-input", placeholder: "账单ID/金额/操作人", clearable: true }
37
+ ],
38
+ btnList: [
39
+ { label: "导出", type: "primary", btnEvent: () => this.exportList() }
40
+ ],
41
+ columns: [
42
+ { label: "账单ID", prop: "id", width: "90px" },
43
+ { label: "账单金额", prop: "total_consume_amount", type: "render", minWidth: "140px" }
44
+ ]
45
+ };
46
+ },
47
+ methods: {
48
+ dealParams(params) {
49
+ return { ...params, keyword: (params.keyword || "").trim() };
50
+ },
51
+ customRender(row, prop) {
52
+ if (prop === "total_consume_amount") return `¥${row[prop] || "0.00"}`;
53
+ return row[prop] || "-";
54
+ }
55
+ }
56
+ };
57
+ </script>
58
+ ```
59
+
60
+ ### Props
61
+
62
+ | Prop | 类型 | 默认值 | 说明 | 示例 |
63
+ | --- | --- | --- | --- | --- |
64
+ | `formData` | `Object` | 必填 | 查询参数、分页参数和总数容器。组件会写入 `page`、`pagesize`、`total`。 | `:formData="{ page: 1, pagesize: 10, total: 0 }"` |
65
+ | `defaultTabName` | `String` | `""` | 默认激活的一级 tab 名称。 | `:defaultTabName="'billList'"` |
66
+ | `hideTab` | `Boolean` | `false` | 隐藏一级 tab 头部。 | `hideTab` |
67
+ | `tabList` | `Array` | `[{}]` | 一级 tab 配置,直接透传给 `el-tab-pane`;每项可带 `reqUrl`。 | `[{ label: "账单列表", name: "billList", reqUrl: "/admin/reconciliation/bills/" }]` |
68
+ | `filterList` | `Array` | `[]` | 传给 `InflyForm` 的筛选/详情字段配置。 | `[{ label: "关键词", name: "keyword", type: "infly-input" }]` |
69
+ | `columns` | `Array` | 必填 | 表格列配置,支持普通列、操作列、特殊类型、多级表头。 | `[{ label: "ID", prop: "id" }]` |
70
+ | `btnList` | `Array` | `[]` | 顶部操作按钮,传给 `InflyForm`。 | `[{ label: "上传", type: "blue", btnEvent: this.openDialog }]` |
71
+ | `outSideReqParams` | `Object` | `{}` | 额外请求参数,每次请求合并到 `formData` 后。 | `:outSideReqParams="{ bill_id: billId }"` |
72
+ | `reqUrl` | `String` | `""` | 列表接口地址;为空时会尝试使用当前 tab 的 `reqUrl`。 | `reqUrl="/admin/reconciliation/logs/"` |
73
+ | `reqMethod` | `String` | `"get"` | 请求方法,使用 `this.$axios[reqMethod]`。 | `reqMethod="post"` |
74
+ | `defaultInit` | `Boolean` | `true` | 创建后是否自动请求。详情页常设为 `false`,待详情信息加载后手动请求。 | `:defaultInit="false"` |
75
+ | `dealParams` | `Function` | `null` | 请求前处理参数,返回对象会替换最终参数。 | `:dealParams="(params) => ({ ...params, status: params.status || undefined })"` |
76
+ | `dealRes` | `Function` | `null` | 请求后处理响应,返回对象会作为最终响应。 | `:dealRes="(res) => ({ lists: res.data, counts: res.total })"` |
77
+ | `initEventName` | `String` | `"initData"` | 查询后额外 emit 的事件名。 | `initEventName="refresh"` |
78
+ | `hideDivider` | `Boolean` | `false` | 隐藏筛选区和表格之间的分隔线。 | `hideDivider` |
79
+ | `isInnerList` | `Boolean` | `false` | 内嵌列表样式。 | `isInnerList` |
80
+ | `isTopList` | `Boolean` | `true` | 页面顶部列表样式。 | `:isTopList="false"` |
81
+ | `hideEmptyTag` | `Boolean` | `false` | `el-tag` 列为空时不渲染 tag。 | `hideEmptyTag` |
82
+ | `hideJumpPageButton` | `Boolean` | `false` | 隐藏分页右侧“跳转”按钮。 | `hideJumpPageButton` |
83
+ | `customRender` | `Function` | 取 `row[prop]` | `type: "render"`、`custom`、`el-popover` 的统一渲染函数,可返回字符串或 VNode。 | `customRender(row, prop) { return row[prop] || "-" }` |
84
+ | `tableProps` | `Object` | `{}` | 透传给 `el-table`,也支持 `dataList` 覆盖内部请求数据。 | `:tableProps="{ stripe: true, dataList: localRows }"` |
85
+ | `formProps` | `Object` | `{ "label-width": "80px" }` | 透传给内部 `InflyForm`。 | `:formProps="{ layout: 'inline-seamless', 'label-width': '120px' }"` |
86
+ | `emptyText` | `String` | `""` | 普通单元格空值文案。 | `emptyText="-"` |
87
+ | `tabsProps` | `Object` | `{ type: "border-card" }` | 透传给 `el-tabs`。 | `:tabsProps="{ type: '' }"` |
88
+
89
+ ### 事件
90
+
91
+ | 事件 | 触发时机 | 示例 |
92
+ | --- | --- | --- |
93
+ | `initData` | 调用 `initData()` 后触发;名称可由 `initEventName` 改写。 | `@initData="afterSearch"` |
94
+ | `tab-change` / `tabChange` | 一级 tab 切换时触发,参数包含原始 tab 配置和 `activityTab`。 | `@tab-change="handleTabChange"` |
95
+ | `sec-tab-change` / `secTabChange` | 内部 `InflyForm` 的 `secTab` 切换时触发。 | `@secTabChange="handleSecTabChange"` |
96
+ | `request-error` | 请求异常或请求方法不支持时触发。 | `@request-error="handleError"` |
97
+ | `request-timeout` | 单次请求超过 60 秒时触发。 | `@request-timeout="handleTimeout"` |
98
+
99
+ ### 插槽
100
+
101
+ | 插槽 | 位置 | 示例 |
102
+ | --- | --- | --- |
103
+ | `pretop` | `el-tabs` 内、tab pane 前。 | `<template #pretop><div>顶部说明</div></template>` |
104
+ | `prepend` | 每个 tab pane 的表单前。 | `<template #prepend><div class="tips">说明</div></template>` |
105
+ | `replace` | 替换表单、分隔线、表格和分页整体。 | `<template #replace>自定义完整内容</template>` |
106
+ | `replaceTable` | 只替换表格和分页。 | `<template #replaceTable><CustomTable /></template>` |
107
+ | `customRender` | 传给 `InflyForm` 的 `type: "customRender"` 字段。 | `<template #customRender="{ item }"><MyInput :item="item" /></template>` |
108
+ | `expand` | `type: "expand"` 展开列内容。 | `<template #expand="{ row }">{{ row.detail }}</template>` |
109
+ | `[prop]` | 表格列同名具名插槽,优先级高于列 `type`。 | `<template #status="{ row }"><el-tag>{{ row.status_str }}</el-tag></template>` |
110
+
111
+ ### 列配置
112
+
113
+ 列配置会把内部字段之外的属性透传给 `el-table-column`,例如 `label`、`prop`、`width`、`minWidth`、`fixed`、`sortable`、`showOverflowTooltip`。默认 `align` 为 `center`。
114
+
115
+ 内部字段包括:`children`、`columns`、`type`、`buttonList`、`className`、`isHide`、`click`、`options`、`optionKeyField`、`optionValueField`、`propValueField`、`mapField`、`render`。
116
+
117
+ #### 普通列
118
+
119
+ ```js
120
+ columns: [
121
+ { label: "账单ID", prop: "id", width: "90px" },
122
+ { label: "所属机构", prop: "level_name", minWidth: "150px", showOverflowTooltip: true }
123
+ ]
124
+ ```
125
+
126
+ #### 默认列:selection、index、expand
127
+
128
+ ```js
129
+ columns: [
130
+ { type: "selection", width: 55 },
131
+ { type: "index", label: "序号", width: 70 },
132
+ { type: "expand", width: 50 },
133
+ { label: "名称", prop: "name" }
134
+ ]
135
+ ```
136
+
137
+ ```vue
138
+ <InflyList :formData="formData" v-bind="pageConfig">
139
+ <template #expand="{ row }">
140
+ <pre>{{ row }}</pre>
141
+ </template>
142
+ </InflyList>
143
+ ```
19
144
 
20
- ```bash
21
- # 项目安装
22
- npm/pnpm install @infly/ui
145
+ #### `type: "render"` / `custom`
146
+
147
+ ```js
148
+ columns: [
149
+ { label: "消耗金额(含税)", prop: "total_consume_amount_with_tax", type: "render" }
150
+ ],
151
+ customRender(row, prop) {
152
+ return `<span class="text-red">¥${row[prop] || "0.00"}</span>`;
153
+ }
154
+ ```
155
+
156
+ #### `type: "el-tag"`
157
+
158
+ ```js
159
+ columns: [
160
+ {
161
+ label: "状态",
162
+ prop: "status",
163
+ type: "el-tag",
164
+ options: [
165
+ { value: "pending", name: "待处理", tagType: "info" },
166
+ { value: "completed", name: "完成", tagType: "success" },
167
+ { value: "failed", name: "失败", tagType: "danger" }
168
+ ]
169
+ }
170
+ ]
171
+ ```
172
+
173
+ #### 操作列:`type: "el-button"` 或 `buttonList`
174
+
175
+ `buttonList` 每一项除 `name`、`label`、`className`、`isShow`、`isHide`、`click`、`btnEvent` 外,其余属性会透传给 `el-button`,例如 `size`、`plain`、`disabled`、`loading`、`icon`。
176
+
177
+ ```js
178
+ columns: [
179
+ {
180
+ label: "操作",
181
+ prop: "action",
182
+ type: "el-button",
183
+ fixed: "right",
184
+ width: "120px",
185
+ buttonList: [
186
+ {
187
+ name: "查看详情",
188
+ type: "text",
189
+ size: "mini",
190
+ className: "text-blue",
191
+ disabled: false,
192
+ isShow: (row) => row.status !== "deleted",
193
+ click: (row) => this.goDetail(row)
194
+ }
195
+ ]
196
+ }
197
+ ]
198
+ ```
199
+
200
+ #### `type: "el-image"`
201
+
202
+ ```js
203
+ columns: [
204
+ { label: "图片", prop: "cover_url", type: "el-image", width: 80, fit: "cover" }
205
+ ]
23
206
  ```
207
+
208
+ #### 多级表头
209
+
210
+ 支持 `children` 或 `columns`,叶子列继续使用普通列能力。
211
+
212
+ ```js
213
+ columns: [
214
+ { label: "日期", prop: "date", width: 150 },
215
+ {
216
+ label: "配送信息",
217
+ children: [
218
+ { label: "姓名", prop: "name", width: 120 },
219
+ {
220
+ label: "地址",
221
+ columns: [
222
+ { label: "省份", prop: "province", width: 120 },
223
+ { label: "市区", prop: "city", width: 120 },
224
+ { label: "地址", prop: "address", minWidth: 200, showOverflowTooltip: true }
225
+ ]
226
+ }
227
+ ]
228
+ }
229
+ ]
230
+ ```
231
+
232
+ ### 常用页面模式
233
+
234
+ #### 一级 tab 切换不同接口和列
235
+
236
+ ```js
237
+ pageConfig() {
238
+ return {
239
+ reqUrl: this.currentTabConfig.reqUrl,
240
+ tabList: [
241
+ { label: "账单列表", name: "billList" },
242
+ { label: "操作日志", name: "processLog" }
243
+ ],
244
+ filterList: this.currentTabConfig.filterList,
245
+ btnList: this.currentTabConfig.btnList,
246
+ columns: this.currentTabConfig.columns
247
+ };
248
+ },
249
+ methods: {
250
+ handleTabChange({ name }) {
251
+ this.activeTab = name;
252
+ }
253
+ }
254
+ ```
255
+
256
+ #### 本地数据表格
257
+
258
+ ```vue
259
+ <InflyList
260
+ :formData="{ page: 1, pagesize: 10, total: rows.length }"
261
+ :defaultInit="false"
262
+ :columns="columns"
263
+ :tableProps="{ dataList: rows, stripe: true }"
264
+ />
265
+ ```
266
+
267
+ #### 替换表格区域
268
+
269
+ ```vue
270
+ <InflyList :formData="formData" v-bind="pageConfig">
271
+ <template #replaceTable>
272
+ <CustomDistributionTable :rows="rows" />
273
+ </template>
274
+ </InflyList>
275
+ ```
276
+
277
+ ## InflyForm
278
+
279
+ `InflyForm` 是动态表单/详情展示组件。编辑态下根据 `filterList` 渲染输入控件;非编辑态下渲染文本、tag、链接或自定义内容。`InflyList` 内部的筛选区也是使用该组件。
280
+
281
+ ### 基础示例
282
+
283
+ ```vue
284
+ <template>
285
+ <InflyForm
286
+ ref="formRef"
287
+ :formData="formData"
288
+ :filterList="filterList"
289
+ :btnList="btnList"
290
+ layout="inline"
291
+ label-width="100px"
292
+ @initData="search"
293
+ @reset-form="resetForm"
294
+ />
295
+ </template>
296
+
297
+ <script>
298
+ export default {
299
+ data() {
300
+ return {
301
+ formData: { keyword: "", status: "" },
302
+ filterList: [
303
+ { label: "关键词", name: "keyword", type: "infly-input", placeholder: "请输入关键词", clearable: true },
304
+ { label: "状态", name: "status", type: "el-select", options: [{ label: "启用", value: "enabled" }], clearable: true }
305
+ ],
306
+ btnList: [
307
+ { label: "导出", type: "primary", btnEvent: () => this.exportData() }
308
+ ]
309
+ };
310
+ }
311
+ };
312
+ </script>
313
+ ```
314
+
315
+ ### Props
316
+
317
+ | Prop | 类型 | 默认值 | 说明 | 示例 |
318
+ | --- | --- | --- | --- | --- |
319
+ | `formClass` | `String` | `""` | 追加到内部 `el-form` 的 class。 | `formClass="reconciliation-summary-form"` |
320
+ | `layout` | `String \| Array` | `""` | 表单布局 class,支持 `inline`、`inline-seamless`、`compact`,可传数组组合。 | `layout="inline-seamless"` |
321
+ | `formData` | `Object` | 必填 | 表单数据对象,字段通过 `name` 双向绑定。 | `:formData="{ keyword: '' }"` |
322
+ | `formRef` | `String` | `"formRef"` | 内部 `el-form` ref 名称,供 `validate()` 等方法使用。 | `formRef="searchFormRef"` |
323
+ | `btnList` | `Array` | `[]` | 表单上方按钮列表。 | `[{ label: "上传", type: "blue", btnEvent: this.openDialog }]` |
324
+ | `filterList` | `Array` | `[]` | 表单字段配置。 | `[{ label: "名称", name: "name", type: "infly-input" }]` |
325
+ | `reqParams` | `Object` | `{}` | 当前请求参数,导出按钮会从中取参数。通常由 `InflyList` 传入。 | `:reqParams="{ keyword: formData.keyword }"` |
326
+ | `hideSearchBtn` | `Boolean` | `false` | 隐藏底部默认“查询”按钮。 | `hideSearchBtn` |
327
+ | `hideResetBtn` | `Boolean` | `true` | 隐藏底部默认“重置”按钮。默认隐藏。 | `:hideResetBtn="false"` |
328
+ | `isEdit` | `Boolean \| null` | `null` | 强制编辑/展示态;为 `null` 时按路由 `mode` 判断。 | `:isEdit="false"` |
329
+ | `optBtnList` | `Array` | `[]` | 底部查询/重置后的附加按钮。 | `:optBtnList="[{ label: '保存', type: 'primary', btnEvent: 'submit' }]"` |
330
+ | `btnWrapDirection` | `String` | `"row"` | 顶部按钮排列方向 class。 | `btnWrapDirection="column"` |
331
+ | `btnWrapClass` | `String` | `""` | 底部按钮容器追加 class。 | `btnWrapClass="dialog-footer"` |
332
+ | `baseButtonsLeft` | `String` | `"420px"` | 底部按钮距离 label 后的偏移基准。 | `baseButtonsLeft="260px"` |
333
+ | `emptyStr` | `String` | `"-"` | 非编辑态空值展示。 | `emptyStr="暂无"` |
334
+
335
+ `InflyForm` 还会把未声明的属性透传给 `el-form`,例如 `label-width`、`label-suffix`、`rules`、`size`。
336
+
337
+ ```vue
338
+ <InflyForm
339
+ :formData="formData"
340
+ :filterList="filterList"
341
+ label-width="120px"
342
+ label-suffix=":"
343
+ size="small"
344
+ />
345
+ ```
346
+
347
+ ### 事件
348
+
349
+ | 事件 | 触发时机 | 示例 |
350
+ | --- | --- | --- |
351
+ | `initData` | 底部默认“查询”按钮点击。 | `@initData="search"` |
352
+ | `reset-form` | 底部默认“重置”按钮点击,参数为初始表单快照。 | `@reset-form="(data) => Object.assign(formData, data)"` |
353
+ | `submit` | 按钮 `btnEvent: "submit"` 且校验通过。 | `@submit="submitForm"` |
354
+ | `secTabChange` / `sec-tab-change` | `type: "secTab"` 切换。 | `@secTabChange="handleSecTabChange"` |
355
+ | 自定义事件 | `btnEvent` 为字符串时直接 emit。 | `{ label: "保存", btnEvent: "save" }` + `@save="save"` |
356
+
357
+ ### 方法
358
+
359
+ | 方法 | 说明 | 示例 |
360
+ | --- | --- | --- |
361
+ | `getFormInstance()` | 返回内部 `el-form` 实例。 | `this.$refs.formRef.getFormInstance()` |
362
+ | `validate(callback)` | 调用内部 `el-form.validate`。 | `await this.$refs.formRef.validate()` |
363
+ | `clearValidate(props)` | 清除校验。 | `this.$refs.formRef.clearValidate(["name"])` |
364
+ | `validateField(props, callback)` | 校验指定字段。 | `this.$refs.formRef.validateField("name")` |
365
+ | `resetFormData()` | 触发 `reset-form`,并清理 `InstitutionSelect`。 | `this.$refs.formRef.resetFormData()` |
366
+
367
+ ### 插槽
368
+
369
+ | 插槽 | 位置 | 示例 |
370
+ | --- | --- | --- |
371
+ | `prepend` | 表单整体前。 | `<template #prepend><div>说明</div></template>` |
372
+ | `append` | 表单整体后。 | `<template #append><div>底部说明</div></template>` |
373
+ | `customRender` | 字段 `type: "customRender"` 时渲染。 | `<template #customRender="{ item }"><MyField :item="item" /></template>` |
374
+
375
+ ### filterList 字段配置
376
+
377
+ 字段配置会拆分函数类型属性:除 `isHide`、`isShow` 和 `el-upload` 回调外,函数属性会作为事件监听传给内部控件。
378
+
379
+ | 字段 | 说明 | 示例 |
380
+ | --- | --- | --- |
381
+ | `label` | 表单项 label。 | `{ label: "关键词" }` |
382
+ | `name` | 绑定字段名;日期范围可传数组。 | `{ name: "keyword" }`、`{ name: ["start", "end"], type: "daterange" }` |
383
+ | `prop` | 未传 `name` 时作为字段名。 | `{ prop: "keyword", type: "infly-input" }` |
384
+ | `type` | 控件类型或展示类型。 | `{ type: "el-select" }` |
385
+ | `options` | 选择类控件选项。 | `{ options: [{ label: "启用", value: 1 }] }` |
386
+ | `required` | 是否显示必填标记。 | `{ required: true }` |
387
+ | `rules` | 当前字段校验规则。 | `{ rules: [{ required: true, message: "请输入名称" }] }` |
388
+ | `isHide` | 隐藏条件,布尔值或函数。 | `{ isHide: (form) => form.type !== "coupon" }` |
389
+ | `isShow` | 显示条件,布尔值或函数。 | `{ isShow: (form) => form.enabled }` |
390
+ | `mode` | 单项强制编辑态。 | `{ mode: "edit" }` |
391
+ | `formItemClass` | 当前 `el-form-item` 追加 class。 | `{ formItemClass: "summary-tax-line" }` |
392
+ | `nowrap` | 给当前项追加不换行 class。 | `{ nowrap: true }` |
393
+ | `position` | 双列定位布局,支持 `left`、`right`、`full`。 | `{ label: "备注", name: "remark", type: "render", position: "full" }` |
394
+ | `valuePrefix` | 非编辑态展示前缀。 | `{ valuePrefix: "¥" }` |
395
+ | `optionConfig` | 自定义选项取值和展示。 | `{ optionConfig: { labelKey: "name", valueKey: "id" } }` |
396
+ | `radioType` | `el-radio-group` 内部单选组件,默认 `el-radio`。 | `{ type: "el-radio-group", radioType: "el-radio-button" }` |
397
+ | 其他属性 | 透传给内部控件或 `el-form-item`。 | `{ placeholder: "请输入", clearable: true }` |
398
+
399
+ ### 支持的字段类型
400
+
401
+ #### 输入框:`infly-input` / `InflyInput` / `textarea` / `infly-input-number` / `el-autocomplete`
402
+
403
+ ```js
404
+ filterList: [
405
+ { label: "关键词", name: "keyword", type: "infly-input", placeholder: "请输入关键词", clearable: true },
406
+ { label: "备注", name: "remark", type: "textarea", rows: 3, maxlength: 50, showWordLimit: true }
407
+ ]
408
+ ```
409
+
410
+ #### 选择器:`el-select`
411
+
412
+ ```js
413
+ filterList: [
414
+ {
415
+ label: "账单月份",
416
+ name: "bill_month",
417
+ type: "el-select",
418
+ options: [{ label: "05", value: "05" }],
419
+ clearable: true,
420
+ placeholder: "请选择账单月份"
421
+ }
422
+ ]
423
+ ```
424
+
425
+ #### 日期:`date` / `month` / `year` / `datetime` / `daterange` / `datetimerange` / `el-time-picker`
426
+
427
+ ```js
428
+ filterList: [
429
+ { label: "账单年份", name: "bill_year", type: "year", valueFormat: "yyyy", format: "yyyy", placeholder: "请选择年份" },
430
+ { label: "账单年月", name: "bill_month", type: "month", valueFormat: "yyyy-MM", placeholder: "请选择月份" },
431
+ { label: "账单周期", name: ["period_start", "period_end"], type: "daterange" }
432
+ ]
433
+ ```
434
+
435
+ 数组形式的 `name` 会自动把 `period_start`、`period_end` 与内部范围值同步。
436
+
437
+ #### 机构选择:`institution-select` / `InstitutionSelect`
438
+
439
+ ```js
440
+ filterList: [
441
+ {
442
+ label: "所属省份",
443
+ name: "province_level_id",
444
+ type: "institution-select",
445
+ title: "选择省份",
446
+ btnText: "选择",
447
+ levelTypes: "1",
448
+ levelNameKey: "province_level_name_filter",
449
+ hideTips: true
450
+ }
451
+ ]
452
+ ```
453
+
454
+ #### 复选:`infly-checkbox` / `InflyCheckBox`
455
+
456
+ ```js
457
+ filterList: [
458
+ {
459
+ label: "处理结果",
460
+ name: "process_result",
461
+ type: "infly-checkbox",
462
+ options: [
463
+ { label: "成功", value: "success" },
464
+ { label: "失败", value: "failed" }
465
+ ]
466
+ }
467
+ ]
468
+ ```
469
+
470
+ #### 单选:`el-radio-group`
471
+
472
+ ```js
473
+ filterList: [
474
+ {
475
+ label: "类型",
476
+ name: "type",
477
+ type: "el-radio-group",
478
+ radioType: "el-radio-button",
479
+ options: [
480
+ { name: "全部", value: "" },
481
+ { name: "已启用", value: "enabled" }
482
+ ]
483
+ }
484
+ ]
485
+ ```
486
+
487
+ #### 上传:`el-upload`
488
+
489
+ ```js
490
+ filterList: [
491
+ {
492
+ label: "活动列表",
493
+ name: "activity_file",
494
+ type: "el-upload",
495
+ action: "",
496
+ drag: true,
497
+ accept: ".xlsx",
498
+ tips: "仅支持 .xlsx 文件",
499
+ "on-change": this.handleFileChange,
500
+ "auto-upload": false,
501
+ "file-list": this.activityFileList
502
+ }
503
+ ]
504
+ ```
505
+
506
+ `el-upload` 的回调函数保留为属性整体透传,适配 Element UI 的 `on-change`、`on-remove` 等写法。
507
+
508
+ #### 展示态文本:`text`
509
+
510
+ ```js
511
+ filterList: [
512
+ { label: "账单ID", name: "id", type: "text" }
513
+ ]
514
+ ```
515
+
516
+ 当 `isEdit=false` 或路由 `mode` 非编辑态时,显示 `formData[name + "_str"]` 优先,其次显示 `formData[name]`。
517
+
518
+ #### 分组标题:`module`
519
+
520
+ `module` 用于只显示分组标题。表单内存在 `module` 时,普通字段会继承 `label-suffix`,`module` 自身不展示后缀和字段值。
521
+
522
+ ```js
523
+ filterList: [
524
+ { label: "基础信息", type: "module" },
525
+ { label: "活动名称", name: "activity_name", type: "infly-input", required: true }
526
+ ]
527
+ ```
528
+
529
+ #### 业务开关:`BusinessSwitch` / `business-switch`
530
+
531
+ ```js
532
+ filterList: [
533
+ {
534
+ label: "启用状态",
535
+ name: "enabled",
536
+ type: "business-switch",
537
+ activeValue: true,
538
+ inactiveValue: false,
539
+ render: (value) => (value ? "已启用" : "已停用")
540
+ }
541
+ ]
542
+ ```
543
+
544
+ #### 展示态链接:`router-link`
545
+
546
+ `router-link` 只在非编辑态渲染,其他属性会透传给 Vue Router 的 `router-link`。
547
+
548
+ ```js
549
+ filterList: [
550
+ {
551
+ label: "详情页",
552
+ name: "detail_text",
553
+ type: "router-link",
554
+ to: { path: "/reconciliation/detail", query: { id: this.formData.id } }
555
+ }
556
+ ]
557
+ ```
558
+
559
+ #### 展示态 tag:`el-tag`
560
+
561
+ ```js
562
+ filterList: [
563
+ {
564
+ label: "状态",
565
+ name: "status_str",
566
+ type: "el-tag",
567
+ propValueField: "status",
568
+ options: [
569
+ { value: "completed", tagType: "success" },
570
+ { value: "failed", tagType: "danger" }
571
+ ]
572
+ }
573
+ ]
574
+ ```
575
+
576
+ #### 自定义展示:`render`
577
+
578
+ ```js
579
+ filterList: [
580
+ {
581
+ label: "消耗金额(含税)",
582
+ name: "total_consume_amount_with_tax",
583
+ type: "render",
584
+ render: (value) => `<span class="text-red">¥${value || "0.00"}</span>`
585
+ }
586
+ ]
587
+ ```
588
+
589
+ `render` 可返回字符串或 VNode。字符串会通过 `v-html` 渲染,调用方必须确保内容可信或已转义。
590
+
591
+ #### 自定义插槽:`customRender`
592
+
593
+ ```vue
594
+ <InflyForm :formData="formData" :filterList="filterList">
595
+ <template #customRender="{ item }">
596
+ <CustomUploader :config="item" />
597
+ </template>
598
+ </InflyForm>
599
+ ```
600
+
601
+ ```js
602
+ filterList: [
603
+ { label: "附件", name: "files", type: "customRender" }
604
+ ]
605
+ ```
606
+
607
+ #### 二级 tab:`secTab`
608
+
609
+ 适合详情页“基础信息 + 下方明细 tab”的结构。`secTab` 项会插入到它在 `filterList` 中出现的位置,激活 tab 的 `filterList` 会跟在 tab 后面。
610
+
611
+ ```js
612
+ filterList: [
613
+ { label: "账单ID", name: "id", type: "text", position: "left" },
614
+ {
615
+ label: "订单明细",
616
+ name: "orders",
617
+ type: "secTab",
618
+ buttonList: [
619
+ { name: "导出订单明细", type: "primary", click: () => this.exportDetail("orders") }
620
+ ],
621
+ filterList: [
622
+ { label: "订单号查询", name: "empower_order_id", type: "infly-input", position: "full", clearable: true }
623
+ ]
624
+ },
625
+ {
626
+ label: "消耗明细",
627
+ name: "consumes",
628
+ type: "secTab",
629
+ filterList: [
630
+ { label: "关键词搜索", name: "keyword", type: "infly-input", position: "full", clearable: true }
631
+ ]
632
+ }
633
+ ]
634
+ ```
635
+
636
+ ### 布局示例
637
+
638
+ #### 行内筛选
639
+
640
+ ```vue
641
+ <InflyForm
642
+ :formData="formData"
643
+ :filterList="filterList"
644
+ layout="inline"
645
+ label-width="100px"
646
+ />
647
+ ```
648
+
649
+ #### 无缝行内详情
650
+
651
+ ```vue
652
+ <InflyForm
653
+ :formData="billInfo"
654
+ :filterList="summaryFilterList"
655
+ :isEdit="false"
656
+ layout="inline-seamless"
657
+ label-width="150px"
658
+ label-suffix=":"
659
+ />
660
+ ```
661
+
662
+ #### 左右定位与整行插入
663
+
664
+ `position` 只影响传了 `left`、`right`、`full` 的项。`left` 固定左列,`right` 固定右列,`full` 占整行并按配置顺序插入,不会被统一挪到最后。
665
+
666
+ ```js
667
+ filterList: [
668
+ { label: "账单ID", name: "id", type: "text", position: "left" },
669
+ { label: "充值金额", name: "total_order_amount", type: "render", position: "right", render: this.renderMoney },
670
+ { label: "账单年份", name: "task_bill_year", type: "text", position: "left" },
671
+ { label: "结算金额", name: "total_settlement_amount", type: "render", position: "right", render: this.renderMoney },
672
+ {
673
+ label: "备注说明",
674
+ name: "summary_note",
675
+ type: "render",
676
+ position: "full",
677
+ nowrap: true,
678
+ render: () => this.summaryNoteHtml()
679
+ },
680
+ { label: "订单号查询", name: "empower_order_id", type: "infly-input", position: "full", clearable: true }
681
+ ]
682
+ ```
683
+
684
+ ### 按钮配置
685
+
686
+ #### 顶部按钮:`btnList`
687
+
688
+ ```js
689
+ btnList: [
690
+ { label: "上传账单", type: "blue", btnEvent: () => { this.uploadDialogVisible = true; } },
691
+ { label: "导出", type: "primary", isShow: () => Uts.getPM("perm.export"), btnEvent: this.exportList }
692
+ ]
693
+ ```
694
+
695
+ #### 底部按钮:默认查询、重置和 `optBtnList`
696
+
697
+ ```vue
698
+ <InflyForm
699
+ :formData="formData"
700
+ :filterList="filterList"
701
+ :hideResetBtn="false"
702
+ :optBtnList="[{ label: '保存', type: 'primary', btnEvent: 'submit' }]"
703
+ @initData="search"
704
+ @submit="submitForm"
705
+ />
706
+ ```
707
+
708
+ #### 导出按钮
709
+
710
+ ```js
711
+ btnList: [
712
+ {
713
+ label: "导出",
714
+ type: "success",
715
+ exportUrl: "/admin/reconciliation/bills/export/",
716
+ exportFileName: "金融营销对账账单",
717
+ exportMethod: "get",
718
+ dealParams: (params, formData) => ({ ...params, keyword: formData.keyword })
719
+ }
720
+ ]
721
+ ```
722
+
723
+ ## AI 维护规则
724
+
725
+ 1. 新增或修改 `InflyList` / `InflyForm` 的 prop、事件、插槽、列类型、字段类型、配置字段时,同步更新本 README。
726
+ 2. 每个新增能力至少提供一个完整示例,优先参考 `apps/postal-benefits-platform/src/shared/pages/` 中已经存在的写法。
727
+ 3. 公共组件改动必须保持旧配置语义不变;新能力优先通过显式配置启用。
728
+ 4. 交付说明中写清影响范围、已验证路径和未覆盖风险。
package/index.js CHANGED
@@ -24,22 +24,27 @@ const businessComponents = requireBusiness.keys().reduce((components, modulePath
24
24
  const allComponents = { ...baseComponents, ...businessComponents };
25
25
  const components = Object.values(allComponents);
26
26
 
27
- const install = Vue => {
27
+ const install = (Vue) => {
28
28
  if (install.installed || !Vue) return;
29
29
  install.installed = true;
30
- components.forEach(component => Vue.component(component.name, component));
30
+ components.forEach((component) => Vue.component(component.name, component));
31
31
  };
32
32
 
33
33
  // CDN 支持
34
34
  if (typeof window !== "undefined" && window.Vue) install(window.Vue);
35
35
 
36
+ // 动态导出
37
+
36
38
  // 动态导出
37
39
  export const {
38
40
  InflyInput,
39
41
  InflyCheckBox,
40
42
  InflyForm,
41
- InflyModal,
43
+ InflyDialog,
42
44
  InflyList,
43
- InstitutionSelect
45
+ InstitutionSelect,
46
+ BusinessTag,
47
+ BusinessSwitch
44
48
  } = allComponents;
49
+
45
50
  export default { install, ...allComponents };
package/package.json CHANGED
@@ -1,12 +1,10 @@
1
1
  {
2
2
  "name": "@infly/ui",
3
- "version": "1.0.9",
3
+ "version": "1.0.13",
4
4
  "description": "组件库 ",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1",
8
- "build:entry": "node scripts/build-entry.js",
9
- "build": "pnpm run build:entry && vite build",
10
8
  "publishPkg": "npm version patch && npm publish --access=public --registry=https://registry.npmjs.org/"
11
9
  },
12
10
  "exports": {