@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.
- package/CHANGELOG.md +13 -0
- package/README.md +1 -1
- 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/guides/architecture.md +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/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 +304 -9
- 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,64 +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
|
-
};
|
|
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
|
+
};
|
|
@@ -1,153 +1,153 @@
|
|
|
1
|
-
# C_Tree 全局树形组件
|
|
2
|
-
|
|
3
|
-
纯树形展示组件,提供标签页、搜索、过滤等功能。布局由页面自行控制。
|
|
4
|
-
|
|
5
|
-
## 设计原则
|
|
6
|
-
|
|
7
|
-
- ✅ **单一职责**:只负责树形展示,不管布局
|
|
8
|
-
- ✅ **解耦设计**:与页面布局完全独立
|
|
9
|
-
- ✅ **高复用性**:可在任何布局中使用
|
|
10
|
-
- ✅ **自动导入**:无需手动 import
|
|
11
|
-
|
|
12
|
-
## Props
|
|
13
|
-
|
|
14
|
-
| 参数 | 说明 | 类型 | 默认值 | 必填 |
|
|
15
|
-
| ----------------- | ------------ | ---------------------- | ---------------------------------------- | ------ |
|
|
16
|
-
| tabs | 标签页配置 | `Array<{label, name}>` | - | 否 |
|
|
17
|
-
| treeData | 树形数据 | `Array` | - | **是** |
|
|
18
|
-
| treeProps | 树形配置 | `Object` | `{children: 'children', label: 'label'}` | 否 |
|
|
19
|
-
| defaultActiveTab | 默认激活标签 | `string` | `'tab1'` | 否 |
|
|
20
|
-
| showSearch | 显示搜索 | `boolean` | `true` | 否 |
|
|
21
|
-
| searchPlaceholder | 搜索占位符 | `string` | `'关键词搜索'` | 否 |
|
|
22
|
-
| defaultExpandAll | 默认展开 | `boolean` | `true` | 否 |
|
|
23
|
-
| highlightCurrent | 高亮当前 | `boolean` | `true` | 否 |
|
|
24
|
-
|
|
25
|
-
## Events
|
|
26
|
-
|
|
27
|
-
| 事件名 | 说明 | 参数 |
|
|
28
|
-
| ---------- | ---------- | ------------------- |
|
|
29
|
-
| node-click | 节点被点击 | `(data: any)` |
|
|
30
|
-
| tab-change | 标签页切换 | `(tabName: string)` |
|
|
31
|
-
|
|
32
|
-
## Slots
|
|
33
|
-
|
|
34
|
-
| 插槽名 | 说明 | 参数 |
|
|
35
|
-
| ------ | -------------- | ---------- |
|
|
36
|
-
| node | 自定义节点内容 | `{ data }` |
|
|
37
|
-
|
|
38
|
-
## 暴露方法
|
|
39
|
-
|
|
40
|
-
| 方法名 | 说明 | 参数 |
|
|
41
|
-
| ----------- | ---------- | ------------------- |
|
|
42
|
-
| clearSearch | 清空搜索 | - |
|
|
43
|
-
| switchTab | 切换标签页 | `(tabName: string)` |
|
|
44
|
-
|
|
45
|
-
## 使用示例
|
|
46
|
-
|
|
47
|
-
### 1. 基础用法
|
|
48
|
-
|
|
49
|
-
```vue
|
|
50
|
-
<template>
|
|
51
|
-
<C_Tree :tree-data="treeData" @node-click="handleNodeClick" />
|
|
52
|
-
</template>
|
|
53
|
-
|
|
54
|
-
<script setup>
|
|
55
|
-
const treeData = ref([
|
|
56
|
-
{
|
|
57
|
-
id: "1",
|
|
58
|
-
label: "节点1",
|
|
59
|
-
children: [{ id: "1-1", label: "子节点1-1" }]
|
|
60
|
-
}
|
|
61
|
-
]);
|
|
62
|
-
|
|
63
|
-
const handleNodeClick = (data) => {
|
|
64
|
-
console.log("点击节点:", data);
|
|
65
|
-
};
|
|
66
|
-
</script>
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### 2. 带标签页和搜索
|
|
70
|
-
|
|
71
|
-
```vue
|
|
72
|
-
<template>
|
|
73
|
-
<C_Tree
|
|
74
|
-
:tabs="tabs"
|
|
75
|
-
:tree-data="treeData"
|
|
76
|
-
:default-active-tab="activeTab"
|
|
77
|
-
@node-click="handleNodeClick"
|
|
78
|
-
@tab-change="handleTabChange"
|
|
79
|
-
/>
|
|
80
|
-
</template>
|
|
81
|
-
|
|
82
|
-
<script setup>
|
|
83
|
-
const tabs = [
|
|
84
|
-
{ label: "基本信息", name: "tab1" },
|
|
85
|
-
{ label: "交付标准", name: "tab2" }
|
|
86
|
-
];
|
|
87
|
-
|
|
88
|
-
const activeTab = ref("tab1");
|
|
89
|
-
const treeData = ref([...]);
|
|
90
|
-
|
|
91
|
-
const handleTabChange = (tabName) => {
|
|
92
|
-
activeTab.value = tabName;
|
|
93
|
-
// 加载对应标签页的数据...
|
|
94
|
-
};
|
|
95
|
-
</script>
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### 3. 左右布局(使用 jh-drag-col)
|
|
99
|
-
|
|
100
|
-
```vue
|
|
101
|
-
<template>
|
|
102
|
-
<jh-drag-col :left-width="300">
|
|
103
|
-
<!-- 左侧:树形 -->
|
|
104
|
-
<template #left>
|
|
105
|
-
<C_Tree
|
|
106
|
-
:tabs="tabs"
|
|
107
|
-
:tree-data="treeData"
|
|
108
|
-
@node-click="handleNodeClick"
|
|
109
|
-
/>
|
|
110
|
-
</template>
|
|
111
|
-
|
|
112
|
-
<!-- 右侧:详情 -->
|
|
113
|
-
<template #right>
|
|
114
|
-
<div class="detail-panel">
|
|
115
|
-
<h3>{{ selectedNode?.label }}</h3>
|
|
116
|
-
<p>详情内容...</p>
|
|
117
|
-
</div>
|
|
118
|
-
</template>
|
|
119
|
-
</jh-drag-col>
|
|
120
|
-
</template>
|
|
121
|
-
|
|
122
|
-
<script setup>
|
|
123
|
-
const tabs = [
|
|
124
|
-
{ label: "基本信息", name: "tab1" },
|
|
125
|
-
{ label: "交付标准", name: "tab2" }
|
|
126
|
-
];
|
|
127
|
-
|
|
128
|
-
const treeData = ref([...]);
|
|
129
|
-
const selectedNode = ref(null);
|
|
130
|
-
|
|
131
|
-
const handleNodeClick = (data) => {
|
|
132
|
-
selectedNode.value = data;
|
|
133
|
-
};
|
|
134
|
-
</script>
|
|
135
|
-
|
|
136
|
-
<style scoped>
|
|
137
|
-
.detail-panel {
|
|
138
|
-
padding: 16px;
|
|
139
|
-
background: #fff;
|
|
140
|
-
border-radius: 4px;
|
|
141
|
-
height: 100%;
|
|
142
|
-
}
|
|
143
|
-
</style>
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
## 注意事项
|
|
147
|
-
|
|
148
|
-
1. **treeData 必填**:组件必须传入树形数据
|
|
149
|
-
2. **布局由页面控制**:组件本身只占满父容器的 100% 高度
|
|
150
|
-
3. **自动导入**:已配置 Vite 自动导入,无需手动 import
|
|
151
|
-
4. **事件名格式**:使用 kebab-case(`@node-click`、`@tab-change`)
|
|
152
|
-
|
|
153
|
-
|
|
1
|
+
# C_Tree 全局树形组件
|
|
2
|
+
|
|
3
|
+
纯树形展示组件,提供标签页、搜索、过滤等功能。布局由页面自行控制。
|
|
4
|
+
|
|
5
|
+
## 设计原则
|
|
6
|
+
|
|
7
|
+
- ✅ **单一职责**:只负责树形展示,不管布局
|
|
8
|
+
- ✅ **解耦设计**:与页面布局完全独立
|
|
9
|
+
- ✅ **高复用性**:可在任何布局中使用
|
|
10
|
+
- ✅ **自动导入**:无需手动 import
|
|
11
|
+
|
|
12
|
+
## Props
|
|
13
|
+
|
|
14
|
+
| 参数 | 说明 | 类型 | 默认值 | 必填 |
|
|
15
|
+
| ----------------- | ------------ | ---------------------- | ---------------------------------------- | ------ |
|
|
16
|
+
| tabs | 标签页配置 | `Array<{label, name}>` | - | 否 |
|
|
17
|
+
| treeData | 树形数据 | `Array` | - | **是** |
|
|
18
|
+
| treeProps | 树形配置 | `Object` | `{children: 'children', label: 'label'}` | 否 |
|
|
19
|
+
| defaultActiveTab | 默认激活标签 | `string` | `'tab1'` | 否 |
|
|
20
|
+
| showSearch | 显示搜索 | `boolean` | `true` | 否 |
|
|
21
|
+
| searchPlaceholder | 搜索占位符 | `string` | `'关键词搜索'` | 否 |
|
|
22
|
+
| defaultExpandAll | 默认展开 | `boolean` | `true` | 否 |
|
|
23
|
+
| highlightCurrent | 高亮当前 | `boolean` | `true` | 否 |
|
|
24
|
+
|
|
25
|
+
## Events
|
|
26
|
+
|
|
27
|
+
| 事件名 | 说明 | 参数 |
|
|
28
|
+
| ---------- | ---------- | ------------------- |
|
|
29
|
+
| node-click | 节点被点击 | `(data: any)` |
|
|
30
|
+
| tab-change | 标签页切换 | `(tabName: string)` |
|
|
31
|
+
|
|
32
|
+
## Slots
|
|
33
|
+
|
|
34
|
+
| 插槽名 | 说明 | 参数 |
|
|
35
|
+
| ------ | -------------- | ---------- |
|
|
36
|
+
| node | 自定义节点内容 | `{ data }` |
|
|
37
|
+
|
|
38
|
+
## 暴露方法
|
|
39
|
+
|
|
40
|
+
| 方法名 | 说明 | 参数 |
|
|
41
|
+
| ----------- | ---------- | ------------------- |
|
|
42
|
+
| clearSearch | 清空搜索 | - |
|
|
43
|
+
| switchTab | 切换标签页 | `(tabName: string)` |
|
|
44
|
+
|
|
45
|
+
## 使用示例
|
|
46
|
+
|
|
47
|
+
### 1. 基础用法
|
|
48
|
+
|
|
49
|
+
```vue
|
|
50
|
+
<template>
|
|
51
|
+
<C_Tree :tree-data="treeData" @node-click="handleNodeClick" />
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<script setup>
|
|
55
|
+
const treeData = ref([
|
|
56
|
+
{
|
|
57
|
+
id: "1",
|
|
58
|
+
label: "节点1",
|
|
59
|
+
children: [{ id: "1-1", label: "子节点1-1" }]
|
|
60
|
+
}
|
|
61
|
+
]);
|
|
62
|
+
|
|
63
|
+
const handleNodeClick = (data) => {
|
|
64
|
+
console.log("点击节点:", data);
|
|
65
|
+
};
|
|
66
|
+
</script>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 2. 带标签页和搜索
|
|
70
|
+
|
|
71
|
+
```vue
|
|
72
|
+
<template>
|
|
73
|
+
<C_Tree
|
|
74
|
+
:tabs="tabs"
|
|
75
|
+
:tree-data="treeData"
|
|
76
|
+
:default-active-tab="activeTab"
|
|
77
|
+
@node-click="handleNodeClick"
|
|
78
|
+
@tab-change="handleTabChange"
|
|
79
|
+
/>
|
|
80
|
+
</template>
|
|
81
|
+
|
|
82
|
+
<script setup>
|
|
83
|
+
const tabs = [
|
|
84
|
+
{ label: "基本信息", name: "tab1" },
|
|
85
|
+
{ label: "交付标准", name: "tab2" }
|
|
86
|
+
];
|
|
87
|
+
|
|
88
|
+
const activeTab = ref("tab1");
|
|
89
|
+
const treeData = ref([...]);
|
|
90
|
+
|
|
91
|
+
const handleTabChange = (tabName) => {
|
|
92
|
+
activeTab.value = tabName;
|
|
93
|
+
// 加载对应标签页的数据...
|
|
94
|
+
};
|
|
95
|
+
</script>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 3. 左右布局(使用 jh-drag-col)
|
|
99
|
+
|
|
100
|
+
```vue
|
|
101
|
+
<template>
|
|
102
|
+
<jh-drag-col :left-width="300">
|
|
103
|
+
<!-- 左侧:树形 -->
|
|
104
|
+
<template #left>
|
|
105
|
+
<C_Tree
|
|
106
|
+
:tabs="tabs"
|
|
107
|
+
:tree-data="treeData"
|
|
108
|
+
@node-click="handleNodeClick"
|
|
109
|
+
/>
|
|
110
|
+
</template>
|
|
111
|
+
|
|
112
|
+
<!-- 右侧:详情 -->
|
|
113
|
+
<template #right>
|
|
114
|
+
<div class="detail-panel">
|
|
115
|
+
<h3>{{ selectedNode?.label }}</h3>
|
|
116
|
+
<p>详情内容...</p>
|
|
117
|
+
</div>
|
|
118
|
+
</template>
|
|
119
|
+
</jh-drag-col>
|
|
120
|
+
</template>
|
|
121
|
+
|
|
122
|
+
<script setup>
|
|
123
|
+
const tabs = [
|
|
124
|
+
{ label: "基本信息", name: "tab1" },
|
|
125
|
+
{ label: "交付标准", name: "tab2" }
|
|
126
|
+
];
|
|
127
|
+
|
|
128
|
+
const treeData = ref([...]);
|
|
129
|
+
const selectedNode = ref(null);
|
|
130
|
+
|
|
131
|
+
const handleNodeClick = (data) => {
|
|
132
|
+
selectedNode.value = data;
|
|
133
|
+
};
|
|
134
|
+
</script>
|
|
135
|
+
|
|
136
|
+
<style scoped>
|
|
137
|
+
.detail-panel {
|
|
138
|
+
padding: 16px;
|
|
139
|
+
background: #fff;
|
|
140
|
+
border-radius: 4px;
|
|
141
|
+
height: 100%;
|
|
142
|
+
}
|
|
143
|
+
</style>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## 注意事项
|
|
147
|
+
|
|
148
|
+
1. **treeData 必填**:组件必须传入树形数据
|
|
149
|
+
2. **布局由页面控制**:组件本身只占满父容器的 100% 高度
|
|
150
|
+
3. **自动导入**:已配置 Vite 自动导入,无需手动 import
|
|
151
|
+
4. **事件名格式**:使用 kebab-case(`@node-click`、`@tab-change`)
|
|
152
|
+
|
|
153
|
+
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
.c-tree-panel {
|
|
2
|
-
height: 100%;
|
|
3
|
-
background: #fff;
|
|
4
|
-
border-radius: 4px;
|
|
5
|
-
padding: 16px;
|
|
6
|
-
display: flex;
|
|
7
|
-
flex-direction: column;
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
|
|
10
|
-
.tree-tabs {
|
|
11
|
-
margin-bottom: 12px;
|
|
12
|
-
flex-shrink: 0;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.tree-search {
|
|
16
|
-
margin-bottom: 12px;
|
|
17
|
-
flex-shrink: 0;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.el-tree {
|
|
21
|
-
flex: 1;
|
|
22
|
-
overflow-y: auto;
|
|
23
|
-
|
|
24
|
-
// 滚动条样式
|
|
25
|
-
&::-webkit-scrollbar {
|
|
26
|
-
width: 6px;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&::-webkit-scrollbar-thumb {
|
|
30
|
-
background-color: rgba(0, 0, 0, 0.2);
|
|
31
|
-
border-radius: 3px;
|
|
32
|
-
|
|
33
|
-
&:hover {
|
|
34
|
-
background-color: rgba(0, 0, 0, 0.3);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.tree-node-label {
|
|
40
|
-
font-size: 14px;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
.c-tree-panel {
|
|
2
|
+
height: 100%;
|
|
3
|
+
background: #fff;
|
|
4
|
+
border-radius: 4px;
|
|
5
|
+
padding: 16px;
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
|
|
10
|
+
.tree-tabs {
|
|
11
|
+
margin-bottom: 12px;
|
|
12
|
+
flex-shrink: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.tree-search {
|
|
16
|
+
margin-bottom: 12px;
|
|
17
|
+
flex-shrink: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.el-tree {
|
|
21
|
+
flex: 1;
|
|
22
|
+
overflow-y: auto;
|
|
23
|
+
|
|
24
|
+
// 滚动条样式
|
|
25
|
+
&::-webkit-scrollbar {
|
|
26
|
+
width: 6px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&::-webkit-scrollbar-thumb {
|
|
30
|
+
background-color: rgba(0, 0, 0, 0.2);
|
|
31
|
+
border-radius: 3px;
|
|
32
|
+
|
|
33
|
+
&:hover {
|
|
34
|
+
background-color: rgba(0, 0, 0, 0.3);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.tree-node-label {
|
|
40
|
+
font-size: 14px;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="c-tree-panel">
|
|
3
|
-
<!-- Tab 切换 -->
|
|
4
|
-
<el-tabs
|
|
5
|
-
v-if="tabs && tabs.length > 0"
|
|
6
|
-
v-model="activeTab"
|
|
7
|
-
class="tree-tabs"
|
|
8
|
-
>
|
|
9
|
-
<el-tab-pane
|
|
10
|
-
v-for="tab in tabs"
|
|
11
|
-
:key="tab.name"
|
|
12
|
-
:label="tab.label"
|
|
13
|
-
:name="tab.name"
|
|
14
|
-
/>
|
|
15
|
-
</el-tabs>
|
|
16
|
-
|
|
17
|
-
<!-- 搜索框 -->
|
|
18
|
-
<div v-if="showSearch" class="tree-search">
|
|
19
|
-
<el-input
|
|
20
|
-
v-model="searchKeyword"
|
|
21
|
-
:placeholder="searchPlaceholder"
|
|
22
|
-
clearable
|
|
23
|
-
:prefix-icon="Search"
|
|
24
|
-
size="small"
|
|
25
|
-
/>
|
|
26
|
-
</div>
|
|
27
|
-
|
|
28
|
-
<!-- 树形组件 -->
|
|
29
|
-
<el-tree
|
|
30
|
-
ref="treeRef"
|
|
31
|
-
:data="treeData"
|
|
32
|
-
:props="treeProps"
|
|
33
|
-
:filter-node-method="filterNode"
|
|
34
|
-
:default-expand-all="defaultExpandAll"
|
|
35
|
-
:highlight-current="highlightCurrent"
|
|
36
|
-
@node-click="handleNodeClick"
|
|
37
|
-
>
|
|
38
|
-
<template #default="{ data }">
|
|
39
|
-
<slot name="node" :data="data">
|
|
40
|
-
<span class="tree-node-label">{{ data[treeProps.label] }}</span>
|
|
41
|
-
</slot>
|
|
42
|
-
</template>
|
|
43
|
-
</el-tree>
|
|
44
|
-
</div>
|
|
45
|
-
</template>
|
|
46
|
-
|
|
47
|
-
<script setup lang="ts">
|
|
48
|
-
import { createTree, type Props } from "./data";
|
|
49
|
-
|
|
50
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
51
|
-
treeProps: () => ({ children: "children", label: "label" }),
|
|
52
|
-
defaultActiveTab: "tab1",
|
|
53
|
-
showSearch: true,
|
|
54
|
-
searchPlaceholder: "关键词搜索",
|
|
55
|
-
defaultExpandAll: true,
|
|
56
|
-
highlightCurrent: true
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
const emit = defineEmits<{
|
|
60
|
-
(e: "node-click", data: any): void;
|
|
61
|
-
(e: "tab-change", tabName: string): void;
|
|
62
|
-
}>();
|
|
63
|
-
|
|
64
|
-
const {
|
|
65
|
-
Search,
|
|
66
|
-
activeTab,
|
|
67
|
-
searchKeyword,
|
|
68
|
-
treeRef,
|
|
69
|
-
filterNode,
|
|
70
|
-
handleNodeClick,
|
|
71
|
-
clearSearch,
|
|
72
|
-
switchTab
|
|
73
|
-
} = createTree(props, emit);
|
|
74
|
-
|
|
75
|
-
defineExpose({ treeRef, searchKeyword, activeTab, clearSearch, switchTab });
|
|
76
|
-
</script>
|
|
77
|
-
|
|
78
|
-
<style scoped lang="scss" src="./index.scss"></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="c-tree-panel">
|
|
3
|
+
<!-- Tab 切换 -->
|
|
4
|
+
<el-tabs
|
|
5
|
+
v-if="tabs && tabs.length > 0"
|
|
6
|
+
v-model="activeTab"
|
|
7
|
+
class="tree-tabs"
|
|
8
|
+
>
|
|
9
|
+
<el-tab-pane
|
|
10
|
+
v-for="tab in tabs"
|
|
11
|
+
:key="tab.name"
|
|
12
|
+
:label="tab.label"
|
|
13
|
+
:name="tab.name"
|
|
14
|
+
/>
|
|
15
|
+
</el-tabs>
|
|
16
|
+
|
|
17
|
+
<!-- 搜索框 -->
|
|
18
|
+
<div v-if="showSearch" class="tree-search">
|
|
19
|
+
<el-input
|
|
20
|
+
v-model="searchKeyword"
|
|
21
|
+
:placeholder="searchPlaceholder"
|
|
22
|
+
clearable
|
|
23
|
+
:prefix-icon="Search"
|
|
24
|
+
size="small"
|
|
25
|
+
/>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<!-- 树形组件 -->
|
|
29
|
+
<el-tree
|
|
30
|
+
ref="treeRef"
|
|
31
|
+
:data="treeData"
|
|
32
|
+
:props="treeProps"
|
|
33
|
+
:filter-node-method="filterNode"
|
|
34
|
+
:default-expand-all="defaultExpandAll"
|
|
35
|
+
:highlight-current="highlightCurrent"
|
|
36
|
+
@node-click="handleNodeClick"
|
|
37
|
+
>
|
|
38
|
+
<template #default="{ data }">
|
|
39
|
+
<slot name="node" :data="data">
|
|
40
|
+
<span class="tree-node-label">{{ data[treeProps.label] }}</span>
|
|
41
|
+
</slot>
|
|
42
|
+
</template>
|
|
43
|
+
</el-tree>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script setup lang="ts">
|
|
48
|
+
import { createTree, type Props } from "./data";
|
|
49
|
+
|
|
50
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
51
|
+
treeProps: () => ({ children: "children", label: "label" }),
|
|
52
|
+
defaultActiveTab: "tab1",
|
|
53
|
+
showSearch: true,
|
|
54
|
+
searchPlaceholder: "关键词搜索",
|
|
55
|
+
defaultExpandAll: true,
|
|
56
|
+
highlightCurrent: true
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const emit = defineEmits<{
|
|
60
|
+
(e: "node-click", data: any): void;
|
|
61
|
+
(e: "tab-change", tabName: string): void;
|
|
62
|
+
}>();
|
|
63
|
+
|
|
64
|
+
const {
|
|
65
|
+
Search,
|
|
66
|
+
activeTab,
|
|
67
|
+
searchKeyword,
|
|
68
|
+
treeRef,
|
|
69
|
+
filterNode,
|
|
70
|
+
handleNodeClick,
|
|
71
|
+
clearSearch,
|
|
72
|
+
switchTab
|
|
73
|
+
} = createTree(props, emit);
|
|
74
|
+
|
|
75
|
+
defineExpose({ treeRef, searchKeyword, activeTab, clearSearch, switchTab });
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<style scoped lang="scss" src="./index.scss"></style>
|