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,
a.module_id,
a.path,
a.method,
a.protocol,
atc.pos
FROM
api_test_case atc

View File

@ -65,12 +65,14 @@
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 { useAppStore } from '@/store';
import useProjectEnvStore, { NEW_ENV_GROUP } from '@/store/modules/setting/useProjectEnvStore';
import { hasAnyPermission } from '@/utils/permission';
import { EnvListItem } from '@/models/projectManagement/environmental';
const { t } = useI18n();
const appStore = useAppStore();
@ -159,8 +161,15 @@
projectId: appStore.currentProjectId,
envGroupProject,
};
await groupUpdateEnv(params);
let res: EnvListItem;
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) {
// eslint-disable-next-line no-console
console.error(e);

View File

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

View File

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