@agile-team/wl-skills-kit 1.2.1 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +137 -0
- package/README.md +180 -357
- package/bin/wl-skills.js +206 -44
- package/files/.github/copilot-instructions.md +104 -43
- package/files/.github/guides/README.md +13 -0
- package/files/.github/guides/architecture.md +555 -0
- package/files/.github/guides/usage.md +166 -0
- package/files/.github/reports/README.md +65 -0
- package/files/.github/reports/SYS_DICT_INFO.md +19 -0
- package/files/.github/reports/SYS_PERMISSION_INFO.md +20 -0
- package/files/.github/reports//347/273/204/344/273/266/346/217/220/345/217/226/345/273/272/350/256/256.md +33 -0
- package/files/.github/reports//350/247/204/350/214/203/345/256/241/346/237/245/346/212/245/345/221/212.md +44 -0
- package/files/.github/skills/_compat/README.md +108 -0
- package/files/.github/skills/_compat/editors.json +61 -0
- package/files/.github/skills/_compat/headers/agents.txt +8 -0
- package/files/.github/skills/_compat/headers/claude-code.txt +7 -0
- package/files/.github/skills/_compat/headers/cline.txt +7 -0
- package/files/.github/skills/_compat/headers/cursor-mdc.txt +16 -0
- package/files/.github/skills/_compat/headers/cursor-rules.txt +7 -0
- package/files/.github/skills/_compat/headers/github-copilot.txt +1 -0
- package/files/.github/skills/_compat/headers/kiro.txt +10 -0
- package/files/.github/skills/_compat/headers/trae.txt +11 -0
- package/files/.github/skills/_compat/headers/windsurf.txt +7 -0
- package/files/.github/skills/_registry.md +81 -0
- package/files/.github/skills/{api-contract → core/api-contract}/SKILL.md +126 -29
- package/files/.github/skills/core/api-contract/USAGE.md +110 -0
- package/files/.github/skills/core/convention-audit/SKILL.md +189 -0
- package/files/.github/skills/core/convention-audit/USAGE.md +99 -0
- package/files/.github/skills/{page-codegen → core/page-codegen}/SKILL.md +64 -21
- package/files/.github/skills/core/page-codegen/USAGE.md +102 -0
- package/files/.github/skills/core/page-codegen/templates/_index.md +46 -0
- package/files/.github/skills/core/page-codegen/templates/domains/_CONTRIBUTING.md +107 -0
- package/files/.github/skills/{page-codegen → core/page-codegen/templates/domains/produce}/TPL-OPERATION-STATION.md +442 -442
- package/files/.github/skills/core/page-codegen/templates/domains/sale/README.md +26 -0
- package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-DETAIL-TABS.md +94 -39
- package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-DRIVEN.md +124 -124
- package/files/.github/skills/core/prototype-scan/USAGE.md +95 -0
- package/files/.github/skills/core/template-extract/SKILL.md +139 -0
- package/files/.github/skills/core/template-extract/USAGE.md +93 -0
- package/files/.github/skills/domain/README.md +51 -0
- package/files/.github/skills/ops/code-fix/SKILL.draft.md +108 -0
- package/files/.github/skills/sync/dict-sync/SKILL.draft.md +100 -0
- package/files/.github/skills/{menu-sync → sync/menu-sync}/SKILL.md +258 -258
- package/files/.github/skills/sync/menu-sync/USAGE.md +104 -0
- package/files/.github/skills/{menu-sync → sync/menu-sync}/env/guide.md +83 -83
- package/files/.github/skills/sync/permission-sync/SKILL.draft.md +91 -0
- package/files/.github/standards/01-toolchain.md +57 -0
- package/files/.github/standards/02-code-structure.md +111 -0
- package/files/.github/standards/03-comments.md +53 -0
- package/files/.github/standards/04-coding-basics.md +33 -0
- package/files/.github/standards/05-logging.md +38 -0
- package/files/.github/standards/06-security.md +44 -0
- package/files/.github/standards/07-config.md +52 -0
- package/files/.github/standards/08-git.md +60 -0
- package/files/.github/standards/09-typescript.md +71 -0
- package/files/.github/standards/10-pinia.md +57 -0
- package/files/.github/standards/11-form-validation.md +81 -0
- package/files/.github/standards/12-base-table.md +116 -0
- package/files/.github/standards/13-platform-components.md +123 -0
- package/files/.github/standards/index.md +89 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/data.ts +196 -196
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.scss +150 -150
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.vue +79 -79
- package/files/docs/jh-date-range.md +257 -257
- package/files/docs/jh-date.md +222 -222
- package/files/docs/jh-dept-picker.md +190 -190
- package/files/docs/jh-drag-row.md +590 -590
- package/files/docs/jh-file-upload.md +216 -216
- package/files/docs/jh-picker.md +218 -218
- package/files/docs/jh-select.md +148 -148
- package/files/docs/jh-text.md +248 -248
- package/files/docs/jh-user-picker.md +197 -197
- package/package.json +6 -2
- package/files/.github/docs/menu-sync-design.md +0 -264
- package/files/.github/docs/use-skill.md +0 -382
- package/files/.github/docs/wl-skills-kit.md +0 -266
- package/files/.github/skills/convention-extract/SKILL.md +0 -236
- /package/files/.github/{docs → reports}/SYS_MENU_INFO.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-CHANGE-HISTORY.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-FORM-ROUTE.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-LIST.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-MASTER-DETAIL.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-RECORD-FORM.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-TREE-LIST.md +0 -0
- /package/files/.github/skills/{prototype-scan → core/prototype-scan}/SKILL.md +0 -0
- /package/files/.github/skills/{menu-sync → sync/menu-sync}/env/env.local.json +0 -0
|
@@ -1,590 +1,590 @@
|
|
|
1
|
-
# jh-drag-row - 可拖拽分栏组件
|
|
2
|
-
|
|
3
|
-
> 上下分栏布局组件,支持拖拽调整上下区域高度,适用于双表联动、主从表等场景
|
|
4
|
-
|
|
5
|
-
## 📦 组件位置
|
|
6
|
-
|
|
7
|
-
```typescript
|
|
8
|
-
// 来自远程 common-core 包
|
|
9
|
-
import "@jhlc/common-core";
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
组件已在全局注册,无需手动导入,直接在模板中使用 `<jh-drag-row>`。
|
|
13
|
-
|
|
14
|
-
## ⚠️ 重要提醒
|
|
15
|
-
|
|
16
|
-
**使用 jh-drag-row 必须设置以下样式,否则拖拽手柄无法正常工作!**
|
|
17
|
-
|
|
18
|
-
```scss
|
|
19
|
-
// 在页面的 style 标签中添加(必需!)
|
|
20
|
-
:deep(.drager_row) {
|
|
21
|
-
height: 100%;
|
|
22
|
-
}
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
> **核心说明**:
|
|
26
|
-
> 1. 组件渲染时会自动生成 `.drager_row` CSS 类名
|
|
27
|
-
> 2. 必须使用 `:deep()` 穿透 scoped 样式
|
|
28
|
-
> 3. 如果使用全局样式文件,也可以: `.app-page-container .drager_row { height: 100%; }`
|
|
29
|
-
|
|
30
|
-
## 基本用法
|
|
31
|
-
|
|
32
|
-
### 标准双表布局(推荐)
|
|
33
|
-
|
|
34
|
-
```vue
|
|
35
|
-
<template>
|
|
36
|
-
<div class="app-container app-page-container">
|
|
37
|
-
<jh-drag-row :top-height="350">
|
|
38
|
-
<template #top>
|
|
39
|
-
<!-- 上表区域:搜索栏 -->
|
|
40
|
-
<BaseQuery
|
|
41
|
-
:form="queryParam"
|
|
42
|
-
:items="queryItems"
|
|
43
|
-
:columns="4"
|
|
44
|
-
@select="select"
|
|
45
|
-
@reset="select"
|
|
46
|
-
/>
|
|
47
|
-
|
|
48
|
-
<!-- 上表区域:工具栏 -->
|
|
49
|
-
<BaseToolbar :items="toolbars" />
|
|
50
|
-
|
|
51
|
-
<!-- 上表区域:表格 -->
|
|
52
|
-
<BaseTable
|
|
53
|
-
ref="tableRef"
|
|
54
|
-
:data="list"
|
|
55
|
-
:columns="columns"
|
|
56
|
-
showToolbar
|
|
57
|
-
@row-click="handleRowClick"
|
|
58
|
-
/>
|
|
59
|
-
|
|
60
|
-
<!-- 上表区域:分页 -->
|
|
61
|
-
<jh-pagination
|
|
62
|
-
v-show="page.total && page.total > 0"
|
|
63
|
-
:total="page.total || 0"
|
|
64
|
-
v-model:currentPage="page.current"
|
|
65
|
-
v-model:pageSize="page.size"
|
|
66
|
-
@current-change="select"
|
|
67
|
-
@size-change="select"
|
|
68
|
-
/>
|
|
69
|
-
</template>
|
|
70
|
-
|
|
71
|
-
<template #bottom>
|
|
72
|
-
<!-- 下表区域:工具栏 -->
|
|
73
|
-
<BaseToolbar :items="bottomToolbars" />
|
|
74
|
-
|
|
75
|
-
<!-- 下表区域:表格 -->
|
|
76
|
-
<BaseTable
|
|
77
|
-
ref="bottomTableRef"
|
|
78
|
-
:data="bottomList"
|
|
79
|
-
:columns="bottomColumns"
|
|
80
|
-
showToolbar
|
|
81
|
-
/>
|
|
82
|
-
|
|
83
|
-
<!-- 下表区域:分页(如果需要) -->
|
|
84
|
-
<jh-pagination
|
|
85
|
-
v-show="bottomPage.total && bottomPage.total > 0"
|
|
86
|
-
:total="bottomPage.total || 0"
|
|
87
|
-
v-model:currentPage="bottomPage.current"
|
|
88
|
-
v-model:pageSize="bottomPage.size"
|
|
89
|
-
@current-change="selectBottom"
|
|
90
|
-
@size-change="selectBottom"
|
|
91
|
-
/>
|
|
92
|
-
</template>
|
|
93
|
-
</jh-drag-row>
|
|
94
|
-
</div>
|
|
95
|
-
</template>
|
|
96
|
-
|
|
97
|
-
<script setup lang="ts">
|
|
98
|
-
import { ref } from "vue";
|
|
99
|
-
|
|
100
|
-
const page = ref({ current: 1, size: 10, total: 0 });
|
|
101
|
-
const list = ref([]);
|
|
102
|
-
const bottomPage = ref({ current: 1, size: 10, total: 0 });
|
|
103
|
-
const bottomList = ref([]);
|
|
104
|
-
|
|
105
|
-
// 查询上表数据
|
|
106
|
-
const select = async () => {
|
|
107
|
-
// 查询逻辑...
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
// 查询下表数据
|
|
111
|
-
const selectBottom = async () => {
|
|
112
|
-
// 查询逻辑...
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
// 行点击事件:联动查询下表
|
|
116
|
-
const handleRowClick = (row: any) => {
|
|
117
|
-
// 根据选中行的数据查询下表
|
|
118
|
-
selectBottom();
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
onMounted(() => {
|
|
122
|
-
select();
|
|
123
|
-
});
|
|
124
|
-
</script>
|
|
125
|
-
|
|
126
|
-
<style scoped lang="scss">
|
|
127
|
-
// ⚠️ 必需样式:让拖拽组件占满容器高度
|
|
128
|
-
:deep(.drager_row) {
|
|
129
|
-
height: 100%;
|
|
130
|
-
}
|
|
131
|
-
</style>
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### 在 Tab 标签页中使用
|
|
135
|
-
|
|
136
|
-
```vue
|
|
137
|
-
<template>
|
|
138
|
-
<div class="app-container app-page-container my-page">
|
|
139
|
-
<el-tabs v-model="activeTab" class="tabs-container">
|
|
140
|
-
<el-tab-pane label="主从表" name="master">
|
|
141
|
-
<jh-drag-row :top-height="400">
|
|
142
|
-
<template #top>
|
|
143
|
-
<!-- 上表内容 -->
|
|
144
|
-
</template>
|
|
145
|
-
<template #bottom>
|
|
146
|
-
<!-- 下表内容 -->
|
|
147
|
-
</template>
|
|
148
|
-
</jh-drag-row>
|
|
149
|
-
</el-tab-pane>
|
|
150
|
-
</el-tabs>
|
|
151
|
-
</div>
|
|
152
|
-
</template>
|
|
153
|
-
|
|
154
|
-
<style scoped lang="scss">
|
|
155
|
-
.my-page {
|
|
156
|
-
.tabs-container {
|
|
157
|
-
height: calc(100vh - 120px);
|
|
158
|
-
|
|
159
|
-
:deep(.el-tabs__content) {
|
|
160
|
-
height: calc(100% - 55px);
|
|
161
|
-
padding: 10px;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
:deep(.el-tab-pane) {
|
|
165
|
-
height: 100%;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// ⚠️ 核心样式:确保拖拽组件能正常工作
|
|
169
|
-
:deep(.drager_row) {
|
|
170
|
-
height: 100%;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
</style>
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
## Props 属性
|
|
178
|
-
|
|
179
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
|
180
|
-
| ---------- | ------------------------------------ | --------- | ------- |
|
|
181
|
-
| top-height | 上部区域的初始高度(单位:px) | `number` | - |
|
|
182
|
-
| topPercent | 上部区域的初始百分比(与 top-height 二选一) | `number` | - |
|
|
183
|
-
| bottomHeight | 下部区域的初始高度(单位:px) | `number` | - |
|
|
184
|
-
| bottomPercent | 下部区域的初始百分比 | `number` | - |
|
|
185
|
-
| height | 容器总高度 | `string` | `"400px"` |
|
|
186
|
-
| sliderWidth | 拖拽分割线的宽度(单位:px) | `number` | `10` |
|
|
187
|
-
|
|
188
|
-
> **提示**: 推荐使用 `top-height` 设置上部区域高度,下部区域会自动填充剩余空间。
|
|
189
|
-
|
|
190
|
-
## Slots 插槽
|
|
191
|
-
|
|
192
|
-
| 插槽名 | 说明 |
|
|
193
|
-
| ------ | ------------ |
|
|
194
|
-
| top | 上部区域内容 |
|
|
195
|
-
| bottom | 下部区域内容 |
|
|
196
|
-
|
|
197
|
-
## 使用场景
|
|
198
|
-
|
|
199
|
-
### 1. 主从表联动
|
|
200
|
-
|
|
201
|
-
```vue
|
|
202
|
-
<template>
|
|
203
|
-
<div class="app-container app-page-container">
|
|
204
|
-
<jh-drag-row :top-height="350">
|
|
205
|
-
<template #top>
|
|
206
|
-
<!-- 主表:订单列表 -->
|
|
207
|
-
<BaseTable
|
|
208
|
-
:data="orderList"
|
|
209
|
-
:columns="orderColumns"
|
|
210
|
-
@row-click="handleOrderClick"
|
|
211
|
-
/>
|
|
212
|
-
</template>
|
|
213
|
-
<template #bottom>
|
|
214
|
-
<!-- 从表:订单明细 -->
|
|
215
|
-
<BaseTable :data="orderDetailList" :columns="detailColumns" />
|
|
216
|
-
</template>
|
|
217
|
-
</jh-drag-row>
|
|
218
|
-
</div>
|
|
219
|
-
</template>
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
### 2. 轧钢计划与钢坯信息
|
|
223
|
-
|
|
224
|
-
```vue
|
|
225
|
-
<template>
|
|
226
|
-
<div class="app-container app-page-container">
|
|
227
|
-
<jh-drag-row :top-height="380">
|
|
228
|
-
<template #top>
|
|
229
|
-
<!-- 上表:轧钢计划列表 -->
|
|
230
|
-
<BaseTable
|
|
231
|
-
:data="planList"
|
|
232
|
-
:columns="planColumns"
|
|
233
|
-
highlight-current-row
|
|
234
|
-
@current-change="handlePlanChange"
|
|
235
|
-
/>
|
|
236
|
-
</template>
|
|
237
|
-
<template #bottom>
|
|
238
|
-
<!-- 下表:钢坯信息 -->
|
|
239
|
-
<BaseToolbar :items="slabToolbars" />
|
|
240
|
-
<BaseTable :data="slabList" :columns="slabColumns" />
|
|
241
|
-
</template>
|
|
242
|
-
</jh-drag-row>
|
|
243
|
-
</div>
|
|
244
|
-
</template>
|
|
245
|
-
|
|
246
|
-
<script setup lang="ts">
|
|
247
|
-
// 上表选中行变化时,查询下表数据
|
|
248
|
-
const handlePlanChange = (row: any) => {
|
|
249
|
-
if (row && row.lotNo) {
|
|
250
|
-
querySlabList(row.lotNo);
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
</script>
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
### 3. 合并订单(左右+上下布局)
|
|
257
|
-
|
|
258
|
-
```vue
|
|
259
|
-
<template>
|
|
260
|
-
<div class="app-container app-page-container">
|
|
261
|
-
<jh-drag-row :top-height="300">
|
|
262
|
-
<template #top>
|
|
263
|
-
<!-- 上部:母订单列表 -->
|
|
264
|
-
<BaseQuery :form="queryParam" :items="queryItems" />
|
|
265
|
-
<BaseTable :data="motherOrderList" :columns="columns" />
|
|
266
|
-
</template>
|
|
267
|
-
<template #bottom>
|
|
268
|
-
<!-- 下部:左右两个表格 -->
|
|
269
|
-
<div class="bottom-container">
|
|
270
|
-
<div class="left-table">
|
|
271
|
-
<div class="title">已合并订单</div>
|
|
272
|
-
<BaseTable :data="mergedList" :columns="mergedColumns" />
|
|
273
|
-
</div>
|
|
274
|
-
<div class="right-table">
|
|
275
|
-
<div class="title">未合并订单</div>
|
|
276
|
-
<BaseTable :data="unmergedList" :columns="unmergedColumns" />
|
|
277
|
-
</div>
|
|
278
|
-
</div>
|
|
279
|
-
</template>
|
|
280
|
-
</jh-drag-row>
|
|
281
|
-
</div>
|
|
282
|
-
</template>
|
|
283
|
-
|
|
284
|
-
<style scoped lang="scss">
|
|
285
|
-
.bottom-container {
|
|
286
|
-
display: flex;
|
|
287
|
-
gap: 10px;
|
|
288
|
-
height: 100%;
|
|
289
|
-
|
|
290
|
-
.left-table,
|
|
291
|
-
.right-table {
|
|
292
|
-
flex: 1;
|
|
293
|
-
overflow: auto;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
:deep(.drager_row) {
|
|
298
|
-
height: 100%;
|
|
299
|
-
}
|
|
300
|
-
</style>
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
### 项目真实代码示例
|
|
304
|
-
|
|
305
|
-
```vue
|
|
306
|
-
<!-- src/views/produce/production-order/sclk/ommt-steel-lib/index.vue -->
|
|
307
|
-
<template>
|
|
308
|
-
<div class="app-container app-page-container">
|
|
309
|
-
<jh-drag-row :top-height="350">
|
|
310
|
-
<template #top>
|
|
311
|
-
<!-- 搜索栏 -->
|
|
312
|
-
<BaseQuery
|
|
313
|
-
:form="queryParam"
|
|
314
|
-
:items="queryItems"
|
|
315
|
-
:columns="4"
|
|
316
|
-
@select="select"
|
|
317
|
-
@reset="select"
|
|
318
|
-
/>
|
|
319
|
-
<!-- 工具栏 -->
|
|
320
|
-
<BaseToolbar :items="toolbars" />
|
|
321
|
-
<!-- 表格 -->
|
|
322
|
-
<BaseTable
|
|
323
|
-
ref="tableRef"
|
|
324
|
-
:data="list"
|
|
325
|
-
:columns="columns"
|
|
326
|
-
showToolbar
|
|
327
|
-
/>
|
|
328
|
-
<!-- 分页 -->
|
|
329
|
-
<jh-pagination
|
|
330
|
-
v-show="page.total && page.total > 0"
|
|
331
|
-
:total="page.total || 0"
|
|
332
|
-
v-model:currentPage="page.current"
|
|
333
|
-
v-model:pageSize="page.size"
|
|
334
|
-
@current-change="select"
|
|
335
|
-
@size-change="select"
|
|
336
|
-
/>
|
|
337
|
-
</template>
|
|
338
|
-
<template #bottom>
|
|
339
|
-
<BaseTable
|
|
340
|
-
ref="bottomTableRef"
|
|
341
|
-
:data="bottomList"
|
|
342
|
-
:columns="bottomColumns"
|
|
343
|
-
showToolbar
|
|
344
|
-
/>
|
|
345
|
-
</template>
|
|
346
|
-
</jh-drag-row>
|
|
347
|
-
</div>
|
|
348
|
-
</template>
|
|
349
|
-
|
|
350
|
-
<style scoped lang="scss">
|
|
351
|
-
.app-page-container {
|
|
352
|
-
// ⭐ 关键样式:让 drager_row 占满容器高度
|
|
353
|
-
:deep(.drager_row) {
|
|
354
|
-
height: 100%;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
</style>
|
|
358
|
-
```
|
|
359
|
-
|
|
360
|
-
### 另一种样式写法(全局样式)
|
|
361
|
-
|
|
362
|
-
```scss
|
|
363
|
-
// index.scss (非scoped)
|
|
364
|
-
.app-page-container .drager_row {
|
|
365
|
-
height: 100%;
|
|
366
|
-
}
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
---
|
|
370
|
-
|
|
371
|
-
## 常见问题
|
|
372
|
-
|
|
373
|
-
### ❌ 问题 1:拖拽手柄无法拖动
|
|
374
|
-
|
|
375
|
-
**原因:** 缺少关键样式 `.drager_row { height: 100%; }`
|
|
376
|
-
|
|
377
|
-
**解决方案:**
|
|
378
|
-
|
|
379
|
-
```scss
|
|
380
|
-
// 方案 1:使用 :deep() 穿透(推荐)
|
|
381
|
-
:deep(.drager_row) {
|
|
382
|
-
height: 100%;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
// 方案 2:使用全局样式
|
|
386
|
-
.app-page-container .drager_row {
|
|
387
|
-
height: 100%;
|
|
388
|
-
}
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
### ❌ 问题 2:上表只有一条数据时高度太矮,显示拥挤
|
|
392
|
-
|
|
393
|
-
**原因:** `top-height` 设置过小
|
|
394
|
-
|
|
395
|
-
**解决方案:**
|
|
396
|
-
|
|
397
|
-
```vue
|
|
398
|
-
<!-- 适当增加 top-height 值 -->
|
|
399
|
-
<jh-drag-row :top-height="400">
|
|
400
|
-
<!-- 推荐值:350-450 之间 -->
|
|
401
|
-
</jh-drag-row>
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
### ❌ 问题 3:在 Tab 标签页中无法拖动
|
|
405
|
-
|
|
406
|
-
**原因:** Tab 容器没有设置高度,或 `.drager_row` 样式未正确应用
|
|
407
|
-
|
|
408
|
-
**解决方案:**
|
|
409
|
-
|
|
410
|
-
```scss
|
|
411
|
-
.tabs-container {
|
|
412
|
-
height: calc(100vh - 120px); // 给 Tab 容器设置高度
|
|
413
|
-
|
|
414
|
-
:deep(.el-tabs__content) {
|
|
415
|
-
height: calc(100% - 55px);
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
:deep(.el-tab-pane) {
|
|
419
|
-
height: 100%;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
// ⚠️ 关键:必须添加这行
|
|
423
|
-
:deep(.drager_row) {
|
|
424
|
-
height: 100%;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
```
|
|
428
|
-
|
|
429
|
-
### ❌ 问题 4:拖拽后布局错乱
|
|
430
|
-
|
|
431
|
-
**原因:** 容器高度链条断裂
|
|
432
|
-
|
|
433
|
-
**检查清单:**
|
|
434
|
-
|
|
435
|
-
1. ✅ 父容器是否有明确的高度(如 `calc(100vh - 120px)`)
|
|
436
|
-
2. ✅ 所有中间层容器是否设置了 `height: 100%`
|
|
437
|
-
3. ✅ `.drager_row` 是否设置了 `height: 100%`
|
|
438
|
-
4. ✅ 是否使用了 `overflow: hidden` 阻止了拖拽
|
|
439
|
-
|
|
440
|
-
## 最佳实践
|
|
441
|
-
|
|
442
|
-
### ✅ 推荐做法
|
|
443
|
-
|
|
444
|
-
```vue
|
|
445
|
-
<template>
|
|
446
|
-
<div class="app-container app-page-container my-component">
|
|
447
|
-
<jh-drag-row :top-height="380">
|
|
448
|
-
<template #top>
|
|
449
|
-
<!-- 上表完整内容:搜索栏、工具栏、表格、分页 -->
|
|
450
|
-
<BaseQuery />
|
|
451
|
-
<BaseToolbar />
|
|
452
|
-
<BaseTable />
|
|
453
|
-
<jh-pagination />
|
|
454
|
-
</template>
|
|
455
|
-
<template #bottom>
|
|
456
|
-
<!-- 下表完整内容 -->
|
|
457
|
-
<BaseToolbar />
|
|
458
|
-
<BaseTable />
|
|
459
|
-
</template>
|
|
460
|
-
</jh-drag-row>
|
|
461
|
-
</div>
|
|
462
|
-
</template>
|
|
463
|
-
|
|
464
|
-
<style scoped lang="scss">
|
|
465
|
-
.my-component {
|
|
466
|
-
// ⚠️ 必需样式
|
|
467
|
-
:deep(.drager_row) {
|
|
468
|
-
height: 100%;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
</style>
|
|
472
|
-
```
|
|
473
|
-
|
|
474
|
-
### ❌ 不推荐做法
|
|
475
|
-
|
|
476
|
-
```vue
|
|
477
|
-
<!-- ❌ 错误 1:忘记设置 .drager_row 高度 -->
|
|
478
|
-
<style scoped lang="scss">
|
|
479
|
-
.my-component {
|
|
480
|
-
// 缺少 .drager_row 的高度设置
|
|
481
|
-
}
|
|
482
|
-
</style>
|
|
483
|
-
|
|
484
|
-
<!-- ❌ 错误 2:在 jh-drag-row 外层包裹不必要的容器 -->
|
|
485
|
-
<div class="wrapper">
|
|
486
|
-
<jh-drag-row>
|
|
487
|
-
<!-- 内容 -->
|
|
488
|
-
</jh-drag-row>
|
|
489
|
-
</div>
|
|
490
|
-
|
|
491
|
-
<!-- ❌ 错误 3:top-height 设置过小 -->
|
|
492
|
-
<jh-drag-row :top-height="100">
|
|
493
|
-
<!-- 上表会显得很拥挤 -->
|
|
494
|
-
</jh-drag-row>
|
|
495
|
-
```
|
|
496
|
-
|
|
497
|
-
## 高度设置建议
|
|
498
|
-
|
|
499
|
-
| 场景 | 推荐 top-height | 说明 |
|
|
500
|
-
| ---------------------- | --------------- | ------------------------------ |
|
|
501
|
-
| 简单表格(无搜索栏) | 250-300 | 足够显示表头和 5-8 条数据 |
|
|
502
|
-
| 标准表格(含搜索栏) | 350-400 | 显示搜索栏、工具栏、表格、分页 |
|
|
503
|
-
| 复杂表格(多搜索条件) | 400-450 | 搜索条件多,需要更多空间 |
|
|
504
|
-
| 强调上表(主表更重要) | 450-500 | 上表占据更多空间 |
|
|
505
|
-
| 强调下表(从表更重要) | 250-300 | 给下表留更多空间 |
|
|
506
|
-
|
|
507
|
-
## 样式定制
|
|
508
|
-
|
|
509
|
-
### 修改拖拽手柄样式
|
|
510
|
-
|
|
511
|
-
```scss
|
|
512
|
-
:deep(.drager_row) {
|
|
513
|
-
height: 100%;
|
|
514
|
-
|
|
515
|
-
// 拖拽手柄
|
|
516
|
-
.drager {
|
|
517
|
-
background: #e0e0e0; // 手柄背景色
|
|
518
|
-
height: 6px; // 手柄高度
|
|
519
|
-
cursor: row-resize; // 鼠标样式
|
|
520
|
-
|
|
521
|
-
&:hover {
|
|
522
|
-
background: #1890ff; // 悬停颜色
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
```
|
|
527
|
-
|
|
528
|
-
### 调整上下区域内边距
|
|
529
|
-
|
|
530
|
-
```scss
|
|
531
|
-
:deep(.drager_row) {
|
|
532
|
-
height: 100%;
|
|
533
|
-
|
|
534
|
-
.top-area {
|
|
535
|
-
padding: 10px;
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
.bottom-area {
|
|
539
|
-
padding: 10px;
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
```
|
|
543
|
-
|
|
544
|
-
## 性能优化
|
|
545
|
-
|
|
546
|
-
### 避免频繁重渲染
|
|
547
|
-
|
|
548
|
-
```vue
|
|
549
|
-
<script setup lang="ts">
|
|
550
|
-
// ✅ 使用防抖,避免拖拽时频繁触发查询
|
|
551
|
-
import { debounce } from "lodash-es";
|
|
552
|
-
|
|
553
|
-
const handleRowChange = debounce((row: any) => {
|
|
554
|
-
queryBottomData(row);
|
|
555
|
-
}, 300);
|
|
556
|
-
</script>
|
|
557
|
-
```
|
|
558
|
-
|
|
559
|
-
### 虚拟滚动(大数据量)
|
|
560
|
-
|
|
561
|
-
```vue
|
|
562
|
-
<!-- 上下表格数据量大时,配合虚拟滚动 -->
|
|
563
|
-
<template #top>
|
|
564
|
-
<BaseTable
|
|
565
|
-
:data="list"
|
|
566
|
-
:columns="columns"
|
|
567
|
-
virtual-scroll
|
|
568
|
-
:virtual-scroll-height="300"
|
|
569
|
-
/>
|
|
570
|
-
</template>
|
|
571
|
-
```
|
|
572
|
-
|
|
573
|
-
## 参考示例
|
|
574
|
-
|
|
575
|
-
- 📄 钢坯利库:`src/views/produce/production-order/sclk/ommt-billet-lib/index.vue`
|
|
576
|
-
- 📄 订单合并:`src/views/produce/production-order/scdd/omom-order-merge/index.vue`
|
|
577
|
-
- 📄 轧钢计划:`src/views/produce/production-mmwr/jhgl/mmwr-steel-rolling-plan/index.vue`
|
|
578
|
-
- 📄 剔钢作业:`src/views/produce/production-mmwr/sjgl/mmwr-steel-stripping-operations/index.vue`
|
|
579
|
-
|
|
580
|
-
## 总结
|
|
581
|
-
|
|
582
|
-
✅ **使用 jh-drag-row 的核心要点:**
|
|
583
|
-
|
|
584
|
-
1. **必须设置** `:deep(.drager_row) { height: 100%; }`
|
|
585
|
-
2. **合理设置** `top-height` 属性(推荐 350-450)
|
|
586
|
-
3. **确保高度链完整**(父容器 → Tab → 拖拽组件都要有高度)
|
|
587
|
-
4. **上下区域内容完整**(包含搜索栏、工具栏、表格、分页等)
|
|
588
|
-
5. **在 Tab 中使用时**额外注意样式穿透
|
|
589
|
-
|
|
590
|
-
遵循以上规范,jh-drag-row 组件能够提供流畅的拖拽体验和良好的用户交互!
|
|
1
|
+
# jh-drag-row - 可拖拽分栏组件
|
|
2
|
+
|
|
3
|
+
> 上下分栏布局组件,支持拖拽调整上下区域高度,适用于双表联动、主从表等场景
|
|
4
|
+
|
|
5
|
+
## 📦 组件位置
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
// 来自远程 common-core 包
|
|
9
|
+
import "@jhlc/common-core";
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
组件已在全局注册,无需手动导入,直接在模板中使用 `<jh-drag-row>`。
|
|
13
|
+
|
|
14
|
+
## ⚠️ 重要提醒
|
|
15
|
+
|
|
16
|
+
**使用 jh-drag-row 必须设置以下样式,否则拖拽手柄无法正常工作!**
|
|
17
|
+
|
|
18
|
+
```scss
|
|
19
|
+
// 在页面的 style 标签中添加(必需!)
|
|
20
|
+
:deep(.drager_row) {
|
|
21
|
+
height: 100%;
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
> **核心说明**:
|
|
26
|
+
> 1. 组件渲染时会自动生成 `.drager_row` CSS 类名
|
|
27
|
+
> 2. 必须使用 `:deep()` 穿透 scoped 样式
|
|
28
|
+
> 3. 如果使用全局样式文件,也可以: `.app-page-container .drager_row { height: 100%; }`
|
|
29
|
+
|
|
30
|
+
## 基本用法
|
|
31
|
+
|
|
32
|
+
### 标准双表布局(推荐)
|
|
33
|
+
|
|
34
|
+
```vue
|
|
35
|
+
<template>
|
|
36
|
+
<div class="app-container app-page-container">
|
|
37
|
+
<jh-drag-row :top-height="350">
|
|
38
|
+
<template #top>
|
|
39
|
+
<!-- 上表区域:搜索栏 -->
|
|
40
|
+
<BaseQuery
|
|
41
|
+
:form="queryParam"
|
|
42
|
+
:items="queryItems"
|
|
43
|
+
:columns="4"
|
|
44
|
+
@select="select"
|
|
45
|
+
@reset="select"
|
|
46
|
+
/>
|
|
47
|
+
|
|
48
|
+
<!-- 上表区域:工具栏 -->
|
|
49
|
+
<BaseToolbar :items="toolbars" />
|
|
50
|
+
|
|
51
|
+
<!-- 上表区域:表格 -->
|
|
52
|
+
<BaseTable
|
|
53
|
+
ref="tableRef"
|
|
54
|
+
:data="list"
|
|
55
|
+
:columns="columns"
|
|
56
|
+
showToolbar
|
|
57
|
+
@row-click="handleRowClick"
|
|
58
|
+
/>
|
|
59
|
+
|
|
60
|
+
<!-- 上表区域:分页 -->
|
|
61
|
+
<jh-pagination
|
|
62
|
+
v-show="page.total && page.total > 0"
|
|
63
|
+
:total="page.total || 0"
|
|
64
|
+
v-model:currentPage="page.current"
|
|
65
|
+
v-model:pageSize="page.size"
|
|
66
|
+
@current-change="select"
|
|
67
|
+
@size-change="select"
|
|
68
|
+
/>
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<template #bottom>
|
|
72
|
+
<!-- 下表区域:工具栏 -->
|
|
73
|
+
<BaseToolbar :items="bottomToolbars" />
|
|
74
|
+
|
|
75
|
+
<!-- 下表区域:表格 -->
|
|
76
|
+
<BaseTable
|
|
77
|
+
ref="bottomTableRef"
|
|
78
|
+
:data="bottomList"
|
|
79
|
+
:columns="bottomColumns"
|
|
80
|
+
showToolbar
|
|
81
|
+
/>
|
|
82
|
+
|
|
83
|
+
<!-- 下表区域:分页(如果需要) -->
|
|
84
|
+
<jh-pagination
|
|
85
|
+
v-show="bottomPage.total && bottomPage.total > 0"
|
|
86
|
+
:total="bottomPage.total || 0"
|
|
87
|
+
v-model:currentPage="bottomPage.current"
|
|
88
|
+
v-model:pageSize="bottomPage.size"
|
|
89
|
+
@current-change="selectBottom"
|
|
90
|
+
@size-change="selectBottom"
|
|
91
|
+
/>
|
|
92
|
+
</template>
|
|
93
|
+
</jh-drag-row>
|
|
94
|
+
</div>
|
|
95
|
+
</template>
|
|
96
|
+
|
|
97
|
+
<script setup lang="ts">
|
|
98
|
+
import { ref } from "vue";
|
|
99
|
+
|
|
100
|
+
const page = ref({ current: 1, size: 10, total: 0 });
|
|
101
|
+
const list = ref([]);
|
|
102
|
+
const bottomPage = ref({ current: 1, size: 10, total: 0 });
|
|
103
|
+
const bottomList = ref([]);
|
|
104
|
+
|
|
105
|
+
// 查询上表数据
|
|
106
|
+
const select = async () => {
|
|
107
|
+
// 查询逻辑...
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// 查询下表数据
|
|
111
|
+
const selectBottom = async () => {
|
|
112
|
+
// 查询逻辑...
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// 行点击事件:联动查询下表
|
|
116
|
+
const handleRowClick = (row: any) => {
|
|
117
|
+
// 根据选中行的数据查询下表
|
|
118
|
+
selectBottom();
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
onMounted(() => {
|
|
122
|
+
select();
|
|
123
|
+
});
|
|
124
|
+
</script>
|
|
125
|
+
|
|
126
|
+
<style scoped lang="scss">
|
|
127
|
+
// ⚠️ 必需样式:让拖拽组件占满容器高度
|
|
128
|
+
:deep(.drager_row) {
|
|
129
|
+
height: 100%;
|
|
130
|
+
}
|
|
131
|
+
</style>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 在 Tab 标签页中使用
|
|
135
|
+
|
|
136
|
+
```vue
|
|
137
|
+
<template>
|
|
138
|
+
<div class="app-container app-page-container my-page">
|
|
139
|
+
<el-tabs v-model="activeTab" class="tabs-container">
|
|
140
|
+
<el-tab-pane label="主从表" name="master">
|
|
141
|
+
<jh-drag-row :top-height="400">
|
|
142
|
+
<template #top>
|
|
143
|
+
<!-- 上表内容 -->
|
|
144
|
+
</template>
|
|
145
|
+
<template #bottom>
|
|
146
|
+
<!-- 下表内容 -->
|
|
147
|
+
</template>
|
|
148
|
+
</jh-drag-row>
|
|
149
|
+
</el-tab-pane>
|
|
150
|
+
</el-tabs>
|
|
151
|
+
</div>
|
|
152
|
+
</template>
|
|
153
|
+
|
|
154
|
+
<style scoped lang="scss">
|
|
155
|
+
.my-page {
|
|
156
|
+
.tabs-container {
|
|
157
|
+
height: calc(100vh - 120px);
|
|
158
|
+
|
|
159
|
+
:deep(.el-tabs__content) {
|
|
160
|
+
height: calc(100% - 55px);
|
|
161
|
+
padding: 10px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
:deep(.el-tab-pane) {
|
|
165
|
+
height: 100%;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// ⚠️ 核心样式:确保拖拽组件能正常工作
|
|
169
|
+
:deep(.drager_row) {
|
|
170
|
+
height: 100%;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
</style>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Props 属性
|
|
178
|
+
|
|
179
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
180
|
+
| ---------- | ------------------------------------ | --------- | ------- |
|
|
181
|
+
| top-height | 上部区域的初始高度(单位:px) | `number` | - |
|
|
182
|
+
| topPercent | 上部区域的初始百分比(与 top-height 二选一) | `number` | - |
|
|
183
|
+
| bottomHeight | 下部区域的初始高度(单位:px) | `number` | - |
|
|
184
|
+
| bottomPercent | 下部区域的初始百分比 | `number` | - |
|
|
185
|
+
| height | 容器总高度 | `string` | `"400px"` |
|
|
186
|
+
| sliderWidth | 拖拽分割线的宽度(单位:px) | `number` | `10` |
|
|
187
|
+
|
|
188
|
+
> **提示**: 推荐使用 `top-height` 设置上部区域高度,下部区域会自动填充剩余空间。
|
|
189
|
+
|
|
190
|
+
## Slots 插槽
|
|
191
|
+
|
|
192
|
+
| 插槽名 | 说明 |
|
|
193
|
+
| ------ | ------------ |
|
|
194
|
+
| top | 上部区域内容 |
|
|
195
|
+
| bottom | 下部区域内容 |
|
|
196
|
+
|
|
197
|
+
## 使用场景
|
|
198
|
+
|
|
199
|
+
### 1. 主从表联动
|
|
200
|
+
|
|
201
|
+
```vue
|
|
202
|
+
<template>
|
|
203
|
+
<div class="app-container app-page-container">
|
|
204
|
+
<jh-drag-row :top-height="350">
|
|
205
|
+
<template #top>
|
|
206
|
+
<!-- 主表:订单列表 -->
|
|
207
|
+
<BaseTable
|
|
208
|
+
:data="orderList"
|
|
209
|
+
:columns="orderColumns"
|
|
210
|
+
@row-click="handleOrderClick"
|
|
211
|
+
/>
|
|
212
|
+
</template>
|
|
213
|
+
<template #bottom>
|
|
214
|
+
<!-- 从表:订单明细 -->
|
|
215
|
+
<BaseTable :data="orderDetailList" :columns="detailColumns" />
|
|
216
|
+
</template>
|
|
217
|
+
</jh-drag-row>
|
|
218
|
+
</div>
|
|
219
|
+
</template>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### 2. 轧钢计划与钢坯信息
|
|
223
|
+
|
|
224
|
+
```vue
|
|
225
|
+
<template>
|
|
226
|
+
<div class="app-container app-page-container">
|
|
227
|
+
<jh-drag-row :top-height="380">
|
|
228
|
+
<template #top>
|
|
229
|
+
<!-- 上表:轧钢计划列表 -->
|
|
230
|
+
<BaseTable
|
|
231
|
+
:data="planList"
|
|
232
|
+
:columns="planColumns"
|
|
233
|
+
highlight-current-row
|
|
234
|
+
@current-change="handlePlanChange"
|
|
235
|
+
/>
|
|
236
|
+
</template>
|
|
237
|
+
<template #bottom>
|
|
238
|
+
<!-- 下表:钢坯信息 -->
|
|
239
|
+
<BaseToolbar :items="slabToolbars" />
|
|
240
|
+
<BaseTable :data="slabList" :columns="slabColumns" />
|
|
241
|
+
</template>
|
|
242
|
+
</jh-drag-row>
|
|
243
|
+
</div>
|
|
244
|
+
</template>
|
|
245
|
+
|
|
246
|
+
<script setup lang="ts">
|
|
247
|
+
// 上表选中行变化时,查询下表数据
|
|
248
|
+
const handlePlanChange = (row: any) => {
|
|
249
|
+
if (row && row.lotNo) {
|
|
250
|
+
querySlabList(row.lotNo);
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
</script>
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### 3. 合并订单(左右+上下布局)
|
|
257
|
+
|
|
258
|
+
```vue
|
|
259
|
+
<template>
|
|
260
|
+
<div class="app-container app-page-container">
|
|
261
|
+
<jh-drag-row :top-height="300">
|
|
262
|
+
<template #top>
|
|
263
|
+
<!-- 上部:母订单列表 -->
|
|
264
|
+
<BaseQuery :form="queryParam" :items="queryItems" />
|
|
265
|
+
<BaseTable :data="motherOrderList" :columns="columns" />
|
|
266
|
+
</template>
|
|
267
|
+
<template #bottom>
|
|
268
|
+
<!-- 下部:左右两个表格 -->
|
|
269
|
+
<div class="bottom-container">
|
|
270
|
+
<div class="left-table">
|
|
271
|
+
<div class="title">已合并订单</div>
|
|
272
|
+
<BaseTable :data="mergedList" :columns="mergedColumns" />
|
|
273
|
+
</div>
|
|
274
|
+
<div class="right-table">
|
|
275
|
+
<div class="title">未合并订单</div>
|
|
276
|
+
<BaseTable :data="unmergedList" :columns="unmergedColumns" />
|
|
277
|
+
</div>
|
|
278
|
+
</div>
|
|
279
|
+
</template>
|
|
280
|
+
</jh-drag-row>
|
|
281
|
+
</div>
|
|
282
|
+
</template>
|
|
283
|
+
|
|
284
|
+
<style scoped lang="scss">
|
|
285
|
+
.bottom-container {
|
|
286
|
+
display: flex;
|
|
287
|
+
gap: 10px;
|
|
288
|
+
height: 100%;
|
|
289
|
+
|
|
290
|
+
.left-table,
|
|
291
|
+
.right-table {
|
|
292
|
+
flex: 1;
|
|
293
|
+
overflow: auto;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
:deep(.drager_row) {
|
|
298
|
+
height: 100%;
|
|
299
|
+
}
|
|
300
|
+
</style>
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### 项目真实代码示例
|
|
304
|
+
|
|
305
|
+
```vue
|
|
306
|
+
<!-- src/views/produce/production-order/sclk/ommt-steel-lib/index.vue -->
|
|
307
|
+
<template>
|
|
308
|
+
<div class="app-container app-page-container">
|
|
309
|
+
<jh-drag-row :top-height="350">
|
|
310
|
+
<template #top>
|
|
311
|
+
<!-- 搜索栏 -->
|
|
312
|
+
<BaseQuery
|
|
313
|
+
:form="queryParam"
|
|
314
|
+
:items="queryItems"
|
|
315
|
+
:columns="4"
|
|
316
|
+
@select="select"
|
|
317
|
+
@reset="select"
|
|
318
|
+
/>
|
|
319
|
+
<!-- 工具栏 -->
|
|
320
|
+
<BaseToolbar :items="toolbars" />
|
|
321
|
+
<!-- 表格 -->
|
|
322
|
+
<BaseTable
|
|
323
|
+
ref="tableRef"
|
|
324
|
+
:data="list"
|
|
325
|
+
:columns="columns"
|
|
326
|
+
showToolbar
|
|
327
|
+
/>
|
|
328
|
+
<!-- 分页 -->
|
|
329
|
+
<jh-pagination
|
|
330
|
+
v-show="page.total && page.total > 0"
|
|
331
|
+
:total="page.total || 0"
|
|
332
|
+
v-model:currentPage="page.current"
|
|
333
|
+
v-model:pageSize="page.size"
|
|
334
|
+
@current-change="select"
|
|
335
|
+
@size-change="select"
|
|
336
|
+
/>
|
|
337
|
+
</template>
|
|
338
|
+
<template #bottom>
|
|
339
|
+
<BaseTable
|
|
340
|
+
ref="bottomTableRef"
|
|
341
|
+
:data="bottomList"
|
|
342
|
+
:columns="bottomColumns"
|
|
343
|
+
showToolbar
|
|
344
|
+
/>
|
|
345
|
+
</template>
|
|
346
|
+
</jh-drag-row>
|
|
347
|
+
</div>
|
|
348
|
+
</template>
|
|
349
|
+
|
|
350
|
+
<style scoped lang="scss">
|
|
351
|
+
.app-page-container {
|
|
352
|
+
// ⭐ 关键样式:让 drager_row 占满容器高度
|
|
353
|
+
:deep(.drager_row) {
|
|
354
|
+
height: 100%;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
</style>
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### 另一种样式写法(全局样式)
|
|
361
|
+
|
|
362
|
+
```scss
|
|
363
|
+
// index.scss (非scoped)
|
|
364
|
+
.app-page-container .drager_row {
|
|
365
|
+
height: 100%;
|
|
366
|
+
}
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## 常见问题
|
|
372
|
+
|
|
373
|
+
### ❌ 问题 1:拖拽手柄无法拖动
|
|
374
|
+
|
|
375
|
+
**原因:** 缺少关键样式 `.drager_row { height: 100%; }`
|
|
376
|
+
|
|
377
|
+
**解决方案:**
|
|
378
|
+
|
|
379
|
+
```scss
|
|
380
|
+
// 方案 1:使用 :deep() 穿透(推荐)
|
|
381
|
+
:deep(.drager_row) {
|
|
382
|
+
height: 100%;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// 方案 2:使用全局样式
|
|
386
|
+
.app-page-container .drager_row {
|
|
387
|
+
height: 100%;
|
|
388
|
+
}
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### ❌ 问题 2:上表只有一条数据时高度太矮,显示拥挤
|
|
392
|
+
|
|
393
|
+
**原因:** `top-height` 设置过小
|
|
394
|
+
|
|
395
|
+
**解决方案:**
|
|
396
|
+
|
|
397
|
+
```vue
|
|
398
|
+
<!-- 适当增加 top-height 值 -->
|
|
399
|
+
<jh-drag-row :top-height="400">
|
|
400
|
+
<!-- 推荐值:350-450 之间 -->
|
|
401
|
+
</jh-drag-row>
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### ❌ 问题 3:在 Tab 标签页中无法拖动
|
|
405
|
+
|
|
406
|
+
**原因:** Tab 容器没有设置高度,或 `.drager_row` 样式未正确应用
|
|
407
|
+
|
|
408
|
+
**解决方案:**
|
|
409
|
+
|
|
410
|
+
```scss
|
|
411
|
+
.tabs-container {
|
|
412
|
+
height: calc(100vh - 120px); // 给 Tab 容器设置高度
|
|
413
|
+
|
|
414
|
+
:deep(.el-tabs__content) {
|
|
415
|
+
height: calc(100% - 55px);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
:deep(.el-tab-pane) {
|
|
419
|
+
height: 100%;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// ⚠️ 关键:必须添加这行
|
|
423
|
+
:deep(.drager_row) {
|
|
424
|
+
height: 100%;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
### ❌ 问题 4:拖拽后布局错乱
|
|
430
|
+
|
|
431
|
+
**原因:** 容器高度链条断裂
|
|
432
|
+
|
|
433
|
+
**检查清单:**
|
|
434
|
+
|
|
435
|
+
1. ✅ 父容器是否有明确的高度(如 `calc(100vh - 120px)`)
|
|
436
|
+
2. ✅ 所有中间层容器是否设置了 `height: 100%`
|
|
437
|
+
3. ✅ `.drager_row` 是否设置了 `height: 100%`
|
|
438
|
+
4. ✅ 是否使用了 `overflow: hidden` 阻止了拖拽
|
|
439
|
+
|
|
440
|
+
## 最佳实践
|
|
441
|
+
|
|
442
|
+
### ✅ 推荐做法
|
|
443
|
+
|
|
444
|
+
```vue
|
|
445
|
+
<template>
|
|
446
|
+
<div class="app-container app-page-container my-component">
|
|
447
|
+
<jh-drag-row :top-height="380">
|
|
448
|
+
<template #top>
|
|
449
|
+
<!-- 上表完整内容:搜索栏、工具栏、表格、分页 -->
|
|
450
|
+
<BaseQuery />
|
|
451
|
+
<BaseToolbar />
|
|
452
|
+
<BaseTable />
|
|
453
|
+
<jh-pagination />
|
|
454
|
+
</template>
|
|
455
|
+
<template #bottom>
|
|
456
|
+
<!-- 下表完整内容 -->
|
|
457
|
+
<BaseToolbar />
|
|
458
|
+
<BaseTable />
|
|
459
|
+
</template>
|
|
460
|
+
</jh-drag-row>
|
|
461
|
+
</div>
|
|
462
|
+
</template>
|
|
463
|
+
|
|
464
|
+
<style scoped lang="scss">
|
|
465
|
+
.my-component {
|
|
466
|
+
// ⚠️ 必需样式
|
|
467
|
+
:deep(.drager_row) {
|
|
468
|
+
height: 100%;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
</style>
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
### ❌ 不推荐做法
|
|
475
|
+
|
|
476
|
+
```vue
|
|
477
|
+
<!-- ❌ 错误 1:忘记设置 .drager_row 高度 -->
|
|
478
|
+
<style scoped lang="scss">
|
|
479
|
+
.my-component {
|
|
480
|
+
// 缺少 .drager_row 的高度设置
|
|
481
|
+
}
|
|
482
|
+
</style>
|
|
483
|
+
|
|
484
|
+
<!-- ❌ 错误 2:在 jh-drag-row 外层包裹不必要的容器 -->
|
|
485
|
+
<div class="wrapper">
|
|
486
|
+
<jh-drag-row>
|
|
487
|
+
<!-- 内容 -->
|
|
488
|
+
</jh-drag-row>
|
|
489
|
+
</div>
|
|
490
|
+
|
|
491
|
+
<!-- ❌ 错误 3:top-height 设置过小 -->
|
|
492
|
+
<jh-drag-row :top-height="100">
|
|
493
|
+
<!-- 上表会显得很拥挤 -->
|
|
494
|
+
</jh-drag-row>
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
## 高度设置建议
|
|
498
|
+
|
|
499
|
+
| 场景 | 推荐 top-height | 说明 |
|
|
500
|
+
| ---------------------- | --------------- | ------------------------------ |
|
|
501
|
+
| 简单表格(无搜索栏) | 250-300 | 足够显示表头和 5-8 条数据 |
|
|
502
|
+
| 标准表格(含搜索栏) | 350-400 | 显示搜索栏、工具栏、表格、分页 |
|
|
503
|
+
| 复杂表格(多搜索条件) | 400-450 | 搜索条件多,需要更多空间 |
|
|
504
|
+
| 强调上表(主表更重要) | 450-500 | 上表占据更多空间 |
|
|
505
|
+
| 强调下表(从表更重要) | 250-300 | 给下表留更多空间 |
|
|
506
|
+
|
|
507
|
+
## 样式定制
|
|
508
|
+
|
|
509
|
+
### 修改拖拽手柄样式
|
|
510
|
+
|
|
511
|
+
```scss
|
|
512
|
+
:deep(.drager_row) {
|
|
513
|
+
height: 100%;
|
|
514
|
+
|
|
515
|
+
// 拖拽手柄
|
|
516
|
+
.drager {
|
|
517
|
+
background: #e0e0e0; // 手柄背景色
|
|
518
|
+
height: 6px; // 手柄高度
|
|
519
|
+
cursor: row-resize; // 鼠标样式
|
|
520
|
+
|
|
521
|
+
&:hover {
|
|
522
|
+
background: #1890ff; // 悬停颜色
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
### 调整上下区域内边距
|
|
529
|
+
|
|
530
|
+
```scss
|
|
531
|
+
:deep(.drager_row) {
|
|
532
|
+
height: 100%;
|
|
533
|
+
|
|
534
|
+
.top-area {
|
|
535
|
+
padding: 10px;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
.bottom-area {
|
|
539
|
+
padding: 10px;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
## 性能优化
|
|
545
|
+
|
|
546
|
+
### 避免频繁重渲染
|
|
547
|
+
|
|
548
|
+
```vue
|
|
549
|
+
<script setup lang="ts">
|
|
550
|
+
// ✅ 使用防抖,避免拖拽时频繁触发查询
|
|
551
|
+
import { debounce } from "lodash-es";
|
|
552
|
+
|
|
553
|
+
const handleRowChange = debounce((row: any) => {
|
|
554
|
+
queryBottomData(row);
|
|
555
|
+
}, 300);
|
|
556
|
+
</script>
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
### 虚拟滚动(大数据量)
|
|
560
|
+
|
|
561
|
+
```vue
|
|
562
|
+
<!-- 上下表格数据量大时,配合虚拟滚动 -->
|
|
563
|
+
<template #top>
|
|
564
|
+
<BaseTable
|
|
565
|
+
:data="list"
|
|
566
|
+
:columns="columns"
|
|
567
|
+
virtual-scroll
|
|
568
|
+
:virtual-scroll-height="300"
|
|
569
|
+
/>
|
|
570
|
+
</template>
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
## 参考示例
|
|
574
|
+
|
|
575
|
+
- 📄 钢坯利库:`src/views/produce/production-order/sclk/ommt-billet-lib/index.vue`
|
|
576
|
+
- 📄 订单合并:`src/views/produce/production-order/scdd/omom-order-merge/index.vue`
|
|
577
|
+
- 📄 轧钢计划:`src/views/produce/production-mmwr/jhgl/mmwr-steel-rolling-plan/index.vue`
|
|
578
|
+
- 📄 剔钢作业:`src/views/produce/production-mmwr/sjgl/mmwr-steel-stripping-operations/index.vue`
|
|
579
|
+
|
|
580
|
+
## 总结
|
|
581
|
+
|
|
582
|
+
✅ **使用 jh-drag-row 的核心要点:**
|
|
583
|
+
|
|
584
|
+
1. **必须设置** `:deep(.drager_row) { height: 100%; }`
|
|
585
|
+
2. **合理设置** `top-height` 属性(推荐 350-450)
|
|
586
|
+
3. **确保高度链完整**(父容器 → Tab → 拖拽组件都要有高度)
|
|
587
|
+
4. **上下区域内容完整**(包含搜索栏、工具栏、表格、分页等)
|
|
588
|
+
5. **在 Tab 中使用时**额外注意样式穿透
|
|
589
|
+
|
|
590
|
+
遵循以上规范,jh-drag-row 组件能够提供流畅的拖拽体验和良好的用户交互!
|