fix: 修复插件保存后的分类关联

- 插件保存接口返回实体以便前端拿到真实插件 ID

- 分类关联更新改为按差异增删并补充事务保护

- 新建插件后缺失 ID 时明确抛出错误
This commit is contained in:
2026-03-24 18:38:09 +08:00
parent 6e1bd73cd8
commit 799174406e
6 changed files with 49 additions and 46 deletions

View File

@@ -145,12 +145,10 @@ function save() {
})
.then(async (res) => {
if (res.errorCode === 0) {
const pluginId =
res.data?.id ||
res.data ||
plainEntity.id ||
entity.value.id ||
'';
const pluginId = res.data?.id || plainEntity.id || entity.value.id;
if (!pluginId) {
throw new Error('插件保存成功但未返回插件ID');
}
await syncPluginCategories(pluginId, categoryIds);
dialogVisible.value = false;
ElMessage.success($t('message.saveOkMessage'));