Skip to content

Commit 1e009e9

Browse files
jinquantianxiahLinx
authored andcommitted
feat(frontend): 巡检报告改版及个人工作台新增巡检待办 TencentBlueKing#8953
1 parent 8552d46 commit 1e009e9

File tree

24 files changed

+862
-305
lines changed

24 files changed

+862
-305
lines changed

dbm-ui/frontend/lib/bk-icon/demo.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,14 @@ <h2 class="page-title">
989989
<span class="icon bk-dbm-icon db-icon-guzhangji"></span>
990990
<p class="icon-text">guzhangji</p>
991991
</li>
992+
<li class="icon-item" title="wodedaiban">
993+
<span class="icon bk-dbm-icon db-icon-wodedaiban"></span>
994+
<p class="icon-text">wodedaiban</p>
995+
</li>
996+
<li class="icon-item" title="yonghu-2">
997+
<span class="icon bk-dbm-icon db-icon-yonghu-2"></span>
998+
<p class="icon-text">yonghu-2</p>
999+
</li>
9921000
</ul>
9931001
<h3 class="describe-title">为什么使用</h3>
9941002
<ul class="use-describe">
@@ -2314,6 +2322,18 @@ <h3 class="describe-title">如何使用</h3>
23142322
</svg>
23152323
<p class="icon-text">guzhangji</p>
23162324
</li>
2325+
<li class="colorful-icon">
2326+
<svg class="icon svg-icon">
2327+
<use xlink:href="#db-icon-wodedaiban"></use>
2328+
</svg>
2329+
<p class="icon-text">wodedaiban</p>
2330+
</li>
2331+
<li class="colorful-icon">
2332+
<svg class="icon svg-icon">
2333+
<use xlink:href="#db-icon-yonghu-2"></use>
2334+
</svg>
2335+
<p class="icon-text">yonghu-2</p>
2336+
</li>
23172337
</ul>
23182338
<h3 class="describe-title">为什么使用</h3>
23192339
<ul class="use-describe">

dbm-ui/frontend/src/components/db-tab/Index.vue

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
<template>
1515
<BkTab
16+
:key="renderKey"
1617
v-model:active="moduleValue"
1718
class="db-tab"
1819
type="unborder-card">
@@ -31,6 +32,7 @@
3132
3233
interface Props {
3334
exclude?: DBTypes[];
35+
labelConfig?: Record<DBTypes, string>;
3436
}
3537
3638
interface TabItem {
@@ -39,6 +41,7 @@
3941
}
4042
4143
const props = withDefaults(defineProps<Props>(), {
44+
labelConfig: undefined,
4245
exclude: () => [],
4346
});
4447
@@ -48,14 +51,30 @@
4851
default: DBTypes.MYSQL,
4952
});
5053
51-
const renderTabs = Object.values(DBTypeInfos).reduce((result, item) => {
52-
const { id, name, moduleId } = item;
53-
const data = funControllerStore.funControllerData.getFlatData(moduleId);
54-
if (data[id] && !props.exclude.includes(id)) {
55-
result.push({ id, name });
56-
}
57-
return result;
58-
}, [] as TabItem[]);
54+
// 解决 labelConfig 变化后渲染样式异常问题
55+
const renderKey = ref(0);
56+
57+
const renderTabs = computed(() =>
58+
Object.values(DBTypeInfos).reduce((result, item) => {
59+
const { id, name, moduleId } = item;
60+
const data = funControllerStore.funControllerData.getFlatData(moduleId);
61+
if (data[id] && !props.exclude.includes(id)) {
62+
result.push({
63+
id,
64+
name: props.labelConfig?.[id] || name,
65+
});
66+
}
67+
return result;
68+
}, [] as TabItem[]),
69+
);
70+
71+
watch(
72+
() => [props.exclude, props.labelConfig],
73+
() => {
74+
renderKey.value += 1;
75+
},
76+
{ immediate: true },
77+
);
5978
</script>
6079

6180
<style lang="less">

