fix(测试用例): 修复功能用例关联文件跨页选择问题&文案bug
This commit is contained in:
parent
9df8359874
commit
c344bc03a0
|
@ -38,6 +38,8 @@
|
||||||
}"
|
}"
|
||||||
no-disable
|
no-disable
|
||||||
v-on="propsEvent"
|
v-on="propsEvent"
|
||||||
|
@row-select-change="rowSelectChange"
|
||||||
|
@select-all-change="selectAllChange"
|
||||||
>
|
>
|
||||||
<template #name="{ record }">
|
<template #name="{ record }">
|
||||||
<MsTag
|
<MsTag
|
||||||
|
@ -90,7 +92,7 @@
|
||||||
import type { CommonList, ModuleTreeNode, TableQueryParams } from '@/models/common';
|
import type { CommonList, ModuleTreeNode, TableQueryParams } from '@/models/common';
|
||||||
import type { FileListQueryParams } from '@/models/projectManagement/file';
|
import type { FileListQueryParams } from '@/models/projectManagement/file';
|
||||||
import { Repository } from '@/models/projectManagement/file';
|
import { Repository } from '@/models/projectManagement/file';
|
||||||
import { TableKeyEnum } from '@/enums/tableEnum';
|
import { SelectAllEnum, TableKeyEnum } from '@/enums/tableEnum';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
@ -100,7 +102,7 @@
|
||||||
offspringIds: string[]; // 当前选中文件夹的所有子孙节点id
|
offspringIds: string[]; // 当前选中文件夹的所有子孙节点id
|
||||||
modulesCount: Record<string, any>; // 模块数量
|
modulesCount: Record<string, any>; // 模块数量
|
||||||
folderTree: ModuleTreeNode[];
|
folderTree: ModuleTreeNode[];
|
||||||
selectFile: AssociatedList[]; // 表格选中项
|
// selectFile: AssociatedList[]; // 表格选中项
|
||||||
getListRequest: (params: TableQueryParams) => Promise<CommonList<AssociatedList>>;
|
getListRequest: (params: TableQueryParams) => Promise<CommonList<AssociatedList>>;
|
||||||
showType: 'Module' | 'Storage'; // 展示类型
|
showType: 'Module' | 'Storage'; // 展示类型
|
||||||
storageList: Repository[]; // 存储库列表
|
storageList: Repository[]; // 存储库列表
|
||||||
|
@ -111,7 +113,7 @@
|
||||||
}>();
|
}>();
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'init', params: FileListQueryParams): void;
|
(e: 'init', params: FileListQueryParams): void;
|
||||||
(e: 'update:selectFile', val: AssociatedList[]): void;
|
// (e: 'update:selectFile', val: AssociatedList[]): void;
|
||||||
(e: 'updateFileIds', val: string[]): void;
|
(e: 'updateFileIds', val: string[]): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
@ -125,6 +127,9 @@
|
||||||
const combine = ref<Record<string, any>>({});
|
const combine = ref<Record<string, any>>({});
|
||||||
const isMyOrAllFolder = computed(() => ['my', 'all'].includes(props.activeFolder)); // 是否是我的文件/全部文件
|
const isMyOrAllFolder = computed(() => ['my', 'all'].includes(props.activeFolder)); // 是否是我的文件/全部文件
|
||||||
|
|
||||||
|
const innerSelectFile = defineModel<AssociatedList[]>('selectFile', {
|
||||||
|
required: true,
|
||||||
|
});
|
||||||
const columns: MsTableColumn = [
|
const columns: MsTableColumn = [
|
||||||
{
|
{
|
||||||
title: 'project.fileManagement.name',
|
title: 'project.fileManagement.name',
|
||||||
|
@ -337,32 +342,67 @@
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const selectedIds = computed(() => {
|
const selectedFileIds = computed(() => {
|
||||||
return [...propsRes.value.selectedKeys];
|
return [...propsRes.value.selectedKeys];
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => selectedIds.value,
|
() => selectedFileIds.value,
|
||||||
(val) => {
|
(val) => {
|
||||||
emit(
|
const newValue = [...val];
|
||||||
'update:selectFile',
|
if (!newValue.length) {
|
||||||
propsRes.value.data.filter((item: any) => selectedIds.value.indexOf(item.id) > -1)
|
innerSelectFile.value = [];
|
||||||
);
|
}
|
||||||
emit('updateFileIds', val);
|
},
|
||||||
|
{
|
||||||
|
deep: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const selectedIds = computed(() => {
|
||||||
|
return innerSelectFile.value.map((file) => file.id);
|
||||||
|
});
|
||||||
|
|
||||||
const selectedKey = ref('');
|
const selectedKey = ref('');
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => selectedKey.value,
|
() => selectedKey.value,
|
||||||
(key) => {
|
(key) => {
|
||||||
emit(
|
innerSelectFile.value = propsRes.value.data.filter((item: any) => key === item.id);
|
||||||
'update:selectFile',
|
|
||||||
propsRes.value.data.filter((item: any) => key === item.id)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 更新选择文件
|
||||||
|
function updateInnerSelectFile(record: Record<string, any>, shouldAdd: boolean) {
|
||||||
|
const index = innerSelectFile.value.findIndex((e) => e.id === record.id);
|
||||||
|
// 已选择id且列表里边不存在id则push
|
||||||
|
if (shouldAdd) {
|
||||||
|
if (index === -1) {
|
||||||
|
innerSelectFile.value.push(record as AssociatedList);
|
||||||
|
}
|
||||||
|
// 否则则移除
|
||||||
|
} else if (index !== -1) {
|
||||||
|
innerSelectFile.value.splice(index, 1);
|
||||||
|
}
|
||||||
|
emit('updateFileIds', selectedIds.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 单选行
|
||||||
|
function rowSelectChange(record: Record<string, any>) {
|
||||||
|
updateInnerSelectFile(record, propsRes.value.selectedKeys.has(record.id));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选当前页
|
||||||
|
function selectAllChange(v: SelectAllEnum) {
|
||||||
|
propsRes.value.data.forEach((record: Record<string, any>) => {
|
||||||
|
if (v === 'current') {
|
||||||
|
updateInnerSelectFile(record, true);
|
||||||
|
} else {
|
||||||
|
updateInnerSelectFile(record, false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
resetSelector,
|
resetSelector,
|
||||||
});
|
});
|
||||||
|
|
|
@ -904,9 +904,9 @@
|
||||||
return {
|
return {
|
||||||
moduleIds,
|
moduleIds,
|
||||||
projectId: currentProjectId.value,
|
projectId: currentProjectId.value,
|
||||||
excludeIds: batchParams.value.excludeIds,
|
excludeIds: batchParams.value.excludeIds || [],
|
||||||
selectAll: batchParams.value.selectAll,
|
selectAll: batchParams.value.selectAll,
|
||||||
selectIds: batchParams.value.selectedIds as string[],
|
selectIds: batchParams.value.selectedIds || [],
|
||||||
keyword: keyword.value,
|
keyword: keyword.value,
|
||||||
combine: batchParams.value.condition,
|
combine: batchParams.value.condition,
|
||||||
};
|
};
|
||||||
|
@ -1058,9 +1058,8 @@
|
||||||
Message.success(t('caseManagement.featureCase.batchCopySuccess'));
|
Message.success(t('caseManagement.featureCase.batchCopySuccess'));
|
||||||
}
|
}
|
||||||
isMove.value = false;
|
isMove.value = false;
|
||||||
emitTableParams();
|
|
||||||
resetSelector();
|
resetSelector();
|
||||||
loadList();
|
initData();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -394,7 +394,8 @@
|
||||||
node.count = obj?.[node.id] || 0;
|
node.count = obj?.[node.id] || 0;
|
||||||
node.hideMoreAction = node.id === 'root' || props.isModal;
|
node.hideMoreAction = node.id === 'root' || props.isModal;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
{ deep: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<a-input-search
|
<a-input-search
|
||||||
v-model="platformKeyword"
|
v-model="platformKeyword"
|
||||||
:max-length="255"
|
:max-length="255"
|
||||||
:placeholder="t('project.member.searchMember')"
|
:placeholder="t('caseManagement.featureCase.searchByIdAndName')"
|
||||||
allow-clear
|
allow-clear
|
||||||
class="mx-[8px] w-[240px]"
|
class="mx-[8px] w-[240px]"
|
||||||
@search="searchHandler"
|
@search="searchHandler"
|
||||||
|
|
Loading…
Reference in New Issue