Skip to content

Commit

Permalink
feat(frontend): 轮值支持排除业务、指定部分业务 TencentBlueKing#8922
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 28647
  • Loading branch information
jinquantianxia committed Jan 7, 2025
1 parent 797d5ef commit d4d337b
Show file tree
Hide file tree
Showing 3 changed files with 269 additions and 51 deletions.
20 changes: 18 additions & 2 deletions dbm-ui/frontend/src/services/model/monitor/duty-rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ export interface DutyCustomItem {
}

export default class DutyRule {
biz_config: {
exclude?: number[];
include?: number[];
};
biz_config_display: {
exclude?: {
bk_biz_id: number;
bk_biz_name: string;
};
include?: {
bk_biz_id: number;
bk_biz_name: string;
};
};
category: string;
creator: string;
create_at: string;
Expand All @@ -52,16 +66,18 @@ export default class DutyRule {
update_at: string;

constructor(payload = {} as DutyRule) {
this.id = payload.id;
this.biz_config = payload.biz_config;
this.biz_config_display = payload.biz_config_display;
this.creator = payload.creator;
this.create_at = payload.create_at;
this.category = payload.category;
this.db_type = payload.db_type;
this.duty_arranges = payload.duty_arranges;
this.effective_time = payload.effective_time;
this.end_time = payload.end_time;
this.id = payload.id;
this.is_enabled = payload.is_enabled;
this.is_show_edit = false;
this.end_time = payload.end_time;
this.name = payload.name;
this.permission = payload.permission;
this.priority = payload.priority;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,9 @@
</BkRadioButton>
</BkRadioGroup>
<div class="title-spot item-title mt-24">{{ t('轮值业务') }}<span class="required" /></div>
<BkRadioGroup
v-model="bizType"
class="rotate-biz">
<div class="biz-box">
<BkRadio :label="0">
{{ t('全部业务') }}
</BkRadio>
</div>
</BkRadioGroup>
<RotateBizs
ref="rotateBizsRef"
:data="data" />
<KeepAlive>
<CycleRotate
v-if="rotateType === 'handoff'"
Expand Down Expand Up @@ -105,6 +99,7 @@

import CustomRotate from './CustomRotate.vue';
import CycleRotate from './CycleRotate.vue';
import RotateBizs from './RotateBizs.vue';

interface Props {
dbType: string;
Expand All @@ -130,10 +125,10 @@

const nameTip = ref('');
const rotateType = ref('handoff');
const bizType = ref(0);
const customRef = ref();
const cycleRef = ref();
const formRef = ref();
const rotateBizsRef = ref<InstanceType<typeof RotateBizs>>();
const formModel = reactive({
ruleName: '',
});
Expand Down Expand Up @@ -229,6 +224,7 @@
// 点击确定
const handleConfirm = async () => {
await formRef.value.validate();
const bizConfig = await rotateBizsRef.value!.getValue();
if (rotateType.value === 'handoff') {
const cycleValues = await cycleRef.value.getValue();
const cycleParams = {
Expand All @@ -239,16 +235,17 @@
effective_time: cycleValues.effective_time,
end_time: cycleValues.end_time,
duty_arranges: cycleValues.duty_arranges,
...bizConfig,
};
if (isCreate.value) {
// 新建/克隆
await runCreateDutyRule(cycleParams);
runCreateDutyRule(cycleParams);
} else {
// 克隆或者编辑
if (props.data) {
cycleParams.effective_time = cycleValues.effective_time;
cycleParams.end_time = cycleValues.end_time;
await runUpdateDutyRule(props.data.id, cycleParams);
runUpdateDutyRule(props.data.id, cycleParams);
}
}
} else {
Expand All @@ -262,14 +259,15 @@
effective_time: customValues.effective_time,
end_time: customValues.end_time,
duty_arranges: customValues.duty_arranges,
...bizConfig,
};
if (isCreate.value) {
// 新建/克隆
await runCreateDutyRule(customParams);
runCreateDutyRule(customParams);
} else {
// 克隆或者编辑
if (props.data) {
await runUpdateDutyRule(props.data.id, customParams);
runUpdateDutyRule(props.data.id, customParams);
}
}
}
Expand Down Expand Up @@ -312,40 +310,5 @@
font-size: 12px;
color: #ea3636;
}

.rotate-biz {
width: 100%;
flex-direction: column;
gap: 12px;

.biz-box {
display: flex;
width: 100%;
height: 54px;
padding-left: 17px;
background: #f5f7fa;
border-radius: 2px;
align-items: center;

.biz-box-control {
display: flex;
width: 100%;
margin-left: 36px;
align-items: center;

.biz-select {
width: 710px;
}

.biz-box-append {
display: flex;
font-size: 12px;
color: #3a84ff;
align-items: center;
cursor: pointer;
}
}
}
}
}
</style>
Loading

0 comments on commit d4d337b

Please sign in to comment.