@agile-team/wl-skills-kit 2.11.1 → 2.11.3
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 +25 -0
- package/README.md +38 -21
- package/bin/wl-skills.js +27 -3
- package/files/.wl-skills/docs/jh-pagination.md +505 -505
- package/files/.wl-skills/docs/request.md +940 -940
- package/files/.wl-skills/docs/validate-exempt.md +113 -0
- package/files/.wl-skills/guides/architecture.md +1 -1
- package/files/.wl-skills/skills/_compat/headers/cursor-mdc.txt +1 -1
- package/files/.wl-skills/skills/_compat/headers/kiro.txt +1 -1
- package/files/.wl-skills/skills/_compat/headers/trae.txt +1 -1
- package/files/.wl-skills/skills/core/convention-audit/SKILL.md +3 -3
- package/files/.wl-skills/skills/core/spec-doc-parse/SKILL.md +332 -332
- package/files/.wl-skills/skills/core/spec-doc-parse/USAGE.md +97 -97
- package/files/.wl-skills/skills/sync/permission-sync/USAGE.md +107 -107
- package/files/.wl-skills/src/components/global/C_ParentView/index.vue +3 -3
- package/files/.wl-skills/src/components/global/C_RightToolbar/index.vue +157 -157
- package/files/.wl-skills/src/components/global/C_SvgIcon/index.vue +31 -31
- package/files/.wl-skills/src/components/global/C_SvgIcon/svgicon.js +10 -10
- package/files/.wl-skills/src/components/global/C_TagStatus/README.md +264 -264
- package/files/.wl-skills/src/components/global/C_TagStatus/config.ts +192 -192
- package/files/.wl-skills/src/components/global/C_TagStatus/index.vue +106 -106
- package/files/.wl-skills/src/components/global/C_TagStatus/types.ts +64 -64
- package/files/.wl-skills/src/components/global/C_Tree/README.md +153 -153
- package/files/.wl-skills/src/components/global/C_Tree/index.scss +42 -42
- package/files/.wl-skills/src/components/global/C_Tree/index.vue +78 -78
- package/files/.wl-skills/src/components/global/C_Tree/types.ts +59 -59
- package/files/.wl-skills/src/components/local/c_formModal/README.md +235 -235
- package/files/.wl-skills/src/components/local/c_formModal/data.ts +95 -95
- package/files/.wl-skills/src/components/local/c_formModal/index.scss +8 -8
- package/files/.wl-skills/src/components/local/c_formModal/index.vue +107 -107
- package/files/.wl-skills/src/components/local/c_formSections/data.ts +175 -175
- package/files/.wl-skills/src/components/local/c_formSections/index.scss +280 -280
- package/files/.wl-skills/src/components/local/c_formSections/index.vue +429 -429
- package/files/.wl-skills/src/components/local/c_listModal/data.ts +41 -41
- package/files/.wl-skills/src/components/local/c_listModal/index.vue +136 -136
- package/files/.wl-skills/src/components/local/c_spliterTitle/index.scss +25 -25
- package/files/.wl-skills/src/components/local/c_spliterTitle/index.vue +21 -21
- package/files/.wl-skills/src/components/remote/AGGrid/README.md +530 -530
- package/files/.wl-skills/src/components/remote/BaseForm/README.md +508 -508
- package/files/.wl-skills/src/components/remote/BaseQuery/README.md +865 -865
- package/files/.wl-skills/src/components/remote/BaseTable/README.md +941 -941
- package/files/.wl-skills/src/components/remote/BaseToolbar/README.md +496 -496
- package/files/.wl-skills/src/types/page.ts +24 -24
- package/files/.wl-skills/standards/04-coding-basics.md +39 -1
- package/files/.wl-skills/standards/09-typescript.md +26 -3
- package/files/.wl-skills/standards/12-base-table.md +56 -4
- package/files/.wl-skills/standards/13-platform-components.md +1 -0
- package/files/.wl-skills/standards/index.md +2 -2
- package/files/.wl-skills/templates/README.md +44 -44
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add/api.md +54 -54
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add/data.ts +346 -346
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add/index.scss +1 -1
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add/index.vue +28 -28
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add-form/data.ts +115 -115
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add-form/index.scss +44 -44
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add-form/index.vue +43 -43
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change/data.ts +338 -338
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change/index.scss +1 -1
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change/index.vue +28 -28
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change-form/data.ts +115 -115
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change-form/index.scss +44 -44
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change-form/index.vue +43 -43
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-archive/api.md +88 -88
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-archive/data.ts +601 -601
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-archive/index.scss +1 -1
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-archive/index.vue +64 -64
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-detail/api.md +67 -67
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-detail/data.ts +286 -286
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-detail/index.scss +139 -139
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-detail/index.vue +318 -318
- package/files/.wl-skills/templates/produce/aiflow/mmwr-temp-customer-archive/api.md +98 -98
- package/files/.wl-skills/templates/produce/aiflow/mmwr-temp-customer-archive/data.ts +543 -543
- package/files/.wl-skills/templates/produce/aiflow/mmwr-temp-customer-archive/index.scss +1 -1
- package/files/.wl-skills/templates/produce/aiflow/mmwr-temp-customer-archive/index.vue +52 -52
- package/files/.wl-skills/templates/sale/demo/add-demo/data.ts +518 -518
- package/files/.wl-skills/templates/sale/demo/billet-flame-cut-plan/data.ts +524 -524
- package/files/.wl-skills/templates/sale/demo/billet-flame-cut-plan/index.scss +154 -154
- package/files/.wl-skills/templates/sale/demo/billet-flame-cut-plan/index.vue +117 -117
- package/files/.wl-skills/templates/sale/demo/domestic-trade-order/data.ts +308 -308
- package/files/.wl-skills/templates/sale/demo/domestic-trade-order/index.scss +99 -99
- package/files/.wl-skills/templates/sale/demo/domestic-trade-order/index.vue +77 -77
- package/files/.wl-skills/templates/sale/demo/heat-batch-return/data.ts +367 -367
- package/files/.wl-skills/templates/sale/demo/heat-batch-return/index.scss +100 -100
- package/files/.wl-skills/templates/sale/demo/heat-batch-return/index.vue +170 -170
- package/files/.wl-skills/templates/sale/demo/heat-batch-return/meltDialog.vue +320 -320
- package/files/.wl-skills/templates/sale/demo/metallurgical-spec/data.ts +824 -824
- package/lib/ast-rules.js +395 -12
- package/mcp/config.js +46 -46
- package/mcp/registry.js +6 -1
- package/mcp/tools/projectTools.js +9 -1
- package/package.json +2 -2
|
@@ -1,192 +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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,106 +1,106 @@
|
|
|
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" src="./index.scss"></style>
|
|
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" src="./index.scss"></style>
|