85
85
<script lang="ts" setup>
86
86
import * as DefinitionApi from ' @/api/bpm/definition'
87
87
import * as ProcessInstanceApi from ' @/api/bpm/processInstance'
88
- import { CategoryApi } from ' @/api/bpm/category'
88
+ import { CategoryApi , CategoryVO } from ' @/api/bpm/category'
89
89
import ProcessDefinitionDetail from ' ./ProcessDefinitionDetail.vue'
90
90
import { groupBy } from ' lodash-es'
91
91
@@ -221,14 +221,14 @@ const handleSelect = async (row, formVariables?) => {
221
221
processDefinitionDetailRef .value ?.initProcessInfo (row , formVariables )
222
222
}
223
223
224
- /** 处理滚动事件 */
225
- const handleScroll = (e ) => {
224
+ /** 处理滚动事件,和左侧分类联动 */
225
+ const handleScroll = (e : any ) => {
226
226
// 直接使用事件对象获取滚动位置
227
227
const scrollTop = e .scrollTop
228
228
229
229
// 获取所有分类区域的位置信息
230
230
const categoryPositions = categoryList .value
231
- .map ((category ) => {
231
+ .map ((category : CategoryVO ) => {
232
232
const categoryRef = proxy .$refs [` category-${category .code } ` ]
233
233
if (categoryRef ?.[0 ]) {
234
234
return {
@@ -254,29 +254,31 @@ const handleScroll = (e) => {
254
254
255
255
// 更新当前 active 的分类
256
256
if (currentCategory && categoryActive .value .code !== currentCategory .code ) {
257
- categoryActive .value = categoryList .value .find ((c ) => c .code === currentCategory .code )
257
+ categoryActive .value = categoryList .value .find (
258
+ (c : CategoryVO ) => c .code === currentCategory .code
259
+ )
258
260
}
259
261
}
260
262
261
- /** 初始化 */
262
- onMounted (() => {
263
- getList ()
264
- })
265
-
266
- /** 过滤出有流程的分类列表 */
263
+ /** 过滤出有流程的分类列表。目的:只展示有流程的分类 */
267
264
const availableCategories = computed (() => {
268
265
if (! categoryList .value ?.length || ! processDefinitionGroup .value ) {
269
266
return []
270
267
}
271
-
268
+
272
269
// 获取所有有流程的分类代码
273
270
const availableCategoryCodes = Object .keys (processDefinitionGroup .value )
274
-
271
+
275
272
// 过滤出有流程的分类
276
- return categoryList .value .filter (category =>
273
+ return categoryList .value .filter (( category : CategoryVO ) =>
277
274
availableCategoryCodes .includes (category .code )
278
275
)
279
276
})
277
+
278
+ /** 初始化 */
279
+ onMounted (() => {
280
+ getList ()
281
+ })
280
282
</script >
281
283
282
284
<style lang="scss" scoped>
0 commit comments