@infly/ui 1.0.13 → 1.0.17

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 (2) hide show
  1. package/README.md +43 -26
  2. package/package.json +2 -5
package/README.md CHANGED
@@ -321,9 +321,10 @@ export default {
321
321
  | `formData` | `Object` | 必填 | 表单数据对象,字段通过 `name` 双向绑定。 | `:formData="{ keyword: '' }"` |
322
322
  | `formRef` | `String` | `"formRef"` | 内部 `el-form` ref 名称,供 `validate()` 等方法使用。 | `formRef="searchFormRef"` |
323
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` |
324
+ | `filterList` | `Array` | `[]` | 表单字段配置。 | `[{ label: "名称", name: "name", type: "infly-input" }]` |
325
+ | `reqParams` | `Object` | `{}` | 当前请求参数,导出按钮会从中取参数。通常由 `InflyList` 传入。 | `:reqParams="{ keyword: formData.keyword }"` |
326
+ | `request` | `Function` | `null` | 导出按钮使用的请求实例。导出请求优先级为按钮 `exportFunc`、`request` prop、组件实例 `this.$axios`。 | `:request="$axios"` |
327
+ | `hideSearchBtn` | `Boolean` | `false` | 隐藏底部默认“查询”按钮。 | `hideSearchBtn` |
327
328
  | `hideResetBtn` | `Boolean` | `true` | 隐藏底部默认“重置”按钮。默认隐藏。 | `:hideResetBtn="false"` |
328
329
  | `isEdit` | `Boolean \| null` | `null` | 强制编辑/展示态;为 `null` 时按路由 `mode` 判断。 | `:isEdit="false"` |
329
330
  | `optBtnList` | `Array` | `[]` | 底部查询/重置后的附加按钮。 | `:optBtnList="[{ label: '保存', type: 'primary', btnEvent: 'submit' }]"` |
@@ -350,9 +351,10 @@ export default {
350
351
  | --- | --- | --- |
351
352
  | `initData` | 底部默认“查询”按钮点击。 | `@initData="search"` |
352
353
  | `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"` |
354
+ | `submit` | 按钮 `btnEvent: "submit"` 且校验通过。 | `@submit="submitForm"` |
355
+ | `secTabChange` / `sec-tab-change` | `type: "secTab"` 切换。 | `@secTabChange="handleSecTabChange"` |
356
+ | `export-request-error` | 导出按钮配置了 `exportUrl` 但没有可用请求实例时触发。 | `@export-request-error="handleExportRequestError"` |
357
+ | 自定义事件 | `btnEvent` 为字符串时直接 emit。 | `{ label: "保存", btnEvent: "save" }` + `@save="save"` |
356
358
 
357
359
  ### 方法
358
360
 
@@ -442,15 +444,19 @@ filterList: [
442
444
  label: "所属省份",
443
445
  name: "province_level_id",
444
446
  type: "institution-select",
445
- title: "选择省份",
446
- btnText: "选择",
447
- levelTypes: "1",
448
- levelNameKey: "province_level_name_filter",
449
- hideTips: true
450
- }
451
- ]
452
- ```
453
-
447
+ title: "选择省份",
448
+ btnText: "选择",
449
+ request: this.$axios,
450
+ reqModule: "admin",
451
+ levelTypes: "1",
452
+ levelNameKey: "province_level_name_filter",
453
+ hideTips: true
454
+ }
455
+ ]
456
+ ```
457
+
458
+ `InstitutionSelect` 请求实例优先使用 `request` prop,其次使用组件实例 `this.$axios`。默认接口为 `/${reqModule}/level/`,也可以通过 `reqUrl` 显式覆盖;组件不再读取外部工具库的环境信息推导 `reqModule`。
459
+
454
460
  #### 复选:`infly-checkbox` / `InflyCheckBox`
455
461
 
456
462
  ```js
@@ -686,11 +692,11 @@ filterList: [
686
692
  #### 顶部按钮:`btnList`
687
693
 
688
694
  ```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
- ```
695
+ btnList: [
696
+ { label: "上传账单", type: "blue", btnEvent: () => { this.uploadDialogVisible = true; } },
697
+ { label: "导出", type: "primary", isShow: () => this.canExport, btnEvent: this.exportList }
698
+ ]
699
+ ```
694
700
 
695
701
  #### 底部按钮:默认查询、重置和 `optBtnList`
696
702
 
@@ -705,12 +711,23 @@ btnList: [
705
711
  />
706
712
  ```
707
713
 
708
- #### 导出按钮
709
-
710
- ```js
711
- btnList: [
712
- {
713
- label: "导出",
714
+ #### 导出按钮
715
+
716
+ 导出请求实例按 `exportFunc -> request prop -> this.$axios` 的顺序解析;组件不再内置 `REST` fallback。独立使用 `InflyForm` 时,如果页面没有全局注入 `$axios`,需要显式传入 `request` 或在按钮上配置 `exportFunc`。
717
+
718
+ ```vue
719
+ <InflyForm
720
+ :formData="formData"
721
+ :filterList="filterList"
722
+ :btnList="btnList"
723
+ :request="$axios"
724
+ />
725
+ ```
726
+
727
+ ```js
728
+ btnList: [
729
+ {
730
+ label: "导出",
714
731
  type: "success",
715
732
  exportUrl: "/admin/reconciliation/bills/export/",
716
733
  exportFileName: "金融营销对账账单",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infly/ui",
3
- "version": "1.0.13",
3
+ "version": "1.0.17",
4
4
  "description": "组件库 ",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -25,8 +25,5 @@
25
25
  "infly-ui"
26
26
  ],
27
27
  "author": "Kahal",
28
- "license": "ISC",
29
- "peerDependencies": {
30
- "infly-libs": "^2.0.0"
31
- }
28
+ "license": "ISC"
32
29
  }