fix(项目管理): 修复保存环境组错误的缺陷

--bug=1038209 --user=王孝刚 【项目管理】环境管理-环境组-添加环境组后 保存时提示“ID不能为空”
https://www.tapd.cn/55049933/s/1485207
This commit is contained in:
wxg0103 2024-04-01 15:21:43 +08:00 committed by 刘瑞斌
parent 7927527502
commit 6f3b7cb332
4 changed files with 20 additions and 17 deletions

View File

@ -58,6 +58,8 @@
atc.tags, atc.tags,
a.module_id, a.module_id,
a.path, a.path,
a.method,
a.protocol,
atc.pos atc.pos
FROM FROM
api_test_case atc api_test_case atc

View File

@ -65,12 +65,14 @@
import paramsTable, { type ParamTableColumn } from '@/views/api-test/components/paramTable.vue'; import paramsTable, { type ParamTableColumn } from '@/views/api-test/components/paramTable.vue';
import { getGroupDetailEnv, groupUpdateEnv } from '@/api/modules/project-management/envManagement'; import { getGroupDetailEnv, groupAddEnv, groupUpdateEnv } from '@/api/modules/project-management/envManagement';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import { useAppStore } from '@/store'; import { useAppStore } from '@/store';
import useProjectEnvStore, { NEW_ENV_GROUP } from '@/store/modules/setting/useProjectEnvStore'; import useProjectEnvStore, { NEW_ENV_GROUP } from '@/store/modules/setting/useProjectEnvStore';
import { hasAnyPermission } from '@/utils/permission'; import { hasAnyPermission } from '@/utils/permission';
import { EnvListItem } from '@/models/projectManagement/environmental';
const { t } = useI18n(); const { t } = useI18n();
const appStore = useAppStore(); const appStore = useAppStore();
@ -159,8 +161,15 @@
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,
envGroupProject, envGroupProject,
}; };
await groupUpdateEnv(params); let res: EnvListItem;
Message.success(t('common.saveSuccess')); if (id) {
res = await groupUpdateEnv(params);
Message.success(t('common.saveSuccess'));
initDetail(res.id);
} else {
res = await groupAddEnv(params);
}
emit('saveOrUpdate', res.id);
} catch (e) { } catch (e) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error(e); console.error(e);

View File

@ -37,12 +37,7 @@
import { reactive, ref, watchEffect } from 'vue'; import { reactive, ref, watchEffect } from 'vue';
import { Message } from '@arco-design/web-vue'; import { Message } from '@arco-design/web-vue';
import { import { getGroupDetailEnv, groupUpdateEnv, updateOrAddEnv } from '@/api/modules/project-management/envManagement';
getGroupDetailEnv,
groupAddEnv,
groupUpdateEnv,
updateOrAddEnv,
} from '@/api/modules/project-management/envManagement';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import { useAppStore } from '@/store'; import { useAppStore } from '@/store';
import useProjectEnvStore, { NEW_ENV_GROUP } from '@/store/modules/setting/useProjectEnvStore'; import useProjectEnvStore, { NEW_ENV_GROUP } from '@/store/modules/setting/useProjectEnvStore';

View File

@ -138,13 +138,11 @@
{ label: 'Response Code', value: 'RESPONSE_CODE' }, { label: 'Response Code', value: 'RESPONSE_CODE' },
]); ]);
const relationOptions = computed(() => [ const relationOptions = computed(() => [
{ label: '包含', value: 'contain' }, { label: t('advanceFilter.operator.contains'), value: 'CONTAINS' },
{ label: '不包含', value: 'notContain' }, { label: t('advanceFilter.operator.not_contains'), value: 'NOT_CONTAINS' },
{ label: '等于', value: 'equal' }, { label: t('advanceFilter.operator.equal'), value: 'EQUALS' },
{ label: '不等于', value: 'notEqual' }, { label: t('advanceFilter.operator.start_with'), value: 'START_WITH' },
{ label: '正则匹配', value: 'regex' }, { label: t('advanceFilter.operator.end_with'), value: 'END_WITH' },
{ label: '以...开始', value: 'startWith' },
{ label: '以...结束', value: 'endWith' },
]); ]);
const tableBatchActions = { const tableBatchActions = {
@ -207,7 +205,6 @@
type: 'select', type: 'select',
options: relationOptions.value, options: relationOptions.value,
className: 'w-[120px]', className: 'w-[120px]',
defaultValue: 'equal',
}, },
{ {
filed: 'expression', // - filed: 'expression', // -