Skip to content

Commit

Permalink
feat(frontend): 业务下单据流程设置需求改动并添加权限控制 TencentBlueKing#6346
Browse files Browse the repository at this point in the history
  • Loading branch information
JustaCattt authored and jinquantianxia committed Sep 2, 2024
1 parent b09a534 commit 5c6b817
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 159 deletions.
1 change: 1 addition & 0 deletions dbm-ui/frontend/src/components/auth-component/use-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const withBizActionList = [
'sqlserver_apply',
'sqlserver_account_create',
'sqlserver_account_rules_view',
'biz_ticket_config_set',
];

export default function (props: Props) {
Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/frontend/src/layout/components/ConfigManage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<span
v-overflow-tips.right
class="text-overflow">
{{ t('单据流程设置') }}
{{ t('单据免审批设置') }}
</span>
</BkMenuItem>
</BkMenuGroup>
Expand Down
7 changes: 4 additions & 3 deletions dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3403,8 +3403,6 @@
"添加人工确认节点": "添加人工确认节点",
"全局设置的作为各个业务初始化设置,更改后会自动同步至各个业务;在业务下可以根据运行情况,可调整“是否审批”,其中“是否人工确认”在业务下不可更改": "全局设置的作为各个业务初始化设置,更改后会自动同步至各个业务;在业务下可以根据运行情况,可调整“是否审批”,其中“是否人工确认”在业务下不可更改",
"单据配置": "单据配置",
"内置策略不支持更改。如需自定义配置,可通过追加配置来更改目标和是否审批": "内置策略不支持更改。如需自定义配置,可通过追加配置来更改目标和是否审批",
"追加配置": "追加配置",
"自定义": "自定义",
"追加的配置不能与已存在的": "追加的配置不能与已存在的",
"必须选择业务": "必须选择业务",
Expand All @@ -3424,7 +3422,6 @@
"备份方式:": "备份方式:",
"备份位置:": "备份位置:",
"备份保存时间:": "备份保存时间:",
"已经存在两条生效策略时 ,禁用【追加配置】": "已经存在两条生效策略时 ,禁用【追加配置】",
"(共 n 个)": "(共 {n} 个)",
"构造 DB 名称": "构造 DB 名称",
"构造后 DB 名称(自动生成,可修改)": "构造后 DB 名称(自动生成,可修改)",
Expand Down Expand Up @@ -3458,5 +3455,9 @@
"确认断开同步": "确认断开同步",
"最终 DB 和指定 DB 数量不匹配": "最终 DB 和指定 DB 数量不匹配",
"添加从库:同机的所有集群会统一新增从库,仅支持 always on 集群": "添加从库:同机的所有集群会统一新增从库,仅支持 always on 集群",
"添加免审批": "添加免审批",
"所有集群已免审批": "所有集群已免审批",
"单据免审批设置": "单据免审批设置",
"内置策略为平台预设的审批规则,不可修改。根据业务需求,您可对全部或部分集群应用免审批策略。": "内置策略为平台预设的审批规则,不可修改。根据业务需求,您可对全部或部分集群应用免审批策略。",
"这行勿动!新增翻译请在上一行添加!": ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default class TicketFlowDescribe {
bk_biz_id: number;
cluster_ids: number[];
clusters: {
id: number;
cluster_id: number;
immute_domain: string;
}[];
configs: {
Expand All @@ -18,6 +18,7 @@ export default class TicketFlowDescribe {
id: number;
permission: {
ticket_config_set: boolean;
biz_ticket_config_set: boolean;
};
ticket_type: string;
ticket_type_display: string;
Expand Down Expand Up @@ -45,11 +46,6 @@ export default class TicketFlowDescribe {
return utcDisplayTime(this.update_at);
}

// 是否内置目标
get isDefaultTarget() {
return this.bk_biz_id === 0;
}

// 是否自定义目标
get isCustomTarget() {
return this.bk_biz_id !== 0;
Expand All @@ -60,11 +56,6 @@ export default class TicketFlowDescribe {
return this.isCustomTarget && this.cluster_ids.length > 0;
}

// 是否为业务全部目标
get isCurrentBizTarget() {
return this.isCustomTarget && !this.isClusterTarget;
}

// 集群列表
get clusterDomainList() {
return this.clusters.map((cluster) => cluster.immute_domain);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
:before-close="handleClose"
class="append-config-side"
render-directive="if"
:title="t('追加配置')"
:title="t('添加免审批')"
:width="840"
@closed="handleClose">
<DbForm
Expand All @@ -23,18 +23,6 @@
ref="targetRef"
v-model="targetData" />
</BkFormItem>
<BkFormItem
:label="t('可增加的流程节点')"
required>
<BkCheckbox
v-for="item in configList"
:key="item.value"
v-model="item.checked"
:disabled="item.disabled"
@change="handleChangeCheckbox">
{{ item.label }}
</BkCheckbox>
</BkFormItem>
</DbForm>
<template #footer>
<BkButton
Expand Down Expand Up @@ -88,29 +76,13 @@
const formRef = ref();
const targetRef = ref<InstanceType<typeof RenderTarget>>();
const needItsm = ref(false);
const targetData = computed(() => ({
dbType: (props.data.group as DBTypes) || DBTypes.MYSQL,
bizId: props.data.bk_biz_id || window.PROJECT_CONFIG.BIZ_ID,
clusterIds: props.data.cluster_ids || [],
}));
const configList = computed(() => [
{
value: 'need_itsm',
label: t('单据审批'),
checked: props.data.configs.need_itsm,
disabled: false,
},
{
value: 'need_manual_confirm',
label: t('人工确认'),
checked: props.data.configs.need_manual_confirm,
disabled: true,
},
]);
const { run: createTicketFlowConfigRun, loading: isSubmitting } = useRequest(createTicketFlowConfig, {
manual: true,
onSuccess() {
Expand All @@ -120,10 +92,6 @@
},
});
const handleChangeCheckbox = (value: boolean) => {
needItsm.value = value;
};
const handleClose = async () => {
window.changeConfirm = true;
const result = await handleBeforeClose();
Expand All @@ -140,7 +108,7 @@
ticket_types: [props.data.ticket_type],
configs: {
need_manual_confirm: props.data.configs.need_manual_confirm,
need_itsm: needItsm.value,
need_itsm: false,
},
};
createTicketFlowConfigRun(params);
Expand Down
Loading

0 comments on commit 5c6b817

Please sign in to comment.