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