@agile-team/wl-skills-kit 2.11.1 → 2.11.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.
Files changed (85) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +1 -1
  3. package/bin/wl-skills.js +27 -3
  4. package/files/.wl-skills/docs/jh-pagination.md +505 -505
  5. package/files/.wl-skills/docs/request.md +940 -940
  6. package/files/.wl-skills/guides/architecture.md +1 -1
  7. package/files/.wl-skills/skills/core/convention-audit/SKILL.md +3 -3
  8. package/files/.wl-skills/skills/core/spec-doc-parse/SKILL.md +332 -332
  9. package/files/.wl-skills/skills/core/spec-doc-parse/USAGE.md +97 -97
  10. package/files/.wl-skills/skills/sync/permission-sync/USAGE.md +107 -107
  11. package/files/.wl-skills/src/components/global/C_ParentView/index.vue +3 -3
  12. package/files/.wl-skills/src/components/global/C_RightToolbar/index.vue +157 -157
  13. package/files/.wl-skills/src/components/global/C_SvgIcon/index.vue +31 -31
  14. package/files/.wl-skills/src/components/global/C_SvgIcon/svgicon.js +10 -10
  15. package/files/.wl-skills/src/components/global/C_TagStatus/README.md +264 -264
  16. package/files/.wl-skills/src/components/global/C_TagStatus/config.ts +192 -192
  17. package/files/.wl-skills/src/components/global/C_TagStatus/index.vue +106 -106
  18. package/files/.wl-skills/src/components/global/C_TagStatus/types.ts +64 -64
  19. package/files/.wl-skills/src/components/global/C_Tree/README.md +153 -153
  20. package/files/.wl-skills/src/components/global/C_Tree/index.scss +42 -42
  21. package/files/.wl-skills/src/components/global/C_Tree/index.vue +78 -78
  22. package/files/.wl-skills/src/components/global/C_Tree/types.ts +59 -59
  23. package/files/.wl-skills/src/components/local/c_formModal/README.md +235 -235
  24. package/files/.wl-skills/src/components/local/c_formModal/data.ts +95 -95
  25. package/files/.wl-skills/src/components/local/c_formModal/index.scss +8 -8
  26. package/files/.wl-skills/src/components/local/c_formModal/index.vue +107 -107
  27. package/files/.wl-skills/src/components/local/c_formSections/data.ts +175 -175
  28. package/files/.wl-skills/src/components/local/c_formSections/index.scss +280 -280
  29. package/files/.wl-skills/src/components/local/c_formSections/index.vue +429 -429
  30. package/files/.wl-skills/src/components/local/c_listModal/data.ts +41 -41
  31. package/files/.wl-skills/src/components/local/c_listModal/index.vue +136 -136
  32. package/files/.wl-skills/src/components/local/c_spliterTitle/index.scss +25 -25
  33. package/files/.wl-skills/src/components/local/c_spliterTitle/index.vue +21 -21
  34. package/files/.wl-skills/src/components/remote/AGGrid/README.md +530 -530
  35. package/files/.wl-skills/src/components/remote/BaseForm/README.md +508 -508
  36. package/files/.wl-skills/src/components/remote/BaseQuery/README.md +865 -865
  37. package/files/.wl-skills/src/components/remote/BaseTable/README.md +941 -941
  38. package/files/.wl-skills/src/components/remote/BaseToolbar/README.md +496 -496
  39. package/files/.wl-skills/src/types/page.ts +24 -24
  40. package/files/.wl-skills/standards/04-coding-basics.md +39 -1
  41. package/files/.wl-skills/standards/09-typescript.md +26 -3
  42. package/files/.wl-skills/standards/index.md +2 -2
  43. package/files/.wl-skills/templates/README.md +44 -44
  44. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add/api.md +54 -54
  45. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add/data.ts +346 -346
  46. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add/index.scss +1 -1
  47. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add/index.vue +28 -28
  48. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add-form/data.ts +115 -115
  49. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add-form/index.scss +44 -44
  50. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add-form/index.vue +43 -43
  51. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change/data.ts +338 -338
  52. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change/index.scss +1 -1
  53. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change/index.vue +28 -28
  54. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change-form/data.ts +115 -115
  55. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change-form/index.scss +44 -44
  56. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change-form/index.vue +43 -43
  57. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-archive/api.md +88 -88
  58. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-archive/data.ts +601 -601
  59. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-archive/index.scss +1 -1
  60. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-archive/index.vue +64 -64
  61. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-detail/api.md +67 -67
  62. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-detail/data.ts +286 -286
  63. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-detail/index.scss +139 -139
  64. package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-detail/index.vue +318 -318
  65. package/files/.wl-skills/templates/produce/aiflow/mmwr-temp-customer-archive/api.md +98 -98
  66. package/files/.wl-skills/templates/produce/aiflow/mmwr-temp-customer-archive/data.ts +543 -543
  67. package/files/.wl-skills/templates/produce/aiflow/mmwr-temp-customer-archive/index.scss +1 -1
  68. package/files/.wl-skills/templates/produce/aiflow/mmwr-temp-customer-archive/index.vue +52 -52
  69. package/files/.wl-skills/templates/sale/demo/add-demo/data.ts +518 -518
  70. package/files/.wl-skills/templates/sale/demo/billet-flame-cut-plan/data.ts +524 -524
  71. package/files/.wl-skills/templates/sale/demo/billet-flame-cut-plan/index.scss +154 -154
  72. package/files/.wl-skills/templates/sale/demo/billet-flame-cut-plan/index.vue +117 -117
  73. package/files/.wl-skills/templates/sale/demo/domestic-trade-order/data.ts +308 -308
  74. package/files/.wl-skills/templates/sale/demo/domestic-trade-order/index.scss +99 -99
  75. package/files/.wl-skills/templates/sale/demo/domestic-trade-order/index.vue +77 -77
  76. package/files/.wl-skills/templates/sale/demo/heat-batch-return/data.ts +367 -367
  77. package/files/.wl-skills/templates/sale/demo/heat-batch-return/index.scss +100 -100
  78. package/files/.wl-skills/templates/sale/demo/heat-batch-return/index.vue +170 -170
  79. package/files/.wl-skills/templates/sale/demo/heat-batch-return/meltDialog.vue +320 -320
  80. package/files/.wl-skills/templates/sale/demo/metallurgical-spec/data.ts +824 -824
  81. package/lib/ast-rules.js +304 -9
  82. package/mcp/config.js +46 -46
  83. package/mcp/registry.js +6 -1
  84. package/mcp/tools/projectTools.js +9 -1
  85. package/package.json +2 -2
