Skip to content

Commit ccfcfc8

Browse files
committed
feat(frontend): sqlserver添加统一设置和单据备注 #9684
1 parent 4d906dd commit ccfcfc8

File tree

2 files changed

+34
-43
lines changed

2 files changed

+34
-43
lines changed

dbm-ui/frontend/src/components/editable-table/Column.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@
171171
const rowContext = inject(injectKey);
172172
const currentInstance = getCurrentInstance() as ComponentInternalInstance;
173173
174-
const columnKey = `bk-editable-table-column-${rowContext?.getColumnIndex()}`;
174+
const columnIndex = rowContext!.getColumnIndex();
175+
const columnKey = `bk-editable-table-column-${columnIndex}`;
175176
176177
interface IFinalRule {
177178
message: string | (() => string);
@@ -337,9 +338,9 @@
337338
if (!props.disabledMethod) {
338339
return '';
339340
}
340-
const columnIndex = tableContext!.getColumnRelateRowIndexByInstance(currentInstance);
341+
const rowIndex = rowContext!.getRowIndex();
341342
342-
const result = props.disabledMethod(tableContext!.props.model[columnIndex], props.field);
343+
const result = props.disabledMethod(tableContext!.props.model[rowIndex], props.field);
343344
if (typeof result === 'string') {
344345
return result;
345346
}
@@ -518,9 +519,8 @@
518519
}
519520
520521
const rowIndex = rowContext!.getRowIndex();
521-
const columnIndex = tableContext!.getColumnRelateRowIndexByInstance(currentInstance);
522522
const rowDataValue = {
523-
columnIndex,
523+
columnIndex: columnIndex - 1,
524524
rowData: tableContext.props.model[rowIndex],
525525
rowIndex,
526526
};

dbm-ui/frontend/src/views/db-manage/sqlserver/SQLSERVER_ROLLBACK/components/common/FinalDbColumn.vue

Lines changed: 29 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,32 @@
11
<template>
22
<EditableColumn
33
ref="editableColumnRef"
4+
:disabled-method="disabledMethod"
45
field="rename_infos"
56
:label="t('构造后 DB 名')"
67
:min-width="300"
78
required
89
:rules="rules">
910
<BkLoading :loading="isLoading || isCheckoutDbLoading">
1011
<EditableBlock>
11-
<span
12-
v-bk-tooltips="{
13-
content: disabledTips,
14-
disabled: !Boolean(disabledTips),
15-
}"
12+
<BkButton
13+
text
14+
theme="primary"
1615
@click="handleShowEditName">
17-
<BkButton
18-
:disabled="Boolean(disabledTips)"
19-
text
20-
theme="primary">
21-
<span v-if="moduleValue.length < 1">--</span>
22-
<template v-else>
23-
<span v-if="hasEditDbName">
24-
{{ t('已更新') }}
16+
<span v-if="moduleValue.length < 1">--</span>
17+
<template v-else>
18+
<span v-if="hasEditDbName">
19+
{{ t('已更新') }}
20+
</span>
21+
<I18nT
22+
v-else
23+
keypath="n项待修改">
24+
<span style="padding-right: 4px; font-weight: bold; color: #ea3636">
25+
{{ moduleValue.length }}
2526
</span>
26-
<I18nT
27-
v-else
28-
keypath="n项待修改">
29-
<span style="padding-right: 4px; font-weight: bold; color: #ea3636">
30-
{{ moduleValue.length }}
31-
</span>
32-
</I18nT>
33-
</template>
34-
</BkButton>
35-
</span>
27+
</I18nT>
28+
</template>
29+
</BkButton>
3630
</EditableBlock>
3731
</BkLoading>
3832
</EditableColumn>
@@ -116,18 +110,6 @@
116110
const isShowEditName = ref(false);
117111
const hasEditDbName = ref(false);
118112
119-
const disabledTips = computed(() => {
120-
if (
121-
props.cluster.id &&
122-
props.targetClusterId &&
123-
dbName.value.length > 0 &&
124-
(props.restoreBackupFile || props.restoreTime)
125-
) {
126-
return '';
127-
}
128-
return props.isLocal ? t('请先设置集群、构造 DB、回档信息') : t('请先设置集群、目标集群、构造 DB、回档信息');
129-
});
130-
131113
const rules = [
132114
{
133115
message: t('构造后 DB 名不能为空'),
@@ -199,12 +181,21 @@
199181
);
200182
201183
const handleShowEditName = () => {
202-
if (disabledTips.value) {
203-
return;
204-
}
205184
isShowEditName.value = true;
206185
};
207186
187+
const disabledMethod = () => {
188+
if (
189+
props.cluster.id &&
190+
props.targetClusterId &&
191+
dbName.value.length > 0 &&
192+
(props.restoreBackupFile || props.restoreTime)
193+
) {
194+
return false;
195+
}
196+
return props.isLocal ? t('请先设置集群、构造 DB、回档信息') : t('请先设置集群、目标集群、构造 DB、回档信息');
197+
};
198+
208199
const handleSubmit = () => {
209200
editNameRef.value!.submit().then((result) => {
210201
isShowEditName.value = false;

0 commit comments

Comments
 (0)