diff --git a/src/components/common/delete-alert.vue b/src/components/common/delete-alert.vue new file mode 100644 index 0000000..ae47e2d --- /dev/null +++ b/src/components/common/delete-alert.vue @@ -0,0 +1,56 @@ + + + + + + + 📢 {{ text }};该删除为 + 物理删除 + ,删除后不可恢复,必须时可以先导出备份 + + + + + diff --git a/src/store/modules/auth/index.ts b/src/store/modules/auth/index.ts index 5e85fa4..0f0488d 100644 --- a/src/store/modules/auth/index.ts +++ b/src/store/modules/auth/index.ts @@ -35,7 +35,12 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => { userName: '', roles: [], buttons: [], - namespaceIds: [] + namespaceIds: [], + deleteAlert: { + 'job-task': true, + 'retry-scene': true, + 'workflow-task': true + } }); /** is super role in static route */ @@ -140,6 +145,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => { info!.userName = info?.username; info!.roles = [roleTypeRecord[info.role]]; localStg.set('userInfo', info); + localStg.set('userInfo', info); Object.assign(userInfo, info); themeStore.setWatermarkText(`${userInfo.userName}@${appTitle}`); @@ -178,6 +184,16 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => { localStg.set('namespaceId', namespaceId); } + function setDeleteAlert(type: Api.Auth.DeleteAlertType, value: boolean) { + userInfo.deleteAlert[type] = value; + localStg.set('deleteAlert', userInfo.deleteAlert); + } + + function getDeleteAlert(type: Api.Auth.DeleteAlertType) { + const deleteAlert = localStg.get('deleteAlert') || userInfo.deleteAlert; + return deleteAlert[type]; + } + return { token, userInfo, @@ -190,6 +206,8 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => { getUserInfo, initUserInfo, initAppVersion, - setNamespaceId + setNamespaceId, + setDeleteAlert, + getDeleteAlert }; }); diff --git a/src/store/modules/auth/shared.ts b/src/store/modules/auth/shared.ts index 1eda573..eac0078 100644 --- a/src/store/modules/auth/shared.ts +++ b/src/store/modules/auth/shared.ts @@ -16,7 +16,12 @@ export function getUserInfo() { role: 1, roles: [], buttons: [], - namespaceIds: [] + namespaceIds: [], + deleteAlert: { + 'job-task': true, + 'retry-scene': true, + 'workflow-task': true + } }; const userInfo = localStg.get('userInfo') || emptyInfo; @@ -34,4 +39,5 @@ export function clearAuthStorage() { // localStg.remove('refreshToken'); localStg.remove('namespaceId'); localStg.remove('userInfo'); + localStg.remove('deleteAlert'); } diff --git a/src/typings/api.d.ts b/src/typings/api.d.ts index 54f4ba5..00b9cc9 100644 --- a/src/typings/api.d.ts +++ b/src/typings/api.d.ts @@ -130,6 +130,8 @@ declare namespace Api { namespaceIds: NamespaceId[]; } + type DeleteAlertType = 'job-task' | 'retry-scene' | 'workflow-task'; + interface UserInfo { id: string; userId: string; @@ -140,6 +142,9 @@ declare namespace Api { roles: string[]; buttons: string[]; namespaceIds: NamespaceId[]; + deleteAlert: { + [key in DeleteAlertType]: boolean; + }; } interface NamespaceId { diff --git a/src/typings/storage.d.ts b/src/typings/storage.d.ts index 0929db7..c662515 100644 --- a/src/typings/storage.d.ts +++ b/src/typings/storage.d.ts @@ -49,5 +49,8 @@ declare namespace StorageType { taskBatchId: string; data: Api.JobLog.JobMessage[]; }; + deleteAlert: { + [key in Api.Auth.DeleteAlertType]: boolean; + }; } } diff --git a/src/views/job/task/index.vue b/src/views/job/task/index.vue index 8ff0fc7..c0179c4 100644 --- a/src/views/job/task/index.vue +++ b/src/views/job/task/index.vue @@ -281,6 +281,7 @@ function handleExport() { + + ( @@ -283,6 +282,7 @@ function goToBatch(workflowId: string) { +