fix(用例管理): 修复用例管理关联文件时的一揽子缺陷:切换存储模式时数据加载问题、各种统计问题、表格字段没有支持排序的问题

This commit is contained in:
song-tianyang 2024-02-27 17:21:00 +08:00 committed by 刘瑞斌
parent a74f9cc9e6
commit 867886860f
6 changed files with 51 additions and 35 deletions

View File

@ -23,5 +23,7 @@ public class ModuleConstants {
/* 模块数量统计相关key */ /* 模块数量统计相关key */
public static final String MODULE_COUNT_ALL = "all"; public static final String MODULE_COUNT_ALL = "all";
public static final String MODULE_COUNT_MY = "my"; public static final String MODULE_COUNT_MY = "my";
public static final String MODULE_COUNT_GIT = "git";
public static final String MODULE_COUNT_MINIO = "minio";
/* 模块数量统计相关key end*/ /* 模块数量统计相关key end*/
} }

View File

@ -40,10 +40,10 @@ public class FileInformationResponse {
@Schema(description = "模块ID") @Schema(description = "模块ID")
private String moduleId; private String moduleId;
@Schema(description = "更新") @Schema(description = "创建")
private String createUser; private String createUser;
@Schema(description = "更新时间") @Schema(description = "创建时间")
private long createTime; private long createTime;
@Schema(description = "更新人") @Schema(description = "更新人")

View File

@ -30,7 +30,7 @@
SELECT SELECT
f.id, f.id,
updateUser.name as update_user, updateUser.name as update_user,
createUser.name AS create_uUser, createUser.name AS create_user,
f.module_id, f.module_id,
f.name, f.name,
f.type, f.type,

View File

@ -459,10 +459,16 @@ public class FileMetadataService {
myFileCountDTO.setStorage(null); myFileCountDTO.setStorage(null);
myFileCountDTO.setHiddenIds(pageDTO.getHiddenIds()); myFileCountDTO.setHiddenIds(pageDTO.getHiddenIds());
long allCount = extFileMetadataMapper.fileCount(myFileCountDTO); long allCount = extFileMetadataMapper.fileCount(myFileCountDTO);
//查找git文件数量
myFileCountDTO.setStorage(StorageType.GIT.name());
long gitAllCount = extFileMetadataMapper.fileCount(myFileCountDTO);
myFileCountDTO.setStorage(null);
myFileCountDTO.setOperator(operator); myFileCountDTO.setOperator(operator);
long myFileCount = extFileMetadataMapper.fileCount(myFileCountDTO); long myFileCount = extFileMetadataMapper.fileCount(myFileCountDTO);
moduleCountMap.put(ModuleConstants.MODULE_COUNT_MY, myFileCount); moduleCountMap.put(ModuleConstants.MODULE_COUNT_MY, myFileCount);
moduleCountMap.put(ModuleConstants.MODULE_COUNT_ALL, allCount); moduleCountMap.put(ModuleConstants.MODULE_COUNT_ALL, allCount);
moduleCountMap.put(ModuleConstants.MODULE_COUNT_GIT, gitAllCount);
moduleCountMap.put(ModuleConstants.MODULE_COUNT_MINIO, allCount - gitAllCount);
return moduleCountMap; return moduleCountMap;
} }

View File