dbm-ui/frontend/src/hooks/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export * from './useLocalPagination';
2727
export * from './useLocation';
2828
export * from './useModelProvider';
2929
export * from './useProps';
30+
export * from './useReportCount';
3031
export * from './useSelectorDialogWidth';
3132
export * from './useSQLTaskNotify';
3233
export * from './useStickyFooter';
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-DB管理系统(BlueKing-BK-DBM) available.
3+
*
4+
* Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved.
5+
*
6+
* Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at https://opensource.org/licenses/MIT
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
10+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for
11+
* the specific language governing permissions and limitations under the License.
12+
*/
13+
14+
import { useRequest } from 'vue-request';
15+
16+
import { getReportCount } from '@services/source/report';
17+
18+
/**
19+
* 巡检报告统计数据
20+
*/
21+
export const useReportCount = () => {
22+
const manageCount = ref(0);
23+
const assistCount = ref(0);
24+
const dbReportCountMap = ref<
25+
Record<
26+
string,
27+
{
28+
assistCount: number;
29+
manageCount: number;
30+
}
31+
>
32+
>({});
33+
34+
useRequest(getReportCount, {
35+
onSuccess(countResult) {
36+
let manages = 0;
37+
let assists = 0;
38+
Object.entries(countResult).forEach(([db, value]) => {
39+
const singleDbCount = Object.values(value).reduce(
40+
(results, item) => {
41+
Object.assign(results, {
42+
manageCount: item.manage_count + results.manageCount,
43+
assistCount: item.assist_count + results.assistCount,
44+
});
45+
return results;
46+
},
47+
{
48+
manageCount: 0,
49+
assistCount: 0,
50+
},
51+
);
52+
dbReportCountMap.value[db] = singleDbCount;
53+
manages = manages + singleDbCount.manageCount;
54+
assists = assists + singleDbCount.assistCount;
55+
});
56+
manageCount.value = manages;
57+
assistCount.value = assists;
58+
},
59+
});
60+
61+
return {
62+
manageCount,
63+
assistCount,
64+
dbReportCountMap,
65+
};
66+
};

dbm-ui/frontend/src/layout/Index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,14 @@
164164
'PlatformTicketFlowSetting',
165165
'PlatformStaffManage',
166166
],
167-
[menuEnum.platformManage]: ['platformTaskManage', 'ticketPlatformManage'],
167+
[menuEnum.platformManage]: ['platformTaskManage', 'ticketPlatformManage', 'inspectionReportGlobal'],
168168
[menuEnum.personalWorkbench]: [
169169
'serviceApply',
170170
'SelfServiceMyTickets',
171171
'MyTodos',
172172
'ticketSelfDone',
173173
'ticketSelfManage',
174+
'InspectionTodos',
174175
],
175176
} as Record<string, string[]>;
176177

dbm-ui/frontend/src/layout/components/ObservableManage.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<span
3434
v-overflow-tips.right
3535
class="text-overflow">
36-
{{ t('健康报告') }}
36+
{{ t('巡检报告') }}
3737
</span>
3838
</BkMenuItem>
3939
</BkMenuGroup>

