From 564d18f6b7ed381994a206ded215497942a2f2a7 Mon Sep 17 00:00:00 2001 From: dhb52 Date: Sat, 4 May 2024 22:34:46 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"fix:=20=E8=B7=AF=E7=94=B1=E7=AD=96?= =?UTF-8?q?=E7=95=A5key=E7=B1=BB=E5=9E=8B=E4=B8=BAstring"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit ca112f4467230df11a6193e5e1e45d81a72b273a. --- src/constants/business.ts | 10 ++--- src/typings/api.d.ts | 2 +- src/utils/common.ts | 8 ++-- src/views/job/batch/index.vue | 43 +++++++------------ .../task/modules/job-task-operate-drawer.vue | 2 +- .../scene/modules/scene-operate-drawer.vue | 2 +- 6 files changed, 26 insertions(+), 41 deletions(-) diff --git a/src/constants/business.ts b/src/constants/business.ts index 5c21996..00623b2 100644 --- a/src/constants/business.ts +++ b/src/constants/business.ts @@ -117,12 +117,12 @@ export const backOffRecord: Record = { export const backOffRecordOptions = transformRecordToNumberOption(backOffRecord, true); export const routeKeyRecord: Record = { - '1': 'common.routeKey.items.consistentHash', - '2': 'common.routeKey.items.random', - '3': 'common.routeKey.items.lru', - '4': 'common.routeKey.items.round' + 1: 'common.routeKey.items.consistentHash', + 2: 'common.routeKey.items.random', + 3: 'common.routeKey.items.lru', + 4: 'common.routeKey.items.round' }; -export const routeKeyRecordOptions = transformRecordToOption(routeKeyRecord); +export const routeKeyRecordOptions = transformRecordToNumberOption(routeKeyRecord, true); /** 阻塞策略 */ export const blockStrategyRecord: Record = { diff --git a/src/typings/api.d.ts b/src/typings/api.d.ts index bda0016..48bcf14 100644 --- a/src/typings/api.d.ts +++ b/src/typings/api.d.ts @@ -71,7 +71,7 @@ declare namespace Api { } & T; /** 1: 一致性Hash 2: 随机 3: LRU 4: 轮询 */ - type RouteKey = '1' | '2' | '3' | '4'; + type RouteKey = 1 | 2 | 3 | 4; /** 阻塞策略 1:丢弃 2:覆盖 3:并行 */ type BlockStrategy = 1 | 2 | 3; diff --git a/src/utils/common.ts b/src/utils/common.ts index 4e4dbc5..9d425f5 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -69,9 +69,7 @@ export function translateOptions2(options: string[]) { * * @param index */ -export function tagColor(index: number | string) { - const indexNumber = Number(index); - +export function tagColor(index: number) { const tagMap: Record = { 0: 'error', 1: 'info', @@ -80,9 +78,9 @@ export function tagColor(index: number | string) { 4: 'primary' }; - if (indexNumber === null || indexNumber < 0) { + if (index === null || index < 0) { return tagMap[1]; } - return tagMap[indexNumber % 5]; + return tagMap[index % 5]; } diff --git a/src/views/job/batch/index.vue b/src/views/job/batch/index.vue index bcd47d7..a735159 100644 --- a/src/views/job/batch/index.vue +++ b/src/views/job/batch/index.vue @@ -53,33 +53,27 @@ const { columns, data, getData, loading, mobilePagination, searchParams, resetSe return null; } const tagMap: Record = { - 0: 'warning', - 1: 'warning', - 2: 'warning', - 3: 'warning', - 4: 'warning', - 5: 'warning', - 6: 'warning', - 7: 'warning', - 8: 'warning', - 9: 'warning', - 10: 'warning', - 11: 'warning', - 12: 'warning', - 13: 'warning', - 14: 'warning' + 0: 'default', + 1: 'default', + 2: 'error', + 3: 'default', + 4: 'default', + 5: 'default', + 6: 'default', + 7: 'default', + 8: 'default', + 9: 'default', + 10: 'default', + 11: 'default', + 12: 'default', + 13: 'default', + 14: 'default' }; const label = $t(operationReasonRecord[row.operationReason!]); return {label}; } }, - { - key: 'createDt', - title: $t('common.createDt'), - align: 'center', - minWidth: 120 - }, { key: 'operate', title: $t('common.operate'), @@ -90,9 +84,6 @@ const { columns, data, getData, loading, mobilePagination, searchParams, resetSe detail(row.id!)}> {$t('common.detail')} - handleExecute(row.id!)}> - {$t('common.execute')} - ) } @@ -102,10 +93,6 @@ const { columns, data, getData, loading, mobilePagination, searchParams, resetSe function detail(id: string) { console.log(id); } - -function handleExecute(id: string) { - console.log(id); -}