Skip to content

Commit 2a92ab7

Browse files
3octaveshLinx
authored andcommitted
feat(frontend): sqlserver添加统一设置和单据备注 #9684
1 parent 8036541 commit 2a92ab7

File tree

2 files changed

+27
-34
lines changed

2 files changed

+27
-34
lines changed

dbm-ui/frontend/src/views/db-manage/sqlserver/SQLSERVER_ROLLBACK/components/other-cluster/Index.vue

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,11 @@
240240
window.changeConfirm = true;
241241
};
242242
243-
const handleDstClusterBatchEdit = (clusterList: SqlserverHaModel[]) => {
244-
if (clusterList.length > 0) {
245-
const [clusterItem] = clusterList;
246-
tableData.value.forEach((item) => {
247-
Object.assign(item, { dst_cluster: clusterItem });
248-
});
249-
window.changeConfirm = true;
250-
}
243+
const handleDstClusterBatchEdit = (value: string) => {
244+
tableData.value.forEach((item) => {
245+
Object.assign(item.dst_cluster, { master_domain: value });
246+
});
247+
window.changeConfirm = true;
251248
};
252249
253250
const handleDbTableBatchEdit = (value: string[], field: string) => {

dbm-ui/frontend/src/views/db-manage/sqlserver/SQLSERVER_ROLLBACK/components/other-cluster/components/DstClusterColumn.vue

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,19 @@
2222
:min-width="300"
2323
required>
2424
<template #headAppend>
25-
<span
26-
v-bk-tooltips="t('统一设置:将该列统一设置为相同的值')"
27-
class="batch-select-button"
28-
@click="handleShowHeadClusterSelector">
29-
<DbIcon type="bulk-edit" />
30-
</span>
25+
<BatchEditColumn
26+
v-model="showBatchEdit"
27+
:placeholder="t('请输入集群域名')"
28+
:title="t('目标集群')"
29+
type="input"
30+
@change="handleBatchEditChange">
31+
<span
32+
v-bk-tooltips="t('统一设置:将该列统一设置为相同的值')"
33+
class="batch-edit-btn"
34+
@click="handleBatchEditShow">
35+
<DbIcon type="bulk-edit" />
36+
</span>
37+
</BatchEditColumn>
3138
</template>
3239
<EditableInput
3340
v-model="modelValue.master_domain"
@@ -43,13 +50,6 @@
4350
</div>
4451
</template>
4552
</EditableInput>
46-
<ClusterSelector
47-
v-model:is-show="isShowHeadClusterSelector"
48-
:cluster-types="[ClusterTypes.SQLSERVER_HA, ClusterTypes.SQLSERVER_SINGLE]"
49-
only-one-type
50-
:selected="headSelected"
51-
:tab-list-config="clusterSelectorTabConfig"
52-
@change="handleHeadClusterChange" />
5353
<ClusterSelector
5454
v-model:is-show="isShowCellClusterSelector"
5555
:cluster-types="[ClusterTypes.SQLSERVER_HA, ClusterTypes.SQLSERVER_SINGLE]"
@@ -74,6 +74,8 @@
7474

7575
import ClusterSelector from '@components/cluster-selector/Index.vue';
7676

77+
import BatchEditColumn from '@views/db-manage/common/batch-edit-column/Index.vue';
78+
7779
interface Props {
7880
srcClusterData: {
7981
bk_cloud_id: 0;
@@ -83,7 +85,7 @@
8385
};
8486
}
8587

86-
type Emits = (e: 'batch-edit', value: SqlServerHaModel[]) => void;
88+
type Emits = (e: 'batch-edit', value: string) => void;
8789

8890
const props = defineProps<Props>();
8991
const emits = defineEmits<Emits>();
@@ -102,13 +104,8 @@
102104

103105
const { t } = useI18n();
104106

105-
const isShowHeadClusterSelector = ref(false);
106107
const isShowCellClusterSelector = ref(false);
107-
108-
const headSelected: ComponentProps<typeof ClusterSelector>['selected'] = {
109-
[ClusterTypes.SQLSERVER_HA]: [],
110-
[ClusterTypes.SQLSERVER_SINGLE]: [],
111-
};
108+
const showBatchEdit = ref(false);
112109

113110
const clusterSelectorTabConfig = {
114111
[ClusterTypes.SQLSERVER_HA]: {
@@ -200,13 +197,12 @@
200197
},
201198
);
202199

203-
const handleHeadClusterChange = (selected: { [key: string]: Array<SqlServerHaModel> }) => {
204-
const clusterList = Object.values(selected).flatMap((selectedList) => selectedList);
205-
emits('batch-edit', clusterList);
200+
const handleBatchEditChange = (value: string | string[]) => {
201+
emits('batch-edit', value as string);
206202
};
207203

208-
const handleShowHeadClusterSelector = () => {
209-
isShowHeadClusterSelector.value = true;
204+
const handleBatchEditShow = () => {
205+
showBatchEdit.value = true;
210206
};
211207

212208
const handleShowClusterSelector = () => {
@@ -220,7 +216,7 @@
220216
};
221217
</script>
222218
<style lang="less" scoped>
223-
.batch-select-button {
219+
.batch-edit-btn {
224220
font-size: 14px;
225221
color: #3a84ff;
226222
cursor: pointer;

0 commit comments

Comments
 (0)