feat: 补充(系统&组织&项目)任务中心新增字段

This commit is contained in:
xinxin.wu 2024-05-08 15:16:20 +08:00 committed by Craftsman
parent 92a1ca5aa7
commit a44efef7a3
6 changed files with 79 additions and 22 deletions

View File

@ -66,9 +66,12 @@ export enum TableKeyEnum {
TASK_API_CASE_SYSTEM = 'taskCenterApiCaseSystem',
TASK_API_CASE_ORGANIZATION = 'taskCenterApiCaseOrganization',
TASK_API_CASE_PROJECT = 'taskCenterApiCaseProject',
TASK_SCHEDULE_TASK_SYSTEM = 'taskCenterScheduleSystem',
TASK_SCHEDULE_TASK_ORGANIZATION = 'taskCenterScheduleOrganization',
TASK_SCHEDULE_TASK_PROJECT = 'taskCenterScheduleProject',
TASK_SCHEDULE_TASK_API_IMPORT_SYSTEM = 'taskCenterScheduleApiImportSystem',
TASK_SCHEDULE_TASK_API_SCENARIO_SYSTEM = 'taskCenterScheduleApiScenarioSystem',
TASK_SCHEDULE_TASK_API_IMPORT_ORGANIZATION = 'taskCenterScheduleApiImportOrganization',
TASK_SCHEDULE_TASK_API_SCENARIO_ORGANIZATION = 'taskCenterScheduleApiScenarioOrganization',
TASK_SCHEDULE_TASK_API_IMPORT_PROJECT = 'taskCenterScheduleApiImportProject',
TASK_SCHEDULE_TASK_API_SCENARIO_PROJECT = 'taskCenterScheduleApiScenarioProject',
}
// 具有特殊功能的列

View File

@ -313,8 +313,7 @@
</a-form>
</MsDrawer>
<MsDrawer v-model:visible="taskDrawerVisible" :width="960" :title="t('apiTestManagement.timeTask')" :footer="false">
<div class="mb-[16px] flex items-center justify-between">
{{ t('apiTestManagement.timeTaskList') }}
<div class="mb-[16px] flex items-center justify-end">
<a-input-search
v-model:model-value="keyword"
:placeholder="t('apiTestManagement.searchTaskPlaceholder')"

View File

@ -111,11 +111,7 @@
mode="remote"
value-key="id"
label-key="name"
:type="
groupColumnsMap[props.group].key === TableKeyEnum.TASK_SCHEDULE_TASK_SYSTEM
? UserRequestTypeEnum.SYSTEM_PROJECT_LIST
: UserRequestTypeEnum.SYSTEM_ORGANIZATION_PROJECT
"
:type="UserRequestTypeEnum.SYSTEM_ORGANIZATION_PROJECT"
:placeholder-text="t('project.taskCenter.filterOrgPlaceholderText')"
@search="initData()"
>

View File

