fix:【infra】数据源 id = 0 可以被编辑的错误

This commit is contained in:
YunaiV
2025-11-29 16:12:38 +08:00
parent 7aab11b984
commit 72bbfd4a9c
4 changed files with 16 additions and 4 deletions

View File

@@ -78,7 +78,8 @@ function handleRowCheckboxChange({
}: { }: {
records: InfraDataSourceConfigApi.DataSourceConfig[]; records: InfraDataSourceConfigApi.DataSourceConfig[];
}) { }) {
checkedIds.value = records.map((item) => item.id!); // 过滤掉id为 0 的主数据源
checkedIds.value = records.map((item) => item.id!).filter((id) => id !== 0);
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({
@@ -140,6 +141,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
type: 'link', type: 'link',
icon: ACTION_ICON.EDIT, icon: ACTION_ICON.EDIT,
auth: ['infra:data-source-config:update'], auth: ['infra:data-source-config:update'],
disabled: row.id === 0,
onClick: handleEdit.bind(null, row), onClick: handleEdit.bind(null, row),
}, },
{ {
@@ -148,6 +150,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
danger: true, danger: true,
icon: ACTION_ICON.DELETE, icon: ACTION_ICON.DELETE,
auth: ['infra:data-source-config:delete'], auth: ['infra:data-source-config:delete'],
disabled: row.id === 0,
popConfirm: { popConfirm: {
title: $t('ui.actionMessage.deleteConfirm', [row.name]), title: $t('ui.actionMessage.deleteConfirm', [row.name]),
confirm: handleDelete.bind(null, row), confirm: handleDelete.bind(null, row),

View File

@@ -76,7 +76,8 @@ function handleRowCheckboxChange({
}: { }: {
records: InfraDataSourceConfigApi.DataSourceConfig[]; records: InfraDataSourceConfigApi.DataSourceConfig[];
}) { }) {
checkedIds.value = records.map((item) => item.id!); // 过滤掉id为 0 的主数据源
checkedIds.value = records.map((item) => item.id!).filter((id) => id !== 0);
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({
@@ -138,6 +139,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
link: true, link: true,
icon: ACTION_ICON.EDIT, icon: ACTION_ICON.EDIT,
auth: ['infra:data-source-config:update'], auth: ['infra:data-source-config:update'],
disabled: row.id === 0,
onClick: handleEdit.bind(null, row), onClick: handleEdit.bind(null, row),
}, },
{ {
@@ -146,6 +148,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
link: true, link: true,
icon: ACTION_ICON.DELETE, icon: ACTION_ICON.DELETE,
auth: ['infra:data-source-config:delete'], auth: ['infra:data-source-config:delete'],
disabled: row.id === 0,
popConfirm: { popConfirm: {
title: $t('ui.actionMessage.deleteConfirm', [row.name]), title: $t('ui.actionMessage.deleteConfirm', [row.name]),
confirm: handleDelete.bind(null, row), confirm: handleDelete.bind(null, row),

View File

@@ -76,7 +76,8 @@ function handleRowCheckboxChange({
}: { }: {
records: InfraDataSourceConfigApi.DataSourceConfig[]; records: InfraDataSourceConfigApi.DataSourceConfig[];
}) { }) {
checkedIds.value = records.map((item) => item.id!); // 过滤掉id为 0 的主数据源
checkedIds.value = records.map((item) => item.id!).filter((id) => id !== 0);
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({
@@ -138,6 +139,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
text: true, text: true,
icon: ACTION_ICON.EDIT, icon: ACTION_ICON.EDIT,
auth: ['infra:data-source-config:update'], auth: ['infra:data-source-config:update'],
disabled: row.id === 0,
onClick: handleEdit.bind(null, row), onClick: handleEdit.bind(null, row),
}, },
{ {
@@ -146,6 +148,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
text: true, text: true,
icon: ACTION_ICON.DELETE, icon: ACTION_ICON.DELETE,
auth: ['infra:data-source-config:delete'], auth: ['infra:data-source-config:delete'],
disabled: row.id === 0,
popConfirm: { popConfirm: {
title: $t('ui.actionMessage.deleteConfirm', [row.name]), title: $t('ui.actionMessage.deleteConfirm', [row.name]),
confirm: handleDelete.bind(null, row), confirm: handleDelete.bind(null, row),

View File

@@ -77,7 +77,8 @@ function handleRowCheckboxChange({
}: { }: {
records: InfraDataSourceConfigApi.DataSourceConfig[]; records: InfraDataSourceConfigApi.DataSourceConfig[];
}) { }) {
checkedIds.value = records.map((item) => item.id!); // 过滤掉id为 0 的主数据源
checkedIds.value = records.map((item) => item.id!).filter((id) => id !== 0);
} }
const [Grid, gridApi] = useVbenVxeGrid({ const [Grid, gridApi] = useVbenVxeGrid({
@@ -138,6 +139,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
variant: 'text', variant: 'text',
icon: ACTION_ICON.EDIT, icon: ACTION_ICON.EDIT,
auth: ['infra:data-source-config:update'], auth: ['infra:data-source-config:update'],
disabled: row.id === 0,
onClick: handleEdit.bind(null, row), onClick: handleEdit.bind(null, row),
}, },
{ {
@@ -146,6 +148,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
type: 'danger', type: 'danger',
icon: ACTION_ICON.DELETE, icon: ACTION_ICON.DELETE,
auth: ['infra:data-source-config:delete'], auth: ['infra:data-source-config:delete'],
disabled: row.id === 0,
popConfirm: { popConfirm: {
title: $t('ui.actionMessage.deleteConfirm', [row.name]), title: $t('ui.actionMessage.deleteConfirm', [row.name]),
confirm: handleDelete.bind(null, row), confirm: handleDelete.bind(null, row),