@agile-team/wl-skills-kit 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -63
- package/README.md +15 -148
- package/bin/wl-skills.js +2 -100
- package/files/.github/guides/README.md +13 -13
- package/files/.github/guides/architecture.md +555 -576
- package/files/.github/guides/usage.md +176 -176
- package/files/.github/reports/README.md +65 -65
- package/files/.github/reports/SYS_DICT_INFO.md +50 -50
- package/files/.github/reports/SYS_MENU_INFO.md +247 -247
- package/files/.github/reports/SYS_PERMISSION_INFO.md +20 -20
- package/files/.github/reports//347/273/204/344/273/266/346/217/220/345/217/226/345/273/272/350/256/256.md +33 -33
- package/files/.github/reports//350/247/204/350/214/203/345/256/241/346/237/245/346/212/245/345/221/212.md +44 -44
- package/files/.github/skills/_compat/README.md +108 -108
- package/files/.github/skills/_compat/headers/agents.txt +8 -8
- package/files/.github/skills/_compat/headers/claude-code.txt +7 -7
- package/files/.github/skills/_compat/headers/cline.txt +7 -7
- package/files/.github/skills/_compat/headers/cursor-mdc.txt +16 -16
- package/files/.github/skills/_compat/headers/cursor-rules.txt +7 -7
- package/files/.github/skills/_compat/headers/github-copilot.txt +1 -1
- package/files/.github/skills/_compat/headers/kiro.txt +10 -10
- package/files/.github/skills/_compat/headers/trae.txt +11 -11
- package/files/.github/skills/_compat/headers/windsurf.txt +7 -7
- package/files/.github/skills/_registry.md +81 -81
- package/files/.github/skills/core/api-contract/SKILL.md +344 -344
- package/files/.github/skills/core/api-contract/USAGE.md +110 -110
- package/files/.github/skills/core/convention-audit/SKILL.md +189 -189
- package/files/.github/skills/core/convention-audit/USAGE.md +99 -99
- package/files/.github/skills/core/page-codegen/SKILL.md +973 -973
- package/files/.github/skills/core/page-codegen/USAGE.md +102 -102
- package/files/.github/skills/core/page-codegen/templates/_index.md +46 -46
- package/files/.github/skills/core/page-codegen/templates/domains/_CONTRIBUTING.md +107 -107
- package/files/.github/skills/core/page-codegen/templates/domains/produce/TPL-OPERATION-STATION.md +442 -442
- package/files/.github/skills/core/page-codegen/templates/domains/sale/README.md +26 -26
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-CHANGE-HISTORY.md +276 -276
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-DETAIL-TABS.md +1145 -1145
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-DRIVEN.md +124 -124
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-FORM-ROUTE.md +436 -436
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-LIST.md +191 -191
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-MASTER-DETAIL.md +148 -148
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-RECORD-FORM.md +376 -376
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-TREE-LIST.md +186 -186
- package/files/.github/skills/core/prototype-scan/SKILL.md +498 -498
- package/files/.github/skills/core/prototype-scan/USAGE.md +95 -95
- package/files/.github/skills/core/template-extract/SKILL.md +139 -139
- package/files/.github/skills/core/template-extract/USAGE.md +93 -93
- package/files/.github/skills/domain/README.md +51 -51
- package/files/.github/skills/sync/menu-sync/SKILL.md +263 -263
- package/files/.github/skills/sync/menu-sync/USAGE.md +104 -104
- package/files/.github/skills/sync/menu-sync/env/env.local.json +7 -7
- package/files/.github/skills/sync/menu-sync/env/guide.md +99 -99
- package/files/.github/skills/sync/permission-sync/SKILL.draft.md +91 -91
- package/files/.github/standards/01-toolchain.md +57 -57
- package/files/.github/standards/02-code-structure.md +111 -111
- package/files/.github/standards/03-comments.md +53 -53
- package/files/.github/standards/04-coding-basics.md +33 -33
- package/files/.github/standards/05-logging.md +38 -38
- package/files/.github/standards/06-security.md +44 -44
- package/files/.github/standards/07-config.md +52 -52
- package/files/.github/standards/08-git.md +60 -60
- package/files/.github/standards/09-typescript.md +71 -71
- package/files/.github/standards/10-pinia.md +57 -57
- package/files/.github/standards/11-form-validation.md +81 -81
- package/files/.github/standards/12-base-table.md +153 -153
- package/files/.github/standards/13-platform-components.md +123 -123
- package/files/.github/standards/index.md +89 -89
- package/files/demo/produce/aiflow/mmwr-customer-apply-add/api.md +1 -1
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/data.ts +196 -196
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.scss +150 -150
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.vue +79 -79
- package/files/docs/jh-date-range.md +257 -257
- package/files/docs/jh-date.md +222 -222
- package/files/docs/jh-dept-picker.md +190 -190
- package/files/docs/jh-drag-row.md +590 -590
- package/files/docs/jh-file-upload.md +216 -216
- package/files/docs/jh-picker.md +218 -218
- package/files/docs/jh-select.md +148 -148
- package/files/docs/jh-text.md +248 -248
- package/files/docs/jh-user-picker.md +197 -197
- package/files/docs/request.md +24 -9
- package/files/src/components/global/C_RightToolbar/data.ts +228 -0
- package/files/src/components/global/C_RightToolbar/index.scss +44 -0
- package/files/src/components/global/C_RightToolbar/index.vue +34 -336
- package/files/src/components/global/C_Splitter/index.scss +61 -0
- package/files/src/components/global/C_Splitter/index.vue +2 -64
- package/files/src/components/global/C_SvgIcon/index.scss +15 -0
- package/files/src/components/global/C_SvgIcon/index.vue +20 -50
- package/files/src/components/global/C_TagStatus/index.scss +20 -0
- package/files/src/components/global/C_TagStatus/index.vue +1 -22
- package/files/src/components/global/C_Tree/data.ts +61 -0
- package/files/src/components/global/C_Tree/index.vue +12 -53
- package/files/src/components/local/c_listModal/index.scss +4 -0
- package/files/src/components/local/c_listModal/index.vue +1 -1
- package/package.json +5 -9
package/files/docs/jh-text.md
CHANGED
|
@@ -1,248 +1,248 @@
|
|
|
1
|
-
# jh-text - 文本展示组件
|
|
2
|
-
|
|
3
|
-
> 统一的文本展示组件,内置平台字典、用户、部门的自动翻译能力,用于列表、详情等只读场景
|
|
4
|
-
|
|
5
|
-
## 📦 组件位置
|
|
6
|
-
|
|
7
|
-
```ts
|
|
8
|
-
import "@jhlc/common-core";
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
组件已全局注册,可直接在模板中使用 `<jh-text />`。
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## 基本用法
|
|
16
|
-
|
|
17
|
-
### 1️⃣ 字典文本展示(最常用)
|
|
18
|
-
|
|
19
|
-
```vue
|
|
20
|
-
<template>
|
|
21
|
-
<jh-text dict="order_status" :value="row.status" />
|
|
22
|
-
</template>
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
> 根据字典 code + value 自动翻译显示文本
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
### 2️⃣ 用户名称展示
|
|
30
|
-
|
|
31
|
-
```vue
|
|
32
|
-
<jh-text type="user" :value="row.createUserId" />
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
### 3️⃣ 部门名称展示
|
|
38
|
-
|
|
39
|
-
```vue
|
|
40
|
-
<jh-text type="dept" :value="row.deptId" />
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
### 4️⃣ 普通文本展示
|
|
46
|
-
|
|
47
|
-
```vue
|
|
48
|
-
<jh-text :value="row.remark" />
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## Props 属性
|
|
54
|
-
|
|
55
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
|
56
|
-
| --- | --- | --- | --- |
|
|
57
|
-
| content | 需要展示的值(优先级高于 value) | `string \| number \| Date \| Array` | `""` |
|
|
58
|
-
| value | 需要展示的值(与Content二选一) | `string \| number \| string[]` | - |
|
|
59
|
-
| dict | 字典名称(平台字典 code) | `string` | - |
|
|
60
|
-
| type | 文本类型 | `"text" \| "dict" \| "user" \| "dept"` | `"text"` |
|
|
61
|
-
| logicType | 逻辑类型(用于自动识别) | `BusLogicDataType` | - |
|
|
62
|
-
| logicValue | 逻辑值(字典code/用户/部门) | `string` | - |
|
|
63
|
-
| separator | 多值分隔符 | `string` | `"、"` |
|
|
64
|
-
| emptyText | 空值显示文本 | `string` | `"-"` |
|
|
65
|
-
| format | 文本格式 | `"default" \| "ellipsis" \| "html"` | `"default"` |
|
|
66
|
-
| rows | 多行显示时的行数 | `number` | `1` |
|
|
67
|
-
| fontSize | 字体大小 | `"extra-small" \| "small" \| "base" \| "medium" \| "large" \| "extra-large"` | - |
|
|
68
|
-
| fontWeight | 字体粗细 | `"light" \| "regular" \| "medium" \| "semi"` | - |
|
|
69
|
-
|
|
70
|
-
> **提示**:
|
|
71
|
-
> - `dict` 传入时,会自动设置 `type="dict"`
|
|
72
|
-
> - 同时使用 `logicType` 和 `logicValue` 可以实现自动翻译
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## 支持类型说明
|
|
77
|
-
|
|
78
|
-
| type 值 | 说明 |
|
|
79
|
-
| --- | --- |
|
|
80
|
-
| text | 普通文本(默认) |
|
|
81
|
-
| dict | 字典翻译 |
|
|
82
|
-
| user | 用户名称 |
|
|
83
|
-
| dept | 部门名称 |
|
|
84
|
-
|
|
85
|
-
> 当传入 `dict` 时,`type` 可省略
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## 常见场景
|
|
90
|
-
|
|
91
|
-
### 场景 1:表格字典列展示(推荐)
|
|
92
|
-
|
|
93
|
-
```vue
|
|
94
|
-
<el-table-column label="订单状态">
|
|
95
|
-
<template #default="{ row }">
|
|
96
|
-
<jh-text dict="order_status" :value="row.status" />
|
|
97
|
-
</template>
|
|
98
|
-
</el-table-column>
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
✅ **统一字典展示**
|
|
102
|
-
✅ **避免每个页面手动转换**
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
### 场景 2:用户/部门字段展示
|
|
107
|
-
|
|
108
|
-
```vue
|
|
109
|
-
<jh-text type="user" :value="row.createUserId" />
|
|
110
|
-
<jh-text type="dept" :value="row.deptId" />
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
### 场景 3:详情页只读展示
|
|
116
|
-
|
|
117
|
-
```vue
|
|
118
|
-
<el-descriptions-item label="订单状态">
|
|
119
|
-
<jh-text dict="order_status" :value="detail.status" />
|
|
120
|
-
</el-descriptions-item>
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
---
|
|
124
|
-
|
|
125
|
-
### 场景 4:多值展示
|
|
126
|
-
|
|
127
|
-
```vue
|
|
128
|
-
<jh-text
|
|
129
|
-
dict="order_tag"
|
|
130
|
-
:value="row.tags"
|
|
131
|
-
separator=" / "
|
|
132
|
-
/>
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### 场景 5:BaseDetail 配置式用法
|
|
136
|
-
|
|
137
|
-
```ts
|
|
138
|
-
// data.ts 详情项配置
|
|
139
|
-
export const detailItemsConfig: BaseFormDetailDesc[] = [
|
|
140
|
-
{
|
|
141
|
-
name: "status",
|
|
142
|
-
label: "状态",
|
|
143
|
-
logicType: BusLogicDataType.dict,
|
|
144
|
-
logicValue: "order_status"
|
|
145
|
-
// 会自动渲染为 jh-text 并翻译字典
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
name: "createUserId",
|
|
149
|
-
label: "创建人",
|
|
150
|
-
logicType: BusLogicDataType.user,
|
|
151
|
-
logicValue: "userId"
|
|
152
|
-
// 会自动翻译用户名
|
|
153
|
-
}
|
|
154
|
-
];
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
---
|
|
158
|
-
|
|
159
|
-
## 与手动处理对比
|
|
160
|
-
|
|
161
|
-
### 使用 jh-text(推荐)
|
|
162
|
-
|
|
163
|
-
```vue
|
|
164
|
-
<jh-text dict="order_status" :value="row.status" />
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
### 手动处理(不推荐)
|
|
168
|
-
|
|
169
|
-
```vue
|
|
170
|
-
{{ getDictLabel("order_status", row.status) }}
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
❌ 依赖工具函数
|
|
174
|
-
❌ 每个页面重复实现
|
|
175
|
-
❌ 不利于统一规范
|
|
176
|
-
|
|
177
|
-
---
|
|
178
|
-
|
|
179
|
-
## 最佳实践
|
|
180
|
-
|
|
181
|
-
### 1️⃣ 列表展示统一使用 jh-text
|
|
182
|
-
|
|
183
|
-
- 字典值
|
|
184
|
-
- 用户 / 部门 ID
|
|
185
|
-
- 多选值
|
|
186
|
-
|
|
187
|
-
```vue
|
|
188
|
-
<jh-text ... />
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
---
|
|
192
|
-
|
|
193
|
-
### 2️⃣ 表单编辑 + 展示组件配套使用
|
|
194
|
-
|
|
195
|
-
| 场景 | 编辑 | 展示 |
|
|
196
|
-
| --- | --- | --- |
|
|
197
|
-
| 字典 | jh-select | jh-text |
|
|
198
|
-
| 用户 | jh-user-picker | jh-text |
|
|
199
|
-
| 部门 | jh-dept-picker | jh-text |
|
|
200
|
-
|
|
201
|
-
---
|
|
202
|
-
|
|
203
|
-
### 3️⃣ 空值兜底处理
|
|
204
|
-
|
|
205
|
-
```vue
|
|
206
|
-
<jh-text :value="row.remark" empty-text="暂无" />
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
---
|
|
210
|
-
|
|
211
|
-
## 注意事项
|
|
212
|
-
|
|
213
|
-
1. **仅用于展示**
|
|
214
|
-
- 不支持编辑
|
|
215
|
-
- 不触发任何 change 事件
|
|
216
|
-
|
|
217
|
-
2. **字典值必须合法**
|
|
218
|
-
- value 必须存在于字典中
|
|
219
|
-
- 否则显示 `emptyText`
|
|
220
|
-
|
|
221
|
-
3. **多值类型**
|
|
222
|
-
- value 为数组或逗号分隔字符串均可
|
|
223
|
-
|
|
224
|
-
---
|
|
225
|
-
|
|
226
|
-
## 🎯 真实项目示例
|
|
227
|
-
|
|
228
|
-
### 示例 1:列表页
|
|
229
|
-
|
|
230
|
-
```vue
|
|
231
|
-
<jh-text dict="order_status" :value="row.status" />
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
### 示例 2:详情页
|
|
235
|
-
|
|
236
|
-
```vue
|
|
237
|
-
<jh-text type="user" :value="detail.createUserId" />
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
## 🚀 快速开始
|
|
243
|
-
|
|
244
|
-
- **字典展示**:直接传 `dict`
|
|
245
|
-
- **用户/部门**:使用 `type`
|
|
246
|
-
- **空值兜底**:配置 `emptyText`
|
|
247
|
-
|
|
248
|
-
**推荐作为平台统一的文本展示组件使用!**
|
|
1
|
+
# jh-text - 文本展示组件
|
|
2
|
+
|
|
3
|
+
> 统一的文本展示组件,内置平台字典、用户、部门的自动翻译能力,用于列表、详情等只读场景
|
|
4
|
+
|
|
5
|
+
## 📦 组件位置
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import "@jhlc/common-core";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
组件已全局注册,可直接在模板中使用 `<jh-text />`。
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 基本用法
|
|
16
|
+
|
|
17
|
+
### 1️⃣ 字典文本展示(最常用)
|
|
18
|
+
|
|
19
|
+
```vue
|
|
20
|
+
<template>
|
|
21
|
+
<jh-text dict="order_status" :value="row.status" />
|
|
22
|
+
</template>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
> 根据字典 code + value 自动翻译显示文本
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
### 2️⃣ 用户名称展示
|
|
30
|
+
|
|
31
|
+
```vue
|
|
32
|
+
<jh-text type="user" :value="row.createUserId" />
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
### 3️⃣ 部门名称展示
|
|
38
|
+
|
|
39
|
+
```vue
|
|
40
|
+
<jh-text type="dept" :value="row.deptId" />
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
### 4️⃣ 普通文本展示
|
|
46
|
+
|
|
47
|
+
```vue
|
|
48
|
+
<jh-text :value="row.remark" />
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Props 属性
|
|
54
|
+
|
|
55
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
56
|
+
| --- | --- | --- | --- |
|
|
57
|
+
| content | 需要展示的值(优先级高于 value) | `string \| number \| Date \| Array` | `""` |
|
|
58
|
+
| value | 需要展示的值(与Content二选一) | `string \| number \| string[]` | - |
|
|
59
|
+
| dict | 字典名称(平台字典 code) | `string` | - |
|
|
60
|
+
| type | 文本类型 | `"text" \| "dict" \| "user" \| "dept"` | `"text"` |
|
|
61
|
+
| logicType | 逻辑类型(用于自动识别) | `BusLogicDataType` | - |
|
|
62
|
+
| logicValue | 逻辑值(字典code/用户/部门) | `string` | - |
|
|
63
|
+
| separator | 多值分隔符 | `string` | `"、"` |
|
|
64
|
+
| emptyText | 空值显示文本 | `string` | `"-"` |
|
|
65
|
+
| format | 文本格式 | `"default" \| "ellipsis" \| "html"` | `"default"` |
|
|
66
|
+
| rows | 多行显示时的行数 | `number` | `1` |
|
|
67
|
+
| fontSize | 字体大小 | `"extra-small" \| "small" \| "base" \| "medium" \| "large" \| "extra-large"` | - |
|
|
68
|
+
| fontWeight | 字体粗细 | `"light" \| "regular" \| "medium" \| "semi"` | - |
|
|
69
|
+
|
|
70
|
+
> **提示**:
|
|
71
|
+
> - `dict` 传入时,会自动设置 `type="dict"`
|
|
72
|
+
> - 同时使用 `logicType` 和 `logicValue` 可以实现自动翻译
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 支持类型说明
|
|
77
|
+
|
|
78
|
+
| type 值 | 说明 |
|
|
79
|
+
| --- | --- |
|
|
80
|
+
| text | 普通文本(默认) |
|
|
81
|
+
| dict | 字典翻译 |
|
|
82
|
+
| user | 用户名称 |
|
|
83
|
+
| dept | 部门名称 |
|
|
84
|
+
|
|
85
|
+
> 当传入 `dict` 时,`type` 可省略
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 常见场景
|
|
90
|
+
|
|
91
|
+
### 场景 1:表格字典列展示(推荐)
|
|
92
|
+
|
|
93
|
+
```vue
|
|
94
|
+
<el-table-column label="订单状态">
|
|
95
|
+
<template #default="{ row }">
|
|
96
|
+
<jh-text dict="order_status" :value="row.status" />
|
|
97
|
+
</template>
|
|
98
|
+
</el-table-column>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
✅ **统一字典展示**
|
|
102
|
+
✅ **避免每个页面手动转换**
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
### 场景 2:用户/部门字段展示
|
|
107
|
+
|
|
108
|
+
```vue
|
|
109
|
+
<jh-text type="user" :value="row.createUserId" />
|
|
110
|
+
<jh-text type="dept" :value="row.deptId" />
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### 场景 3:详情页只读展示
|
|
116
|
+
|
|
117
|
+
```vue
|
|
118
|
+
<el-descriptions-item label="订单状态">
|
|
119
|
+
<jh-text dict="order_status" :value="detail.status" />
|
|
120
|
+
</el-descriptions-item>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
### 场景 4:多值展示
|
|
126
|
+
|
|
127
|
+
```vue
|
|
128
|
+
<jh-text
|
|
129
|
+
dict="order_tag"
|
|
130
|
+
:value="row.tags"
|
|
131
|
+
separator=" / "
|
|
132
|
+
/>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 场景 5:BaseDetail 配置式用法
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
// data.ts 详情项配置
|
|
139
|
+
export const detailItemsConfig: BaseFormDetailDesc[] = [
|
|
140
|
+
{
|
|
141
|
+
name: "status",
|
|
142
|
+
label: "状态",
|
|
143
|
+
logicType: BusLogicDataType.dict,
|
|
144
|
+
logicValue: "order_status"
|
|
145
|
+
// 会自动渲染为 jh-text 并翻译字典
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "createUserId",
|
|
149
|
+
label: "创建人",
|
|
150
|
+
logicType: BusLogicDataType.user,
|
|
151
|
+
logicValue: "userId"
|
|
152
|
+
// 会自动翻译用户名
|
|
153
|
+
}
|
|
154
|
+
];
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## 与手动处理对比
|
|
160
|
+
|
|
161
|
+
### 使用 jh-text(推荐)
|
|
162
|
+
|
|
163
|
+
```vue
|
|
164
|
+
<jh-text dict="order_status" :value="row.status" />
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### 手动处理(不推荐)
|
|
168
|
+
|
|
169
|
+
```vue
|
|
170
|
+
{{ getDictLabel("order_status", row.status) }}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
❌ 依赖工具函数
|
|
174
|
+
❌ 每个页面重复实现
|
|
175
|
+
❌ 不利于统一规范
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## 最佳实践
|
|
180
|
+
|
|
181
|
+
### 1️⃣ 列表展示统一使用 jh-text
|
|
182
|
+
|
|
183
|
+
- 字典值
|
|
184
|
+
- 用户 / 部门 ID
|
|
185
|
+
- 多选值
|
|
186
|
+
|
|
187
|
+
```vue
|
|
188
|
+
<jh-text ... />
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
### 2️⃣ 表单编辑 + 展示组件配套使用
|
|
194
|
+
|
|
195
|
+
| 场景 | 编辑 | 展示 |
|
|
196
|
+
| --- | --- | --- |
|
|
197
|
+
| 字典 | jh-select | jh-text |
|
|
198
|
+
| 用户 | jh-user-picker | jh-text |
|
|
199
|
+
| 部门 | jh-dept-picker | jh-text |
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
### 3️⃣ 空值兜底处理
|
|
204
|
+
|
|
205
|
+
```vue
|
|
206
|
+
<jh-text :value="row.remark" empty-text="暂无" />
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## 注意事项
|
|
212
|
+
|
|
213
|
+
1. **仅用于展示**
|
|
214
|
+
- 不支持编辑
|
|
215
|
+
- 不触发任何 change 事件
|
|
216
|
+
|
|
217
|
+
2. **字典值必须合法**
|
|
218
|
+
- value 必须存在于字典中
|
|
219
|
+
- 否则显示 `emptyText`
|
|
220
|
+
|
|
221
|
+
3. **多值类型**
|
|
222
|
+
- value 为数组或逗号分隔字符串均可
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## 🎯 真实项目示例
|
|
227
|
+
|
|
228
|
+
### 示例 1:列表页
|
|
229
|
+
|
|
230
|
+
```vue
|
|
231
|
+
<jh-text dict="order_status" :value="row.status" />
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### 示例 2:详情页
|
|
235
|
+
|
|
236
|
+
```vue
|
|
237
|
+
<jh-text type="user" :value="detail.createUserId" />
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## 🚀 快速开始
|
|
243
|
+
|
|
244
|
+
- **字典展示**:直接传 `dict`
|
|
245
|
+
- **用户/部门**:使用 `type`
|
|
246
|
+
- **空值兜底**:配置 `emptyText`
|
|
247
|
+
|
|
248
|
+
**推荐作为平台统一的文本展示组件使用!**
|