@ -83,7 +83,8 @@
<template
v-if="
hasAnyPermission(
groupColumnsMap[props.group].key === TableKeyEnum.TASK_SCHEDULE_TASK_SYSTEM
groupColumnsMap[props.group].key === TableKeyEnum.TASK_SCHEDULE_TASK_API_IMPORT_SYSTEM ||
groupColumnsMap[props.group].key === TableKeyEnum.TASK_SCHEDULE_TASK_API_SCENARIO_SYSTEM
? ['SYSTEM_ORGANIZATION_PROJECT:READ']
: ['ORGANIZATION_PROJECT:READ']
)
@ -98,7 +99,8 @@
:load-option-params="{ organizationId: appStore.currentOrgId }"
:placeholder-text="t('project.taskCenter.filterProPlaceholderText')"
:type="
groupColumnsMap[props.group].key === TableKeyEnum.TASK_SCHEDULE_TASK_SYSTEM
groupColumnsMap[props.group].key === TableKeyEnum.TASK_SCHEDULE_TASK_API_IMPORT_SYSTEM ||
groupColumnsMap[props.group].key === TableKeyEnum.TASK_SCHEDULE_TASK_API_SCENARIO_SYSTEM
? UserRequestTypeEnum.SYSTEM_PROJECT_LIST
: UserRequestTypeEnum.SYSTEM_ORGANIZATION_PROJECT
"
@ -273,7 +275,6 @@
showDrag: false,
sortIndex: 1,
columnSelectorDisabled: true,
fixed: 'left',
},
{
title: 'project.taskCenter.resourceName',
@ -334,19 +335,60 @@
},
];
const groupColumnsMap = {
const swaggerUrlColumn: MsTableColumn = [
{
title: 'project.taskCenter.swaggerUrl',
slotName: 'swaggerUrl',
dataIndex: 'swaggerUrl',
width: 300,
showDrag: false,
showTooltip: true,
columnSelectorDisabled: true,
showInTable: true,
},
];
const groupColumnsMap: Record<string, any> = {
system: {
key: TableKeyEnum.TASK_SCHEDULE_TASK_SYSTEM,
API_IMPORT: {
key: TableKeyEnum.TASK_SCHEDULE_TASK_API_IMPORT_SYSTEM,
columns: [
...ordAndProjectColumn,
...columns.slice(0, 2),
...swaggerUrlColumn,
...columns.slice(2, columns.length),
],
},
API_SCENARIO: {
key: TableKeyEnum.TASK_SCHEDULE_TASK_API_SCENARIO_SYSTEM,
columns: [...ordAndProjectColumn, ...columns],
},
},
organization: {
key: TableKeyEnum.TASK_SCHEDULE_TASK_ORGANIZATION,
API_IMPORT: {
key: TableKeyEnum.TASK_SCHEDULE_TASK_API_IMPORT_ORGANIZATION,
columns: [
...ordAndProjectColumn.slice(-1),
...columns.slice(0, 2),
...swaggerUrlColumn,
...columns.slice(2, columns.length),
],
},
API_SCENARIO: {
key: TableKeyEnum.TASK_SCHEDULE_TASK_API_SCENARIO_ORGANIZATION,
columns: [...ordAndProjectColumn.slice(-1), ...columns],
},
},
project: {
key: TableKeyEnum.TASK_SCHEDULE_TASK_PROJECT,
API_IMPORT: {
key: TableKeyEnum.TASK_SCHEDULE_TASK_API_IMPORT_PROJECT,
columns: [...columns.slice(0, 2), ...swaggerUrlColumn, ...columns.slice(2, columns.length)],
},
API_SCENARIO: {
key: TableKeyEnum.TASK_SCHEDULE_TASK_API_SCENARIO_PROJECT,
columns,
},
},
};
const orgFilterVisible = ref<boolean>(false);
const projectFilterVisible = ref<boolean>(false);
@ -373,7 +415,7 @@
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector } = useTable(
loadRealMap.value[props.group].list,
{
tableKey: groupColumnsMap[props.group].key,
tableKey: groupColumnsMap[props.group][props.moduleType].key,
scroll: {
x: 1200,
},
@ -602,7 +644,22 @@
}
);
await tableStore.initColumn(groupColumnsMap[props.group].key, groupColumnsMap[props.group].columns, 'drawer', true);
await tableStore.initColumn(
groupColumnsMap[props.group][props.moduleType].key,
groupColumnsMap[props.group][props.moduleType].columns,
'drawer',
true
);
const tableRef = ref();
watch(
() => props.moduleType,
(val) => {
if (val) {
tableRef.value.initColumn(groupColumnsMap[props.group][props.moduleType].columns);
}
}
);
</script>
<style scoped lang="less">

View File

@ -55,6 +55,7 @@ export default {
'project.taskCenter.batchDisableTask': 'Are you sure to disable {num} tasks?',
'project.taskCenter.batchEnableTaskContent': 'Enabling will execute the task',
'project.taskCenter.batchDisableTaskContent': 'Closing will affect the execution of the task',
'project.taskCenter.swaggerUrl': 'Swagger Url',
'project.taskCenter.confirmEnable': 'Confirm enable',
'project.taskCenter.confirmDisable': 'Confirm disable',
'project.taskCenter.enableSuccess': 'Enable successfully',

View File

@ -53,6 +53,7 @@ export default {
'project.taskCenter.batchDisableTask': '确定关闭 {num} 个任务吗?',
'project.taskCenter.batchEnableTaskContent': '开启会执行任务',
'project.taskCenter.batchDisableTaskContent': '关闭后会影响任务的执行',
'project.taskCenter.swaggerUrl': 'Swagger Url',
'project.taskCenter.confirmEnable': '确认开启',
'project.taskCenter.confirmDisable': '确认关闭',
'project.taskCenter.enableSuccess': '开启成功',