From c07769e6e3bea2f764f0ad5ddbc3786c658ff21c Mon Sep 17 00:00:00 2001 From: Austin <1344583166@qq.com> Date: Thu, 27 Jun 2024 20:07:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=E5=BC=80=E5=8C=BA=E9=9B=86?= =?UTF-8?q?=E7=BE=A4=E9=80=89=E6=8B=A9=E4=BA=A4=E4=BA=92=E8=B0=83=E6=95=B4?= =?UTF-8?q?=20#5235?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/target-cluster/Index.vue | 30 +++++++++---------- .../components/target-cluster/Index.vue | 27 ++++++++++------- 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/dbm-ui/frontend/src/views/mysql/openarea/create/components/target-cluster/Index.vue b/dbm-ui/frontend/src/views/mysql/openarea/create/components/target-cluster/Index.vue index 234cf053ad..a142d78f88 100644 --- a/dbm-ui/frontend/src/views/mysql/openarea/create/components/target-cluster/Index.vue +++ b/dbm-ui/frontend/src/views/mysql/openarea/create/components/target-cluster/Index.vue @@ -99,7 +99,7 @@ const currentBizId = window.PROJECT_CONFIG.BIZ_ID; // 集群域名是否已存在表格的映射表 - // const domainMemo: Record = {}; + const domainMemo: Record = {}; const handleHostChange = (hostList: HostDetails[]) => { if (checkListEmpty(tableData.value)) { @@ -157,20 +157,20 @@ selectedClusters.value = selected; const list = Object.keys(selected).reduce((list: TendbhaModel[], key) => list.concat(...selected[key]), []); const newList = list.reduce((result, item) => { - // const domain = item.master_domain; - // if (!domainMemo[domain]) { - const row = createRowData({ - clusterData: { - id: item.id, - master_domain: item.master_domain, - bk_biz_id: item.bk_biz_id, - bk_cloud_id: item.bk_cloud_id, - bk_cloud_name: item.bk_cloud_name, - }, - }); - result.push(row); - // domainMemo[domain] = true; - // } + const domain = item.master_domain; + if (!domainMemo[domain]) { + const row = createRowData({ + clusterData: { + id: item.id, + master_domain: domain, + bk_biz_id: item.bk_biz_id, + bk_cloud_id: item.bk_cloud_id, + bk_cloud_name: item.bk_cloud_name, + }, + }); + result.push(row); + domainMemo[domain] = true; + } return result; }, [] as IDataRow[]); diff --git a/dbm-ui/frontend/src/views/spider-manage/openarea-create/components/target-cluster/Index.vue b/dbm-ui/frontend/src/views/spider-manage/openarea-create/components/target-cluster/Index.vue index b559b951d7..b0f3cacbb1 100644 --- a/dbm-ui/frontend/src/views/spider-manage/openarea-create/components/target-cluster/Index.vue +++ b/dbm-ui/frontend/src/views/spider-manage/openarea-create/components/target-cluster/Index.vue @@ -97,6 +97,9 @@ const currentBizId = window.PROJECT_CONFIG.BIZ_ID; + // 集群域名是否已存在表格的映射表 + const domainMemo: Record = {}; + const handleHostChange = (hostList: HostDetails[]) => { if (checkListEmpty(tableData.value)) { return; @@ -150,16 +153,20 @@ selectedClusters.value = selected; const list = selected[ClusterTypes.TENDBCLUSTER]; const newList = list.reduce((result, item) => { - const row = createRowData({ - clusterData: { - id: item.id, - master_domain: item.master_domain, - bk_biz_id: item.bk_biz_id, - bk_cloud_id: item.bk_cloud_id, - bk_cloud_name: item.bk_cloud_name, - }, - }); - result.push(row); + const domain = item.master_domain; + if (!domainMemo[domain]) { + const row = createRowData({ + clusterData: { + id: item.id, + master_domain: domain, + bk_biz_id: item.bk_biz_id, + bk_cloud_id: item.bk_cloud_id, + bk_cloud_name: item.bk_cloud_name, + }, + }); + result.push(row); + domainMemo[domain] = true; + } return result; }, [] as IDataRow[]); if (checkListEmpty(tableData.value)) {