@agile-team/wl-skills-kit 1.0.0
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 +13 -0
- package/README.md +328 -0
- package/bin/wl-skills.js +104 -0
- package/files/.github/copilot-instructions.md +211 -0
- package/files/.github/docs/SYS_MENU_INFO.md +247 -0
- package/files/.github/docs/menu-sync-design.md +265 -0
- package/files/.github/docs/use-skill.md +379 -0
- package/files/.github/docs/wl-skills-kit.md +266 -0
- package/files/.github/skills/api-contract/SKILL.md +247 -0
- package/files/.github/skills/convention-extract/SKILL.md +355 -0
- package/files/.github/skills/menu-sync/SKILL.md +255 -0
- package/files/.github/skills/menu-sync/env/guide.md +73 -0
- package/files/.github/skills/page-codegen/SKILL.md +825 -0
- package/files/.github/skills/page-codegen/TPL-CHANGE-HISTORY.md +281 -0
- package/files/.github/skills/page-codegen/TPL-DETAIL-TABS.md +1112 -0
- package/files/.github/skills/page-codegen/TPL-DRIVEN.md +124 -0
- package/files/.github/skills/page-codegen/TPL-FORM-ROUTE.md +441 -0
- package/files/.github/skills/page-codegen/TPL-LIST.md +196 -0
- package/files/.github/skills/page-codegen/TPL-MASTER-DETAIL.md +153 -0
- package/files/.github/skills/page-codegen/TPL-OPERATION-STATION.md +442 -0
- package/files/.github/skills/page-codegen/TPL-RECORD-FORM.md +376 -0
- package/files/.github/skills/page-codegen/TPL-TREE-LIST.md +191 -0
- package/files/.github/skills/prototype-scan/SKILL.md +414 -0
- package/files/demo/README.md +44 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add/api.md +54 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add/data.ts +346 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add/index.scss +1 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add/index.vue +28 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add-form/data.ts +115 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add-form/index.scss +44 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add-form/index.vue +43 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change/data.ts +338 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change/index.scss +1 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change/index.vue +28 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-form/data.ts +115 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-form/index.scss +44 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-form/index.vue +43 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/data.ts +196 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.scss +150 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.vue +79 -0
- package/files/demo/produce/aiflow/mmwr-customer-archive/api.md +88 -0
- package/files/demo/produce/aiflow/mmwr-customer-archive/data.ts +601 -0
- package/files/demo/produce/aiflow/mmwr-customer-archive/index.scss +1 -0
- package/files/demo/produce/aiflow/mmwr-customer-archive/index.vue +64 -0
- package/files/demo/produce/aiflow/mmwr-customer-detail/api.md +67 -0
- package/files/demo/produce/aiflow/mmwr-customer-detail/data.ts +286 -0
- package/files/demo/produce/aiflow/mmwr-customer-detail/index.scss +139 -0
- package/files/demo/produce/aiflow/mmwr-customer-detail/index.vue +318 -0
- package/files/demo/produce/aiflow/mmwr-temp-customer-archive/api.md +98 -0
- package/files/demo/produce/aiflow/mmwr-temp-customer-archive/data.ts +543 -0
- package/files/demo/produce/aiflow/mmwr-temp-customer-archive/index.scss +1 -0
- package/files/demo/produce/aiflow/mmwr-temp-customer-archive/index.vue +52 -0
- package/files/demo/sale/demo/add-demo/data.ts +518 -0
- package/files/demo/sale/demo/add-demo/index.scss +207 -0
- package/files/demo/sale/demo/add-demo/index.vue +167 -0
- package/files/demo/sale/demo/billet-flame-cut-plan/data.ts +524 -0
- package/files/demo/sale/demo/billet-flame-cut-plan/index.scss +155 -0
- package/files/demo/sale/demo/billet-flame-cut-plan/index.vue +117 -0
- package/files/demo/sale/demo/domestic-trade-order/data.ts +308 -0
- package/files/demo/sale/demo/domestic-trade-order/index.scss +99 -0
- package/files/demo/sale/demo/domestic-trade-order/index.vue +77 -0
- package/files/demo/sale/demo/heat-batch-return/data.ts +367 -0
- package/files/demo/sale/demo/heat-batch-return/index.scss +100 -0
- package/files/demo/sale/demo/heat-batch-return/index.vue +170 -0
- package/files/demo/sale/demo/heat-batch-return/meltDialog.vue +320 -0
- package/files/demo/sale/demo/metallurgical-spec/data.ts +825 -0
- package/files/demo/sale/demo/metallurgical-spec/index.scss +264 -0
- package/files/demo/sale/demo/metallurgical-spec/index.vue +309 -0
- package/files/docs/jh-date-range.md +257 -0
- package/files/docs/jh-date.md +222 -0
- package/files/docs/jh-dept-picker.md +190 -0
- package/files/docs/jh-drag-row.md +590 -0
- package/files/docs/jh-file-upload.md +216 -0
- package/files/docs/jh-pagination.md +505 -0
- package/files/docs/jh-picker.md +218 -0
- package/files/docs/jh-select.md +148 -0
- package/files/docs/jh-text.md +248 -0
- package/files/docs/jh-user-picker.md +197 -0
- package/files/docs/page-query-hook-best-practices.md +362 -0
- package/files/docs/request.md +925 -0
- package/files/src/components/global/C_ParentView/index.vue +3 -0
- package/files/src/components/global/C_RightToolbar/index.vue +459 -0
- package/files/src/components/global/C_Splitter/index.vue +195 -0
- package/files/src/components/global/C_SvgIcon/index.vue +61 -0
- package/files/src/components/global/C_SvgIcon/svgicon.js +10 -0
- package/files/src/components/global/C_TagStatus/README.md +264 -0
- package/files/src/components/global/C_TagStatus/config.ts +192 -0
- package/files/src/components/global/C_TagStatus/index.vue +127 -0
- package/files/src/components/global/C_TagStatus/types.ts +64 -0
- package/files/src/components/global/C_Tree/README.md +153 -0
- package/files/src/components/global/C_Tree/index.scss +42 -0
- package/files/src/components/global/C_Tree/index.vue +119 -0
- package/files/src/components/global/C_Tree/types.ts +59 -0
- package/files/src/components/local/c_formModal/README.md +235 -0
- package/files/src/components/local/c_formModal/data.ts +95 -0
- package/files/src/components/local/c_formModal/index.scss +8 -0
- package/files/src/components/local/c_formModal/index.vue +107 -0
- package/files/src/components/local/c_formSections/README.md +496 -0
- package/files/src/components/local/c_formSections/data.ts +175 -0
- package/files/src/components/local/c_formSections/index.scss +280 -0
- package/files/src/components/local/c_formSections/index.vue +429 -0
- package/files/src/components/local/c_listModal/data.ts +41 -0
- package/files/src/components/local/c_listModal/index.vue +136 -0
- package/files/src/components/local/c_spliterTitle/index.scss +25 -0
- package/files/src/components/local/c_spliterTitle/index.vue +21 -0
- package/files/src/components/remote/AGGrid/README.md +530 -0
- package/files/src/components/remote/BaseForm/README.md +508 -0
- package/files/src/components/remote/BaseQuery/README.md +865 -0
- package/files/src/components/remote/BaseTable/README.md +941 -0
- package/files/src/components/remote/BaseToolbar/README.md +496 -0
- package/files/src/types/page.ts +24 -0
- package/package.json +31 -0
|
@@ -0,0 +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
|
+
- 表格自定义渲染文档
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: ChenYu ycyplus@gmail.com
|
|
3
|
+
* @Date: 2026-02-14
|
|
4
|
+
* @LastEditors: ChenYu ycyplus@gmail.com
|
|
5
|
+
* @LastEditTime: 2026-02-14
|
|
6
|
+
* @FilePath: \cx-ui-produce\src\components\global\C_TagStatus\config.ts
|
|
7
|
+
* @Description: 状态标签组件 - 配置中心
|
|
8
|
+
* Copyright (c) 2026 by CHENY, All Rights Reserved 😎.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { StatusTypeConfig, StatusConfig } from "./types";
|
|
12
|
+
import { StatusType } from "./types";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 状态配置映射表
|
|
16
|
+
*
|
|
17
|
+
* 使用说明:
|
|
18
|
+
* 1. value: 后端返回的状态值(字符串/数字/布尔值)
|
|
19
|
+
* 2. label: 前端显示的文本
|
|
20
|
+
* 3. type: Element Plus Tag 类型(success/warning/danger/info/'')
|
|
21
|
+
* 4. color: 自定义颜色(可选,优先级高于 type)
|
|
22
|
+
* 5. effect: Tag 效果(light/dark/plain,默认 light)
|
|
23
|
+
*
|
|
24
|
+
* 颜色方案:
|
|
25
|
+
* - type='': 默认灰色 (#909399)
|
|
26
|
+
* - type='info': 信息蓝 (#909399)
|
|
27
|
+
* - type='success': 成功绿 (#67C23A)
|
|
28
|
+
* - type='warning': 警告橙 (#E6A23C)
|
|
29
|
+
* - type='danger': 危险红 (#F56C6C)
|
|
30
|
+
* - 自定义 color: 任意合法的 CSS 颜色值
|
|
31
|
+
*/
|
|
32
|
+
export const STATUS_CONFIG: StatusTypeConfig = {
|
|
33
|
+
/**
|
|
34
|
+
* 计划状态配置
|
|
35
|
+
* 字典: mmwrMillPlanStatus / mmwrFinishPlanStatus
|
|
36
|
+
*/
|
|
37
|
+
[StatusType.PLAN]: [
|
|
38
|
+
{ value: "0", label: "待下达", type: "info" },
|
|
39
|
+
{ value: "1", label: "已下达", type: "", color: "#409EFF" },
|
|
40
|
+
{ value: "2", label: "执行中", type: "warning" },
|
|
41
|
+
{ value: "3", label: "已完成", type: "success" },
|
|
42
|
+
{ value: "4", label: "已取消", type: "danger" },
|
|
43
|
+
{ value: "A", label: "待入炉", type: "info" },
|
|
44
|
+
{ value: "B", label: "已入炉", type: "", color: "#409EFF" },
|
|
45
|
+
{ value: "C", label: "待完轧", type: "warning" },
|
|
46
|
+
{ value: "D", label: "已完轧", type: "success" }
|
|
47
|
+
],
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 产品状态配置
|
|
51
|
+
* 字典: mmwrProdStatus
|
|
52
|
+
*/
|
|
53
|
+
[StatusType.PRODUCT]: [
|
|
54
|
+
{ value: "0", label: "待加工", type: "info" },
|
|
55
|
+
{ value: "1", label: "加工中", type: "", color: "#409EFF" },
|
|
56
|
+
{ value: "2", label: "已完成", type: "success" },
|
|
57
|
+
{ value: "3", label: "合格品", type: "success", effect: "dark" },
|
|
58
|
+
{ value: "4", label: "不合格", type: "danger" },
|
|
59
|
+
{ value: "A", label: "待产出", type: "info" },
|
|
60
|
+
{ value: "B", label: "已产出", type: "success" },
|
|
61
|
+
{ value: "C", label: "产出完毕", type: "success", effect: "dark" }
|
|
62
|
+
],
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 材料状态配置
|
|
66
|
+
* 字典: mmwrMatStatus
|
|
67
|
+
*/
|
|
68
|
+
[StatusType.MATERIAL]: [
|
|
69
|
+
{ value: "0", label: "在库", type: "info" },
|
|
70
|
+
{ value: "1", label: "在线", type: "", color: "#409EFF" },
|
|
71
|
+
{ value: "2", label: "已使用", type: "success" },
|
|
72
|
+
{ value: "3", label: "待检", type: "warning" },
|
|
73
|
+
{ value: "4", label: "异常", type: "danger" }
|
|
74
|
+
],
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* 进程状态配置
|
|
78
|
+
* 字典: mmwrProcessStatus
|
|
79
|
+
*/
|
|
80
|
+
[StatusType.PROCESS]: [
|
|
81
|
+
{ value: "0", label: "待上料", type: "info" },
|
|
82
|
+
{ value: "1", label: "上料中", type: "", color: "#409EFF" },
|
|
83
|
+
{ value: "2", label: "已产出", type: "success" },
|
|
84
|
+
{ value: "3", label: "已取消", type: "danger" },
|
|
85
|
+
{ value: "A", label: "待处理", type: "info" },
|
|
86
|
+
{ value: "B", label: "处理中", type: "warning" },
|
|
87
|
+
{ value: "C", label: "已完成", type: "success" }
|
|
88
|
+
],
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* 切取确认状态配置
|
|
92
|
+
* 字典: mmwrSampLingStus
|
|
93
|
+
*/
|
|
94
|
+
[StatusType.SAMPLING]: [
|
|
95
|
+
{ value: "0", label: "未确认", type: "info" },
|
|
96
|
+
{ value: "1", label: "已确认", type: "success" },
|
|
97
|
+
{ value: "2", label: "已取消", type: "danger" }
|
|
98
|
+
],
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* 试样状态配置
|
|
102
|
+
* 字典: mmwrSampleStatus
|
|
103
|
+
*/
|
|
104
|
+
[StatusType.SAMPLE]: [
|
|
105
|
+
{ value: "0", label: "待检验", type: "info" },
|
|
106
|
+
{ value: "1", label: "检验中", type: "warning" },
|
|
107
|
+
{ value: "2", label: "已完成", type: "success" },
|
|
108
|
+
{ value: "3", label: "不合格", type: "danger" }
|
|
109
|
+
],
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* 出炉状态配置
|
|
113
|
+
* 字典: mmwrSlabStatus
|
|
114
|
+
*/
|
|
115
|
+
[StatusType.SLAB]: [
|
|
116
|
+
{ value: "0", label: "待出炉", type: "info" },
|
|
117
|
+
{ value: "1", label: "已出炉", type: "success" },
|
|
118
|
+
{ value: "2", label: "在线", type: "", color: "#409EFF" }
|
|
119
|
+
],
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* 布尔状态配置
|
|
123
|
+
* 用于 是/否 类型字段
|
|
124
|
+
*/
|
|
125
|
+
[StatusType.BOOLEAN]: [
|
|
126
|
+
{ value: true, label: "是", type: "success" },
|
|
127
|
+
{ value: false, label: "否", type: "info" },
|
|
128
|
+
{ value: 1, label: "是", type: "success" },
|
|
129
|
+
{ value: 0, label: "否", type: "info" },
|
|
130
|
+
{ value: "1", label: "是", type: "success" },
|
|
131
|
+
{ value: "0", label: "否", type: "info" },
|
|
132
|
+
{ value: "Y", label: "是", type: "success" },
|
|
133
|
+
{ value: "N", label: "否", type: "info" }
|
|
134
|
+
]
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* 获取状态配置
|
|
139
|
+
* @param statusType 状态类型
|
|
140
|
+
* @param value 状态值
|
|
141
|
+
* @returns 状态配置对象
|
|
142
|
+
*/
|
|
143
|
+
export function getStatusConfig(
|
|
144
|
+
statusType: StatusType | string,
|
|
145
|
+
value: string | number | boolean | null | undefined
|
|
146
|
+
): StatusConfig | undefined {
|
|
147
|
+
if (value === null || value === undefined || value === "") {
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const configs = STATUS_CONFIG[statusType as StatusType];
|
|
152
|
+
if (!configs) {
|
|
153
|
+
return undefined;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// 精确匹配
|
|
157
|
+
let config = configs.find((c) => c.value === value);
|
|
158
|
+
|
|
159
|
+
// 如果精确匹配失败,尝试字符串化后匹配
|
|
160
|
+
if (!config) {
|
|
161
|
+
const valueStr = String(value);
|
|
162
|
+
config = configs.find((c) => String(c.value) === valueStr);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return config;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* 获取状态显示文本
|
|
170
|
+
* @param statusType 状态类型
|
|
171
|
+
* @param value 状态值
|
|
172
|
+
* @returns 显示文本
|
|
173
|
+
*/
|
|
174
|
+
export function getStatusLabel(
|
|
175
|
+
statusType: StatusType | string,
|
|
176
|
+
value: string | number | boolean | null | undefined
|
|
177
|
+
): string {
|
|
178
|
+
const config = getStatusConfig(statusType, value);
|
|
179
|
+
return config?.label || String(value || "-");
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* 批量注册新的状态配置
|
|
184
|
+
* @param statusType 状态类型
|
|
185
|
+
* @param configs 状态配置数组
|
|
186
|
+
*/
|
|
187
|
+
export function registerStatusConfig(
|
|
188
|
+
statusType: string,
|
|
189
|
+
configs: StatusConfig[]
|
|
190
|
+
): void {
|
|
191
|
+
STATUS_CONFIG[statusType as StatusType] = configs;
|
|
192
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenYu ycyplus@gmail.com
|
|
3
|
+
* @Date: 2026-02-14
|
|
4
|
+
* @LastEditors: ChenYu ycyplus@gmail.com
|
|
5
|
+
* @LastEditTime: 2026-02-14
|
|
6
|
+
* @FilePath: \cx-ui-produce\src\components\global\C_TagStatus\index.vue
|
|
7
|
+
* @Description: 状态标签组件 - 统一的状态展示
|
|
8
|
+
* Copyright (c) 2026 by CHENY, All Rights Reserved 😎.
|
|
9
|
+
-->
|
|
10
|
+
<template>
|
|
11
|
+
<el-tag
|
|
12
|
+
v-if="statusConfig"
|
|
13
|
+
:type="statusConfig.type"
|
|
14
|
+
:color="statusConfig.color"
|
|
15
|
+
:effect="statusConfig.effect || 'light'"
|
|
16
|
+
:size="size"
|
|
17
|
+
:round="round"
|
|
18
|
+
:closable="closable"
|
|
19
|
+
:disable-transitions="disableTransitions"
|
|
20
|
+
@click="handleClick"
|
|
21
|
+
@close="handleClose"
|
|
22
|
+
>
|
|
23
|
+
{{ statusConfig.label }}
|
|
24
|
+
</el-tag>
|
|
25
|
+
<span v-else class="status-fallback">{{ displayValue }}</span>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup lang="ts">
|
|
29
|
+
import { computed } from "vue";
|
|
30
|
+
import { getStatusConfig } from "./config";
|
|
31
|
+
import type { StatusType, TagEffect } from "./types";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 组件属性定义
|
|
35
|
+
*/
|
|
36
|
+
interface Props {
|
|
37
|
+
/** 状态值 */
|
|
38
|
+
value: string | number | boolean | null | undefined;
|
|
39
|
+
/** 状态类型(plan/product/material/process/sampling/sample/slab/boolean) */
|
|
40
|
+
type: StatusType | string;
|
|
41
|
+
/** Tag 尺寸 */
|
|
42
|
+
size?: "" | "large" | "default" | "small";
|
|
43
|
+
/** 是否圆角 */
|
|
44
|
+
round?: boolean;
|
|
45
|
+
/** 是否可关闭 */
|
|
46
|
+
closable?: boolean;
|
|
47
|
+
/** 是否禁用过渡动画 */
|
|
48
|
+
disableTransitions?: boolean;
|
|
49
|
+
/** 默认 Tag 效果(当配置中未指定时使用) */
|
|
50
|
+
defaultEffect?: TagEffect;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
54
|
+
size: "default",
|
|
55
|
+
round: true,
|
|
56
|
+
closable: false,
|
|
57
|
+
disableTransitions: false,
|
|
58
|
+
defaultEffect: "light"
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 组件事件定义
|
|
63
|
+
*/
|
|
64
|
+
const emit = defineEmits<{
|
|
65
|
+
click: [event: MouseEvent];
|
|
66
|
+
close: [event: MouseEvent];
|
|
67
|
+
}>();
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 获取状态配置
|
|
71
|
+
*/
|
|
72
|
+
const statusConfig = computed(() => {
|
|
73
|
+
const config = getStatusConfig(props.type, props.value);
|
|
74
|
+
if (config && !config.effect) {
|
|
75
|
+
// 如果配置中没有指定 effect,使用默认值
|
|
76
|
+
return { ...config, effect: props.defaultEffect };
|
|
77
|
+
}
|
|
78
|
+
return config;
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 显示值(降级方案)
|
|
83
|
+
*/
|
|
84
|
+
const displayValue = computed(() => {
|
|
85
|
+
if (props.value === null || props.value === undefined || props.value === "") {
|
|
86
|
+
return "-";
|
|
87
|
+
}
|
|
88
|
+
return String(props.value);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* 点击事件处理
|
|
93
|
+
*/
|
|
94
|
+
const handleClick = (event: MouseEvent) => {
|
|
95
|
+
emit("click", event);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* 关闭事件处理
|
|
100
|
+
*/
|
|
101
|
+
const handleClose = (event: MouseEvent) => {
|
|
102
|
+
emit("close", event);
|
|
103
|
+
};
|
|
104
|
+
</script>
|
|
105
|
+
|
|
106
|
+
<style scoped lang="scss">
|
|
107
|
+
.status-fallback {
|
|
108
|
+
display: inline-block;
|
|
109
|
+
padding: 0 8px;
|
|
110
|
+
font-size: 12px;
|
|
111
|
+
color: #909399;
|
|
112
|
+
line-height: 22px;
|
|
113
|
+
white-space: nowrap;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// 增强 el-tag 的视觉效果
|
|
117
|
+
:deep(.el-tag) {
|
|
118
|
+
font-weight: 500;
|
|
119
|
+
border: none;
|
|
120
|
+
|
|
121
|
+
// 为淡色效果添加边框
|
|
122
|
+
&.el-tag--light {
|
|
123
|
+
border: 1px solid currentColor;
|
|
124
|
+
border-color: var(--el-tag-border-color);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
</style>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: ChenYu ycyplus@gmail.com
|
|
3
|
+
* @Date: 2026-02-14
|
|
4
|
+
* @LastEditors: ChenYu ycyplus@gmail.com
|
|
5
|
+
* @LastEditTime: 2026-02-14
|
|
6
|
+
* @FilePath: \cx-ui-produce\src\components\global\C_TagStatus\types.ts
|
|
7
|
+
* @Description: 状态标签组件 - 类型定义
|
|
8
|
+
* Copyright (c) 2026 by CHENY, All Rights Reserved 😎.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Element Plus Tag 组件的类型
|
|
13
|
+
*/
|
|
14
|
+
export type TagType = "" | "success" | "warning" | "danger" | "info";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Element Plus Tag 组件的效果
|
|
18
|
+
*/
|
|
19
|
+
export type TagEffect = "light" | "dark" | "plain";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 状态类型枚举
|
|
23
|
+
*/
|
|
24
|
+
export enum StatusType {
|
|
25
|
+
/** 计划状态 */
|
|
26
|
+
PLAN = "plan",
|
|
27
|
+
/** 产品状态 */
|
|
28
|
+
PRODUCT = "product",
|
|
29
|
+
/** 材料状态 */
|
|
30
|
+
MATERIAL = "material",
|
|
31
|
+
/** 进程状态 */
|
|
32
|
+
PROCESS = "process",
|
|
33
|
+
/** 切取确认状态 */
|
|
34
|
+
SAMPLING = "sampling",
|
|
35
|
+
/** 试样状态 */
|
|
36
|
+
SAMPLE = "sample",
|
|
37
|
+
/** 出炉状态 */
|
|
38
|
+
SLAB = "slab",
|
|
39
|
+
/** 布尔状态 */
|
|
40
|
+
BOOLEAN = "boolean"
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 状态配置项
|
|
45
|
+
*/
|
|
46
|
+
export interface StatusConfig {
|
|
47
|
+
/** 状态值(用于匹配) */
|
|
48
|
+
value: string | number | boolean;
|
|
49
|
+
/** 显示文本 */
|
|
50
|
+
label: string;
|
|
51
|
+
/** Element Plus Tag 类型 */
|
|
52
|
+
type?: TagType;
|
|
53
|
+
/** 自定义颜色(优先级高于 type) */
|
|
54
|
+
color?: string;
|
|
55
|
+
/** Tag 效果 */
|
|
56
|
+
effect?: TagEffect;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 状态类型配置映射
|
|
61
|
+
*/
|
|
62
|
+
export type StatusTypeConfig = {
|
|
63
|
+
[key in StatusType]?: StatusConfig[];
|
|
64
|
+
};
|