File tree Expand file tree Collapse file tree 1 file changed +38
-1
lines changed
src/views/bpm/processInstance/create Expand file tree Collapse file tree 1 file changed +38
-1
lines changed Original file line number Diff line number Diff line change 33
33
</div >
34
34
</el-col >
35
35
<el-col :span =" 19" >
36
- <el-scrollbar ref =" scrollWrapper" height =" 700" >
36
+ <el-scrollbar ref =" scrollWrapper" height =" 700" @scroll = " handleScroll " >
37
37
<div
38
38
class =" mb-20px pl-10px"
39
39
v-for =" (definitions, categoryCode) in processDefinitionGroup"
@@ -220,6 +220,43 @@ const handleSelect = async (row, formVariables?) => {
220
220
processDefinitionDetailRef .value ?.initProcessInfo (row , formVariables )
221
221
}
222
222
223
+ /** 处理滚动事件 */
224
+ const handleScroll = (e ) => {
225
+ // 直接使用事件对象获取滚动位置
226
+ const scrollTop = e .scrollTop
227
+
228
+ // 获取所有分类区域的位置信息
229
+ const categoryPositions = categoryList .value
230
+ .map ((category ) => {
231
+ const categoryRef = proxy .$refs [` category-${category .code } ` ]
232
+ if (categoryRef ?.[0 ]) {
233
+ return {
234
+ code: category .code ,
235
+ offsetTop: categoryRef [0 ].offsetTop ,
236
+ height: categoryRef [0 ].offsetHeight
237
+ }
238
+ }
239
+ return null
240
+ })
241
+ .filter (Boolean )
242
+
243
+ // 查找当前滚动位置对应的分类
244
+ let currentCategory = categoryPositions [0 ]
245
+ for (const position of categoryPositions ) {
246
+ // 为了更好的用户体验,可以添加一个缓冲区域(比如 50px)
247
+ if (scrollTop >= position .offsetTop - 50 ) {
248
+ currentCategory = position
249
+ } else {
250
+ break
251
+ }
252
+ }
253
+
254
+ // 更新当前 active 的分类
255
+ if (currentCategory && categoryActive .value .code !== currentCategory .code ) {
256
+ categoryActive .value = categoryList .value .find ((c ) => c .code === currentCategory .code )
257
+ }
258
+ }
259
+
223
260
/** 初始化 */
224
261
onMounted (() => {
225
262
getList ()
You can’t perform that action at this time.
0 commit comments