@@ -1,264 +1,264 @@
1
- # C_TagStatus 状态标签组件
2
-
3
- ## 📖 简介
4
-
5
- `C_TagStatus` 是一个统一的状态标签组件,基于 Element Plus 的 `el-tag` 封装,用于在表格、表单等场景中展示各种状态信息。
6
-
7
- **特性**:
8
-
9
- - ✅ 开箱即用,预配置了棒线材模块所有状态
10
- - ✅ 视觉精致,圆角标签 + 语义化配色
11
- - ✅ 类型安全,完整的 TypeScript 支持
12
- - ✅ 易于扩展,支持自定义状态配置
13
- - ✅ 性能优秀,组件级复用
14
-
15
- ---
16
-
17
- ## 🎨 效果预览
18
-
19
- ```
20
- [待下达] [已下达] [执行中] [已完成] [已取消]
21
- 灰色 蓝色 橙色 绿色 红色
22
- ```
23
-
24
- ---
25
-
26
- ## 🚀 快速开始
27
-
28
- ### 1. 基础用法(在模板中使用)
29
-
30
- ```vue
31
- <template>
32
- <C_TagStatus :value="row.planStatus" type="plan" />
33
- <C_TagStatus :value="row.prodStatus" type="product" />
34
- <C_TagStatus :value="row.isHot" type="boolean" />
35
- </template>
36
- ```
37
-
38
- ### 2. 在表格列中使用(推荐)
39
-
40
- ```typescript
41
- import { renderPlanStatus, renderProductStatus } from '@/util/status-render';
42
-
43
- // 方式1:使用预定义的渲染器
44
- {
45
- label: "计划状态",
46
- name: "planStatus",
47
- minWidth: 120,
48
- customRender: (row) => renderPlanStatus(row, 'planStatus')
49
- }
50
-
51
- // 方式2:使用通用渲染函数
52
- {
53
- label: "产品状态",
54
- name: "prodStatus",
55
- minWidth: 120,
56
- customRender: (row) => renderStatusTag(row, 'prodStatus', { type: 'product' })
57
- }
58
-
59
- // 方式3:自定义点击事件
60
- {
61
- label: "材料状态",
62
- name: "matStatus",
63
- minWidth: 120,
64
- customRender: (row) => renderStatusTag(row, 'matStatus', {
65
- type: 'material',
66
- onClick: (row, value, event) => {
67
- console.log('点击了状态', row, value);
68
- }
69
- })
70
- }
71
- ```
72
-
73
- ---
74
-
75
- ## 📝 组件属性
76
-
77
- | 属性 | 说明 | 类型 | 可选值 | 默认值 |
78
- | ------------- | ---------- | ----------------------------- | ---------------------------------------------------------- | ------- |
79
- | value | 状态值 | `string \| number \| boolean` | - | - |
80
- | type | 状态类型 | `StatusType \| string` | plan/product/material/process/sampling/sample/slab/boolean | - |
81
- | size | 尺寸 | `string` | large/default/small | `small` |
82
- | round | 是否圆角 | `boolean` | - | `true` |
83
- | closable | 是否可关闭 | `boolean` | - | `false` |
84
- | defaultEffect | 默认效果 | `TagEffect` | light/dark/plain | `light` |
85
-
86
- ---
87
-
88
- ## 🎯 状态类型说明
89
-
90
- ### 1. 计划状态 (plan)
91
-
92
- **字典**: `mmwrMillPlanStatus` / `mmwrFinishPlanStatus`
93
-
94
- | 状态值 | 显示文本 | 颜色 |
95
- | ------ | -------- | ---- |
96
- | 0 | 待下达 | 灰色 |
97
- | 1 | 已下达 | 蓝色 |
98
- | 2 | 执行中 | 橙色 |
99
- | 3 | 已完成 | 绿色 |
100
- | 4 | 已取消 | 红色 |
101
- | A | 待入炉 | 灰色 |
102
- | B | 已入炉 | 蓝色 |
103
- | C | 待完轧 | 橙色 |
104
- | D | 已完轧 | 绿色 |
105
-
106
- ### 2. 产品状态 (product)
107
-
108
- **字典**: `mmwrProdStatus`
109
-
110
- | 状态值 | 显示文本 | 颜色 |
111
- | ------ | -------- | ---- |
112
- | 0 | 待加工 | 灰色 |
113
- | 1 | 加工中 | 蓝色 |
114
- | 2 | 已完成 | 绿色 |
115
- | 3 | 合格品 | 深绿 |
116
- | 4 | 不合格 | 红色 |
117
- | A | 待产出 | 灰色 |
118
- | B | 已产出 | 绿色 |
119
- | C | 产出完毕 | 深绿 |
120
-
121
- ### 3. 材料状态 (material)
122
-
123
- **字典**: `mmwrMatStatus`
124
-
125
- | 状态值 | 显示文本 | 颜色 |
126
- | ------ | -------- | ---- |
127
- | 0 | 在库 | 灰色 |
128
- | 1 | 在线 | 蓝色 |
129
- | 2 | 已使用 | 绿色 |
130
- | 3 | 待检 | 橙色 |
131
- | 4 | 异常 | 红色 |
132
-
133
- ### 4. 进程状态 (process)
134
-
135
- **字典**: `mmwrProcessStatus`
136
-
137
- | 状态值 | 显示文本 | 颜色 |
138
- | ------ | -------- | ---- |
139
- | 0 | 待上料 | 灰色 |
140
- | 1 | 上料中 | 蓝色 |
141
- | 2 | 已产出 | 绿色 |
142
- | 3 | 已取消 | 红色 |
143
- | A | 待处理 | 灰色 |
144
- | B | 处理中 | 橙色 |
145
- | C | 已完成 | 绿色 |
146
-
147
- ### 5. 切取确认状态 (sampling)
148
-
149
- **字典**: `mmwrSampLingStus`
150
-
151
- | 状态值 | 显示文本 | 颜色 |
152
- | ------ | -------- | ---- |
153
- | 0 | 未确认 | 灰色 |
154
- | 1 | 已确认 | 绿色 |
155
- | 2 | 已取消 | 红色 |
156
-
157
- ### 6. 试样状态 (sample)
158
-
159
- **字典**: `mmwrSampleStatus`
160
-
161
- | 状态值 | 显示文本 | 颜色 |
162
- | ------ | -------- | ---- |
163
- | 0 | 待检验 | 灰色 |
164
- | 1 | 检验中 | 橙色 |
165
- | 2 | 已完成 | 绿色 |
166
- | 3 | 不合格 | 红色 |
167
-
168
- ### 7. 出炉状态 (slab)
169
-
170
- **字典**: `mmwrSlabStatus`
171
-
172
- | 状态值 | 显示文本 | 颜色 |
173
- | ------ | -------- | ---- |
174
- | 0 | 待出炉 | 灰色 |
175
- | 1 | 已出炉 | 绿色 |
176
- | 2 | 在线 | 蓝色 |
177
-
178
- ### 8. 布尔状态 (boolean)
179
-
180
- **用于**: 是/否 类型字段
181
-
182
- | 状态值 | 显示文本 | 颜色 |
183
- | --------------- | -------- | ---- |
184
- | true/1/"1"/"Y" | 是 | 绿色 |
185
- | false/0/"0"/"N" | 否 | 灰色 |
186
-
187
- ---
188
-
189
- ## 🔧 高级用法
190
-
191
- ### 1. 扩展自定义状态
192
-
193
- ```typescript
194
- import { registerStatusConfig } from "@/components/global/C_TagStatus/config";
195
-
196
- // 注册新的状态类型
197
- registerStatusConfig("custom", [
198
- { value: "1", label: "自定义状态1", type: "success" },
199
- { value: "2", label: "自定义状态2", type: "warning", color: "#FF6B6B" }
200
- ]);
201
- ```
202
-
203
- ### 2. 创建自定义渲染器
204
-
205
- ```typescript
206
- import { createStatusRenderer } from '@/util/status-render';
207
-
208
- // 创建自定义渲染器
209
- const renderMyStatus = createStatusRenderer('custom', {
210
- size: 'small',
211
- effect: 'dark'
212
- });
213
-
214
- // 在表格中使用
215
- {
216
- label: "自定义状态",
217
- name: "myStatus",
218
- customRender: (row) => renderMyStatus(row, 'myStatus')
219
- }
220
- ```
221
-
222
- ---
223
-
224
- ## 📦 文件结构
225
-
226
- ```
227
- C_TagStatus/
228
- ├── index.vue # 组件主体
229
- ├── config.ts # 状态配置(颜色映射表)
230
- ├── types.ts # TypeScript 类型定义
231
- └── README.md # 使用文档(本文件)
232
- ```
233
-
234
- ---
235
-
236
- ## 💡 最佳实践
237
-
238
- 1. **统一使用预定义渲染器**:优先使用 `renderPlanStatus`、`renderProductStatus` 等预定义函数
239
- 2. **保持配置集中**:所有状态配置统一在 `config.ts` 中管理
240
- 3. **类型安全**:充分利用 TypeScript 类型检查,避免配置错误
241
- 4. **性能优化**:表格中大量使用时,组件会自动复用,无需担心性能问题
242
-
243
- ---
244
-
245
- ## 🐛 常见问题
246
-
247
- ### Q: 状态显示为原始值,没有颜色?
248
-
249
- A: 检查 `type` 属性是否正确,以及状态值是否在配置表中。
250
-
251
- ### Q: 如何添加新的状态值?
252
-
253
- A: 在 `config.ts` 中对应的状态类型数组中添加配置项。
254
-
255
- ### Q: 可以使用自定义颜色吗?
256
-
257
- A: 可以,在配置中添加 `color` 属性,优先级高于 `type`。
258
-
259
- ---
260
-
261
- ## 📚 相关文档
262
-
263
- - [Element Plus Tag 组件](https://element-plus.org/zh-CN/component/tag.html)
264
- - 表格自定义渲染文档
1
+ # C_TagStatus 状态标签组件
2
+
3
+ ## 📖 简介
4
+
5
+ `C_TagStatus` 是一个统一的状态标签组件,基于 Element Plus 的 `el-tag` 封装,用于在表格、表单等场景中展示各种状态信息。
6
+
7
+ **特性**:
8
+
9
+ - ✅ 开箱即用,预配置了棒线材模块所有状态
10
+ - ✅ 视觉精致,圆角标签 + 语义化配色
11
+ - ✅ 类型安全,完整的 TypeScript 支持
12
+ - ✅ 易于扩展,支持自定义状态配置
13
+ - ✅ 性能优秀,组件级复用
14
+
15
+ ---
16
+
17
+ ## 🎨 效果预览
18
+
19
+ ```
20
+ [待下达] [已下达] [执行中] [已完成] [已取消]
21
+ 灰色 蓝色 橙色 绿色 红色
22
+ ```
23
+
24
+ ---
25
+
26
+ ## 🚀 快速开始
27
+
28
+ ### 1. 基础用法(在模板中使用)
29
+
30
+ ```vue
31
+ <template>
32
+ <C_TagStatus :value="row.planStatus" type="plan" />
33
+ <C_TagStatus :value="row.prodStatus" type="product" />
34
+ <C_TagStatus :value="row.isHot" type="boolean" />
35
+ </template>
36
+ ```
37
+
38
+ ### 2. 在表格列中使用(推荐)
39
+
40
+ ```typescript
41
+ import { renderPlanStatus, renderProductStatus } from '@/util/status-render';
42
+
43
+ // 方式1:使用预定义的渲染器
44
+ {
45
+ label: "计划状态",
46
+ name: "planStatus",
47
+ minWidth: 120,
48
+ customRender: (row) => renderPlanStatus(row, 'planStatus')
49
+ }
50
+
51
+ // 方式2:使用通用渲染函数
52
+ {
53
+ label: "产品状态",
54
+ name: "prodStatus",
55
+ minWidth: 120,
56
+ customRender: (row) => renderStatusTag(row, 'prodStatus', { type: 'product' })
57
+ }
58
+
59
+ // 方式3:自定义点击事件
60
+ {
61
+ label: "材料状态",
62
+ name: "matStatus",
63
+ minWidth: 120,
64
+ customRender: (row) => renderStatusTag(row, 'matStatus', {
65
+ type: 'material',
66
+ onClick: (row, value, event) => {
67
+ console.log('点击了状态', row, value);
68
+ }
69
+ })
70
+ }
71
+ ```
72
+
73
+ ---
74
+
75
+ ## 📝 组件属性
76
+
77
+ | 属性 | 说明 | 类型 | 可选值 | 默认值 |
78
+ | ------------- | ---------- | ----------------------------- | ---------------------------------------------------------- | ------- |
79
+ | value | 状态值 | `string \| number \| boolean` | - | - |
80
+ | type | 状态类型 | `StatusType \| string` | plan/product/material/process/sampling/sample/slab/boolean | - |
81
+ | size | 尺寸 | `string` | large/default/small | `small` |
82
+ | round | 是否圆角 | `boolean` | - | `true` |
83
+ | closable | 是否可关闭 | `boolean` | - | `false` |
84
+ | defaultEffect | 默认效果 | `TagEffect` | light/dark/plain | `light` |
85
+
86
+ ---
87
+
88
+ ## 🎯 状态类型说明
89
+
90
+ ### 1. 计划状态 (plan)
91
+
92
+ **字典**: `mmwrMillPlanStatus` / `mmwrFinishPlanStatus`
93
+
94
+ | 状态值 | 显示文本 | 颜色 |
95
+ | ------ | -------- | ---- |
96
+ | 0 | 待下达 | 灰色 |
97
+ | 1 | 已下达 | 蓝色 |
98
+ | 2 | 执行中 | 橙色 |
99
+ | 3 | 已完成 | 绿色 |
100
+ | 4 | 已取消 | 红色 |
101
+ | A | 待入炉 | 灰色 |
102
+ | B | 已入炉 | 蓝色 |
103
+ | C | 待完轧 | 橙色 |
104
+ | D | 已完轧 | 绿色 |
105
+
106
+ ### 2. 产品状态 (product)
107
+
108
+ **字典**: `mmwrProdStatus`
109
+
110
+ | 状态值 | 显示文本 | 颜色 |
111
+ | ------ | -------- | ---- |
112
+ | 0 | 待加工 | 灰色 |
113
+ | 1 | 加工中 | 蓝色 |
114
+ | 2 | 已完成 | 绿色 |
115
+ | 3 | 合格品 | 深绿 |
116
+ | 4 | 不合格 | 红色 |
117
+ | A | 待产出 | 灰色 |
118
+ | B | 已产出 | 绿色 |
119
+ | C | 产出完毕 | 深绿 |
120
+
121
+ ### 3. 材料状态 (material)
122
+
123
+ **字典**: `mmwrMatStatus`
124
+
125
+ | 状态值 | 显示文本 | 颜色 |
126
+ | ------ | -------- | ---- |
127
+ | 0 | 在库 | 灰色 |
128
+ | 1 | 在线 | 蓝色 |
129
+ | 2 | 已使用 | 绿色 |
130
+ | 3 | 待检 | 橙色 |
131
+ | 4 | 异常 | 红色 |
132
+
133
+ ### 4. 进程状态 (process)
134
+
135
+ **字典**: `mmwrProcessStatus`
136
+
137
+ | 状态值 | 显示文本 | 颜色 |
138
+ | ------ | -------- | ---- |
139
+ | 0 | 待上料 | 灰色 |
140
+ | 1 | 上料中 | 蓝色 |
141
+ | 2 | 已产出 | 绿色 |
142
+ | 3 | 已取消 | 红色 |
143
+ | A | 待处理 | 灰色 |
144
+ | B | 处理中 | 橙色 |
145
+ | C | 已完成 | 绿色 |
146
+
147
+ ### 5. 切取确认状态 (sampling)
148
+
149
+ **字典**: `mmwrSampLingStus`
150
+
151
+ | 状态值 | 显示文本 | 颜色 |
152
+ | ------ | -------- | ---- |
153
+ | 0 | 未确认 | 灰色 |
154
+ | 1 | 已确认 | 绿色 |
155
+ | 2 | 已取消 | 红色 |
156
+
157
+ ### 6. 试样状态 (sample)
158
+
159
+ **字典**: `mmwrSampleStatus`
160
+
161
+ | 状态值 | 显示文本 | 颜色 |
162
+ | ------ | -------- | ---- |
163
+ | 0 | 待检验 | 灰色 |
164
+ | 1 | 检验中 | 橙色 |
165
+ | 2 | 已完成 | 绿色 |
166
+ | 3 | 不合格 | 红色 |
167
+
168
+ ### 7. 出炉状态 (slab)
169
+
170
+ **字典**: `mmwrSlabStatus`
171
+
172
+ | 状态值 | 显示文本 | 颜色 |
173
+ | ------ | -------- | ---- |
174
+ | 0 | 待出炉 | 灰色 |
175
+ | 1 | 已出炉 | 绿色 |
176
+ | 2 | 在线 | 蓝色 |
177
+
178
+ ### 8. 布尔状态 (boolean)
179
+
180
+ **用于**: 是/否 类型字段
181
+
182
+ | 状态值 | 显示文本 | 颜色 |
183
+ | --------------- | -------- | ---- |
184
+ | true/1/"1"/"Y" | 是 | 绿色 |
185
+ | false/0/"0"/"N" | 否 | 灰色 |
186
+
187
+ ---
188
+
189
+ ## 🔧 高级用法
190
+
191
+ ### 1. 扩展自定义状态
192
+
193
+ ```typescript
194
+ import { registerStatusConfig } from "@/components/global/C_TagStatus/config";
195
+
196
+ // 注册新的状态类型
197
+ registerStatusConfig("custom", [
198
+ { value: "1", label: "自定义状态1", type: "success" },
199
+ { value: "2", label: "自定义状态2", type: "warning", color: "#FF6B6B" }
200
+ ]);
201
+ ```
202
+
203
+ ### 2. 创建自定义渲染器
204
+
205
+ ```typescript
206
+ import { createStatusRenderer } from '@/util/status-render';
207
+
208
+ // 创建自定义渲染器
209
+ const renderMyStatus = createStatusRenderer('custom', {
210
+ size: 'small',
211
+ effect: 'dark'
212
+ });
213
+
214
+ // 在表格中使用
215
+ {
216
+ label: "自定义状态",
217
+ name: "myStatus",
218
+ customRender: (row) => renderMyStatus(row, 'myStatus')
219
+ }
220
+ ```
221
+
222
+ ---
223
+
224
+ ## 📦 文件结构
225
+
226
+ ```
227
+ C_TagStatus/
228
+ ├── index.vue # 组件主体
229
+ ├── config.ts # 状态配置(颜色映射表)
230
+ ├── types.ts # TypeScript 类型定义
231
+ └── README.md # 使用文档(本文件)
232
+ ```
233
+
234
+ ---
235
+
236
+ ## 💡 最佳实践
237
+
238
+ 1. **统一使用预定义渲染器**:优先使用 `renderPlanStatus`、`renderProductStatus` 等预定义函数
239
+ 2. **保持配置集中**:所有状态配置统一在 `config.ts` 中管理
240
+ 3. **类型安全**:充分利用 TypeScript 类型检查,避免配置错误
241
+ 4. **性能优化**:表格中大量使用时,组件会自动复用,无需担心性能问题
242
+
243
+ ---
244
+
245
+ ## 🐛 常见问题
246
+
247
+ ### Q: 状态显示为原始值,没有颜色?
248
+
249
+ A: 检查 `type` 属性是否正确,以及状态值是否在配置表中。
250
+
251
+ ### Q: 如何添加新的状态值?
252
+
253
+ A: 在 `config.ts` 中对应的状态类型数组中添加配置项。
254
+
255
+ ### Q: 可以使用自定义颜色吗?
256
+
257
+ A: 可以,在配置中添加 `color` 属性,优先级高于 `type`。
258
+
259
+ ---
260
+
261
+ ## 📚 相关文档
262
+
263
+ - [Element Plus Tag 组件](https://element-plus.org/zh-CN/component/tag.html)
264
+ - 表格自定义渲染文档