@ -72,6 +72,7 @@
:get-list-request="props.getListRequest" :get-list-request="props.getListRequest"
:get-list-fun-params="props.getListFunParams" :get-list-fun-params="props.getListFunParams"
:selector-type="props.selectorType" :selector-type="props.selectorType"
:file-all-count-by-storage="fileAllCountByStorage"
@init="handleModuleTableInit" @init="handleModuleTableInit"
/> />
</template> </template>
@ -80,22 +81,22 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import {ref} from 'vue';
import MsButton from '@/components/pure/ms-button/index.vue'; import MsButton from '@/components/pure/ms-button/index.vue';
import MsDrawer from '@/components/pure/ms-drawer/index.vue'; import MsDrawer from '@/components/pure/ms-drawer/index.vue';
import MsSplitBox from '@/components/pure/ms-split-box/index.vue'; import MsSplitBox from '@/components/pure/ms-split-box/index.vue';
import FileTree from './fileTree.vue'; import FileTree from './fileTree.vue';
import LinkFileTable from './linkFileTable.vue'; import LinkFileTable from './linkFileTable.vue';
import StorageList from './storageList.vue'; import StorageList from './storageList.vue';
import { useI18n } from '@/hooks/useI18n'; import {useI18n} from '@/hooks/useI18n';
import type { AssociatedList } from '@/models/caseManagement/featureCase'; import type {AssociatedList} from '@/models/caseManagement/featureCase';
import type { CommonList, ModuleTreeNode, TableQueryParams } from '@/models/common'; import type {CommonList, ModuleTreeNode, TableQueryParams} from '@/models/common';
import { FileListQueryParams, Repository } from '@/models/projectManagement/file'; import {FileListQueryParams, Repository} from '@/models/projectManagement/file';
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps<{ const props = defineProps<{
visible: boolean; visible: boolean;
@ -136,6 +137,7 @@
const modulesCount = ref<Record<string, number>>({}); const modulesCount = ref<Record<string, number>>({});
const myFileCount = ref(0); const myFileCount = ref(0);
const allFileCount = ref(0); const allFileCount = ref(0);
const fileAllCountByStorage = ref<number>(0);
const isExpandAll = ref(false); const isExpandAll = ref(false);
@ -175,10 +177,11 @@
try { try {
modulesCount.value = await props.getCountRequest(params); modulesCount.value = await props.getCountRequest(params);
myFileCount.value = modulesCount.value.my || 0; myFileCount.value = modulesCount.value.my || 0;
if (showType.value === 'Storage') { allFileCount.value = modulesCount.value.all;
allFileCount.value = storageCount.value; if(showType.value === 'Storage'){
} else { fileAllCountByStorage.value = modulesCount.value.git;
allFileCount.value = modulesCount.value.all || 0; }else {
fileAllCountByStorage.value = modulesCount.value.minio;
} }
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
@ -195,18 +198,6 @@
function changeShowType(val: string | number | boolean) { function changeShowType(val: string | number | boolean) {
showType.value = val as FileShowType; showType.value = val as FileShowType;
activeFolder.value = 'all'; activeFolder.value = 'all';
if (val === 'Storage') {
initModulesCount({
...tableFilterParams.value,
combine: {
...tableFilterParams.value.combine,
// ...props.getListFunParams.combine,
storage: 'git',
},
});
} else {
initModulesCount(tableFilterParams.value);
}
} }
/** /**

View File

@ -84,6 +84,7 @@ const { t } = useI18n();
storageList: Repository[]; // storageList: Repository[]; //
getListFunParams: TableQueryParams; // getListFunParams: TableQueryParams; //
selectorType?: 'none' | 'checkbox' | 'radio'; selectorType?: 'none' | 'checkbox' | 'radio';
fileAllCountByStorage: number;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'init', params: FileListQueryParams): void; (e: 'init', params: FileListQueryParams): void;
@ -105,6 +106,10 @@ const { t } = useI18n();
title: 'project.fileManagement.name', title: 'project.fileManagement.name',
slotName: 'name', slotName: 'name',
dataIndex: 'name', dataIndex: 'name',
sortable: {
sortDirections: ['ascend', 'descend'],
sorter: true,
},
width: 270, width: 270,
}, },
{ {
@ -119,20 +124,32 @@ const { t } = useI18n();
}, },
{ {
title: 'project.fileManagement.creator', title: 'project.fileManagement.creator',
dataIndex: 'creator', dataIndex: 'createUser',
showTooltip: true, showTooltip: true,
width: 120, width: 120,
sortable: {
sortDirections: ['ascend', 'descend'],
sorter: true,
},
}, },
{ {
title: 'project.fileManagement.updater', title: 'project.fileManagement.updater',
dataIndex: 'updateUser', dataIndex: 'updateUser',
showTooltip: true, showTooltip: true,
width: 120, width: 120,
sortable: {
sortDirections: ['ascend', 'descend'],
sorter: true,
},
}, },
{ {
title: 'project.fileManagement.updateTime', title: 'project.fileManagement.updateTime',
dataIndex: 'updateTime', dataIndex: 'updateTime',
width: 180, width: 180,
sortable: {
sortDirections: ['ascend', 'descend'],
sorter: true,
},
}, },
]; ];
@ -174,7 +191,7 @@ const { t } = useI18n();
} else { } else {
combine.value.createUser = ''; combine.value.createUser = '';
} }
if (fileType.value === 'storage') { if (props.showType === 'Storage') {
combine.value.storage = 'git'; combine.value.storage = 'git';
} else { } else {
combine.value.storage = 'minio'; combine.value.storage = 'minio';
@ -258,7 +275,7 @@ const { t } = useI18n();
if (props.activeFolder === 'all') { if (props.activeFolder === 'all') {
return { return {
name: t('ms.file.allFileModule'), name: t('ms.file.allFileModule'),
count: props.modulesCount[props.activeFolder], count: props.fileAllCountByStorage,
}; };
} }
return { return {
@ -271,7 +288,7 @@ const { t } = useI18n();
if (props.activeFolder === 'all') { if (props.activeFolder === 'all') {
return { return {
name: t('ms.file.allRepositoryFileModule'), name: t('ms.file.allRepositoryFileModule'),
count: storageItemCount.value, count: props.fileAllCountByStorage,
}; };
} }
return { return {