fantasy-ngzorro 2.1.0 → 2.1.2
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/README.md +765 -804
- package/bundles/fantasy-ngzorro.umd.js +1780 -623
- package/bundles/fantasy-ngzorro.umd.js.map +1 -1
- package/bundles/fantasy-ngzorro.umd.min.js +2 -2
- package/bundles/fantasy-ngzorro.umd.min.js.map +1 -1
- package/esm2015/fantasy-ngzorro.js +26 -24
- package/esm2015/hd-button/hd-button.component.js +6 -11
- package/esm2015/hd-button/hd-button.module.js +3 -7
- package/esm2015/hd-button-group/hd-button-group.component.js +1 -1
- package/esm2015/hd-button-group/hd-button-group.module.js +3 -3
- package/esm2015/hd-component.module.js +3 -1
- package/esm2015/hd-current-table/hd-current-table.component.js +1 -1
- package/esm2015/hd-detail-form/hd-detail-form.component.js +14 -4
- package/esm2015/hd-detail-form/hd-detail-form.module.js +3 -5
- package/esm2015/hd-detail-lines/hd-detail-lines.component.js +173 -30
- package/esm2015/hd-detail-lines/hd-detail-lines.module.js +18 -8
- package/esm2015/hd-detail-lines-page/hd-detail-lines-page.component.js +357 -0
- package/esm2015/hd-detail-lines-page/hd-detail-lines-page.module.js +20 -0
- package/esm2015/hd-detail-tip/hd-detail-tip.component.js +18 -8
- package/esm2015/hd-detail-tip/hd-detail-tip.module.js +3 -3
- package/esm2015/hd-filter/hd-filter.component.js +76 -15
- package/esm2015/hd-filter/hd-filter.module.js +3 -19
- package/esm2015/hd-filter/hd-filter.service.js +5 -1
- package/esm2015/hd-form/hd-form.component.js +76 -3
- package/esm2015/hd-form/hd-form.module.js +3 -23
- package/esm2015/hd-form/hd-form.service.js +19 -3
- package/esm2015/hd-form-lines/hd-form-lines.component.js +267 -135
- package/esm2015/hd-form-lines/hd-form-lines.module.js +3 -21
- package/esm2015/hd-form-lines/hd-form-lines.service.js +9 -1
- package/esm2015/hd-log/hd-log.component.js +2 -2
- package/esm2015/hd-log/hd-log.module.js +3 -1
- package/esm2015/hd-popconfirm/hd-popconfirm.component.js +2 -2
- package/esm2015/hd-popconfirm/hd-popconfirm.module.js +3 -3
- package/esm2015/hd-space/hd-space.module.js +3 -3
- package/esm2015/hd-status/hd-status.component.js +17 -8
- package/esm2015/hd-status/hd-status.module.js +4 -2
- package/esm2015/hd-status/hd-status.service.js +7 -6
- package/esm2015/hd-table/hd-table.component.js +246 -115
- package/esm2015/hd-table/hd-table.service.js +8 -1
- package/esm2015/hd-tip/hd-tip.component.js +3 -3
- package/esm2015/hd-tip/hd-tip.module.js +3 -3
- package/esm2015/index.js +2 -2
- package/esm2015/model/common-type.js +35 -1
- package/esm2015/public-api.js +2 -2
- package/esm5/fantasy-ngzorro.js +26 -24
- package/esm5/hd-button/hd-button.component.js +15 -19
- package/esm5/hd-button/hd-button.module.js +3 -7
- package/esm5/hd-button-group/hd-button-group.component.js +1 -1
- package/esm5/hd-button-group/hd-button-group.module.js +3 -3
- package/esm5/hd-component.module.js +3 -1
- package/esm5/hd-current-table/hd-current-table.component.js +1 -1
- package/esm5/hd-detail-form/hd-detail-form.component.js +14 -4
- package/esm5/hd-detail-form/hd-detail-form.module.js +3 -5
- package/esm5/hd-detail-lines/hd-detail-lines.component.js +211 -25
- package/esm5/hd-detail-lines/hd-detail-lines.module.js +18 -8
- package/esm5/hd-detail-lines-page/hd-detail-lines-page.component.js +423 -0
- package/esm5/hd-detail-lines-page/hd-detail-lines-page.module.js +24 -0
- package/esm5/hd-detail-tip/hd-detail-tip.component.js +18 -8
- package/esm5/hd-detail-tip/hd-detail-tip.module.js +3 -3
- package/esm5/hd-filter/hd-filter.component.js +91 -16
- package/esm5/hd-filter/hd-filter.module.js +3 -19
- package/esm5/hd-filter/hd-filter.service.js +5 -1
- package/esm5/hd-form/hd-form.component.js +87 -3
- package/esm5/hd-form/hd-form.module.js +3 -23
- package/esm5/hd-form/hd-form.service.js +19 -3
- package/esm5/hd-form-lines/hd-form-lines.component.js +286 -129
- package/esm5/hd-form-lines/hd-form-lines.module.js +3 -21
- package/esm5/hd-form-lines/hd-form-lines.service.js +9 -1
- package/esm5/hd-log/hd-log.component.js +2 -2
- package/esm5/hd-log/hd-log.module.js +3 -1
- package/esm5/hd-popconfirm/hd-popconfirm.component.js +2 -2
- package/esm5/hd-popconfirm/hd-popconfirm.module.js +3 -3
- package/esm5/hd-space/hd-space.module.js +3 -3
- package/esm5/hd-status/hd-status.component.js +16 -7
- package/esm5/hd-status/hd-status.module.js +4 -2
- package/esm5/hd-status/hd-status.service.js +7 -6
- package/esm5/hd-table/hd-table.component.js +252 -102
- package/esm5/hd-table/hd-table.service.js +6 -1
- package/esm5/hd-tip/hd-tip.component.js +3 -3
- package/esm5/hd-tip/hd-tip.module.js +3 -3
- package/esm5/index.js +2 -2
- package/esm5/model/common-type.js +39 -1
- package/esm5/public-api.js +2 -2
- package/fantasy-ngzorro.d.ts +24 -22
- package/fantasy-ngzorro.metadata.json +1 -1
- package/fesm2015/fantasy-ngzorro.js +1621 -661
- package/fesm2015/fantasy-ngzorro.js.map +1 -1
- package/fesm5/fantasy-ngzorro.js +1758 -617
- package/fesm5/fantasy-ngzorro.js.map +1 -1
- package/hd-button/hd-button.component.d.ts +3 -2
- package/hd-detail-form/hd-detail-form.component.d.ts +9 -0
- package/hd-detail-lines/hd-detail-lines.component.d.ts +19 -6
- package/hd-detail-lines-page/hd-detail-lines-page.component.d.ts +56 -0
- package/hd-detail-lines-page/hd-detail-lines-page.module.d.ts +2 -0
- package/hd-detail-tip/hd-detail-tip.component.d.ts +1 -1
- package/hd-filter/hd-filter.component.d.ts +4 -0
- package/hd-filter/hd-filter.service.d.ts +2 -0
- package/hd-form/hd-form.component.d.ts +4 -0
- package/hd-form/hd-form.service.d.ts +10 -3
- package/hd-form-lines/hd-form-lines.component.d.ts +18 -7
- package/hd-form-lines/hd-form-lines.service.d.ts +2 -0
- package/hd-status/hd-status.component.d.ts +1 -1
- package/hd-status/hd-status.service.d.ts +1 -1
- package/hd-table/hd-table.component.d.ts +16 -7
- package/hd-table/hd-table.service.d.ts +3 -1
- package/model/common-type.d.ts +14 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -2,382 +2,453 @@
|
|
|
2
2
|
|
|
3
3
|
# Fantasy-Ngzorro
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
5
|
+
基于 **Angular 8** + **ng-zorro-antd 8.5.x** 的业务组件库,封装按钮、表格、表单、详情页等常用 UI 模式。
|
|
6
|
+
|
|
7
|
+
## 组件一览
|
|
8
|
+
|
|
9
|
+
| 序号 | 选择器 | 说明 |
|
|
10
|
+
| ---- | ------ | ---- |
|
|
11
|
+
| 1 | `hd-button` | 按钮 |
|
|
12
|
+
| 2 | `hd-button-group` | 按钮组(左右布局) |
|
|
13
|
+
| 3 | `hd-space` | 间隔占位 |
|
|
14
|
+
| 4 | `hd-tip` | 小标题 |
|
|
15
|
+
| 5 | `hd-status` | 状态标签 |
|
|
16
|
+
| 6 | `hd-popconfirm` | 气泡确认框 |
|
|
17
|
+
| 7 | `hd-filter` | 筛选器 |
|
|
18
|
+
| 8 | `hd-current-table` | 通用表格(自定义列模板) |
|
|
19
|
+
| 9 | `hd-table` | 增强表格(列配置、排序、列缓存) |
|
|
20
|
+
| 10 | `hd-form` | 表单 |
|
|
21
|
+
| 11 | `hd-form-lines` | 明细表单(可编辑表格) |
|
|
22
|
+
| 12 | `hd-detail-tip` | 详情头 |
|
|
23
|
+
| 13 | `hd-detail-form` | 详情单头 |
|
|
24
|
+
| 14 | `hd-detail-lines` | 详情明细(前端分页 / 搜索) |
|
|
25
|
+
| 15 | `hd-detail-lines-page` | 详情明细(服务端分页) |
|
|
26
|
+
| 16 | `hd-log` | 操作日志 |
|
|
27
|
+
|
|
28
|
+
> 配置类型(SelectOption、FormItem、HdTableColumn 等)见 [附录:公共配置类型](#附录公共配置类型)。
|
|
12
29
|
|
|
30
|
+
## 更新记录
|
|
13
31
|
|
|
32
|
+
| 更新人 | 更新时间 | 更新内容 |
|
|
33
|
+
| ------ | -------- | -------- |
|
|
34
|
+
| MC | 2023-2-10 | Readme 创建;按钮、按钮组、通用表格、筛选器、状态、详情头、详情单头、详情明细文档 |
|
|
35
|
+
| MC | 2023-2-13 | 表单、明细表单、间隔、小标题文档;组件字段增加必填说明 |
|
|
36
|
+
| — | 2026-5-20 | 补充 hd-table、hd-detail-lines-page 等组件;完善公共子类型(SelectOption、FormItem 等)文档 |
|
|
37
|
+
| — | 2026-6-23 | hd-table 状态列支持 `stateField` 自定义取值字段、`isState` 按列名取值;hd-form Input 支持 `prefix` / `prefixIcon`;hd-detail-lines-page 支持 `isCrossPageSelect` 跨页勾选开关 |
|
|
38
|
+
| — | 2026-7-6 | hd-form 支持 `FormListType.Checkbox`(单个复选框 / 复选框组)及 `CheckboxOption` 配置 |
|
|
14
39
|
|
|
15
40
|
## 前言
|
|
16
41
|
|
|
17
|
-
> 1
|
|
18
|
-
>
|
|
19
|
-
>
|
|
20
|
-
>
|
|
21
|
-
> 3、运行本地服务之后,访问demo路由即可查看具体交互
|
|
22
|
-
|
|
42
|
+
> 1. 文档中的「插槽」对应 Angular 的模板 `#template`(`ng-template` + `@ContentChild`)。
|
|
43
|
+
> 2. 事件回调建议使用 `bind(this)`,示例:`onChangeEvent: this.formInputChange.bind(this)`。
|
|
44
|
+
> 3. 本地运行 `npm start`,访问 `http://localhost:13000` 查看 Demo 交互。
|
|
45
|
+
> 4. 业务模块引入:`import { FantasyNgzorroModule } from 'fantasy-ngzorro'`。
|
|
23
46
|
|
|
47
|
+
### 公共导出
|
|
24
48
|
|
|
25
|
-
|
|
49
|
+
| 模块 | 说明 |
|
|
50
|
+
| ---- | ---- |
|
|
51
|
+
| `ColWidth` | 列宽常量 |
|
|
52
|
+
| `Page<T>` | 分页数据结构 |
|
|
53
|
+
| `Utils` | 精度计算工具 |
|
|
54
|
+
| `HdTableColumn` / `FormLine` / `Filter` 等 | 各组件配置类型,详见 [附录:公共配置类型](#附录公共配置类型) |
|
|
26
55
|
|
|
27
|
-
|
|
56
|
+
---
|
|
28
57
|
|
|
29
|
-
|
|
58
|
+
## 1、按钮(hd-button)
|
|
30
59
|
|
|
31
60
|
### 示例
|
|
32
61
|
|
|
33
62
|
```html
|
|
34
|
-
<hd-button type="primary">查询</hd-button>
|
|
63
|
+
<hd-button type="primary" (clickAction)="search()">查询</hd-button>
|
|
64
|
+
<hd-button type="default" [loading]="loading" (clickAction)="save()">保存</hd-button>
|
|
35
65
|
```
|
|
36
66
|
|
|
37
|
-
###
|
|
67
|
+
### 参数
|
|
38
68
|
|
|
39
|
-
| 参数
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
69
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
70
|
+
| ---- | ---- | ------ | ---- |
|
|
71
|
+
| type | string | default | primary \| dashed \| danger \| default \| link \| reset \| add |
|
|
72
|
+
| size | string | normal | 按钮尺寸 |
|
|
73
|
+
| loading | boolean | false | 加载中(与 loading 配合时必须用 clickAction) |
|
|
74
|
+
| disabled | boolean | false | 是否禁用 |
|
|
75
|
+
| clickAction | EventEmitter | — | 点击事件 |
|
|
44
76
|
|
|
45
77
|
### 注意点
|
|
46
78
|
|
|
47
|
-
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
## 2、按钮组(hd-button-group)
|
|
79
|
+
- **禁止**使用 `type="submit"`,请用普通按钮 + `clickAction` 触发表单提交。
|
|
80
|
+
- 设置了 `loading` 的按钮必须用 `(clickAction)`,不能用 `(click)`。
|
|
52
81
|
|
|
53
|
-
|
|
82
|
+
---
|
|
54
83
|
|
|
55
|
-
|
|
84
|
+
## 2、按钮组(hd-button-group)
|
|
56
85
|
|
|
57
86
|
### 示例
|
|
58
87
|
|
|
59
88
|
```html
|
|
60
89
|
<hd-button-group>
|
|
61
90
|
<ng-template #buttonGroupLeft>
|
|
62
|
-
<hd-button type="add"
|
|
63
|
-
<hd-button type="default">default</hd-button>
|
|
64
|
-
<hd-button type="default">default</hd-button>
|
|
65
|
-
<hd-button type="default">default</hd-button>
|
|
91
|
+
<hd-button type="add">新增</hd-button>
|
|
66
92
|
</ng-template>
|
|
67
93
|
<ng-template #buttonGroupRight>
|
|
68
|
-
<hd-button type="default"
|
|
94
|
+
<hd-button type="default">导出</hd-button>
|
|
69
95
|
</ng-template>
|
|
70
96
|
</hd-button-group>
|
|
71
97
|
```
|
|
72
98
|
|
|
73
|
-
###
|
|
99
|
+
### 插槽
|
|
74
100
|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
| buttonGroupLeft
|
|
78
|
-
| buttonGroupRight |
|
|
101
|
+
| 插槽 | 说明 |
|
|
102
|
+
| ---- | ---- |
|
|
103
|
+
| buttonGroupLeft | 左侧按钮区 |
|
|
104
|
+
| buttonGroupRight | 右侧按钮区 |
|
|
79
105
|
|
|
80
|
-
|
|
106
|
+
按钮间距自动 12px。
|
|
107
|
+
|
|
108
|
+
---
|
|
81
109
|
|
|
82
|
-
|
|
110
|
+
## 3、间隔(hd-space)
|
|
83
111
|
|
|
112
|
+
### 示例
|
|
84
113
|
|
|
114
|
+
```html
|
|
115
|
+
<hd-space background="#fff" type="row" size="12"></hd-space>
|
|
116
|
+
```
|
|
85
117
|
|
|
86
|
-
|
|
118
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
119
|
+
| ---- | ---- | ------ | ---- |
|
|
120
|
+
| background | string | inherit | 背景色 |
|
|
121
|
+
| type | string | row | row \| column |
|
|
122
|
+
| size | number | — | 高度或宽度(px) |
|
|
87
123
|
|
|
88
|
-
|
|
124
|
+
---
|
|
89
125
|
|
|
90
|
-
|
|
126
|
+
## 4、小标题(hd-tip)
|
|
91
127
|
|
|
92
128
|
### 示例
|
|
93
129
|
|
|
94
130
|
```html
|
|
95
|
-
<hd-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
131
|
+
<hd-tip title="基本信息" [fontSize]="14"></hd-tip>
|
|
132
|
+
<hd-tip title="新增" [showIcon]="false" [fontSize]="16"></hd-tip>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
136
|
+
| ---- | ---- | ------ | ---- |
|
|
137
|
+
| title | string | — | 标题文案 |
|
|
138
|
+
| showIcon | boolean | true | 是否显示左侧竖线 |
|
|
139
|
+
| fontSize | number | — | 字体大小 |
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## 5、状态(hd-status)
|
|
144
|
+
|
|
145
|
+
### 示例
|
|
146
|
+
|
|
147
|
+
```html
|
|
148
|
+
<hd-status status="initial">未审核</hd-status>
|
|
149
|
+
<hd-status status="audited">已审核</hd-status>
|
|
150
|
+
<hd-status status="received">已收货</hd-status>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
| 参数 | 类型 | 说明 |
|
|
154
|
+
| ---- | ---- | ---- |
|
|
155
|
+
| status | string | 状态值,匹配 `hd-status.service.ts` 中 `statusToColor` 配置 |
|
|
156
|
+
|
|
157
|
+
匹配时不区分大小写。新增状态请在 `statusToColor` 中配置颜色。
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## 6、气泡确认(hd-popconfirm)
|
|
162
|
+
|
|
163
|
+
### 示例
|
|
164
|
+
|
|
165
|
+
```html
|
|
166
|
+
<hd-popconfirm message="确认删除该记录吗?" (confirmOption)="onConfirm()" (cancelOption)="onCancel()">
|
|
167
|
+
</hd-popconfirm>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
| 参数 | 类型 | 说明 |
|
|
171
|
+
| ---- | ---- | ---- |
|
|
172
|
+
| message | string | 提示文案 |
|
|
173
|
+
| confirmOption | EventEmitter | 点击确认 |
|
|
174
|
+
| cancelOption | EventEmitter | 点击取消 |
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## 7、筛选器(hd-filter)
|
|
179
|
+
|
|
180
|
+
### 示例
|
|
181
|
+
|
|
182
|
+
```html
|
|
183
|
+
<hd-filter [filterList]="filterList" (searchEvent)="filterChange($event)" (resetEvent)="resetFilterChange($event)">
|
|
184
|
+
</hd-filter>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
| 参数 | 类型 | 说明 |
|
|
188
|
+
| ---- | ---- | ---- |
|
|
189
|
+
| filterList | Array\<Filter\> | 筛选项配置 |
|
|
190
|
+
| searchEvent | EventEmitter | 查询,带回筛选数据 |
|
|
191
|
+
| resetEvent | EventEmitter | 重置 |
|
|
192
|
+
|
|
193
|
+
#### Filter 配置
|
|
194
|
+
|
|
195
|
+
筛选项使用 [Filter](#filter筛选项) 类型,下拉/数字/级联等子配置见 [SelectOption](#selectoption下拉选项配置)、[InputNumber](#inputnumber数字输入配置)、[CascaderOption](#cascaderoption级联选择配置)。
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## 8、通用表格(hd-current-table)(已废弃、禁用)
|
|
200
|
+
|
|
201
|
+
适用于**完全自定义**表头、表体模板的列表页。
|
|
202
|
+
|
|
203
|
+
### 示例
|
|
204
|
+
|
|
205
|
+
```html
|
|
206
|
+
<hd-current-table #hdCurrentTable [(tablePageIndex)]="pageIndex" [(tablePageSize)]="pageSize"
|
|
207
|
+
[scroll]="{x: '600px'}" [tableData]="page" [tableLoading]="loading"
|
|
208
|
+
(tableSearchEvent)="search($event)" showSelected selectField="billNumber"
|
|
209
|
+
(selectEvent)="selectResult($event)">
|
|
210
|
+
<ng-template #tableTotal>...</ng-template>
|
|
106
211
|
<ng-template #tableHead>
|
|
107
|
-
<th
|
|
108
|
-
<th>收货日期</th>
|
|
212
|
+
<th>配送单号</th>
|
|
109
213
|
<th>状态</th>
|
|
110
|
-
<th nzRight="0px">操作</th>
|
|
111
214
|
</ng-template>
|
|
112
215
|
<ng-template #tableBody let-data>
|
|
113
|
-
|
|
114
|
-
<td
|
|
115
|
-
<td>{{ data.distDate || '<空>' }}</td>
|
|
116
|
-
<td>
|
|
117
|
-
<hd-status [status]="'initial'">未审核</hd-status>
|
|
118
|
-
</td>
|
|
119
|
-
<td nzRight="0px" style="width: 200px">
|
|
120
|
-
<span class="common-btn-group">
|
|
121
|
-
<a>复制</a>
|
|
122
|
-
<a>修改详情</a>
|
|
123
|
-
<a>修改日期</a>
|
|
124
|
-
<a class="common-danger-btn">删除</a>
|
|
125
|
-
</span>
|
|
126
|
-
</td>
|
|
216
|
+
<td>{{ data.billNumber }}</td>
|
|
217
|
+
<td><hd-status [status]="data.state">{{ data.stateText }}</hd-status></td>
|
|
127
218
|
</ng-template>
|
|
128
219
|
</hd-current-table>
|
|
129
220
|
```
|
|
130
221
|
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
page: Page<any> = new Page<any>();
|
|
222
|
+
```typescript
|
|
223
|
+
page: Page<any> = new Page();
|
|
134
224
|
pageIndex = 1;
|
|
135
225
|
pageSize = 10;
|
|
136
|
-
loading
|
|
137
|
-
tableSelectList: Array<any> = [];
|
|
138
|
-
|
|
139
|
-
// 表格的查询事件
|
|
140
|
-
search(reset: boolean = false): void {
|
|
141
|
-
if (reset) {
|
|
142
|
-
this.pageIndex = 1;
|
|
143
|
-
}
|
|
226
|
+
loading = false;
|
|
144
227
|
|
|
228
|
+
search(reset = false) {
|
|
229
|
+
if (reset) { this.pageIndex = 1; }
|
|
145
230
|
this.queryFilter.pageNumber = this.pageIndex - 1;
|
|
146
231
|
this.queryFilter.pageSize = this.pageSize;
|
|
147
|
-
|
|
148
232
|
this.loading = true;
|
|
149
|
-
this.
|
|
150
|
-
result => {
|
|
151
|
-
|
|
152
|
-
this.page = result;
|
|
153
|
-
}, error => {
|
|
154
|
-
this.loading = false;
|
|
155
|
-
}
|
|
233
|
+
this.service.query(this.queryFilter).subscribe(
|
|
234
|
+
result => { this.loading = false; this.page = result; },
|
|
235
|
+
() => { this.loading = false; }
|
|
156
236
|
);
|
|
157
237
|
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* 表格的选择事件
|
|
161
|
-
* @param selectList 勾选的所有的数据集合
|
|
162
|
-
*/
|
|
163
|
-
selectResult(selectList?: any) {
|
|
164
|
-
// 拿到勾选的所有的数据
|
|
165
|
-
// console.log('selectList', selectList);
|
|
166
|
-
this.tableSelectList = selectList;
|
|
167
|
-
}
|
|
168
238
|
```
|
|
169
239
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
|
173
|
-
|
|
|
174
|
-
|
|
|
175
|
-
|
|
|
176
|
-
|
|
|
177
|
-
|
|
|
178
|
-
|
|
|
179
|
-
|
|
|
180
|
-
| selectEvent
|
|
181
|
-
|
|
|
182
|
-
| tableHead | @ContentChild TemplateRef<any> | | 表格头插槽 |
|
|
183
|
-
| tableBody | @ContentChild TemplateRef<any> | | 表格数据主体插槽 |
|
|
184
|
-
| tableTotal | @ContentChild TemplateRef<any> | | 表格顶部合计插槽 |
|
|
185
|
-
| showTableTotal(弃用) | boolean | False | 是否显示底部合计区域 |
|
|
186
|
-
| tableTotalOption(弃用) | Array<TableTotalOption> | | 底部合计区域的合计字段选项集合 |
|
|
240
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
241
|
+
| ---- | ---- | ------ | ---- |
|
|
242
|
+
| tableData | Page\<any\> | — | 分页数据 |
|
|
243
|
+
| tablePageIndex | number | 1 | 当前页(双向绑定) |
|
|
244
|
+
| tablePageSize | number | 10 | 每页条数(双向绑定) |
|
|
245
|
+
| tableLoading | boolean | false | 加载状态 |
|
|
246
|
+
| tableSearchEvent | EventEmitter | — | 翻页 / 改 pageSize 触发,参数 reset 表示是否重置到第一页 |
|
|
247
|
+
| scroll | object | { x: '1150px' } | 横向滚动 |
|
|
248
|
+
| showSelected | boolean | false | 是否显示勾选列 |
|
|
249
|
+
| selectField | string | billNumber | 勾选主键字段 |
|
|
250
|
+
| selectEvent | EventEmitter | — | 勾选变化 |
|
|
251
|
+
| tableHead / tableBody / tableTotal | TemplateRef | — | 表头 / 表体 / 顶部合计插槽 |
|
|
187
252
|
|
|
188
|
-
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## 9、增强表格(hd-table)
|
|
256
|
+
|
|
257
|
+
在通用表格基础上支持**列配置渲染**、**排序**、**列宽/顺序/pageSize 本地缓存**、**设置列**等能力。列表页**优先推荐使用**。
|
|
258
|
+
|
|
259
|
+
### 示例
|
|
260
|
+
|
|
261
|
+
```html
|
|
262
|
+
<hd-table #hdTable [(tablePageIndex)]="pageIndex" [(tablePageSize)]="pageSize"
|
|
263
|
+
[tableCols]="tableCols" [tableData]="page" [tableLoading]="loading"
|
|
264
|
+
(tableSearchEvent)="search($event)" showSelected showOperateColWarpButton
|
|
265
|
+
selectField="billNumber" (selectEvent)="selectResult($event)"
|
|
266
|
+
uuid="74907b48-1b17-4e51-9fa9-81fd0ac94051"
|
|
267
|
+
(sortEvent)="sortEvent($event)" (tablePageSizeChangeEvent)="search(true)">
|
|
268
|
+
<ng-template #tableLeftButton>
|
|
269
|
+
<hd-button type="default" (clickAction)="search()">刷新</hd-button>
|
|
270
|
+
</ng-template>
|
|
271
|
+
<ng-template #tableRightButton>
|
|
272
|
+
<hd-button type="default">导出</hd-button>
|
|
273
|
+
</ng-template>
|
|
274
|
+
<ng-template #tableTotal>...</ng-template>
|
|
275
|
+
</hd-table>
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
tableCols: HdTableColumn[] = [{
|
|
280
|
+
title: '配送单号',
|
|
281
|
+
name: 'billNumber',
|
|
282
|
+
fixed: 'left',
|
|
283
|
+
click: (line) => { /* 点击行 */ }
|
|
284
|
+
}, {
|
|
285
|
+
title: '状态',
|
|
286
|
+
name: 'state',
|
|
287
|
+
width: ColWidth.enumColWidth,
|
|
288
|
+
// stateField: 'orderStatus', // 可选,自定义状态取值字段,默认取 data.state
|
|
289
|
+
render: (line) => line.state === 'received' ? '已收货' : '未收货'
|
|
290
|
+
}, {
|
|
291
|
+
title: '订单状态',
|
|
292
|
+
name: 'orderStatus',
|
|
293
|
+
isState: true, // 按 hd-status 渲染,取值字段为 name(orderStatus)
|
|
294
|
+
width: ColWidth.enumColWidth,
|
|
295
|
+
render: (line) => line.orderStatusText
|
|
296
|
+
}, {
|
|
297
|
+
title: '操作',
|
|
298
|
+
name: 'operate',
|
|
299
|
+
width: ColWidth.operateColWidth,
|
|
300
|
+
btnList: [{ name: '删除', showConfirm: true, click: (line) => this.remove(line) }]
|
|
301
|
+
// showConfirm 也可传函数,按行属性决定是否二次确认
|
|
302
|
+
// btnList: [{ name: '删除', showConfirm: (line) => line.state !== 'draft', click: (line) => this.remove(line) }]
|
|
303
|
+
}];
|
|
304
|
+
```
|
|
189
305
|
|
|
190
|
-
|
|
306
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
307
|
+
| ---- | ---- | ------ | ---- |
|
|
308
|
+
| tableCols | HdTableColumn[] | [] | 列配置 |
|
|
309
|
+
| tableData | Page\<any\> | — | 分页数据 |
|
|
310
|
+
| tablePageIndex / tablePageSize | number | — | 分页(双向绑定) |
|
|
311
|
+
| tableLoading | boolean | false | 加载状态 |
|
|
312
|
+
| tableSearchEvent | EventEmitter | — | 翻页查询 |
|
|
313
|
+
| sortEvent | EventEmitter | — | 排序 |
|
|
314
|
+
| selectEvent | EventEmitter | — | 勾选变化 |
|
|
315
|
+
| showSelected | boolean | false | 勾选列 |
|
|
316
|
+
| showOperateColWarpButton | boolean | false | 展开/缩略显示换行列 |
|
|
317
|
+
| showTableTotal | boolean | false | 底部合计行 |
|
|
318
|
+
| tableTotalOption | HdTableTotalOption[] | — | 合计配置 |
|
|
319
|
+
| isFirstEntrySearch | boolean | — | 首次进入是否自动查询 |
|
|
320
|
+
| isCrossPageSelect | boolean | — | 跨页勾选 |
|
|
321
|
+
| uuid | string | — | 列缓存唯一标识(必填,用于 IndexedDB 缓存) |
|
|
322
|
+
| tableLeftButton / tableRightButton / tableTotal | TemplateRef | — | 工具栏插槽 |
|
|
191
323
|
|
|
324
|
+
#### HdTableColumn 配置
|
|
192
325
|
|
|
326
|
+
列定义见 [HdTableColumn](#hdtablecolumn表格列)、[OperateBtn](#operatebtn操作列按钮)、[HdTableTotalOption](#hdtabletotaloptionhd-table-底部合计)。
|
|
193
327
|
|
|
194
|
-
|
|
328
|
+
当 `name` 为 `state` 或 `isState` 为 `true` 时,列内容使用 `hd-status` 渲染。取值规则:`isState` 时取 `data[name]`;否则可通过 `stateField` 指定字段,未配置时默认取 `state`。
|
|
195
329
|
|
|
196
|
-
|
|
330
|
+
---
|
|
197
331
|
|
|
198
|
-
|
|
332
|
+
## 10、表单(hd-form)
|
|
199
333
|
|
|
200
334
|
### 示例
|
|
201
335
|
|
|
202
|
-
```
|
|
203
|
-
<hd-
|
|
336
|
+
```html
|
|
337
|
+
<hd-form [formList]="formInput" (changeEvent)="formChangeEvent($event)"></hd-form>
|
|
204
338
|
```
|
|
205
339
|
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
type: FilterListType.Input,
|
|
340
|
+
```typescript
|
|
341
|
+
formInput: FormItem[] = [{
|
|
342
|
+
type: FormListType.Input,
|
|
210
343
|
label: '配送单号',
|
|
211
|
-
name: '
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
344
|
+
name: 'billNumber',
|
|
345
|
+
require: true,
|
|
346
|
+
width: 2,
|
|
347
|
+
onChangeEvent: this.formInputChange.bind(this)
|
|
216
348
|
}, {
|
|
217
|
-
type:
|
|
218
|
-
label: '
|
|
219
|
-
name: '
|
|
220
|
-
|
|
221
|
-
selectOption: {
|
|
222
|
-
value: 'value',
|
|
223
|
-
label: 'label',
|
|
224
|
-
selectList: [{
|
|
225
|
-
value: true,
|
|
226
|
-
label: '是是是是是是是是是是是是是是是是是是是是是是'
|
|
227
|
-
}, {
|
|
228
|
-
value: false,
|
|
229
|
-
label: '否'
|
|
230
|
-
}]
|
|
231
|
-
},
|
|
232
|
-
onChangeEvent: (item) => {
|
|
233
|
-
console.log('item', item);
|
|
234
|
-
}
|
|
349
|
+
type: FormListType.Select,
|
|
350
|
+
label: '是否启用',
|
|
351
|
+
name: 'enabled',
|
|
352
|
+
width: 1,
|
|
353
|
+
selectOption: { value: 'value', label: 'label', selectList: [...] }
|
|
235
354
|
}, {
|
|
236
|
-
type:
|
|
237
|
-
label: '
|
|
238
|
-
name: '
|
|
239
|
-
|
|
240
|
-
onChangeEvent: (item) => {
|
|
241
|
-
console.log('onChangeEvent', item);
|
|
242
|
-
},
|
|
243
|
-
onSearchEvent: (item) => {
|
|
244
|
-
console.log('onSearchEvent', item);
|
|
245
|
-
},
|
|
246
|
-
selectOption: {
|
|
247
|
-
value: 'value',
|
|
248
|
-
label: 'label',
|
|
249
|
-
selectList: [{
|
|
250
|
-
value: '01',
|
|
251
|
-
label: '第一个第一个第一个第一个第一个'
|
|
252
|
-
}, {
|
|
253
|
-
value: '02',
|
|
254
|
-
label: '第二个'
|
|
255
|
-
}, {
|
|
256
|
-
value: '03',
|
|
257
|
-
label: '第三个'
|
|
258
|
-
}, {
|
|
259
|
-
value: '04',
|
|
260
|
-
label: '第四个'
|
|
261
|
-
}]
|
|
262
|
-
}
|
|
355
|
+
type: FormListType.Input,
|
|
356
|
+
label: '金额',
|
|
357
|
+
name: 'amount',
|
|
358
|
+
prefix: '¥' // 前缀文字,对应 nz-input-group nzPrefix
|
|
263
359
|
}, {
|
|
264
|
-
type:
|
|
265
|
-
label: '
|
|
266
|
-
name: '
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
},
|
|
274
|
-
onSearchEvent: (item, selectOption) => {
|
|
275
|
-
console.log('onSearchEvent', item);
|
|
276
|
-
console.log('selectOption', selectOption);
|
|
277
|
-
// 在这里去调接口查数据 定时器模拟调接口
|
|
278
|
-
setTimeout(() => {
|
|
279
|
-
selectOption.selectList = [{
|
|
280
|
-
productCode: '123213213',
|
|
281
|
-
productName: '测试商品1'
|
|
282
|
-
}, {
|
|
283
|
-
productCode: 'qwertyuiop',
|
|
284
|
-
productName: '测试商品2'
|
|
285
|
-
}]
|
|
286
|
-
}, 1000);
|
|
287
|
-
}
|
|
360
|
+
type: FormListType.Input,
|
|
361
|
+
label: '手机号',
|
|
362
|
+
name: 'mobile',
|
|
363
|
+
prefixIcon: 'phone' // 前缀图标,对应 nz-icon nzType
|
|
364
|
+
}, {
|
|
365
|
+
type: FormListType.InputNumber,
|
|
366
|
+
label: '数量',
|
|
367
|
+
name: 'qty',
|
|
368
|
+
inputNumber: { min: 0, max: 9999, step: 1, precision: 2 }
|
|
288
369
|
}, {
|
|
289
|
-
type:
|
|
290
|
-
label: '
|
|
291
|
-
name: '
|
|
292
|
-
value:
|
|
370
|
+
type: FormListType.Checkbox,
|
|
371
|
+
label: '是否启用',
|
|
372
|
+
name: 'enabled',
|
|
373
|
+
value: false // 单个复选框,值为 boolean
|
|
293
374
|
}, {
|
|
294
|
-
type:
|
|
295
|
-
label: '
|
|
296
|
-
name: '
|
|
297
|
-
value: ['
|
|
375
|
+
type: FormListType.Checkbox,
|
|
376
|
+
label: '权限',
|
|
377
|
+
name: 'permissions',
|
|
378
|
+
value: ['read'],
|
|
379
|
+
checkboxOption: {
|
|
380
|
+
label: 'name',
|
|
381
|
+
value: 'code',
|
|
382
|
+
optionList: [
|
|
383
|
+
{ code: 'read', name: '查看' },
|
|
384
|
+
{ code: 'edit', name: '编辑' }
|
|
385
|
+
]
|
|
386
|
+
}
|
|
298
387
|
}];
|
|
299
388
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
console.log('filter',filter);
|
|
303
|
-
if (filter) {
|
|
304
|
-
this.queryFilter = filter;
|
|
305
|
-
// 因为更改了filter 需要清空所有的勾选 触发组件的重置事件
|
|
306
|
-
this.hdCurrentTable.resetStatus();
|
|
307
|
-
this.search(true);
|
|
308
|
-
}
|
|
389
|
+
formChangeEvent(validateForm: FormGroup) {
|
|
390
|
+
this.validateHdForm = validateForm;
|
|
309
391
|
}
|
|
310
392
|
```
|
|
311
393
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
|
315
|
-
|
|
|
316
|
-
| filterList | Array<Filter> | | 所有的筛选器空间数据 |
|
|
317
|
-
| searchEvent | EventEmitter<> | | 查询、重置按钮触发函数,带回筛选器数据 |
|
|
318
|
-
|
|
319
|
-
#### Filter
|
|
320
|
-
|
|
321
|
-
| 参数 | 类型 | 默认值 | 说明 |
|
|
322
|
-
| ------------- | ----------------------------------------------------------- | ------ | ------------------------------------------------------------ |
|
|
323
|
-
| *type | FilterListType | | 控件类型 Input \| Select \| Date \| DateRange \| MultipleSelect |
|
|
324
|
-
| *label | string | | 控件前文案 |
|
|
325
|
-
| *name | string | | 字段名称 |
|
|
326
|
-
| placeholder | string | | 输入框提示文案 |
|
|
327
|
-
| value | string \| boolen \| number \| Array<string \| Date> \| null | null | 初始值 |
|
|
328
|
-
| selectOption | SelectOption | | select选择器选项配置 |
|
|
329
|
-
| onSearchEvent | EventEmitter<> | | select选择器搜索事件 可用于更新备选集合 |
|
|
330
|
-
| onChangeEvent | EventEmitter<> | | 控件的值改变事件 可用于控件间联动 |
|
|
394
|
+
| 参数 | 类型 | 说明 |
|
|
395
|
+
| ---- | ---- | ---- |
|
|
396
|
+
| formList | FormItem[] | 表单项配置 |
|
|
397
|
+
| changeEvent | EventEmitter | 表单值变化,返回 FormGroup |
|
|
331
398
|
|
|
332
|
-
####
|
|
399
|
+
#### FormItem 配置
|
|
333
400
|
|
|
334
|
-
|
|
335
|
-
| -------------------------- | ---------- | ------ | ------------------------------------------------------ |
|
|
336
|
-
| *label | string | | label字段,取selectList数组中的某个字段作为选择器label |
|
|
337
|
-
| *value | string | | Value字段,取selectList数组中的某个字段作为选择器value |
|
|
338
|
-
| *selectList | Array<any> | | 选项列表 |
|
|
339
|
-
| showLabelAndValue | boolean | false | 选项同时展示label和value,格式:[value]label |
|
|
340
|
-
| hdDropdownMatchSelectWidth | boolean | false | 选择框长度是否和控件长度保持一致,默认不保持 |
|
|
401
|
+
表单项使用 [FormItem](#formitem表单项) 类型,下拉/数字等子配置见 [SelectOption](#selectoption下拉选项配置)、[InputNumber](#inputnumber数字输入配置)、[RadioOption](#radiooption单选配置)、[CheckboxOption](#checkboxoption复选框配置)。
|
|
341
402
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
- 事件函数如果内部语句过多,请使用bind(this)方法,示例:onChangeEvent: this.formInputChange.bind(this)
|
|
403
|
+
---
|
|
345
404
|
|
|
346
|
-
##
|
|
405
|
+
## 11、明细表单(hd-form-lines)
|
|
347
406
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-

|
|
407
|
+
可编辑的明细行表格,支持键盘导航、行内搜索、合计等。
|
|
351
408
|
|
|
352
409
|
### 示例
|
|
353
410
|
|
|
354
411
|
```html
|
|
355
|
-
<hd-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
<hd-status status="deleted">已删除</hd-status>
|
|
361
|
-
<hd-status status="shipped">已配送</hd-status>
|
|
412
|
+
<hd-form-lines #hdFormLines showSearch showKeyboardOperateTip
|
|
413
|
+
[formLines]="formLines" [formLinesData]="formLinesData"
|
|
414
|
+
[operateButtons]="['add', 'delete']" [allowEmpty]="false"
|
|
415
|
+
(changeEvent)="formLinesChangeEvent($event)">
|
|
416
|
+
</hd-form-lines>
|
|
362
417
|
```
|
|
363
418
|
|
|
364
|
-
|
|
419
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
420
|
+
| ---- | ---- | ------ | ---- |
|
|
421
|
+
| formLines | FormLine[] | — | 列定义 |
|
|
422
|
+
| formLinesData | any[] | — | 行数据 |
|
|
423
|
+
| operateButtons | string[] | ['add','delete'] | 操作按钮 |
|
|
424
|
+
| showDeleteConfirm | boolean | false | 删除前确认 |
|
|
425
|
+
| showSearch | boolean | false | 行内搜索 |
|
|
426
|
+
| showKeyboardOperateTip | boolean | false | 键盘操作提示 |
|
|
427
|
+
| showLineNumber | boolean | true | 序号列 |
|
|
428
|
+
| allowEmpty | boolean | true | 是否允许空表 |
|
|
429
|
+
| showTotal | boolean | false | 合计行 |
|
|
430
|
+
| totalOption / columnsNumber | — | — | 合计配置 |
|
|
431
|
+
| scroll | object | { x: '1px' } | 横向滚动 |
|
|
432
|
+
| changeEvent | EventEmitter | — | 表单变化 |
|
|
433
|
+
| deleteLastLineEvent | EventEmitter | — | 删除最后一行 |
|
|
365
434
|
|
|
366
|
-
|
|
367
|
-
| ------ | ------ | ------ |
|
|
368
|
-
| status | string | 状态值 |
|
|
435
|
+
#### FormLine 配置
|
|
369
436
|
|
|
370
|
-
|
|
437
|
+
明细列使用 [FormLine](#formline明细表单项) 类型,含 [ColorOption](#coloroption)、[ExplainOption](#explainoption) 及表格型 [SelectOption](#selectoption下拉选项配置)。
|
|
371
438
|
|
|
372
|
-
|
|
439
|
+
---
|
|
373
440
|
|
|
441
|
+
开启 `showKeyboardOperateTip` 后支持 `[↑][↓][←][→]`、`Enter` 在单元格间跳转;InputNumber 上下键用于跳转,不触发 step 增减。
|
|
374
442
|
|
|
443
|
+
#### 暴露方法
|
|
375
444
|
|
|
376
|
-
|
|
445
|
+
```typescript
|
|
446
|
+
this.hdFormLines.getValid(); // 获取整表校验状态
|
|
447
|
+
```
|
|
377
448
|
|
|
378
|
-
|
|
449
|
+
---
|
|
379
450
|
|
|
380
|
-
|
|
451
|
+
## 12、详情头(hd-detail-tip)
|
|
381
452
|
|
|
382
453
|
### 示例
|
|
383
454
|
|
|
@@ -385,590 +456,480 @@ filterChange(filter?: any) {
|
|
|
385
456
|
<hd-detail-tip state="shipped" stateText="配送中" billNumber="202111030001"></hd-detail-tip>
|
|
386
457
|
```
|
|
387
458
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
|
391
|
-
|
|
|
392
|
-
|
|
|
393
|
-
|
|
|
394
|
-
| billNumber | string | 单号 |
|
|
395
|
-
|
|
396
|
-
### 注意点
|
|
397
|
-
|
|
398
|
-
- state需要在hd-status.service.ts中的statusToColor添加值,选择对应的颜色
|
|
399
|
-
|
|
459
|
+
| 参数 | 类型 | 说明 |
|
|
460
|
+
| ---- | ---- | ---- |
|
|
461
|
+
| state | string | 状态值 |
|
|
462
|
+
| stateText | string | 状态文案 |
|
|
463
|
+
| billNumber | string | 单号 |
|
|
464
|
+
| tip | string | 前缀文案,默认「详情」 |
|
|
400
465
|
|
|
466
|
+
---
|
|
401
467
|
|
|
402
|
-
##
|
|
403
|
-
|
|
404
|
-
### 效果图
|
|
405
|
-
|
|
406
|
-

|
|
468
|
+
## 13、详情单头(hd-detail-form)
|
|
407
469
|
|
|
408
470
|
### 示例
|
|
409
471
|
|
|
410
472
|
```html
|
|
411
473
|
<hd-detail-form [formCols]="formCols"></hd-detail-form>
|
|
474
|
+
<!-- 固定两列:<hd-detail-form [formCols]="formCols" [nzColumn]="2"></hd-detail-form> -->
|
|
412
475
|
```
|
|
413
476
|
|
|
414
|
-
```
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
{
|
|
418
|
-
label: '收货单号收货单号收货单号',
|
|
419
|
-
value: '202111030001'
|
|
420
|
-
},
|
|
421
|
-
{
|
|
422
|
-
label: '收货单号',
|
|
423
|
-
value: '202111030001'
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
label: '收货单号',
|
|
427
|
-
value: '202111030001'
|
|
428
|
-
},
|
|
429
|
-
{
|
|
430
|
-
label: '收货单号',
|
|
431
|
-
value: ''
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
label: '收货单号',
|
|
435
|
-
value: '202111030001'
|
|
436
|
-
},
|
|
437
|
-
{
|
|
438
|
-
label: '备注',
|
|
439
|
-
value: '字数很多字数很多字数很多字数很多202111030001字数很多字数很多字数很多字数很多202111030001字数很多字数很多字数很多字数很多202111030001'
|
|
440
|
-
},
|
|
477
|
+
```typescript
|
|
478
|
+
formCols: HdOption[] = [
|
|
479
|
+
{ label: '收货单号', value: '202111030001' },
|
|
480
|
+
{ label: '备注', value: '...' }
|
|
441
481
|
];
|
|
442
482
|
```
|
|
443
483
|
|
|
444
|
-
|
|
484
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
485
|
+
| ---- | ---- | ------ | ---- |
|
|
486
|
+
| formCols | HdOption[] | — | 展示字段,见 [HdOption](#hdoption键值展示项) |
|
|
487
|
+
| nzColumn | number \| object | `{ xxl: 4, xl: 3, lg: 3, md: 3, sm: 2, xs: 1 }` | 列数;传数字为固定列数,传对象为响应式列数 |
|
|
488
|
+
|
|
489
|
+
---
|
|
445
490
|
|
|
446
|
-
|
|
447
|
-
| -------- | -------------------- | ------------ |
|
|
448
|
-
| formCols | Array<{label,value}> | 展示的列数组 |
|
|
491
|
+
## 14、详情明细(hd-detail-lines)
|
|
449
492
|
|
|
493
|
+
详情页只读/轻编辑明细表格,支持**前端分页**和**行内搜索**。
|
|
450
494
|
|
|
495
|
+
### 示例
|
|
451
496
|
|
|
452
|
-
|
|
497
|
+
```html
|
|
498
|
+
<!-- 带搜索 + 前端分页 -->
|
|
499
|
+
<hd-detail-lines showSearch [lines]="lines" [scroll]="{x: '1150px'}">
|
|
500
|
+
<ng-template #detailLineHead>...</ng-template>
|
|
501
|
+
<ng-template #detailLineBody let-data let-index="index">...</ng-template>
|
|
502
|
+
</hd-detail-lines>
|
|
453
503
|
|
|
454
|
-
|
|
504
|
+
<!-- 勾选 + 合计 + 前端分页 -->
|
|
505
|
+
<hd-detail-lines [lines]="lines" showSelected selectField="uuid"
|
|
506
|
+
hdFrontPagination showTotal columnsNumber="4" [totalOption]="detailLinesTotalOption"
|
|
507
|
+
(selectEvent)="selectResultLines($event)">
|
|
508
|
+
...
|
|
509
|
+
</hd-detail-lines>
|
|
510
|
+
```
|
|
455
511
|
|
|
456
|
-
|
|
512
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
513
|
+
| ---- | ---- | ------ | ---- |
|
|
514
|
+
| lines | any[] | — | 明细数据 |
|
|
515
|
+
| scroll | object | { x: '1px' } | 横向滚动 |
|
|
516
|
+
| showSearch | boolean | false | 行内搜索 |
|
|
517
|
+
| searchFields | string[] | [] | 搜索字段,空则搜全部字段 |
|
|
518
|
+
| hdFrontPagination | boolean | false | 前端分页 |
|
|
519
|
+
| showSelected | boolean | false | 勾选 |
|
|
520
|
+
| selectField | string | billNumber | 勾选主键 |
|
|
521
|
+
| selectedField | string | — | 初始勾选标记字段 |
|
|
522
|
+
| selectEvent | EventEmitter | — | 勾选变化 |
|
|
523
|
+
| allowDrop | boolean | false | 拖拽排序 |
|
|
524
|
+
| showTotal | boolean | false | 合计行 |
|
|
525
|
+
| columnsNumber | number | — | 总列数(含合计) |
|
|
526
|
+
| totalOption | TotalOption[] | — | 合计配置,见 [TotalOption](#totaloption明细合计行) |
|
|
527
|
+
| detailLineHead / detailLineBody | TemplateRef | — | 表头 / 表体插槽 |
|
|
528
|
+
|
|
529
|
+
---
|
|
530
|
+
|
|
531
|
+
## 15、详情明细-服务端分页(hd-detail-lines-page)
|
|
532
|
+
|
|
533
|
+
与 `hd-detail-lines` 模板用法相同,但**不做内部分页和搜索**,分页由父组件控制(对齐 `hd-table`)。
|
|
457
534
|
|
|
458
535
|
### 示例
|
|
459
536
|
|
|
460
537
|
```html
|
|
461
|
-
<hd-detail-lines [scroll]="{x: '1150px'}"
|
|
462
|
-
[lines]="
|
|
538
|
+
<hd-detail-lines-page [scroll]="{x: '1150px'}"
|
|
539
|
+
[lines]="detailLinesPageData.content"
|
|
540
|
+
[tableData]="detailLinesPageData"
|
|
541
|
+
[tableLoading]="detailLinesPageLoading"
|
|
542
|
+
[tablePageIndex]="detailLinesPageIndex"
|
|
543
|
+
[tablePageSize]="detailLinesPageSize"
|
|
544
|
+
(tablePageIndexChange)="onDetailLinesPageIndexChange($event)"
|
|
545
|
+
(tablePageSizeChange)="onDetailLinesPageSizeChange($event)">
|
|
463
546
|
<ng-template #detailLineHead>
|
|
464
547
|
<th style="width: 40px">序号</th>
|
|
465
548
|
<th style="width: 150px">商品编码</th>
|
|
466
549
|
<th>商品名称</th>
|
|
467
|
-
<th style="width: 80px" nzRight="0">操作</th>
|
|
468
550
|
</ng-template>
|
|
469
|
-
<ng-template #detailLineBody let-data>
|
|
470
|
-
<td
|
|
471
|
-
<td
|
|
472
|
-
|
|
473
|
-
<ng-template #modifyTmp>
|
|
474
|
-
<input nz-input placeholder="请输入商品编码" [(ngModel)]="data.productCode" />
|
|
475
|
-
</ng-template>
|
|
476
|
-
</td>
|
|
477
|
-
<td>{{ data.productName || '<空>' }}</td>
|
|
478
|
-
<td style="width: 80px" nzRight="0">
|
|
479
|
-
<span class="common-btn-group">
|
|
480
|
-
<a>详情</a>
|
|
481
|
-
<a class="common-danger-btn">删除</a>
|
|
482
|
-
</span>
|
|
483
|
-
</td>
|
|
551
|
+
<ng-template #detailLineBody let-data let-index="index">
|
|
552
|
+
<td>{{ index + 1 }}</td>
|
|
553
|
+
<td>{{ data.productCode }}</td>
|
|
554
|
+
<td>{{ data.productName }}</td>
|
|
484
555
|
</ng-template>
|
|
485
|
-
</hd-detail-lines>
|
|
556
|
+
</hd-detail-lines-page>
|
|
486
557
|
```
|
|
487
558
|
|
|
488
|
-
```
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
// console.log('selectResultLines', selectList);
|
|
559
|
+
```typescript
|
|
560
|
+
detailLinesPageData: Page<any> = new Page();
|
|
561
|
+
detailLinesPageIndex = 1;
|
|
562
|
+
detailLinesPageSize = 5;
|
|
563
|
+
detailLinesPageLoading = false;
|
|
564
|
+
|
|
565
|
+
loadDetailLinesPage(reset = false) {
|
|
566
|
+
if (reset) { this.detailLinesPageIndex = 1; }
|
|
567
|
+
this.detailLinesPageLoading = true;
|
|
568
|
+
this.service.queryLines({
|
|
569
|
+
pageNumber: this.detailLinesPageIndex - 1,
|
|
570
|
+
pageSize: this.detailLinesPageSize
|
|
571
|
+
}).subscribe(result => {
|
|
572
|
+
this.detailLinesPageData = result;
|
|
573
|
+
this.detailLinesPageLoading = false;
|
|
574
|
+
});
|
|
505
575
|
}
|
|
506
|
-
```
|
|
507
576
|
|
|
508
|
-
|
|
577
|
+
onDetailLinesPageIndexChange(pageIndex: number) {
|
|
578
|
+
this.detailLinesPageIndex = pageIndex;
|
|
579
|
+
this.loadDetailLinesPage();
|
|
580
|
+
}
|
|
509
581
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
| totalOption | Array<TotalOption> | | 合计列选项 |
|
|
516
|
-
| showSelected | boolean | false | 是否开启勾选功能 |
|
|
517
|
-
| selectEvent | EventEmitter<array> | | 勾选状态改变触发函数,emit已勾选数组 |
|
|
518
|
-
| selectField | string | billNumber | 与showSelected配合使用,勾选判断逻辑的关键词(传入源数据中的主键字段) |
|
|
519
|
-
| detailLineHead | @ContentChild TemplateRef<any> | | 表格头插槽 |
|
|
520
|
-
| detailLineBody | @ContentChild TemplateRef<any> | | 表格数据主体插槽 |
|
|
582
|
+
onDetailLinesPageSizeChange(pageSize: number) {
|
|
583
|
+
this.detailLinesPageSize = pageSize;
|
|
584
|
+
this.loadDetailLinesPage(true);
|
|
585
|
+
}
|
|
586
|
+
```
|
|
521
587
|
|
|
522
|
-
|
|
588
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
589
|
+
| ---- | ---- | ------ | ---- |
|
|
590
|
+
| lines | any[] | [] | 当前页数据(也可用 tableData.content) |
|
|
591
|
+
| tableData | Page\<any\> | — | 分页对象,提供 totalElements |
|
|
592
|
+
| tablePageIndex / tablePageSize | number | 1 / 10 | 分页 |
|
|
593
|
+
| tableLoading | boolean | false | 加载状态 |
|
|
594
|
+
| tablePageIndexChange | EventEmitter | — | 页码变化 |
|
|
595
|
+
| tablePageSizeChange | EventEmitter | — | 每页条数变化(组件内会重置到第 1 页) |
|
|
596
|
+
| pageChange | EventEmitter | — | 任意分页变化 |
|
|
597
|
+
| showSelected / allowDrop / showTotal 等 | — | — | 同 hd-detail-lines |
|
|
598
|
+
| isCrossPageSelect | boolean | — | 跨页勾选 |
|
|
523
599
|
|
|
524
|
-
|
|
525
|
-
| ----------- | ------ | ----------------------------------- |
|
|
526
|
-
| insertIndex | number | 插入下标 |
|
|
527
|
-
| insertValue | any | 插入值 |
|
|
528
|
-
| align | string | 列对齐方式 left \| right \| center |
|
|
600
|
+
模板中 `index` 为**全局序号**:`(pageIndex - 1) * pageSize + 行号`。
|
|
529
601
|
|
|
602
|
+
### 与 hd-detail-lines 选型
|
|
530
603
|
|
|
604
|
+
| 场景 | 推荐组件 |
|
|
605
|
+
| ---- | -------- |
|
|
606
|
+
| 数据量小、前端筛选/分页 | hd-detail-lines |
|
|
607
|
+
| 接口分页、数据量大 | hd-detail-lines-page |
|
|
531
608
|
|
|
532
|
-
|
|
609
|
+
---
|
|
533
610
|
|
|
534
|
-
|
|
611
|
+
## 16、操作日志(hd-log)
|
|
535
612
|
|
|
536
|
-
|
|
613
|
+
基于 `hd-detail-lines` 封装的日志展示,内置列:时间、操作人、事件、描述。
|
|
537
614
|
|
|
538
615
|
### 示例
|
|
539
616
|
|
|
540
617
|
```html
|
|
541
|
-
<hd-
|
|
618
|
+
<hd-log [logs]="logs"></hd-log>
|
|
542
619
|
```
|
|
543
620
|
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
}, {
|
|
587
|
-
value: false,
|
|
588
|
-
label: '否'
|
|
589
|
-
}]
|
|
590
|
-
}
|
|
591
|
-
}, {
|
|
592
|
-
type: FormListType.MultipleSelect,
|
|
593
|
-
label: '多项选择器选择',
|
|
594
|
-
name: 'multipleSelectValue',
|
|
595
|
-
value: ['05', '06'],
|
|
596
|
-
require: true,
|
|
597
|
-
defaultLabel: ['第五个', '第六个'],
|
|
598
|
-
width: 2,
|
|
599
|
-
onChangeEvent: (item) => {
|
|
600
|
-
console.log('onChangeEvent', item);
|
|
601
|
-
},
|
|
602
|
-
onSearchEvent: (item) => {
|
|
603
|
-
console.log('onSearchEvent', item);
|
|
604
|
-
},
|
|
605
|
-
selectOption: {
|
|
606
|
-
value: 'value',
|
|
607
|
-
label: 'label',
|
|
608
|
-
selectList: [{
|
|
609
|
-
value: '01',
|
|
610
|
-
label: '第一个'
|
|
611
|
-
}, {
|
|
612
|
-
value: '02',
|
|
613
|
-
label: '第二个'
|
|
614
|
-
}, {
|
|
615
|
-
value: '03',
|
|
616
|
-
label: '第三个'
|
|
617
|
-
}, {
|
|
618
|
-
value: '04',
|
|
619
|
-
label: '第四个'
|
|
620
|
-
}]
|
|
621
|
-
}
|
|
622
|
-
}, {
|
|
623
|
-
type: FormListType.Date,
|
|
624
|
-
label: '单个日期选择选择',
|
|
625
|
-
name: 'dateValue',
|
|
626
|
-
width: 1,
|
|
627
|
-
value: '2020-1-2'
|
|
628
|
-
}, {
|
|
629
|
-
type: FormListType.DateRange,
|
|
630
|
-
label: '日期范围选择',
|
|
631
|
-
require: true,
|
|
632
|
-
width: 1,
|
|
633
|
-
name: 'dateRangeValue',
|
|
634
|
-
value: ['2020-1-2', '2020-1-2']
|
|
635
|
-
}, {
|
|
636
|
-
type: FormListType.InputNumber,
|
|
637
|
-
label: '数字输入',
|
|
638
|
-
require: true,
|
|
639
|
-
width: 1,
|
|
640
|
-
name: 'inputNumberValue',
|
|
641
|
-
value: null,
|
|
642
|
-
disabled: false,
|
|
643
|
-
color: 'red'
|
|
644
|
-
}, {
|
|
645
|
-
type: FormListType.TextArea,
|
|
646
|
-
label: '备注',
|
|
647
|
-
require: true,
|
|
648
|
-
name: 'remark',
|
|
649
|
-
width: 4,
|
|
650
|
-
value: '这是个备注'
|
|
651
|
-
}];
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
/**
|
|
655
|
-
* form组件值改变函数
|
|
656
|
-
* @param validateForm form组件返回的表单对象
|
|
657
|
-
*/
|
|
658
|
-
formChangeEvent(validateForm: any) {
|
|
659
|
-
this.validateHdForm = validateForm;
|
|
660
|
-
// console.log('form组件返回',this.validateHdForm.getRawValue());
|
|
621
|
+
| 参数 | 类型 | 说明 |
|
|
622
|
+
| ---- | ---- | ---- |
|
|
623
|
+
| logs | any[] | 日志列表,字段:`createInfo.operateTime`、`createInfo.operatorName`、`event`、`describe` |
|
|
624
|
+
|
|
625
|
+
也可作为 Modal 内容组件使用(`entryComponents: HdLogComponent`)。
|
|
626
|
+
|
|
627
|
+
---
|
|
628
|
+
|
|
629
|
+
## 附录:公共配置类型
|
|
630
|
+
|
|
631
|
+
以下类型在 `hd-filter`、`hd-form`、`hd-form-lines`、`hd-table` 等组件中复用。
|
|
632
|
+
|
|
633
|
+
### SelectOption(下拉选项配置)
|
|
634
|
+
|
|
635
|
+
用于 `Filter.selectOption`、`FormItem.selectOption`、`FormLine.selectOption`。
|
|
636
|
+
|
|
637
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
638
|
+
| ---- | ---- | ------ | ---- |
|
|
639
|
+
| label | string | — | selectList 中作为显示文案的字段名 |
|
|
640
|
+
| value | string | — | selectList 中作为绑定值的字段名 |
|
|
641
|
+
| selectList | any[] | — | 静态选项列表 |
|
|
642
|
+
| selectListName | string | — | 选项来自行数据某字段时使用(配合 hide 字段) |
|
|
643
|
+
| showLabelAndValue | boolean | false | 选项展示为 `[value]label` |
|
|
644
|
+
| hdDropdownMatchSelectWidth | boolean | false | 下拉宽度是否与控件一致 |
|
|
645
|
+
| hdServerSearch | boolean | false | 是否远程搜索 |
|
|
646
|
+
| hdShowSearch | boolean | true | 是否可搜索 |
|
|
647
|
+
| hdAllowClear | boolean | true | 是否允许清空 |
|
|
648
|
+
| hdShowItemCode | boolean | false | 已选展示是否带 `[value]` 前缀 |
|
|
649
|
+
| tableColumns | SelectOptionTableColumn[] | — | 表格型下拉列配置(商品选择器等) |
|
|
650
|
+
|
|
651
|
+
```typescript
|
|
652
|
+
selectOption: {
|
|
653
|
+
value: 'productCode',
|
|
654
|
+
label: 'productName',
|
|
655
|
+
showLabelAndValue: true,
|
|
656
|
+
hdServerSearch: true,
|
|
657
|
+
selectList: [],
|
|
658
|
+
tableColumns: [
|
|
659
|
+
{ width: ColWidth.codeNameColWidth, label: '商品', name: 'product',
|
|
660
|
+
render: (line) => `[${line.productCode}] ${line.productName}` },
|
|
661
|
+
{ width: ColWidth.enumColWidth, label: '规格', name: 'specification' }
|
|
662
|
+
]
|
|
661
663
|
}
|
|
662
664
|
```
|
|
663
665
|
|
|
664
|
-
###
|
|
665
|
-
|
|
666
|
-
| 参数
|
|
667
|
-
|
|
|
668
|
-
|
|
|
669
|
-
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
|
677
|
-
|
|
|
678
|
-
|
|
|
679
|
-
|
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
|
686
|
-
|
|
|
687
|
-
|
|
|
688
|
-
|
|
|
689
|
-
|
|
|
690
|
-
|
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
|
697
|
-
|
|
|
698
|
-
|
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
|
705
|
-
|
|
|
706
|
-
|
|
|
707
|
-
|
|
|
708
|
-
|
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
type: FormLineType.ViewDom,
|
|
842
|
-
label: '数量',
|
|
843
|
-
name: 'quantity'
|
|
844
|
-
}, {
|
|
845
|
-
type: FormLineType.ViewDom,
|
|
846
|
-
label: '隐藏数量',
|
|
847
|
-
hide: true,
|
|
848
|
-
name: 'hideQuantity'
|
|
849
|
-
}, {
|
|
850
|
-
type: FormLineType.ViewDom,
|
|
851
|
-
label: '隐藏的说明',
|
|
852
|
-
hide: true,
|
|
853
|
-
name: 'explain'
|
|
854
|
-
}, {
|
|
855
|
-
type: FormLineType.ViewDom,
|
|
856
|
-
label: '隐藏的颜色,用于表示',
|
|
857
|
-
hide: true,
|
|
858
|
-
name: 'inputColor'
|
|
859
|
-
}];
|
|
666
|
+
### SelectOptionTableColumn(表格型下拉列)
|
|
667
|
+
|
|
668
|
+
| 参数 | 类型 | 说明 |
|
|
669
|
+
| ---- | ---- | ---- |
|
|
670
|
+
| width | number | 列宽(px),参考 `ColWidth` |
|
|
671
|
+
| label | string | 表头文案 |
|
|
672
|
+
| name | string | selectList item 字段名 |
|
|
673
|
+
| render | (line) => string | 自定义渲染,优先级高于 name |
|
|
674
|
+
| icons | SelectOptionTableColumnIcon[] | 图标列(如推荐、协采标签) |
|
|
675
|
+
|
|
676
|
+
### SelectOptionTableColumnIcon(表格型下拉图标列)
|
|
677
|
+
|
|
678
|
+
| 参数 | 类型 | 说明 |
|
|
679
|
+
| ---- | ---- | ---- |
|
|
680
|
+
| iconName | string | `hd-select-close`(禁用)、`hd-select-purchase`(协)、`hd-recommend-star`、`hd-img-star` |
|
|
681
|
+
| fieldName | string | selectList item 中控制显示的布尔字段 |
|
|
682
|
+
|
|
683
|
+
### InputNumber(数字输入配置)
|
|
684
|
+
|
|
685
|
+
用于 `Filter.inputNumber`、`FormItem.inputNumber`、`FormLine.inputNumber`。
|
|
686
|
+
|
|
687
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
688
|
+
| ---- | ---- | ------ | ---- |
|
|
689
|
+
| min | number | 0 | 最小值 |
|
|
690
|
+
| max | number | 99999999 | 最大值 |
|
|
691
|
+
| step | number | 1 | 步进值 |
|
|
692
|
+
| precision | number | 4 | 小数精度 |
|
|
693
|
+
| nzFormatter | Function | — | 展示格式化 |
|
|
694
|
+
| nzParser | Function | — | 输入解析 |
|
|
695
|
+
|
|
696
|
+
### CascaderOption(级联选择配置)
|
|
697
|
+
|
|
698
|
+
| 参数 | 类型 | 说明 |
|
|
699
|
+
| ---- | ---- | ---- |
|
|
700
|
+
| options | any[] | 级联数据源(ng-zorro cascader 格式) |
|
|
701
|
+
|
|
702
|
+
### RadioOption(单选配置)
|
|
703
|
+
|
|
704
|
+
用于 `FormItem.radioOption`(`FormListType.Radio`)。
|
|
705
|
+
|
|
706
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
707
|
+
| ---- | ---- | ------ | ---- |
|
|
708
|
+
| label | string | — | optionList 中作为显示文案的字段名 |
|
|
709
|
+
| value | string | — | optionList 中作为绑定值的字段名 |
|
|
710
|
+
| optionList | any[] | — | 选项列表 |
|
|
711
|
+
| showLabelAndValue | boolean | false | 选项展示为 `[value]label` |
|
|
712
|
+
|
|
713
|
+
### CheckboxOption(复选框配置)
|
|
714
|
+
|
|
715
|
+
用于 `FormItem.checkboxOption`(`FormListType.Checkbox` 多选组)。未配置 `checkboxOption` 时渲染单个复选框,值为 `boolean`,默认 `false`;配置后为复选框组,值为选中项 `value` 组成的数组,默认 `[]`。
|
|
716
|
+
|
|
717
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
718
|
+
| ---- | ---- | ------ | ---- |
|
|
719
|
+
| label | string | — | optionList 中作为显示文案的字段名 |
|
|
720
|
+
| value | string | — | optionList 中作为绑定值的字段名 |
|
|
721
|
+
| optionList | any[] | — | 选项列表 |
|
|
722
|
+
| showLabelAndValue | boolean | false | 选项展示为 `[value]label` |
|
|
723
|
+
|
|
724
|
+
### HdOption(键值展示项)
|
|
725
|
+
|
|
726
|
+
用于 `hd-detail-form` 的 `formCols`。
|
|
727
|
+
|
|
728
|
+
| 参数 | 类型 | 说明 |
|
|
729
|
+
| ---- | ---- | ---- |
|
|
730
|
+
| label | string | 标签 |
|
|
731
|
+
| value | any | 值 |
|
|
732
|
+
| color | string | 文字颜色 |
|
|
733
|
+
| hide | boolean | 是否隐藏 |
|
|
734
|
+
| clickText | string | 可点击文案 |
|
|
735
|
+
| click | (value) => void | 点击回调 |
|
|
736
|
+
|
|
737
|
+
### Filter(筛选项)
|
|
738
|
+
|
|
739
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
740
|
+
| ---- | ---- | ------ | ---- |
|
|
741
|
+
| type | FilterListType | — | 控件类型 |
|
|
742
|
+
| label | string | — | 标签 |
|
|
743
|
+
| name | string | — | 字段名(提交给后端的 key) |
|
|
744
|
+
| value | any | null | 初始值 |
|
|
745
|
+
| placeholder | string | — | 占位符 |
|
|
746
|
+
| require | boolean | false | 是否必填 |
|
|
747
|
+
| show | boolean | — | 是否显示 |
|
|
748
|
+
| selectOption | SelectOption | — | Select / MultipleSelect 配置 |
|
|
749
|
+
| inputNumber | InputNumber | — | InputNumber 配置 |
|
|
750
|
+
| cascaderOption | CascaderOption | — | Cascader 配置 |
|
|
751
|
+
| showTime | boolean | false | Date 是否含时间 |
|
|
752
|
+
| hdDisabledDate | Function | — | 不可选日期 `(date) => boolean` |
|
|
753
|
+
| onChangeEvent | Function | — | 值变化 |
|
|
754
|
+
| onSearchEvent | Function | — | 下拉搜索 |
|
|
755
|
+
| onBlurEvent | Function | — | 失焦 |
|
|
756
|
+
| onChangeEventDebounceTime | number | — | change 防抖(ms) |
|
|
757
|
+
| onSearchEventEventDebounceTime | number | — | search 防抖(ms) |
|
|
758
|
+
|
|
759
|
+
#### FilterListType 枚举
|
|
760
|
+
|
|
761
|
+
`Input` \| `Select` \| `MultipleSelect` \| `Date` \| `DateRange` \| `Cascader` \| `Month` \| `InputNumber`
|
|
762
|
+
|
|
763
|
+
### FormItem(表单项)
|
|
764
|
+
|
|
765
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
766
|
+
| ---- | ---- | ------ | ---- |
|
|
767
|
+
| type | FormListType | — | 控件类型 |
|
|
768
|
+
| label / name | string | — | 标签 / 字段名 |
|
|
769
|
+
| require | boolean | false | 是否必填 |
|
|
770
|
+
| width | number | 1 | 占据列数(总宽 4 列) |
|
|
771
|
+
| hide | boolean | false | 隐藏字段 |
|
|
772
|
+
| value | any | null | 初始值 |
|
|
773
|
+
| placeholder | string | — | 占位符 |
|
|
774
|
+
| disabled | boolean | — | 是否禁用 |
|
|
775
|
+
| color / labelColor | string | — | 控件 / 标签颜色 |
|
|
776
|
+
| maxLength | number | — | Input 最大长度 |
|
|
777
|
+
| prefix | string | — | Input 前缀文字(`nzPrefix`) |
|
|
778
|
+
| prefixIcon | string | — | Input 前缀图标(`nz-icon` 的 `nzType`) |
|
|
779
|
+
| textAreaRows | number | — | TextArea 行数 |
|
|
780
|
+
| explain | string | — | label 下方说明 |
|
|
781
|
+
| showTime | boolean | false | Date 含时间 |
|
|
782
|
+
| format | string | — | 时间格式化 |
|
|
783
|
+
| selectOption | SelectOption | — | 下拉配置 |
|
|
784
|
+
| radioOption | RadioOption | — | 单选配置 |
|
|
785
|
+
| checkboxOption | CheckboxOption | — | 复选框组配置;不传则为单个复选框 |
|
|
786
|
+
| inputNumber | InputNumber | — | 数字框配置 |
|
|
787
|
+
| cascaderOption | CascaderOption | — | 级联配置 |
|
|
788
|
+
| defaultLabel | string \| string[] | — | Select 默认展示文案 |
|
|
789
|
+
| hdDisabledDate | Function | — | 不可选日期 |
|
|
790
|
+
| validatorKeys | ValidatorKey[] | — | 校验键 |
|
|
791
|
+
| validator | ValidatorFn | — | 自定义校验 |
|
|
792
|
+
| onChangeEvent / onSearchEvent | Function | — | 值变化 / 下拉搜索 |
|
|
793
|
+
| onChangeEventDebounceTime | number | — | change 防抖(ms) |
|
|
794
|
+
| onSearchEventEventDebounceTime | number | — | search 防抖(ms) |
|
|
795
|
+
|
|
796
|
+
#### FormListType 枚举
|
|
797
|
+
|
|
798
|
+
`Input` \| `Select` \| `MultipleSelect` \| `Date` \| `DateRange` \| `TextArea` \| `InputNumber` \| `ViewDom` \| `Switch` \| `Time` \| `Cascader` \| `Radio` \| `Checkbox`
|
|
799
|
+
|
|
800
|
+
#### ValidatorKey
|
|
801
|
+
|
|
802
|
+
| 参数 | 类型 | 说明 |
|
|
803
|
+
| ---- | ---- | ---- |
|
|
804
|
+
| key | string | 校验规则 key |
|
|
805
|
+
| label | string | 校验失败提示 |
|
|
806
|
+
|
|
807
|
+
### FormLine(明细表单项)
|
|
808
|
+
|
|
809
|
+
在 FormItem 基础上用于行内编辑,额外字段:
|
|
810
|
+
|
|
811
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
812
|
+
| ---- | ---- | ------ | ---- |
|
|
813
|
+
| type | FormLineType | — | 控件类型 |
|
|
814
|
+
| align | string | — | 列对齐 |
|
|
815
|
+
| hideViewDomValue | boolean | false | ViewDom 隐藏 value |
|
|
816
|
+
| isSelect | boolean | — | 聚焦后全选内容 |
|
|
817
|
+
| preserveNumber | number | — | ViewDom 小数位 |
|
|
818
|
+
| disabled | boolean | — | 是否禁用 |
|
|
819
|
+
| style | object | — | 列样式 |
|
|
820
|
+
| canSearch | boolean | false | hide 字段参与搜索 |
|
|
821
|
+
| explainOption / explainOptionRight | ExplainOption | — | 说明文字 |
|
|
822
|
+
| colorOption | ColorOption | — | 动态颜色 |
|
|
823
|
+
| selectOption | SelectOption | — | 含 tableColumns 表格下拉 |
|
|
824
|
+
| onChangeEventDebounceTime | number | — | change 防抖(ms) |
|
|
825
|
+
|
|
826
|
+
#### FormLineType 枚举
|
|
827
|
+
|
|
828
|
+
`Input` \| `Select` \| `Date` \| `DateRange` \| `TextArea` \| `InputNumber` \| `MultipleSelect` \| `ViewDom` \| `Switch` \| `Time`
|
|
829
|
+
|
|
830
|
+
#### ColorOption / ExplainOption
|
|
831
|
+
|
|
832
|
+
| ColorOption | ExplainOption |
|
|
833
|
+
| ----------- | ------------- |
|
|
834
|
+
| name:hide 字段名存颜色 | show:是否显示 |
|
|
835
|
+
| color:默认颜色 | name:hide 字段名存文案 |
|
|
836
|
+
| | color:文字颜色 |
|
|
837
|
+
|
|
838
|
+
#### FormLine 事件签名
|
|
839
|
+
|
|
840
|
+
```typescript
|
|
841
|
+
onChangeEvent: (value, line: FormGroup) => void
|
|
842
|
+
onSearchEvent: (keyword, line?: FormGroup) => void
|
|
860
843
|
```
|
|
861
844
|
|
|
862
|
-
###
|
|
863
|
-
|
|
864
|
-
| 参数
|
|
865
|
-
|
|
|
866
|
-
|
|
|
867
|
-
|
|
|
868
|
-
|
|
|
869
|
-
|
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
|
874
|
-
|
|
|
875
|
-
|
|
|
876
|
-
|
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
|
881
|
-
|
|
|
882
|
-
|
|
|
883
|
-
|
|
|
884
|
-
|
|
|
885
|
-
|
|
|
886
|
-
|
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
|
891
|
-
|
|
|
892
|
-
|
|
|
893
|
-
|
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
|
905
|
-
|
|
|
906
|
-
|
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
|
913
|
-
|
|
|
914
|
-
|
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
<hd-space background="#fff" type="row" size="12"></hd-space>
|
|
845
|
+
### HdTableColumn(表格列)
|
|
846
|
+
|
|
847
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
848
|
+
| ---- | ---- | ------ | ---- |
|
|
849
|
+
| title / name | string | — | 列标题 / 字段名 |
|
|
850
|
+
| width / minWidth | number | — | 列宽 / 最小列宽 |
|
|
851
|
+
| align | string | left | 对齐方式 |
|
|
852
|
+
| color | string | — | 文字颜色 |
|
|
853
|
+
| fixed / fixedWidth | — | — | 固定列 |
|
|
854
|
+
| isShow | boolean | true | 设置列可见性 |
|
|
855
|
+
| canSort / canWarp | boolean | false | 排序 / 换行 |
|
|
856
|
+
| isState | boolean | false | 是否按状态列渲染,取值字段为 `name` |
|
|
857
|
+
| stateField | string | — | 状态列取值字段(`name` 为 `state` 且未设置 `isState` 时生效,默认 `state`) |
|
|
858
|
+
| render / click | Function | — | 渲染 / 点击 |
|
|
859
|
+
| btnList | OperateBtn[] | — | 操作按钮 |
|
|
860
|
+
|
|
861
|
+
#### OperateBtn(操作列按钮)
|
|
862
|
+
|
|
863
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
864
|
+
| ---- | ---- | ------ | ---- |
|
|
865
|
+
| name | string | — | 按钮文案 |
|
|
866
|
+
| showConfirm | boolean \| (line) => boolean | false | 是否 popconfirm 确认;传函数时按行数据判断 |
|
|
867
|
+
| isRepeat | boolean | false | 与其他按钮互斥显示 |
|
|
868
|
+
| click | (line) => void | — | 点击回调 |
|
|
869
|
+
| permission | (line) => boolean | — | 是否显示 |
|
|
870
|
+
|
|
871
|
+
#### HdTableTotalOption(hd-table 底部合计)
|
|
872
|
+
|
|
873
|
+
| 参数 | 类型 | 说明 |
|
|
874
|
+
| ---- | ---- | ---- |
|
|
875
|
+
| columnNumber | number | 总列数 |
|
|
876
|
+
| insertIndex | number | 插入列下标 |
|
|
877
|
+
| insertName | string | 合计字段名 |
|
|
878
|
+
|
|
879
|
+
#### TotalOption(明细合计行)
|
|
880
|
+
|
|
881
|
+
用于 `hd-detail-lines`、`hd-detail-lines-page`、`hd-form-lines`。
|
|
882
|
+
|
|
883
|
+
| 参数 | 类型 | 说明 |
|
|
884
|
+
| ---- | ---- | ---- |
|
|
885
|
+
| insertIndex | number | 插入列下标(从 1 开始) |
|
|
886
|
+
| insertValue | any | 合计值 |
|
|
887
|
+
| align | string | 对齐方式 |
|
|
888
|
+
| showDecimal | boolean | 始终显示小数 |
|
|
889
|
+
| isHide | boolean | 隐藏该合计列 |
|
|
890
|
+
|
|
891
|
+
#### TableTotalOption(hd-current-table 合计,已弃用)
|
|
892
|
+
|
|
893
|
+
| 参数 | 类型 | 说明 |
|
|
894
|
+
| ---- | ---- | ---- |
|
|
895
|
+
| columnNumber | number | 总列数 |
|
|
896
|
+
| insertIndex | number | 插入列下标 |
|
|
897
|
+
| insertName | string | 合计字段名 |
|
|
898
|
+
|
|
899
|
+
---
|
|
900
|
+
|
|
901
|
+
## 附录:ColWidth 列宽常量
|
|
902
|
+
|
|
903
|
+
```typescript
|
|
904
|
+
import { ColWidth } from 'fantasy-ngzorro';
|
|
905
|
+
|
|
906
|
+
ColWidth.tableImageColWidth // 25 表格单图标
|
|
907
|
+
ColWidth.tableTwoImageColWidth // 40 表格双图标(Select 表格下拉)
|
|
908
|
+
ColWidth.billNumberColWidth // 150 单号
|
|
909
|
+
ColWidth.nameColWidth // 150 名称
|
|
910
|
+
ColWidth.codeColWidth // 100 代码
|
|
911
|
+
ColWidth.codeNameColWidth // 200 [code]name
|
|
912
|
+
ColWidth.enumColWidth // 100 枚举
|
|
913
|
+
ColWidth.dateColWidth // 100 日期
|
|
914
|
+
ColWidth.dateTimeColWidth // 150 日期时间
|
|
915
|
+
ColWidth.dateRangeWidth // 200 日期范围
|
|
916
|
+
ColWidth.operateColWidth // 150 操作列
|
|
917
|
+
ColWidth.numberColWidth // 100 数字
|
|
918
|
+
ColWidth.remarkColWidth // 250 备注
|
|
919
|
+
ColWidth.fixColWidth // 150 通用固定宽
|
|
920
|
+
ColWidth.maxColWidth // 350 超长省略展开
|
|
939
921
|
```
|
|
940
922
|
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-

|
|
954
|
-
|
|
955
|
-
### 示例
|
|
956
|
-
|
|
957
|
-
```html
|
|
958
|
-
<hd-tip title="基本信息" [fontSize]="14"></hd-tip>
|
|
959
|
-
<hd-tip title="新增" [showIcon]="false" [fontSize]="16"></hd-tip>
|
|
923
|
+
## 附录:Page 分页结构
|
|
924
|
+
|
|
925
|
+
```typescript
|
|
926
|
+
class Page<T> {
|
|
927
|
+
totalPages: number;
|
|
928
|
+
totalElements: number;
|
|
929
|
+
pageNumber: number; // 从 0 开始
|
|
930
|
+
pageSize: number;
|
|
931
|
+
hasContent: boolean;
|
|
932
|
+
hasNext: boolean;
|
|
933
|
+
content: T[];
|
|
934
|
+
}
|
|
960
935
|
```
|
|
961
|
-
|
|
962
|
-
### 说明
|
|
963
|
-
|
|
964
|
-
| 参数 | 类型 | 默认值 | 说明 |
|
|
965
|
-
| -------- | ------ | ------ | ---------------------- |
|
|
966
|
-
| showIcon | boolen | true | 是否显示前面的竖线icon |
|
|
967
|
-
| fontSize | number | | 字体大小 |
|
|
968
|
-
| title | string | False | 标题文案 |
|
|
969
|
-
|
|
970
|
-
## TODO
|
|
971
|
-
|
|
972
|
-
- [x] 文档示例
|
|
973
|
-
- [x] 更新记录
|
|
974
|
-
- [x]
|