|
@@ -472,19 +472,34 @@ const handleMenuSelectionChange = (selection: any[]) => {
|
|
|
};
|
|
|
|
|
|
// 确认添加菜单项
|
|
|
-const confirmAddMenuItems = () => {
|
|
|
+const confirmAddMenuItems = async () => {
|
|
|
console.log('selectedMenus:', selectedMenus.value);
|
|
|
if (selectedMenus.value.length === 0) {
|
|
|
proxy?.$modal.msgWarning('请选择要添加的菜单');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- // 将选中的菜单添加到菜单列表中(无需重复检查,因为列表已经过滤掉了重复项)
|
|
|
- menuItems.value.push(...selectedMenus.value);
|
|
|
+ try {
|
|
|
+ // 将选中的菜单添加到菜单列表中(无需重复检查,因为列表已经过滤掉了重复项)
|
|
|
+ menuItems.value.push(...selectedMenus.value);
|
|
|
+
|
|
|
+ // 如果是编辑模式,立即保存菜单数据到数据库
|
|
|
+ if (isEdit.value && currentEventId.value) {
|
|
|
+ await saveMenuData(currentEventId.value);
|
|
|
+ proxy?.$modal.msgSuccess(`成功添加 ${selectedMenus.value.length} 个菜单项并保存到数据库`);
|
|
|
+ } else {
|
|
|
+ // 新增模式下,菜单数据会在最终保存赛事时一起保存
|
|
|
+ proxy?.$modal.msgSuccess(`成功添加 ${selectedMenus.value.length} 个菜单项(将在保存赛事时一起保存)`);
|
|
|
+ }
|
|
|
|
|
|
- console.log('menuItems:', menuItems.value);
|
|
|
- menuSelectDialogVisible.value = false;
|
|
|
- proxy?.$modal.msgSuccess(`成功添加 ${selectedMenus.value.length} 个菜单项`);
|
|
|
+ console.log('menuItems:', menuItems.value);
|
|
|
+ menuSelectDialogVisible.value = false;
|
|
|
+ } catch (error) {
|
|
|
+ console.error('添加菜单项失败:', error);
|
|
|
+ // 如果保存失败,回滚本地数组的更改
|
|
|
+ menuItems.value.splice(-selectedMenus.value.length, selectedMenus.value.length);
|
|
|
+ proxy?.$modal.msgError('添加菜单项失败,请重试');
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
// 获取跳转类型标签
|
|
@@ -667,7 +682,7 @@ const loadConfigData = async (eventId: string | number) => {
|
|
|
const res = await listGameEventConfig({
|
|
|
eventId: eventId === '' ? '' : eventId,
|
|
|
pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
+ pageSize: 1000,
|
|
|
orderByColumn: '',
|
|
|
isAsc: ''
|
|
|
});
|