fix: tokenMapping 初始加载时被 responseType 的 watch 误清

openDialog 中 responseType 赋值后触发了 watcher 异步清除
tokenMapping,导致已加载的 tokenMapping 值被清空。
通过 _skipTokenClear 标志跳过初始加载时的清除逻辑。

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-07-17 15:11:36 +08:00
co-authored by Claude
parent bf1e9fa89a
commit 3099f65109
2 changed files with 6 additions and 3 deletions
+2 -2
View File
@@ -3,6 +3,6 @@ ENV = 'development'
# 统一后端服务地址前缀(网关服务名:admin-go)
# 开发环境走本地代理,避免 CORS
VITE_API_URL = 'http://116.204.74.41:8000'
# VITE_API_URL = 'http://192.168.3.30:8000'
# VITE_API_URL = 'http://116.204.74.41:8000'
VITE_API_URL = 'http://192.168.3.30:8000'
# VITE_API_URL = 'http://192.168.3.135:8000'
@@ -438,8 +438,10 @@ const mappingPlaceholder = computed(() =>
hasMappingConfig.value ? '请选择' : '请先配置响应映射'
);
/** 切换返回类型时清空 token mapping */
/** 切换返回类型时清空 token mapping(初始加载时跳过) */
let _skipTokenClear = false;
watch(() => formData.responseType, () => {
if (_skipTokenClear) { _skipTokenClear = false; return; }
formData.tokenMapping = { ...defaultTokenMapping };
});
@@ -559,6 +561,7 @@ const openDialog = async (type: 'add' | 'edit', id?: string) => {
if (type === 'edit' && id) {
editId.value = id;
_skipTokenClear = true;
try {
const res = await getModelManage(id);
const row = res.data.modelManage;