dbm-ui/frontend/src/layout/components/PersonalWorkbench.vue

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,34 @@
66
@click="handleMenuChange">
77
<BkMenuGroup
88
v-db-console="'personalWorkbench'"
9-
:name="t('单据管理')">
9+
:name="t('我的待办')">
1010
<BkMenuItem
1111
key="MyTodos"
1212
v-db-console="'personalWorkbench.myTodos'">
1313
<template #icon>
1414
<DbIcon type="todos" />
1515
</template>
1616
<span>
17-
{{ t('我的待办') }}
17+
{{ t('单据待办') }}
1818
</span>
1919
<span class="ticket-count">{{ todoCount }}</span>
2020
</BkMenuItem>
21+
<BkMenuItem
22+
v-if="userProfileStore.isDba"
23+
key="InspectionTodos"
24+
v-db-console="'personalWorkbench.InspectionTodos'">
25+
<template #icon>
26+
<DbIcon type="cluster-standardize" />
27+
</template>
28+
<span>
29+
{{ t('巡检待办') }}
30+
</span>
31+
<span class="ticket-count">{{ manageCount }}</span>
32+
</BkMenuItem>
33+
</BkMenuGroup>
34+
<BkMenuGroup
35+
v-db-console="'personalWorkbench'"
36+
:name="t('我的申请')">
2137
<BkMenuItem
2238
key="SelfServiceMyTickets"
2339
v-db-console="'personalWorkbench.myTickets'">
@@ -28,17 +44,24 @@
2844
{{ t('我的申请') }}
2945
</span>
3046
</BkMenuItem>
47+
</BkMenuGroup>
48+
<BkMenuGroup
49+
v-db-console="'personalWorkbench'"
50+
:name="t('我的已办')">
3151
<BkMenuItem
3252
key="ticketSelfDone"
3353
v-db-console="'personalWorkbench.myTickets'">
3454
<template #icon>
3555
<DbIcon type="todos" />
3656
</template>
3757
<span>
38-
{{ t('我的已办') }}
58+
{{ t('已办单据') }}
3959
</span>
4060
</BkMenuItem>
41-
<!-- <BkMenuItem
61+
<!-- <BkMenuGroup>
62+
v-db-console="'personalWorkbench'"
63+
:name="t('单据管理')">
64+
<BkMenuItem
4265
key="ticketSelfManage"
4366
v-db-console="'personalWorkbench.myTickets'">
4467
<template #icon>
@@ -47,7 +70,8 @@
4770
<span>
4871
{{ t('我负责的业务') }}
4972
</span>
50-
</BkMenuItem> -->
73+
</BkMenuItem>
74+
</BkMenuGroup>-->
5175
<BkMenuItem
5276
key="serviceApply"
5377
v-db-console="'personalWorkbench.serviceApply'">
@@ -67,7 +91,9 @@
6791
import { Menu } from 'bkui-vue';
6892
import { useI18n } from 'vue-i18n';
6993
70-
import { useTicketCount } from '@hooks';
94+
import { useReportCount, useTicketCount } from '@hooks';
95+
96+
import { useUserProfile } from '@stores';
7197
7298
import { useActiveKey } from './hooks/useActiveKey';
7399
@@ -82,6 +108,8 @@
82108
} = useActiveKey(menuRef as Ref<InstanceType<typeof Menu>>, 'MyTodos');
83109
84110
const { data: ticketCount } = useTicketCount();
111+
const { manageCount } = useReportCount();
112+
const userProfileStore = useUserProfile();
85113
86114
const todoCount = computed(() => {
87115
if (!ticketCount.value) {

dbm-ui/frontend/src/layout/components/PlatformManage.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@
1818
{{ t('任务') }}
1919
</BkMenuItem>
2020
</BkMenuGroup>
21+
<BkMenuGroup
22+
v-db-console="'platformManage.healthReport'"
23+
:name="t('巡检')">
24+
<BkMenuItem key="inspectionReportGlobal">
25+
<template #icon>
26+
<DbIcon type="db-config" />
27+
</template>
28+
<span
29+
v-overflow-tips.right
30+
class="text-overflow">
31+
{{ t('巡检报告') }}
32+
</span>
33+
</BkMenuItem>
34+
</BkMenuGroup>
2135
</BkMenu>
2236
</template>
2337
<script setup lang="ts">

dbm-ui/frontend/src/locales/en.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,5 +1657,14 @@
16571657
"sqlserver主从版": "",
16581658
"排除业务": "",
16591659
"该规格已被使用,不允许修改": "",
1660+
"巡检报告": "",
1661+
"已办单据": "",
1662+
"单据待办": "",
1663+
"巡检待办": "",
1664+
"待我处理": "",
1665+
"待我协助": "",
1666+
"展示我作为主 DBA 的业务,当日所产生的巡检异常,一般每日更新一次": "",
1667+
"展示我作为备 DBA、二线 DBA 的业务,当日所产生的巡检异常,一般每日更新一次": "",
1668+
"主DBA": "",
16601669
"这行勿动!新增翻译请在上一行添加!": ""
16611670
}

dbm-ui/frontend/src/locales/zh-cn.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,7 +2248,7 @@
22482248
"请输入部署数量": "请输入部署数量",
22492249
"Mysql 集群管理": "Mysql 集群管理",
22502250
"巡检": "巡检",
2251-
"健康报告": "健康报告",
2251+
"巡检报告": "巡检报告",
22522252
"备份巡检": "备份巡检",
22532253
"元数据检查": "元数据检查",
22542254
"日期": "日期",
@@ -3905,8 +3905,6 @@
39053905
"【MongoDB】分片集群实例视图": "【MongoDB】分片集群实例视图",
39063906
"副本集群": "副本集群",
39073907
"单据中心": "单据中心",
3908-
"待我处理": "待我处理",
3909-
"待我协助": "待我协助",
39103908
"待我处理:通常是我提交的单据,或者我是业务主DBA": "待我处理:通常是我提交的单据,或者我是业务主DBA",
39113909
"待我协助:通常是我被设定为单据协助人,或者我是业务的备DBA、二线 DBA": "待我协助:通常是我被设定为单据协助人,或者我是业务的备DBA、二线 DBA",
39123910
"Proxy存储资源规格:": "Proxy存储资源规格:",
@@ -3934,5 +3932,13 @@
39343932
"复制域名:端口": "复制域名:端口",
39353933
"复制成功n个域名": "复制成功 {n} 个域名",
39363934
"复制成功n个域名:端口": "复制成功 {n} 个域名:端口",
3935+
"已办单据": "已办单据",
3936+
"单据待办": "单据待办",
3937+
"巡检待办": "巡检待办",
3938+
"待我处理": "待我处理",
3939+
"待我协助": "待我协助",
3940+
"展示我作为主 DBA 的业务,当日所产生的巡检异常,一般每日更新一次": "展示我作为主 DBA 的业务,当日所产生的巡检异常,一般每日更新一次",
3941+
"展示我作为备 DBA、二线 DBA 的业务,当日所产生的巡检异常,一般每日更新一次": "展示我作为备 DBA、二线 DBA 的业务,当日所产生的巡检异常,一般每日更新一次",
3942+
"主DBA": "主 DBA",
39373943
"这行勿动!新增翻译请在上一行添加!": ""
39383944
}

0 commit comments

Comments
 (0)