fix: TODO 修改
parent
374335a3c1
commit
c4930bc52c
|
@ -7,7 +7,6 @@ import { Page, useVbenModal } from '@vben/common-ui';
|
|||
import { IconifyIcon } from '@vben/icons';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import { refAutoReset } from '@vueuse/core';
|
||||
import { useSortable } from '@vueuse/integrations/useSortable';
|
||||
import { Button, Card, Dropdown, Input, Menu, message } from 'ant-design-vue';
|
||||
|
||||
|
@ -28,7 +27,7 @@ const [CategoryFormModal, categoryFormModalApi] = useVbenModal({
|
|||
destroyOnClose: true,
|
||||
});
|
||||
// 模型列表加载状态
|
||||
const modelListSpinning = refAutoReset(false, 3000);
|
||||
const modelListSpinning = ref(false);
|
||||
// 保存排序状态
|
||||
const saveSortLoading = ref(false);
|
||||
// 按照 category 分组的数据
|
||||
|
@ -148,7 +147,6 @@ async function handleCategorySortSubmit() {
|
|||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<!-- TODO @jason:体感整个页面的加载,有点卡顿。先看到分类,大概 1-2 秒后,上箭头变成下,然后看到每个模型。我本地大概 4 个分类,每个分类下 20+ 模型 -->
|
||||
<!-- 流程分类表单弹窗 -->
|
||||
<CategoryFormModal @success="getList" />
|
||||
<Card
|
||||
|
@ -212,11 +210,12 @@ async function handleCategorySortSubmit() {
|
|||
<!-- 按照分类,展示其所属的模型列表 -->
|
||||
<div class="px-3" ref="categoryGroupRef">
|
||||
<CategoryDraggableModel
|
||||
v-for="element in categoryGroup"
|
||||
v-for="(element, index) in categoryGroup"
|
||||
:class="isCategorySorting ? 'cursor-move' : ''"
|
||||
:key="element.id"
|
||||
:category-info="element"
|
||||
:is-category-sorting="isCategorySorting"
|
||||
:is-first="index === 0"
|
||||
@success="getList"
|
||||
/>
|
||||
</div>
|
||||
|
|
|
@ -45,6 +45,7 @@ import { useGridColumns } from './data';
|
|||
const props = defineProps<{
|
||||
categoryInfo: ModelCategoryInfo;
|
||||
isCategorySorting: boolean;
|
||||
isFirst?: boolean; // 是否为第一个分类
|
||||
}>();
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
|
@ -68,7 +69,8 @@ const userId = userStore.userInfo?.id;
|
|||
const isModelSorting = ref(false);
|
||||
const originalData = ref<BpmModelApi.Model[]>([]);
|
||||
const modelList = ref<BpmModelApi.Model[]>([]);
|
||||
const isExpand = ref(false);
|
||||
// 根据是否为第一个分类, 来设置初始展开状态
|
||||
const isExpand = ref(!!props.isFirst);
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions: {
|
||||
|
@ -376,9 +378,7 @@ const updateModelList = useDebounceFn(() => {
|
|||
const newModelList = props.categoryInfo.modelList;
|
||||
if (!isEqual(modelList.value, newModelList)) {
|
||||
modelList.value = cloneDeep(newModelList);
|
||||
if (newModelList?.length > 0) {
|
||||
isExpand.value = true;
|
||||
}
|
||||
// 不再自动设置展开状态,除非是第一个分类
|
||||
// 关闭排序
|
||||
isModelSorting.value = false;
|
||||
// 重置排序实例
|
||||
|
|
Loading…
Reference in New Issue