Skip to content

Commit

Permalink
fix(frontend): 资源规格管理删除问题修复 #3596
Browse files Browse the repository at this point in the history
  • Loading branch information
jinquantianxia committed Mar 19, 2024
1 parent d824e04 commit 3528243
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@
permission={data.permission.spec_delete}
theme="primary"
text
onClick={() => handleDelete([data])}>
onClick={() => handleDelete([data], false)}>
{t('删除')}
</auth-button>
)}
Expand Down Expand Up @@ -484,7 +484,7 @@
});
};

const handleDelete = (list: ResourceSpecModel[]) => {
const handleDelete = (list: ResourceSpecModel[], isBatch = true) => {
useInfoWithIcon({
type: 'warnning',
title: t('确认删除以下规格'),
Expand All @@ -496,7 +496,7 @@
onConfirm: async () => {
try {
await batchDeleteResourceSpec({
spec_ids: selectedList.value.map(item => item.spec_id),
spec_ids: isBatch ? selectedList.value.map(item => item.spec_id) : list.map(item => item.spec_id),
});
messageSuccess(t('删除成功'));
fetchData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,15 @@
});
const emits = defineEmits<Emits>();

const createData = () => ({
mount_point: '',
size: '' as string | number,
type: '',
});

const { t } = useI18n();

const tableData = ref([...props.modelValue]);
const tableData = ref(props.modelValue.length > 0 ? props.modelValue : [createData()]);
const deviceClass = ref<{label: string, value: string}[]>([]);
const isLoadDeviceClass = ref(true);

Expand Down Expand Up @@ -220,12 +226,6 @@
},
];

const createData = () => ({
mount_point: '',
size: '' as string | number,
type: '',
});

const handleAdd = (index: number) => {
tableData.value.splice(index + 1, 0, createData());
};
Expand Down

0 comments on commit 3528243

Please sign in to comment.