feat(任务中心): 任务中心权限
This commit is contained in:
parent
3487d8f8fd
commit
409b2511a0
|
@ -93,7 +93,7 @@
|
|||
</template>
|
||||
</a-popover>
|
||||
</li>
|
||||
<li>
|
||||
<li v-permission="['PROJECT_CASE_TASK_CENTER:READ', 'PROJECT_SCHEDULE_TASK_CENTER:READ']">
|
||||
<a-tooltip :content="t('settings.navbar.task')">
|
||||
<a-button type="secondary" @click="goTaskCenter">
|
||||
<template #icon>
|
||||
|
|
|
@ -143,7 +143,7 @@ const Setting: AppRouteRecordRaw = {
|
|||
component: () => import('@/views/setting/system/taskCenter/index.vue'),
|
||||
meta: {
|
||||
locale: 'menu.projectManagement.taskCenter',
|
||||
roles: ['SYSTEM_TASK_CENTER:READ'],
|
||||
roles: [' SYSTEM_CASE_TASK_CENTER:READ'],
|
||||
isTopMenu: true,
|
||||
},
|
||||
},
|
||||
|
@ -406,7 +406,7 @@ const Setting: AppRouteRecordRaw = {
|
|||
component: () => import('@/views/setting/organization/taskCenter/index.vue'),
|
||||
meta: {
|
||||
locale: 'menu.projectManagement.taskCenter',
|
||||
roles: ['ORGANIZATION_TASK_CENTER:READ'],
|
||||
roles: ['ORGANIZATION_CASE_TASK_CENTER:READ'],
|
||||
isTopMenu: true,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
<template #action="{ record }">
|
||||
<MsButton
|
||||
v-if="[ExecuteStatusEnum.RUNNING, ExecuteStatusEnum.RERUNNING].includes(record.status)"
|
||||
v-permission="['SYSTEM_USER:READ+DELETE']"
|
||||
v-permission="[getCurrentPermission('STOP')]"
|
||||
@click="stopTask(record)"
|
||||
>
|
||||
{{ t('common.stop') }}
|
||||
|
@ -69,11 +69,7 @@
|
|||
>
|
||||
{{ t('ms.taskCenter.rerun') }}
|
||||
</MsButton> -->
|
||||
<MsButton
|
||||
v-if="record.status === ExecuteStatusEnum.COMPLETED"
|
||||
v-permission="['SYSTEM_USER:READ+DELETE']"
|
||||
@click="checkExecuteResult(record)"
|
||||
>
|
||||
<MsButton v-if="record.status === ExecuteStatusEnum.COMPLETED" @click="checkExecuteResult(record)">
|
||||
{{ t('ms.taskCenter.executeResult') }}
|
||||
</MsButton>
|
||||
</template>
|
||||
|
@ -124,12 +120,11 @@
|
|||
import useModal from '@/hooks/useModal';
|
||||
import useTableStore from '@/hooks/useTableStore';
|
||||
import { characterLimit } from '@/utils';
|
||||
import { hasAnyPermission } from '@/utils/permission';
|
||||
|
||||
import { TaskCenterTaskDetailItem } from '@/models/taskCenter';
|
||||
import { TableKeyEnum } from '@/enums/tableEnum';
|
||||
import { FilterSlotNameEnum } from '@/enums/tableFilterEnum';
|
||||
import { ExecuteResultEnum, ExecuteStatusEnum } from '@/enums/taskCenter';
|
||||
import { ExecuteStatusEnum } from '@/enums/taskCenter';
|
||||
|
||||
import { executeMethodMap, executeResultMap, executeStatusMap } from './config';
|
||||
|
||||
|
@ -286,6 +281,20 @@
|
|||
]);
|
||||
}
|
||||
|
||||
function getCurrentPermission(action: 'STOP') {
|
||||
return {
|
||||
system: {
|
||||
STOP: 'SYSTEM_CASE_TASK_CENTER:EXEC+STOP',
|
||||
},
|
||||
org: {
|
||||
STOP: 'ORGANIZATION_CASE_TASK_CENTER:EXEC+STOP',
|
||||
},
|
||||
project: {
|
||||
STOP: 'PROJECT_CASE_TASK_CENTER:EXEC+STOP',
|
||||
},
|
||||
}[props.type][action];
|
||||
}
|
||||
|
||||
const tableBatchActions = {
|
||||
baseAction: [
|
||||
{
|
||||
|
|
|
@ -105,12 +105,12 @@
|
|||
<template #action="{ record }">
|
||||
<MsButton
|
||||
v-if="[ExecuteStatusEnum.RUNNING, ExecuteStatusEnum.RERUNNING].includes(record.status)"
|
||||
v-permission="['SYSTEM_USER:READ+DELETE']"
|
||||
v-permission="[getCurrentPermission('STOP')]"
|
||||
@click="stopTask(record)"
|
||||
>
|
||||
{{ t('common.stop') }}
|
||||
</MsButton>
|
||||
<MsButton v-else v-permission="['SYSTEM_USER:READ+DELETE']" @click="deleteTask(record)">
|
||||
<MsButton v-else v-permission="[getCurrentPermission('DELETE')]" @click="deleteTask(record)">
|
||||
{{ t('common.delete') }}
|
||||
</MsButton>
|
||||
<!-- <MsButton
|
||||
|
@ -205,7 +205,6 @@
|
|||
import useTableStore from '@/hooks/useTableStore';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
import { characterLimit } from '@/utils';
|
||||
import { hasAnyPermission } from '@/utils/permission';
|
||||
|
||||
import { TaskCenterTaskItem } from '@/models/taskCenter';
|
||||
import { ReportEnum } from '@/enums/reportEnum';
|
||||
|
@ -368,6 +367,23 @@
|
|||
});
|
||||
}
|
||||
|
||||
function getCurrentPermission(action: 'STOP' | 'DELETE') {
|
||||
return {
|
||||
system: {
|
||||
STOP: 'SYSTEM_CASE_TASK_CENTER:EXEC+STOP',
|
||||
DELETE: 'SYSTEM_CASE_TASK_CENTER:READ+DELETE',
|
||||
},
|
||||
org: {
|
||||
STOP: 'ORGANIZATION_CASE_TASK_CENTER:EXEC+STOP',
|
||||
DELETE: 'ORGANIZATION_CASE_TASK_CENTER:READ+DELETE',
|
||||
},
|
||||
project: {
|
||||
STOP: 'PROJECT_CASE_TASK_CENTER:EXEC+STOP',
|
||||
DELETE: 'PROJECT_CASE_TASK_CENTER:READ+DELETE',
|
||||
},
|
||||
}[props.type][action];
|
||||
}
|
||||
|
||||
const currentExecuteTaskList = {
|
||||
system: getSystemExecuteTaskList,
|
||||
project: getProjectExecuteTaskList,
|
||||
|
|
|
@ -41,21 +41,23 @@
|
|||
</template>
|
||||
<template #runRule="{ record }">
|
||||
<MsCronSelect
|
||||
v-if="hasAnyPermission([getCurrentPermission('EDIT')])"
|
||||
v-model:model-value="record.value"
|
||||
v-model:loading="record.runRuleLoading"
|
||||
@change="(val) => handleRunRuleChange(val, record)"
|
||||
/>
|
||||
<span v-else>{{ record.value }}</span>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<MsButton
|
||||
v-if="['API_IMPORT', 'TEST_PLAN', 'API_SCENARIO'].includes(record.resourceType)"
|
||||
v-permission="['SYSTEM_USER:READ+DELETE']"
|
||||
v-permission="[getCurrentPermission('DELETE')]"
|
||||
class="!mr-[12px]"
|
||||
@click="deleteTask(record)"
|
||||
>
|
||||
{{ t('common.delete') }}
|
||||
</MsButton>
|
||||
<MsButton v-permission="['SYSTEM_USER:READ+DELETE']" class="!mr-0" @click="checkDetail(record)">
|
||||
<MsButton class="!mr-0" @click="checkDetail(record)">
|
||||
{{ t('common.detail') }}
|
||||
</MsButton>
|
||||
</template>
|
||||
|
@ -120,7 +122,6 @@
|
|||
const tableStore = useTableStore();
|
||||
|
||||
const keyword = ref('');
|
||||
const tableSelected = ref<string[]>([]);
|
||||
const batchModalParams = ref();
|
||||
const columns: MsTableColumn = [
|
||||
{
|
||||
|
@ -163,7 +164,7 @@
|
|||
},
|
||||
{
|
||||
title: 'ms.taskCenter.operationTime',
|
||||
dataIndex: 'operationTime',
|
||||
dataIndex: 'createTime',
|
||||
width: 170,
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
|
@ -181,7 +182,7 @@
|
|||
},
|
||||
{
|
||||
title: 'ms.taskCenter.nextExecuteTime',
|
||||
dataIndex: 'nextExecuteTime',
|
||||
dataIndex: 'nextTime',
|
||||
width: 170,
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
|
@ -257,13 +258,30 @@
|
|||
return {
|
||||
...item,
|
||||
runRuleLoading: false,
|
||||
operationTime: item.operationTime ? dayjs(item.operationTime).format('YYYY-MM-DD HH:mm:ss') : '-',
|
||||
createTime: item.createTime ? dayjs(item.createTime).format('YYYY-MM-DD HH:mm:ss') : '-',
|
||||
lastFinishTime: item.lastFinishTime ? dayjs(item.lastFinishTime).format('YYYY-MM-DD HH:mm:ss') : '-',
|
||||
nextExecuteTime: item.nextExecuteTime ? dayjs(item.nextExecuteTime).format('YYYY-MM-DD HH:mm:ss') : '-',
|
||||
nextTime: item.nextTime ? dayjs(item.nextTime).format('YYYY-MM-DD HH:mm:ss') : '-',
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
function getCurrentPermission(action: 'DELETE' | 'EDIT') {
|
||||
return {
|
||||
system: {
|
||||
DELETE: 'SYSTEM_SCHEDULE_TASK_CENTER:READ+DELETE',
|
||||
EDIT: 'SYSTEM_SCHEDULE_TASK_CENTER:READ+UPDATE',
|
||||
},
|
||||
org: {
|
||||
DELETE: 'ORGANIZATION_SCHEDULE_TASK_CENTER:READ+DELETE',
|
||||
EDIT: 'ORGANIZATION_SCHEDULE_TASK_CENTER:READ+UPDATE',
|
||||
},
|
||||
project: {
|
||||
DELETE: 'PROJECT_SCHEDULE_TASK_CENTER:READ+DELETE',
|
||||
EDIT: 'PROJECT_SCHEDULE_TASK_CENTER:READ+UPDATE',
|
||||
},
|
||||
}[props.type][action];
|
||||
}
|
||||
|
||||
function searchTask() {
|
||||
setLoadListParams({ keyword: keyword.value });
|
||||
loadList();
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
import { useI18n } from '@/hooks/useI18n';
|
||||
import useLocalForage from '@/hooks/useLocalForage';
|
||||
import useGlobalStore from '@/store/modules/global';
|
||||
import { hasAnyPermission } from '@/utils/permission';
|
||||
|
||||
import { GlobalEventNameEnum } from '@/enums/commonEnum';
|
||||
import { TaskCenterEnum } from '@/enums/taskCenter';
|
||||
|
@ -43,24 +44,41 @@
|
|||
const globalStore = useGlobalStore();
|
||||
const { getItem, setItem } = useLocalForage();
|
||||
|
||||
const tabList = ref([
|
||||
{
|
||||
value: TaskCenterEnum.CASE,
|
||||
label: t('ms.taskCenter.caseTaskList'),
|
||||
},
|
||||
{
|
||||
value: TaskCenterEnum.DETAIL,
|
||||
label: t('ms.taskCenter.caseTaskDetailList'),
|
||||
},
|
||||
{
|
||||
value: TaskCenterEnum.BACKEND,
|
||||
label: t('ms.taskCenter.backendTaskList'),
|
||||
},
|
||||
]);
|
||||
const tabList = ref<Record<string, any>[]>([]);
|
||||
|
||||
const activeTab = ref<TaskCenterEnum>((route.query.type as TaskCenterEnum) || TaskCenterEnum.CASE);
|
||||
const activeTaskId = ref('');
|
||||
|
||||
function initTabList() {
|
||||
if (
|
||||
(props.type === 'project' && hasAnyPermission(['PROJECT_CASE_TASK_CENTER:READ'])) ||
|
||||
(props.type === 'org' && hasAnyPermission(['ORGANIZATION_CASE_TASK_CENTER:READ'])) ||
|
||||
(props.type === 'system' && hasAnyPermission(['SYSTEM_CASE_TASK_CENTER:READ']))
|
||||
) {
|
||||
tabList.value.push(
|
||||
{
|
||||
value: TaskCenterEnum.CASE,
|
||||
label: t('ms.taskCenter.caseTaskList'),
|
||||
},
|
||||
{
|
||||
value: TaskCenterEnum.DETAIL,
|
||||
label: t('ms.taskCenter.caseTaskDetailList'),
|
||||
}
|
||||
);
|
||||
}
|
||||
if (
|
||||
(props.type === 'project' && hasAnyPermission(['PROJECT_SCHEDULE_TASK_CENTER:READ'])) ||
|
||||
(props.type === 'org' && hasAnyPermission(['ORGANIZATION_SCHEDULE_TASK_CENTER:READ'])) ||
|
||||
(props.type === 'system' && hasAnyPermission(['SYSTEM_SCHEDULE_TASK_CENTER:READ']))
|
||||
) {
|
||||
tabList.value.push({
|
||||
value: TaskCenterEnum.BACKEND,
|
||||
label: t('ms.taskCenter.backendTaskList'),
|
||||
});
|
||||
}
|
||||
}
|
||||
initTabList();
|
||||
|
||||
function goTaskDetail(id: string) {
|
||||
activeTaskId.value = id;
|
||||
activeTab.value = TaskCenterEnum.DETAIL;
|
||||
|
|
Loading…
Reference in New Issue