Skip to content

Commit

Permalink
feat(frontend): 支持配置业务级单据协助人 #8126
Browse files Browse the repository at this point in the history
  • Loading branch information
royalpioneer authored and hLinx committed Nov 25, 2024
1 parent bac1f76 commit 8d9f499
Show file tree
Hide file tree
Showing 16 changed files with 199 additions and 22 deletions.
24 changes: 4 additions & 20 deletions dbm-ui/frontend/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,8 @@
"peacock.remoteColor": "#45e35f",
"bk-code-ai.enable": false,
"typescript.tsdk": "node_modules/typescript/lib",
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#65c89b",
"activityBar.background": "#65c89b",
"activityBar.foreground": "#15202b",
"activityBar.inactiveForeground": "#15202b99",
"activityBarBadge.background": "#945bc4",
"activityBarBadge.foreground": "#e7e7e7",
"commandCenter.border": "#15202b99",
"sash.hoverBorder": "#65c89b",
"statusBar.background": "#42b883",
"statusBar.foreground": "#15202b",
"statusBarItem.hoverBackground": "#359268",
"statusBarItem.remoteBackground": "#42b883",
"statusBarItem.remoteForeground": "#15202b",
"titleBar.activeBackground": "#42b883",
"titleBar.activeForeground": "#15202b",
"titleBar.inactiveBackground": "#42b88399",
"titleBar.inactiveForeground": "#15202b99"
},
"peacock.color": "#42b883"
"peacock.color": "#42b883",
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
10 changes: 10 additions & 0 deletions dbm-ui/frontend/lib/bk-icon/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ <h2 class="page-title">
<span class="icon bk-dbm-icon db-icon-qiyeweixin"></span>
<p class="icon-text">qiyeweixin</p>
</li>
<li class="icon-item" title="lianxi">
<span class="icon bk-dbm-icon db-icon-lianxi"></span>
<p class="icon-text">lianxi</p>
</li>
<li class="icon-item" title="sql">
<span class="icon bk-dbm-icon db-icon-sql"></span>
<p class="icon-text">sql</p>
Expand Down Expand Up @@ -1242,6 +1246,12 @@ <h3 class="describe-title">如何使用</h3>
</svg>
<p class="icon-text">qiyeweixin</p>
</li>
<li class="colorful-icon">
<svg class="icon svg-icon">
<use xlink:href="#db-icon-lianxi"></use>
</svg>
<p class="icon-text">lianxi</p>
</li>
<li class="colorful-icon">
<svg class="icon svg-icon">
<use xlink:href="#db-icon-sql"></use>
Expand Down
Binary file modified dbm-ui/frontend/lib/bk-icon/fonts/iconcool.eot
Binary file not shown.
3 changes: 3 additions & 0 deletions dbm-ui/frontend/lib/bk-icon/fonts/iconcool.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dbm-ui/frontend/lib/bk-icon/fonts/iconcool.ttf
Binary file not shown.
Binary file modified dbm-ui/frontend/lib/bk-icon/fonts/iconcool.woff
Binary file not shown.
2 changes: 1 addition & 1 deletion dbm-ui/frontend/lib/bk-icon/iconcool.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dbm-ui/frontend/lib/bk-icon/iconcool.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dbm-ui/frontend/lib/bk-icon/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ url("fonts/iconcool.eot?#iefix") format("embedded-opentype");
.db-icon-qiyeweixin:before {
content: "\e1d9";
}
.db-icon-lianxi:before {
content: "\e209";
}
.db-icon-sql:before {
content: "\e1cb";
}
Expand Down
1 change: 1 addition & 0 deletions dbm-ui/frontend/src/layout/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
'DBMonitorAlarmGroup',
'StaffManage',
'TicketFlowSetting',
'TicketCooperationSetting',
],
[menuEnum.resourceManage]: ['ResourceSpec', 'resourceManage', 'resourcePoolDirtyMachines'],
[menuEnum.platformManage]: [
Expand Down
12 changes: 12 additions & 0 deletions dbm-ui/frontend/src/layout/components/ConfigManage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@
{{ t('单据免审批设置') }}
</span>
</BkMenuItem>
<BkMenuItem
key="TicketCooperationSetting"
v-db-console="'bizConfigManage.ticketCooperationSetting'">
<template #icon>
<DbIcon type="lianxi" />
</template>
<span
v-overflow-tips.right
class="text-overflow">
{{ t('单据协作设置') }}
</span>
</BkMenuItem>
</BkMenuGroup>
<BkMenuGroup :name="t('设置')">
<BkMenuItem
Expand Down
6 changes: 6 additions & 0 deletions dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3667,5 +3667,11 @@
"全站搜索,支持多对象,Shift + Enter 换行,Enter键开启搜索": "全站搜索,支持多对象,Shift + Enter 换行,Enter键开启搜索",
"全站搜索,支持多对象,Enter开启搜索": "全站搜索,支持多对象,Enter开启搜索",
"权限:新增n个,删除m个": "权限:新增 {0} 个,删除 {1} 个",
"单据协作设置": "单据协作设置",
"开启后,您指定的协作人将能够协助处理单据执行、继续任务等事项,同时也会收到单据通知": "开启后,您指定的协作人将能够协助处理单据执行、继续任务等事项,同时也会收到单据通知",
"单据协助": "单据协助",
"默认协作人": "默认协作人",
"冷/热节点": "冷/热节点",
"冷_热节点规格": "冷_热节点规格",
"这行勿动!新增翻译请在上一行添加!": ""
}
2 changes: 2 additions & 0 deletions dbm-ui/frontend/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import getServiceApplyRoutes from '@views/service-apply/routes';
import getStaffManageRoutes from '@views/staff-manage/routes';
import getTaskHistoryRoutes from '@views/task-history/routes';
import getTemporaryPasswordModify from '@views/temporary-paassword-modify/routes';
import getTicketCooperationSettingRoutes from '@views/ticket-cooperation-setting/routes';
import getTicketFlowSettingBizRoutes from '@views/ticket-flow-setting-biz/routes';
import getTicketFlowSettingGlobalRoutes from '@views/ticket-flow-setting-global/routes';
import getTicketManageRoutes from '@views/ticket-manage/routes';
Expand Down Expand Up @@ -128,6 +129,7 @@ export default () => {
...getTicketManageRoutes(),
...getTemporaryPasswordModify(),
...getTicketFlowSettingBizRoutes(),
...getTicketCooperationSettingRoutes(),
...getTicketFlowSettingGlobalRoutes(),
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ interface ControllerData {
'bizConfigManage.dbConfigure': ControllerItem<string>;
'bizConfigManage.StaffManage': ControllerItem<string>;
'bizConfigManage.ticketFlowSetting': ControllerItem<string>;
'bizConfigManage.ticketCooperationSetting': ControllerItem<string>;
databaseManage: ControllerItem<string>;
'databaseManage.missionManage': ControllerItem<string>;
'databaseManage.whitelistManage': ControllerItem<string>;
Expand Down Expand Up @@ -222,6 +223,7 @@ export default class FunctionController {
'bizConfigManage.dbConfigure': ControllerItem<string>;
'bizConfigManage.StaffManage': ControllerItem<string>;
'bizConfigManage.ticketFlowSetting': ControllerItem<string>;
'bizConfigManage.ticketCooperationSetting': ControllerItem<string>;
databaseManage: ControllerItem<string>;
'databaseManage.missionManage': ControllerItem<string>;
'databaseManage.whitelistManage': ControllerItem<string>;
Expand Down
124 changes: 124 additions & 0 deletions dbm-ui/frontend/src/views/ticket-cooperation-setting/Index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<template>
<div class="ticket-cooperation-setting">
<Teleport to="#dbContentTitleAppend">
<BkTag
class="ml-8"
theme="info">
{{ t('业务配置') }}
</BkTag>
</Teleport>
<DbCard
mode="collapse"
:title="t('单据协助')">
<BkForm
ref="formRef"
:model="formModel">
<BkFormItem :label="t('单据协助')">
<BkSwitcher
v-model="isCooperationOpen"
class="mr-8"
theme="primary" />
{{ t('开启后,您指定的协作人将能够协助处理单据执行、继续任务等事项,同时也会收到单据通知') }}
</BkFormItem>
<BkFormItem
v-if="isCooperationOpen"
:label="t('默认协作人')"
property="members"
required>
<MemberSelector v-model="formModel.members" />
</BkFormItem>
</BkForm>
</DbCard>
<BkButton
class="submit-btn"
:loading="isUpdating"
theme="primary"
@click="handleSubmit">
{{ t('保存') }}
</BkButton>
</div>
</template>

<script setup lang="tsx">
import { useI18n } from 'vue-i18n';
import { useRequest } from 'vue-request';
import { getBizSettingList, updateBizSetting } from '@services/source/bizSetting';
import { useGlobalBizs } from '@stores';
import MemberSelector from '@components/db-member-selector/index.vue';
import { messageSuccess } from '@utils';
const { t } = useI18n();
const formRef = useTemplateRef('formRef');
const globalBizsStore = useGlobalBizs();
const isCooperationOpen = ref(false);
const formModel = reactive({
members: [],
});
// 是否开启单据协助
useRequest(getBizSettingList, {
defaultParams: [
{
bk_biz_id: globalBizsStore.currentBizId,
key: 'BIZ_ASSISTANCE_SWITCH',
},
],
onSuccess: (data) => {
isCooperationOpen.value = data.BIZ_ASSISTANCE_SWITCH;
},
});
// 获取默认协作人
useRequest(getBizSettingList, {
onSuccess: (data) => {
formModel.members = data.BIZ_ASSISTANCE_VARS || [];
},
defaultParams: [
{
bk_biz_id: globalBizsStore.currentBizId,
key: 'BIZ_ASSISTANCE_VARS',
},
],
});
const { runAsync: runUpdate, loading: isUpdating } = useRequest(updateBizSetting, {
manual: true,
onSuccess: () => {
messageSuccess(t('保存成功'));
},
});
const handleSubmit = async () => {
if (isCooperationOpen.value) {
await formRef.value!.validate();
}
Promise.all([
runUpdate({
bk_biz_id: globalBizsStore.currentBizId,
key: 'BIZ_ASSISTANCE_SWITCH',
value: isCooperationOpen.value,
}),
runUpdate({
bk_biz_id: globalBizsStore.currentBizId,
key: 'BIZ_ASSISTANCE_VARS',
value: formModel.members,
}),
]);
};
</script>

<style scoped lang="less">
.ticket-cooperation-setting {
.submit-btn {
width: 88px;
margin-top: 16px;
}
}
</style>
30 changes: 30 additions & 0 deletions dbm-ui/frontend/src/views/ticket-cooperation-setting/routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-DB管理系统(BlueKing-BK-DBM) available.
*
* Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at https://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for
* the specific language governing permissions and limitations under the License.
*/
import { checkDbConsole } from '@utils';

import { t } from '@locales/index';

const routes = [
{
name: 'TicketCooperationSetting',
path: 'ticket-cooperation-setting',
meta: {
navName: t('单据免审批设置'),
},
component: () => import('@views/ticket-cooperation-setting/Index.vue'),
},
];

export default function getRoutes() {
return checkDbConsole('bizConfigManage.ticketCooperationSetting') ? routes : [];
}

0 comments on commit 8d9f499

Please sign in to comment.