fix: 修复任务中心参数问题&关联用例调整

This commit is contained in:
xinxin.wu 2024-04-17 12:45:46 +08:00 committed by Craftsman
parent 9d2a050983
commit 8a8e584886
7 changed files with 69 additions and 51 deletions

View File

@ -113,7 +113,7 @@
</a-tooltip>
</template>
<template #caseLevel="{ record }">
<caseLevel :case-level="getCaseLevel(record)" />
<caseLevel v-if="getCaseLevel(record)" :case-level="getCaseLevel(record)" />
</template>
</ms-base-table>
<div class="footer">
@ -175,24 +175,30 @@
const appStore = useAppStore();
const { t } = useI18n();
const props = defineProps<{
visible: boolean;
projectId?: string; // id
caseId?: string; // id
getModulesFunc: (params: TableQueryParams) => Promise<ModuleTreeNode[]>; //
modulesParams?: Record<string, any>; //
getTableFunc: (params: TableQueryParams) => Promise<CommonList<CaseManagementTable>>; //
tableParams?: TableQueryParams; //
okButtonDisabled?: boolean; //
currentSelectCase: string | number | Record<string, any> | undefined; //
moduleOptions?: { label: string; value: string }[]; //
confirmLoading: boolean;
associatedIds: string[]; // id
hasNotAssociatedIds?: string[];
type: RequestModuleEnum[keyof RequestModuleEnum];
moduleCountParams?: TableQueryParams; //
hideProjectSelect?: boolean; //
}>();
const props = withDefaults(
defineProps<{
visible: boolean;
projectId?: string; // id
caseId?: string; // id
getModulesFunc: (params: TableQueryParams) => Promise<ModuleTreeNode[]>; //
modulesParams?: Record<string, any>; //
getTableFunc: (params: TableQueryParams) => Promise<CommonList<CaseManagementTable>>; //
tableParams?: TableQueryParams; //
okButtonDisabled?: boolean; //
currentSelectCase: string | number | Record<string, any> | undefined; //
moduleOptions?: { label: string; value: string }[]; //
confirmLoading: boolean;
associatedIds: string[]; // id
hasNotAssociatedIds?: string[];
type: RequestModuleEnum[keyof RequestModuleEnum];
moduleCountParams?: TableQueryParams; //
hideProjectSelect?: boolean; //
isHiddenCaseLevel?: boolean;
}>(),
{
isHiddenCaseLevel: false,
}
);
const emit = defineEmits<{
(e: 'update:visible', val: boolean): void;
@ -318,6 +324,20 @@
const keyword = ref('');
const version = ref('');
function getCaseLevelColumn() {
if (!props.isHiddenCaseLevel) {
return [
{
title: 'ms.case.associate.caseLevel',
dataIndex: 'caseLevel',
slotName: 'caseLevel',
width: 90,
},
];
}
return [];
}
const columns: MsTableColumn = [
{
title: 'ID',
@ -342,12 +362,7 @@
showTooltip: true,
width: 250,
},
{
title: 'ms.case.associate.caseLevel',
dataIndex: 'caseLevel',
slotName: 'caseLevel',
width: 90,
},
...getCaseLevelColumn(),
{
title: 'ms.case.associate.tags',
dataIndex: 'tags',
@ -355,6 +370,10 @@
},
];
watchEffect(() => {
getCaseLevelColumn();
});
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector, setTableSelected } = useTable(
props.getTableFunc,
{
@ -379,8 +398,13 @@
);
//
// TODO:
function getCaseLevel(record: CaseManagementTable) {
return (record.customFields.find((item: any) => item.name === '用例等级')?.value as CaseLevel) || 'P1';
if (record.customFields && record.customFields.length) {
const caseItem = record.customFields.find((item: any) => item.fieldName === '用例等级' && item.internal);
return caseItem?.options.find((item: any) => item.value === caseItem?.defaultValue).text;
}
return undefined;
}
const searchParams = ref<TableQueryParams>({

View File

@ -78,6 +78,7 @@
:case-id="props.bugId"
:associated-ids="associatedIds"
:type="RequestModuleEnum.BUG_MANAGEMENT"
:is-hidden-case-level="true"
@close="emit('close')"
@save="saveHandler"
>

View File

@ -64,6 +64,7 @@
:case-id="props.caseId"
:associated-ids="associatedIds"
:type="RequestModuleEnum.API_CASE"
:is-hidden-case-level="true"
@close="emit('close')"
@save="saveHandler"
>

View File

@ -5,7 +5,7 @@
<div class="wrapper mb-6 flex justify-between">
<span class="font-medium text-[var(--color-text-000)]">{{ t('project.basicInfo.basicInfo') }}</span>
<a-button
v-if="!projectDetail?.deleted"
v-show="!projectDetail?.deleted"
v-permission="['PROJECT_BASE_INFO:READ+UPDATE']"
type="outline"
@click="editHandler"
@ -19,12 +19,9 @@
<span class="one-line-text mr-1 max-w-[300px] font-medium text-[var(--color-text-000)]">{{
projectDetail?.name
}}</span>
<span
v-if="!projectDetail?.deleted && projectDetail?.enable"
class="button mr-1"
:class="[projectDetail?.enable ? 'enable-button' : 'delete-button']"
>{{ projectDetail?.enable ? t('project.basicInfo.enable') : t('project.basicInfo.enable') }}</span
>
<span class="button mr-1" :class="[projectDetail?.deleted ? 'delete-button' : 'enable-button']">{{
projectDetail?.deleted ? t('project.basicInfo.deleted') : t('project.basicInfo.enable')
}}</span>
</div>
<div class="one-line-text text-xs text-[--color-text-4]">{{ projectDetail?.description }}</div>
</div>

View File

@ -1,13 +1,6 @@
<template>
<div class="flex flex-row items-center">
<div class="text-[var(--color-text-1)]"> {{ t('project.menu.management') }}</div>
<div>
<MsIcon
class="ml-[4px] text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]"
type="icon-icon-maybe_outlined"
/>
</div>
</div>
<MsBaseTable
ref="tableRef"

View File

@ -500,7 +500,7 @@
function batchStopRealTask() {
openModal({
type: 'warning',
title: t('project.taskCenter.batchStopTask', { num: batchParams.value.selectIds.length }),
title: t('project.taskCenter.batchStopTask', { num: batchParams.value.currentSelectCount }),
content: t('project.taskCenter.stopTaskContent'),
okText: t('project.taskCenter.confirmStop'),
cancelText: t('common.cancel'),
@ -509,11 +509,12 @@
},
onBeforeOk: async () => {
try {
const { selectIds, selectAll } = batchParams.value;
const { selectIds, selectAll, excludeIds } = batchParams.value;
await loadRealMap.value[props.group].batchStop({
moduleType: props.moduleType,
selectIds: selectAll ? [] : selectIds,
selectAll,
selectIds: selectIds || [],
selectAll: !!selectAll,
excludeIds: excludeIds || [],
condition: {
keyword: keyword.value,
filter: {

View File

@ -488,7 +488,7 @@
function batchEnableTask() {
openModal({
type: 'warning',
title: t('project.taskCenter.batchEnableTask', { num: batchParams.value.selectIds.length }),
title: t('project.taskCenter.batchEnableTask', { num: batchParams.value.currentSelectCount }),
content: t('project.taskCenter.batchEnableTaskContent'),
okText: t('project.taskCenter.confirmEnable'),
cancelText: t('common.cancel'),
@ -499,8 +499,8 @@
try {
const { selectIds, selectAll, excludeIds } = batchParams.value;
await loadRealMap.value[props.group].batchEnable({
selectIds: selectAll ? [] : selectIds,
selectAll,
selectIds: selectIds || [],
selectAll: !!selectAll,
scheduleTagType: props.moduleType,
excludeIds,
condition: {
@ -526,7 +526,7 @@
function batchDisableTask() {
openModal({
type: 'warning',
title: t('project.taskCenter.batchDisableTask', { num: batchParams.value.selectIds.length }),
title: t('project.taskCenter.batchDisableTask', { num: batchParams.value.currentSelectCount }),
content: t('project.taskCenter.batchDisableTaskContent'),
okText: t('project.taskCenter.confirmDisable'),
cancelText: t('common.cancel'),
@ -535,10 +535,11 @@
},
onBeforeOk: async () => {
try {
const { selectIds, selectAll } = batchParams.value;
const { selectIds, selectAll, excludeIds } = batchParams.value;
await loadRealMap.value[props.group].batchDisable({
selectIds: selectAll ? [] : selectIds,
selectAll,
selectIds: selectIds || [],
selectAll: !!selectAll,
excludeIds: excludeIds || [],
scheduleTagType: props.moduleType,
condition: {
keyword: keyword.value,